Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec: ban warning on unknown fields for spec v3 #205

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SimonWoolf
Copy link
Member

There's apparently an sdk that prints a warning message when it decodes a Message with an unknown field. This bans that for v3, for forward compatibility.

(I don't know which one, @mschristensen I think you mentioned it, do you know?)

I was thinking if I might have to bump the major version for this change, but looking at various SDKs, the only SDK so far to have implemented wire protocol v3 (and therefore spec v3) is ably-js, which doesn't complain about unknown fields, so already satisfied this. So I think I'm safe to add this as a requirement for v3. @ttypic wdyt?

(the purpose is to be able to use protocol v3 to trigger possible inclusion of new fields that are being added for various purposes like message interactions and data sync)

Copy link

@mschristensen mschristensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I don't know which one, @mschristensen I think you mentioned it, do you know?)

@SimonWoolf I think Paddy mentioned it, and I think he said Ably Java

@@ -1299,6 +1299,7 @@ h4. Message
** @(TM2f)@ @timestamp@ time in milliseconds since epoch. If a message received from Ably does not contain a @timestamp@, it should be set to the @timestamp@ of the encapsulating @ProtocolMessage@
* @(TM4)@ @Message@ has constructors @constructor(name: String?, data: Data?)@ and @constructor(name: String?, data: Data?, clientId: String?)@.
* @(TM3)@ @fromEncoded@ and @fromEncodedArray@ are alternative constructors that take an (already deserialized) @Message@-like object (or array of such objects), and optionally a @channelOptions@, and return a @Message@ (or array of such @Messages@) that's decoded and decrypted as specified in @RSL6@, using the cipher in the @channelOptions@ if the message is encrypted, with any residual transforms (ones that the library cannot decode or decrypt) left in the @encoding@ property per @RSL6b@. This is intended for users receiving messages other than from a REST or Realtime channel (for example, from a queue), to avoid them having to parse the @encoding@ string themselves.
* @(TM5)@ When decoding a @Message@, if the SDK encounters any fields it does not recognise, it must silently ignore them, and not print any kind of error or warning log.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth clarifying that debug/trace/info is ok?

@lawrence-forooghian
Copy link
Collaborator

Does RSF1 not already cover this?

@SimonWoolf
Copy link
Member Author

Does RSF1 not already cover this?

Oh, yes, good point, I missed that.
So if ably-java is logging a warning on unknown fields, it's in breach of that spec item already? Can we get that fixed?

@lawrence-forooghian
Copy link
Collaborator

Yep, I’d say it's an ably-java bug in that case. Do you have an example of the error message? I’ll create an ably-java bug.

@SimonWoolf
Copy link
Member Author

Do you have an example of the error message? I’ll create an ably-java bug.

I don't, I have this second hand (Mike commented above that Paddy mentioned it).
I've just tried to reprod but apparently you can no longer run the ably-java tests without having an android development environment installed for some reason, which I don't. Would you mind having a go?

@lawrence-forooghian
Copy link
Collaborator

Yep, I’ll take a look. Does sandbox contain the realtime changes that trigger the warning?

@lmars
Copy link
Member

lmars commented Sep 9, 2024

you can no longer run the ably-java tests without having an android development environment installed for some reason

quick hack: delete this line: https://github.com/ably/ably-java/blob/e0e23176c717406f0c9a0e96752b6dc8d6663e47/settings.gradle#L3

@paddybyers
Copy link
Member

I have this second hand (Mike commented above that Paddy mentioned it).

See for example https://github.com/ably/ably-java/blob/main/lib/src/main/java/io/ably/lib/types/ProtocolMessage.java#L226

@SimonWoolf
Copy link
Member Author

See for example https://github.com/ably/ably-java/blob/main/lib/src/main/java/io/ably/lib/types/ProtocolMessage.java#L226

That's a VERBOSE log, not a warn or error, so wouldn't even be a violation of this new spec item

@lawrence-forooghian
Copy link
Collaborator

That's a VERBOSE log, not a warn or error, so wouldn't even be a violation of this new spec item

But it does violate the existing RSF1, given that it doesn't "ignore" it per that spec item's language. So it still sounds like an ably-java bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants