fix(server): announce the boot auth state after the initial session restore - #571
Open
johnthecat wants to merge 2 commits into
Open
fix(server): announce the boot auth state after the initial session restore#571johnthecat wants to merge 2 commits into
johnthecat wants to merge 2 commits into
Conversation
…estore The session-store sync's boot tick now calls announce_current after reconciling, so a pairing host receives an opening AuthState (Disconnected included) without calling activateStoredSession.
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.
Problem
A pairing host boots with no answer on the
authcallback when there is nothing to restore. The core restores the persisted session on its own at boot, but a signed-out boot is a no-op transition and emits nothing, so a host cannot tell "still restoring" from "signed out". polkadot-desktop worked around it by guessingDisconnectedafter a timeout, which flashed onboarding at paired users and burned a pairing on every cold start (paritytech/polkadot-desktop#848).Solution
The boot tick of the session-store sync announces its outcome once it has reconciled,
Disconnectedincluded. Theauthcallback therefore always opens with the real boot state:Connectedfor a restored session,Disconnectedotherwise, with nothing emitted before it. ExplicitactivateStoredSessionkeeps its behaviour and never double-emits.Docs for
AuthPresenter, the nativeHostCallbacks, and the@parity/truapi-hostREADME describe the contract; the codegen golden is regenerated accordingly. Tests cover the signed-out boot, the restored boot, and the invalid-blob boot.