Repository navigation
Conversation
…and fail like JS
JS's `connection.connect({auth})` rejects before it does anything when
the client has no userID and the token is non-empty, and `auth: null`
clears the token. The Rust and Swift clients only logged the invalid
pair and ignored the call, and had no way to clear the token.
Rust's `Connection::connect` now takes `ConnectAuth { Keep, Set(String),
Clear }` and returns `Result<(), Error>`; Swift's `connect(_:)` takes
`ConnectAuth { keep, set(String), clear }` and throws. An invalid pair is
the Internal error "ZeroOptions.userID is required when auth is set."
and changes nothing. Both stay synchronous: `subscribe` follows the
state. The conformance runners map a vector's absent, null, and string
`auth` to Keep, Clear, and Set, as the JS harness passes them.
Swift's `connect(auth:)` is gone, an API break below 1.0 that the minor
changeset declares.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tmm's decision 1(b):
connection.connecttakes aConnectAuthand fails like JS, in both clients, with the same shape.userID): fails at once, kindInternal,"ZeroOptions.userID is required when auth is set."(JS's#setAuth). Nothing is set or sent. Before, both clients only loggedconnect(auth:) ignored.Cleardrops the token, as JS'sauth: nulldoes. Before, neither client could clear it.NoSocketOriginearly return, resuming only from a terminal state, andupdateAuthwhile connected. Both stay synchronous;subscribefollows the state.connectsteps map absent,null, and string toKeep,Clear, andSet, as the JS harness passes them.Changesets:
zero-rustminor.zero-swiftminor: removingconnect(auth:)breaks Swift's API, andscripts/api-breaks.shpasses only with a minor bump below 1.0. Swift's next release would be 0.8.0.Tests:
rust/zero-client/tests/connect_auth.rsandHardenConnectionTests.connectWithAuthOnALoggedOutClientThrowsAndClearDropsTheToken. Both fail whenClearis mapped toKeep.Checked locally:
-D warnings, tests, docs, and conformance (66,384 cases, 0 failures).api-breaks.sh(allowed by the minor changeset).