Skip to content

fix(mobile): catch the diff-comments loader rejection at the effect (OTA phase C follow-up) - #22111

Merged
Jinwoo-H merged 3 commits into
mainfrom
ota-fu-diff-comments-rejection
Sep 22, 2026
Merged

Jinwoo-H merged 3 commits into
mainfrom
ota-fu-diff-comments-rejection

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​21 $\color{#cf222e}{\Huge{\mathbf{−}}}$​37 $\color{#cf222e}{\Huge{\mathbf{−}}}$​16
Prod 789 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​796 $\color{#cf222e}{\Huge{\mathbf{−}}}$​827 $\color{#cf222e}{\Huge{\mathbf{−}}}$​31

Summary

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 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.mjs pinned 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 baseline bumped on its own line to f9d4822204, then --record. Every diff line is one of: that bump (787 goldens plus the manifest); the three unhandled-rejection effects leaving matrix-session.diff-notes-worktree.show-1.json, with four checkpoints going to "effects": [] (36 lines, the only content change); or HEAD_EFFECT_SHA256 in mobile-session-route-parity.test.ts reaching its measured value with the 24-effect count unchanged. recorderSha256, adapterSha256 and lockfileSha256 hold. Verified by the lead.

baseline is a branch commit, so a repin to main follows the squash.

Out of scope, filed: one unhandled-rejection effect remains in the corpus at matrix-session.native-chat-page-nativechat.readsession-1.json, a different site.

Commits

sha change red before
f9d4822204 fix: catch the diff-comments loader rejection at the effect; render-check pin to [] 2 failed / 3 passed
47ccbedcf2 test: re-record goldens without the diff-comments rejection; baseline f9d4822204 one golden, three classes
c463b452a6 merge of origin/main (8307dc5d7b), no overlap

Gates

Lane gates all exit 0 on c463b452a6 (mobile 804 files / 8,965 passed; config/scripts 249 passed; ratchet 800 files). Lead gate at base 8307dc5d7b below.

Lead gate on c463b452a6 against 8307dc5d7b: all lint gates 0; config/scripts 249 files passed; mobile 804 files passed; no machine paths.

`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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 rejected worktree.show no 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.mjs drops KNOWN_UNCAUGHT and 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.json and all 787 goldens move baseline to f9d4822204; the only content change is matrix-session.diff-notes-worktree.show-1.json, where the three unhandled-rejection effect definitions are removed and four checkpoints become "effects": [].
  • Effect pin refreshed. HEAD_EFFECT_SHA256 reaches 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.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H
Jinwoo-H merged commit 0b1567a into main Sep 22, 2026
33 checks passed
@Jinwoo-H
Jinwoo-H deleted the ota-fu-diff-comments-rejection branch September 22, 2026 00:27
Jinwoo-H added a commit that referenced this pull request Sep 22, 2026
…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
Jinwoo-H added a commit that referenced this pull request Sep 22, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant