Repository navigation
fix(mobile): catch the diff-comments loader rejection at the effect (OTA phase C follow-up) - #22111
Conversation
`use-mobile-session-diff-comments.ts` ran `void loadDiffComments()` with no catch, so a *rejected* `worktree.show` raised an unhandled rejection on every session mount: a document-level error, not a page fault, and a red herring in crash reports and device proofs. The catch goes at the effect rather than inside the loader, whose promise the recording adapter awaits. `config/scripts/mobile-web-app-session-render.test.mjs` pinned the page's error list to exactly that one rejection; it is now the empty list, which is what makes the browser proof notice the fix. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The corpus certified the unhandled rejection the commit before removes, so the golden had to move with it. Scoped re-record: `baseline` bumped by editing that one line, then `--record`. Every diff line classified: - `baseline`, 788 lines (787 goldens + `pilot-scenarios.json`), and nothing else in 786 of them. - `matrix-session.diff-notes-worktree.show-1.json`, the only golden with a substantive change: three `unhandled-rejection` effects leave the pool (`da8252771fbd` incompatible_reply, `d638e32b9559` transport failure, `cf4fa55e3a8d` empty) and the four checkpoints that carried them now read `"effects": []`. No renumbering; no other effect key moved. - `HEAD_EFFECT_SHA256` to the measured `cc25f370…ebe522`. The 24-effect count is unchanged. `recorderSha256`, `lockfileSha256` and `adapterSha256` all hold. `baseline` is a branch commit, so a repin to main follows the squash. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the one-line fix on the mobile session route, its updated browser proof, and the corresponding re-record of the RPC recording corpus (791 files).
- Diff-comments loader rejection caught at the effect.
void loadDiffComments()gained.catch(() => undefined), so a rejectedworktree.showno longer raises a document-level unhandled rejection on every session mount. Catching at the effect rather than inside the loader keeps the loader's reject behaviour visible to the recording adapter, which is the rationale the in-file comment gives. - Browser proof tightened.
mobile-web-app-session-render.test.mjsdropsKNOWN_UNCAUGHTand pins the session route's error list to[], so the proof now notices any console or page error in this closure. - Corpus re-recorded by design.
pilot-scenarios.jsonand all 787 goldens movebaselinetof9d4822204; the only content change ismatrix-session.diff-notes-worktree.show-1.json, where the threeunhandled-rejectioneffect definitions are removed and four checkpoints become"effects": []. - Effect pin refreshed.
HEAD_EFFECT_SHA256reaches its measured value with the 24-effect count unchanged.
I verified the mechanical claims rather than taking them on trust: all 787 goldens are uniformly rebaselined, the changed golden has no dangling effect references, mobile-session-route-parity.test.ts passes with the new hash, and both the pilot and session.diff-notes family recordings replay green against this branch tree. Only matrix-session.native-chat-page-nativechat.readsession-1.json still carries an unhandled-rejection, matching the out-of-scope note. The pinned commit f9d4822204 is a branch commit that will leave history on squash; that is the documented workflow (a repin to main follows, as with #22072 → #22101) and the PR body calls it out.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…22118) #22111 re-recorded the diff-notes goldens with baseline at its branch commit f9d4822, which the squash left unreachable from main. Bumped to main's tip 0b1567a and re-recorded: the diff is the baseline header in 787 goldens and the manifest's baseline line, nothing else, so the recordings are identical. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…undary, and re-record its family (#22179) * fix(mobile): contain the older-history page's rejection at its own boundary `loadEarlier` in `use-mobile-native-chat-session.ts` runs its read inside a fire-and-forget `void (async () => {...})()` with a `finally` and no `catch`, so every throw inside it reaches the document as an unhandled rejection. Two mechanisms, both certified by `matrix-session.native-chat-page-nativechat.readsession-1`: - The awaited `nativeChat.readSession` request rejecting — a transport drop (`transport failure`, and the empty-message shape) or the client abandoning the in-flight page at teardown (`Connection closed`). - `'error' in result` on an accepted success whose result was absent or null. The operation's reader is `z.unknown()` on purpose, because the reply is a union, so `rpcSuccessResultOrSkip` accepts `undefined` and `null` as results and `in` throws a TypeError on both before the page is ever read. Same class as the diff-comments fix (#22111) for the first mechanism and the catch goes at the same boundary — nothing awaits this promise, so there is no caller a swallowed rejection could hide from. It differs in the second: that TypeError is a defect in the payload read rather than an uncaught rejection, so it is fixed by checking the shape before `in` rather than by the catch, which would only have hidden it. Neither mechanism moves an observable value: the `finally` already cleared `loadingEarlier`, and both new returns land where the throw did, before the window is touched. A refused page and a failed page now leave the delivered window alone, which is this operation's declared skip policy. `mobile-native-chat-page-rejection.test.ts` captures the process `unhandledRejection` handler for the run and reads it; the three cases fail on main with exactly `transport failure` and the two `Cannot use 'in' operator` TypeErrors. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): re-record the corpus without the older-history page's rejections The corpus certified the five unhandled rejections the commit before removes, so the golden had to move with them. Scoped the same way as #22111: `baseline` bumped by editing that one line, then `--record`. The recorder refuses to run on any other tree, and the pin guard's `reproduce` replays the corpus against the pinned tree with only the recorder overlaid, so a product fix cannot be recorded without the bump. 788 files, 824 insertions, 938 deletions. Every line classified: - `baseline`, 787 files (786 goldens + `pilot-scenarios.json`) and nothing else in any of them. One distinct changed line across all of them. - `matrix-session.native-chat-page-nativechat.readsession-1.json`, the only golden with a substantive change (37 insertions, 151 deletions). Its value pool goes 34 -> 24: ten entries leave, none is added, and no surviving entry's content changed. Inside that golden, three things move and each follows from the effects going: - **Effects.** Five `unhandled-rejection` values leave the pool — the two TypeErrors (`02fb8ef75b28` undefined, `74a36d9b608f` null), the two transport rejections (`b5f9fdfa5b32` transport failure, `b388251f574a` empty) and `14095708382e` Connection closed — and the 16 checkpoints that carried them now read `"effects": []`: four each on `result-absent`, `result-null`, `transport-rejection` and `transport-rejection-no-message`. - **One checkpoint is gone.** `native-chat-page-earlier.prelude:cleanup`. `run-recording.ts` emits `cleanup` only when teardown produces an effect, and the abandoned page's `Connection closed` rejection was the only one it produced. Nothing left to observe, so no checkpoint. The two values only that checkpoint referenced leave with it: `980096177097`, its rejected `nativeChat.readSession#1` settlement, and `91a7795fa0ab`, its `nativeChat.unsubscribe#1` frame. - **Renumbering, on `payloads` at 12 checkpoints.** Ordinals are one counter per run, so dropping an effect shifts everything after it: `nativeChat.subscribe#2` 5 -> 4, `nativeChat.unsubscribe#1` 6 -> 5, `nativeChat.unsubscribe#2` 7 -> 6. Each shifted frame is byte-identical to the entry it now points at apart from the ordinal, and every one of those entries was already in the pool — the arms that never rejected recorded them. That is why nothing is added and the three higher-ordinal twins simply go unreferenced. `state`, `sender` and `settlements` are unchanged on every surviving checkpoint, so no observable value moved. `recorderSha256`, `adapterSha256` and `scenarioSha256` all hold, and `HEAD_EFFECT_SHA256` in `mobile-session-route-parity.test.ts` does not move: that pin walks `MobileSessionRouteScreen` and its named expansion hooks, and `useMobileNativeChatSession` is in neither set. `baseline` is a branch commit, so a repin to main follows the squash. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): build the page-rejection client double with one assertion The changed-code quality gate read two assertions in the new file and the second carried no rationale. There is only one shape here the types cannot express, so there is only one cast: `RpcSuccess` requires `result`, which is what makes the matrix's `result-absent` reply untypeable. The sender goes into the object literal the cast already covers. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin the corpus to the head its product tree matches The commit before moved a file under `mobile/src`, and the recorder guards that whole tree rather than only what it loads: `scripts/rpc-recording.mts` refuses to run when `git diff <baseline> -- mobile/src src/shared` is non-empty. Left alone, the pin would name a tree that still reproduces the corpus but that no one could record against without repinning first. 788 files, 788 insertions, 788 deletions, and `baseline` is the only distinct changed line in any of them. Nothing else moved, which is also the determinism check: a second full record against a product tree that differs only by a test file the drivers never load reproduced all 787 goldens byte for byte. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

Summary
use-mobile-session-diff-comments.tsranvoid loadDiffComments()with no catch, so a rejectedworktree.showraised an unhandled rejection on every session mount: a document-level error rather than a page fault, and a red herring in crash reports and device proofs. The catch goes at the effect, not inside the loader, whose promise the recording adapter awaits.config/scripts/mobile-web-app-session-render.test.mjspinned the page's error list to exactly that one rejection and now pins it to the empty list, which is what makes the browser proof notice the fix. Red-first: with the pin at[]and no fix, 2 failed / 3 passed, both printing the rejection; after the fix, 5 passed.The corpus certified the rejection, so the goldens moved by design. Scoped re-record with
baselinebumped on its own line tof9d4822204, then--record. Every diff line is one of: that bump (787 goldens plus the manifest); the threeunhandled-rejectioneffects leavingmatrix-session.diff-notes-worktree.show-1.json, with four checkpoints going to"effects": [](36 lines, the only content change); orHEAD_EFFECT_SHA256inmobile-session-route-parity.test.tsreaching its measured value with the 24-effect count unchanged.recorderSha256,adapterSha256andlockfileSha256hold. Verified by the lead.baselineis a branch commit, so a repin to main follows the squash.Out of scope, filed: one
unhandled-rejectioneffect remains in the corpus atmatrix-session.native-chat-page-nativechat.readsession-1.json, a different site.Commits
f9d4822204[]47ccbedcf2f9d4822204c463b452a6origin/main(8307dc5d7b), no overlapGates
Lane gates all exit 0 on
c463b452a6(mobile 804 files / 8,965 passed;config/scripts249 passed; ratchet 800 files). Lead gate at base8307dc5d7bbelow.Lead gate on
c463b452a6against8307dc5d7b: all lint gates 0;config/scripts249 files passed; mobile 804 files passed; no machine paths.