Sync exchange v2 update pixels for more granularity#9104
Open
CDRussell wants to merge 1 commit into
Open
Conversation
Member
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
12 tasks
f78e252 to
f94c91c
Compare
451a7d9 to
61fb264
Compare
f94c91c to
9255d4f
Compare
92791e8 to
08ed2cf
Compare
08ed2cf to
abdd812
Compare
Contributor
|
Privacy Review task: https://app.asana.com/0/69071770703008/1216272438450758 |
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.

Task/Issue URL: https://app.asana.com/1/137249556945/project/608920331025315/task/1216244452632489?focus=true
Tech Design URL (if applicable):
Description
Adds granular
reasonclassification to the v2 sync setup failure pixels, matching the canonical vocabulary in the [Exchange V2 Unified Algorithm spec](https://app.asana.com/1/137249556945/task/1214739740392701).Previously
sync_setup_ended_failedwas emitted with only broad reasons (transport_failure,unexpected_failure), making it hard to tell a benign network blip from a protocol violation or a peer-side problem.This PR:
SessionErrorKindonExchangeV2Event.SessionErrorso the runner classifies transport, protocol, and preparation errors distinctly at the source.sync_setup_ended_failedenum with the spec's canonical reasonstimeout_stageparameter tosync_setup_ended_failed, sent only whenreason=session_timeoutreasonparameter to the parse-error pixelsSteps to test this PR
Note
Requires the Python pairing reference client for the broken-mode scenarios.
Logcat filter (Android Studio format):
For each scenario below, start with no existing sync account.
1.
unrecognized_code— simplest, no companion client neededVerifies the new
reasonparameter on the manual-code parse-error pixel.not-a-sync-code) and confirm.Pixel sent: sync_setup_manual_code_entered_failed with params: {..., reason=unrecognized_code, flow_version=v2, ...}2.
unexpected_second_hello— protocol violation classificationVerifies the new precise reason for second/duplicate hello (previously would have surfaced as a generic transport failure).
Direction: Android = Presenter (shows code), Python = Scanner.
Paste the other device's code:, paste Android's code.Pixel sent: sync_setup_ended_failed with params: {..., reason=unexpected_second_hello, ...}3.
unexpected_event— out-of-order message classificationVerifies that a non-hello message arriving before hello (SM implicit abort from
Bootstrapped) surfaces asunexpected_eventrather than the previous generic bucket.Direction: Android = Presenter, Python = Scanner.
Pixel sent: sync_setup_ended_failed with params: {..., reason=unexpected_event, ...}4. (Optional, long-running)
session_timeout+timeout_stage=waiting_for_peer_helloVerifies the new
timeout_stagesub-parameter. Skip if you don't want to wait 5 minutes — the mapping is exercised by unit tests inSyncPixelsTest.Pixel sent: sync_setup_ended_failed with params: {..., reason=session_timeout, timeout_stage=waiting_for_peer_hello, ...}UI changes
None. Error dialogs and copy are unchanged; only the pixel payloads gain more granular parameters.
Note
Medium Risk
Changes v2 pairing error handling and poll-loop behavior (terminal throws vs silent stop), which could alter when sessions fail or retry; risk is mitigated by extensive unit tests and telemetry-only user impact.
Overview
Aligns v2 sync setup telemetry with the Exchange V2 Unified Algorithm spec by classifying failures at the source and emitting richer pixel payloads.
Exchange v2 runner and relay:
SessionErrornow carriesSessionErrorKindand optionalTimeoutStage(for 5‑minute deadlines). Poll/send HTTP outcomes throw typed exceptions (ChannelGone,PollBadRequest,PollAuthDenied) instead of silently stopping the poll loop, so failures surface as specific session errors (e.g. relay unavailable, malformed request, unexpected second hello, pairing session not ready).Dispatcher → pixels:
RealSyncCodeDispatchermaps eachSessionErrorKindto dedicatedAccountErrorCodes(includingSESSION_TIMEOUT,PEER_RECOVERY_CODE_UNAVAILABLE, etc.) and passestimeoutStageonDispatchOutcome.Failed.joinAccountFromThirdPartyRecoveryCodeupgrade POST failures now useACCOUNT_UPGRADE_FAILED.Pixels:
sync_setup.json5gainsreasonon barcode/manual parse failures and expandssync_setup_ended_failedwith the spec reason enum plustimeout_stage.SyncPixelsadds matchingSetupFailureReason/TimeoutStage, includessourceon setup-failed events, firesalready_pairedfor same-accountAlreadyConnected, treats peerPAIRING_REJECTEDas abandoned confirmation denial, and wires connect/exchange/login ViewModels to pass screen type andunrecognized_codeon parse failures.Reviewed by Cursor Bugbot for commit abdd812. Configure here.