feat(sso): let a withdrawal reach the paired host that is serving it - #933
Conversation
|
CI Status: 23 required jobs green, 21 passed and 2 skipped by path filter. All job results
Signing credentials: null as of null, a release may fail Commit |
iOS simulator previewBuilt from gh run download 35920228753 --name simulator-preview-9c15ac328
unzip polkadot-app-*.app.zip
xcrun simctl install booted polkadot-app.app
xcrun simctl launch booted io.parity.polkadotapp.developOr download it in a browser, which arrives as a zip wrapping An arm64 simulator slice, so it needs an Apple Silicon Mac and does not |
TarikGul
left a comment
There was a problem hiding this comment.
approving. checked the wire change is append only with explicit indices and that main's decoder ignores an unknown statement and keeps the session, and pulled four of the guards out one at a time with every one failing a test. the send guard recording and building under one lock is the right call, and so is keying the send on Cancelled rather than any fired token.
Part of #926.
A pairing host whose caller withdraws a request it has already published tells the paired host, so the phone stops prompting or allocating for a product that has stopped waiting. The design is in
docs/rfcs/sso-request-cancellation.md.Cancel(Withdrawal { message_id })is appended tov1::RemoteMessageat index 24.#[sso_service]generates its dispatch andname()arms besideDisconnected. Existing SCALE bytes and fixtures are unchanged, andWIRE_CODEC_VERSIONdoes not move.Cancelreplaces its target. It is sent only while its target is the newest statement built on the session's request channel, which is recorded and checked under one lock with every build on that channel, includingDisconnected.serve_sessionfeeds decoded pages toserve_pages, which serves requests one at a time and keeps reading, at most 64 ahead. ACancelfires the running request's token, or stops a queued or not-yet-seen one from starting (up to 64 remembered). A withdrawn request posts no response and is recorded as handled in the replay ledger. A subscription error lets the request being served finish before the loop reports it.handle_sso_requestacceptsCancelat any time and answers the withdrawn requestIgnored.SsoRequestOutcomeand the UniFFI surface are unchanged.dispatchtakes the context the caller built for the message, so the caller owns its cancellation.A peer that predates
Cancellogs it and serves the request as before; the Rust responder, iOS and Android were each checked for that.Not in this PR
Cancelreaches the core too late there. Its dispatcher needs to passCancelthrough (polkadot-ios-community).Cancelhandling (polkadot-android-community).AbortSignal, so a browser host keeps its prompt until answered; the answer authorizes nothing.Cancelis not yet listed in the host-spec divergence D-B.5.6 thev1.rsheader links.Testing. New tests cover a
Cancelwithdrawing an open prompt, one arriving before its request, one read while its target is served, a subscription failure mid-request, the early-withdrawal cap, the pairing host sendingCancel, not sending it with a newer request behind, and not sending it on timeout. Each was mutation-checked by removing the line it guards and confirming that test fails. The macro's trybuild output is identical tomain's.