Repository navigation
refactor(mobile): send the device-state holdouts through typed RpcOperations (step 4, wave 3) - #20915
Conversation
…step 4) Three families the recorder could not reach before, recorded against the pinned baseline's product code so the migration that follows has a parity oracle. The device state these hooks read is real, not declared. The pasteboard is the engine's existing per-recording fixture, so a paste reads the bytes a recorded copy put there one action earlier; the buffered draft store is the product's own useBufferedTerminalDrafts mounted in the same tree. No engine file is touched, so no existing golden moves and no header re-digests: 13 new goldens, 641 unchanged. Only the clipboard's text path is driven. The image path decodes a raster through expo-image-manipulator and stages it on expo-file-system, and recording it would mean inventing image and file-system behaviour. Both paths reach the same send. Two family mutants, one per family whose state() can observe a reply: keeping a refused send's draft cleared, and resolving the first repo's connection instead of the workspace's own. The paste family gets none — the hook returns void and calls onSuccess for an accepted and a refused send alike, so its only reply-dependent behaviour is the takeover report, which lives in the sender list. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…rations (step 4) Ten references over six files, the last of the raw-port sites whose blocker was that a recording could not reach them. Zero goldens move: every one of the six was recorded first, and the suite replays them against the rewritten code. Two operations are new and four sites reuse one that already fixes their method: - accounts.consumeCodexResetCredit, throw-message, payload unread — the call site's decodeResetResult is one scope-and-snapshot check and splitting it across a reader would put one refusal rule in two places. - notifications.getMissedSince, skip — a background pass with no screen to raise a host message on. The member read stays where the optional chaining was. - repo.list: the accessory's connection lookup joins the new-tab reader, which already threw the host's message; the new-workspace dialog joins the skip reader, which already left the list it had. Same reader, same policies, no new acceptance rule and no third operation on that method. - terminal.send: the composed send, the live keystroke send and the clipboard paste all join terminal.input-send, which the accessory raw send already used and which reads acceptance the same way isTerminalSendRpcAccepted did. The typed contract is stricter than the client's own scope type on the redeem: the catalog pairs each runtime with the distro it may name, while the shared CodexResetCreditExpectedScope does not. The invariant is real and held by the attempt journal's schema, so the narrowing is asserted at the send with that named; the bytes are unchanged. Widening the catalog would be a wire change. Two source-shape ratchets pinned the old call text and move with it. The route parity suite's runtime strings drop from 540 to 537: the three method literals that became operation definitions, and nothing else. Every hook, callback identity, effect, JSX and style pin is unchanged. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
ℹ️ No blocking issues — two minor cleanups the migration left behind. Neither file is in the diff, so they're described here rather than anchored inline.
Reviewed changes
- Goldens recorded before the refactor — 13 new goldens (three families:
session.terminal-paste,session.terminal-input-send,session.worktree-connection, plus 7 reply matrices) recorded at pine7206f62a8; no existing golden moved. - Six device-state-gated sites migrated to typed operations — new
codexResetCreditConsume(throw-message) andpushMissedSinceRead(skip); the new-workspace repo list joinsnativeChatRepoListRead, the accessory connection lookup joinsnewTabRepoListRead, and composed/live/paste sends jointerminalInputSend. - Recorder support — a session terminal input mount adapter (drives the product's own draft store and the clipboard fixture) and two family mutants, wired in
pilot-mutants.test.tswithexpect(verdict).toBe('killed'). - Inventory and ratchets — six
unvalidated-rpc-request-portentries deleted (10 references,src/components/now empty); source-shape tests refreshed.
I traced each of the six migrations against the acceptance/barrier engine and the reply matrices; all preserve the old refusal/acceptance behavior, including the rpcUncheckedMemberReader TypeError on a null payload and the preserved transport-promise identity.
ℹ️ terminalInputSend's call-site comment is now stale
The comment at mobile/src/terminal/mobile-terminal-operations.ts:22-24 still says "Two call sites send terminal input this way — the query-reply responder and the live accessory's raw send". This PR routes three more sends through the same operation (use-mobile-session-terminal-send-actions.ts twice, use-mobile-terminal-paste.ts), so it now has five. The sibling repo.list comment in mobile-session-read-operations.ts was updated for exactly this reason.
Technical details
# Stale call-site count on `terminalInputSend`
## Affected sites
- `mobile/src/terminal/mobile-terminal-operations.ts:22-24` — "Two call sites…" no longer matches.
- Pre-existing callers: `mobile-terminal-query-reply.ts:42`, `terminal-live-accessory-raw-send.ts:30`.
- Added by this PR: `use-mobile-session-terminal-send-actions.ts:91` and `:162`, `use-mobile-terminal-paste.ts:160`.
## Required outcome
- The comment names the current call sites (or drops the count) so it does not misstate who depends on the operation's acceptance policy.
## Suggested approach (optional)
- Reuse the wording the PR wrote for the two `repo.list` operations in `mobile-session-read-operations.ts:30-40`.ℹ️ RuntimeRepoSummary is now unused
Removing the RuntimeRepoSummary import from use-mobile-session-accessory-selection.ts dropped the type's last reference; it now exists only at mobile/src/session/mobile-session-route-types.ts:147. MobileRuntimeRepoSummary (mobile-session-read-operations.ts:26) has the identical shape and is what every remaining repo-list consumer imports.
Technical details
# Dead duplicate repo-summary type
## Affected sites
- `mobile/src/session/mobile-session-route-types.ts:147` — `RuntimeRepoSummary` has no consumers after this PR.
- `mobile/src/session/mobile-session-read-operations.ts:26` — `MobileRuntimeRepoSummary`, identical shape, imported by `mobile-new-tab-agent-loader.ts`, `use-mobile-native-chat-readability.ts`, `use-mobile-session-accessory-selection.ts`.
## Required outcome
- One repo-summary type instead of two: delete `RuntimeRepoSummary`, or make one an alias of the other.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe change migrates mobile RPC call sites to typed operations for reset credit, repositories, notification reconciliation, terminal input, paste, and connection lookup. It adds session terminal recording adapters, pilot scenarios, Darwin golden fixtures, and mutation coverage. Tests and route-parity fingerprints are updated for the new operation names and source shapes. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The typed RPC migration preserves the inspected request and response behavior, and no new merge-blocking risk is established. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description gives substantial technical detail and testing evidence, but it does not follow the required template. It lacks a valid linked issue after Resolution Update the description to include every required template section. Add a valid issue reference, provide an ELI5 summary, state
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ents `terminalInputSend`'s doc still claimed two call sites. It now has five non-test consumers, all on the same acceptance: the query-reply responder, the live accessory raw send, the session screen's composed draft send and live keystroke send, and the clipboard paste. That comment is where the next person narrowing `object-result-or-null` learns whose lost-ack meaning they are changing, so it names all five and their files. The session inventory block closed with "opens or rides a subscription, or takes its method as a parameter", which no longer covers every holdout below it: `use-mobile-session-terminal-input.ts` is held out for a webview handle. Its own reason also said PTY mode was unavailable in the runner, which this branch's terminal-input adapter contradicts by fixturing the mode map a paste reads. The sentence is narrowed and the holdout restated: PTY mode is recordable, the live webview handle is what is left. Comments only. No product behaviour, no golden, no parity hash moves. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
`terminal-send-refusal-restores-draft` documents the harm of a refused send that leaves the composed draft cleared, but it was driven by the accepted scenario, where the kill comes from the inverse (a draft restored after a send that landed). The refused scenario shows the documented harm directly: without the restore the input stays empty after the runtime says no. Still one mutant per family, and it kills there — verified by running the suite, `terminal-input-send-refused: kills terminal-send-refusal-restores- draft`. No golden, no product change. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
🟡 Minor · Record refused pastes as refused.
mobile/src/test-support/rpc-recording/adapters/session-terminal-input-mount-adapters.ts:104-109
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winRecord refused pastes as
refused.useMobileTerminalPastereceivesaccepted: false, skips takeover reporting, then still callsonSuccess(). The adapter records that result aspasteOutcome = 'sent', andterminal-paste-refusedonly checks that takeover was not reported. Pass the interpreted acceptance result to the callback, mapfalseto'refused', and assert that outcome in the scenario. Transport failures already map to'error'.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: aa688cf2-c610-4786-94f1-92171c949613
📒 Files selected for processing (3)
mobile/src/terminal/mobile-terminal-operations.tsmobile/src/test-support/rpc-recording/mutants/pilot-mutants.test.tsmobile/src/transport/unvalidated-rpc-request-port-inventory.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- mobile/src/transport/unvalidated-rpc-request-port-inventory.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Re-reviewed the two commits pushed after the prior pullfrog review; both are non-behavioral follow-ups to it.
- Corrected
terminalInputSend's doc comment from "two call sites" to its five consumers, naming each file. - Narrowed the session-scope inventory summary and restated the
use-mobile-session-terminal-input.tsholdout: PTY mode is recordable now, the live webview handle is the remaining blocker. - Re-paired the
terminal-send-refusal-restores-draftmutant with theterminal-input-send-refusedscenario, which now exercises the documented harm directly instead of the inverse.
The comment claims check out against the source — five terminalInputSend call sites (mobile-terminal-query-reply.ts, terminal-live-accessory-raw-send.ts, both sends in use-mobile-session-terminal-send-actions.ts, and use-mobile-terminal-paste.ts), and every remaining session holdout opens or rides a subscription. Re-ran pilot-mutants.test.ts, including terminal-input-send-refused: kills terminal-send-refusal-restores-draft on this head (14 passed / 3 skipped).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…type Three round-2 corrections, comments and one dead type; no behaviour. The gesture-input holdout claimed a recorder gap that does not exist. The flush path reads refs only — client, connection state, PTY modes, the gesture buckets, active handle and tab type — and the clear-buffer reference optional-chains the webview ref, so a mount with a null terminal ref puts both sends on the wire. The reason now says what is true: those 2 references are migratable as they stand and were out of this PR's bucket. The session summary sentence no longer offers a webview reason. `RuntimeRepoSummary` in mobile-session-route-types.ts lost its last consumer when the accessory hook moved to `MobileRuntimeRepoSummary`; `git grep RuntimeRepoSummary` now finds only the `Mobile`-prefixed type. Deleted. Both refreshed route-parity hashes still credited the `interpretOrThrowRefusalMessage` refresh for their current value. They now state the invariant they pin and this PR's reason for the move: the sends and repo reads inside those bodies name their `RpcOperation` instead of the raw `sendRequest` port. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Four conflicts, all unions or deletions taken from both sides. - `pilot-scenarios.json`: merged by scenario id, not by hunk. 328 shared entries untouched, main's 6 terminal-input and paste scenarios and this branch's 6 screen-mount scenarios all kept, 340 total, no id collision and no entry modified on either side. Both sides' entries verified byte-equal after the splice. - `mobile-session-read-operations.ts`: main widened the `repo.list` note with the terminal accessory and the new-workspace dialog; this branch had corrected the claim that every consumer reads one connection id. Kept main's throw/skip grouping and added the tasks route, which keeps the whole list for its pickers. - `pilot-mutants.test.ts`: both mutant maps unioned, 6 new entries. - `unvalidated-rpc-request-port-inventory.ts`: both sides' deletions taken. This branch removes the agent-history panel line, main removes the two `src/components/` lines and rewrote that group's note. Goldens did not conflict. Main's recorder digest never moved, because #20915 touched only `adapters/` and `mutants/`, which `recorderSha256` excludes. Its 13 new goldens therefore arrive on this branch's older digest and are the only ones the re-record has to move. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
One record for the whole merged tree, at the unchanged baseline e7206f6, through a detached worktree reset to that pin with this branch's rpc-recording tree, scenarios and recorder script overlaid. Product source in that worktree was proven identical to the baseline before the run, so the recordings describe the pre-refactor product. 13 goldens move, all of them the ones #20915 added. They arrived carrying the recorder digest from before this branch edited `screen-native-substitutes.ts`, and `recorderSha256` is the only key that moves on any of them; every recording body is identical after decoding through the value pool. The other 654 were re-recorded byte-for-byte and are not in this commit. All 667 goldens now carry one `recorderSha256`, one `baseline` and one `lockfileSha256`. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…cOperations (step 4, wave 3) (#20919) * test(mobile): record six screen-mounted call sites before migrating them Five new mount adapters and six scenarios, recorded against the pinned baseline's product code so the goldens are main's behaviour, not the refactor's. Each site is a screen the recorder could not previously mount: - `home.host-accounts` mounts `fetchMobileHomeAccounts`, whose decoder is re-exported through `AccountUsage.tsx`. That module loads under the mount loader, so the inventory's "no recording can load it" was already stale. - `notifications.display-test-screen` mounts the settings push probe and presses its button by reading the handler back off the rendered inert `Pressable`. - `aiVault.history-screen` mounts the history panel, which is where the last `worktree.ps` lives. Split in two: the base stops once the worktree list has seeded the scopes, because a reply partition there changes the scopePaths the downstream `aiVault.listSessions` carries, and a matrix variant cannot assert params it moved. The full chain is a second scenario, driven as a pilot only. - `tasks.route-repo-list` mounts the tasks screen-root hook and calls its own `ensureLoaded`, which is the only thing that fires `repo.list`. - `linear.select-workspace-picker` calls the render helper the tasks surface calls and invokes the `onSelect` on the element it returns. The picker draws inside `BottomDrawer`, whose reanimated timing driver and gesture builder the recorder would have to impersonate for a row to exist; the closure is the same either way, and the workspace a selection carries comes from the scenario. Five substitute members are added, each with the recording that reads it: `react-native-safe-area-context.useSafeAreaInsets` and `expo-router.useLocalSearchParams` for `tasks.route-repo-list`, and `react-native.TextInput`, `.SectionList` and `.RefreshControl` for `aiVault.history-screen` once its list renders. `useLocalSearchParams` answers one pinned route for the same reason the window size is pinned: a screen's own address is not a device reading, and the one screen that reads it sends `repo.list`, which takes no params. Touching the substitute table moves `recorderSha256`, so all 641 existing goldens are re-recorded. Recorded from a detached worktree at the pinned baseline with this branch's recorder laid over it: every pre-existing golden is header-only, verified by resolving both sides through the value pool — 641 header-only, 0 body, 0 deleted, one distinct `recorderSha256`, `baseline` and `lockfileSha256` across all of them. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): type the linear workspace picker's model fixture `mobile/tsconfig.json` covers the recorder, and the fixture's setters were written with the argument the product happens to pass rather than the `SetStateAction` the model declares. Typing them moves `adapterSha256` on the two goldens recorded through this module, so they are re-recorded here rather than in the refactor commit, which must move none. Re-recorded at the pinned baseline: `linear-select-workspace` and its reply matrix, header-only, bodies unchanged. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): send six screen-mounted call sites through typed RpcOperations Nine references off the raw request port, across six files. Every one is proven against the goldens recorded in the previous commit from the pinned baseline's product code: this commit moves no file under mobile/rpc-foundation/goldens. Reused rather than redefined: - `worktree.ps` in the history panel sends through `worktreeCatalogRead`. Same question, same acceptance — a refused list leaves the screen on what it holds. - `repo.list` in the tasks screen-root hook sends through `newTabRepoListRead`. Its policy raises the host's message and its reader takes `repos` off the payload while preserving the property-read exception a null result used to throw at the cast, which is what this call site did by hand. Its name still says new-tab; a third consumer does not make renaming it this bucket's business. Four operations are new, each because no existing reader on the method takes this consumer's input: - `files.read-directory-or-skip` and `files.legacy-explorer-list-or-skip` for the explorer. Both skip, because neither refusal is the operation's to decide: the readDir refusal code selects the legacy fallback and the list refusal supplies the message. The existing `files.list-or-skip` reads the `files` member alone, and the explorer also needs `truncated` for the "Showing first 5000" note. - `accounts.home-snapshot-or-skip` for the Home card, decoded by `decodeAccountsSnapshot` at the call site as before. - `notifications.test-push-or-skip` for the settings probe, whose `forbidden` and `method_not_found` refusals mean "try the next desktop". - `linear.select-workspace-or-skip` for the filter sheet. Two behaviours are preserved rather than repaired, both recorded: - The workspace switch never read its reply. `.then(() => loadLinearContext())` runs on a refusal exactly as on a success, so only a transport rejection reaches the error copy. Interpreting the operation here would surface a refused switch for the first time; that is a product change with its own re-record. - `app/terminal-settings.tsx` still reads `ms` off the reply envelope instead of off its result, so the value is always undefined. It did not migrate, and the inventory now carries the defect as its own note. Four mutants are added, one per new family that admits a state-only one: the Home snapshot, the push test result and the tasks repo list each decoded one level above the envelope, and the workspace switch with its context reload dropped. `aiVault.history-screen` gets none and says why in the suite: everything `worktree.ps` publishes also moves the `scopePaths` the next scripted completion asserts, so a mutant aborts the sequence instead of diverging from it. Its evidence is the reply matrix at that request. The tasks source-parity ratchet moves with the family it guards: hook, statement, declaration, render and style counts are unchanged, and the semantic source is a pure deletion of four lines — two `rpc:` call signatures and the two method literals they carried. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): matrix the six new screen families' replies One golden per scripted reply, eleven partitions each, recorded at the pinned baseline alongside the pilots. Seven sites: `accounts.list`, `notifications.testPush`, `repo.list`, `linear.selectWorkspace`, and all three of the history screen's — `worktree.ps` and the two `status.get` reads its scan chains off the worktree list. The history matrix is also that family's defect evidence in place of a mutant: every partition at `worktree.ps` changes the `scopePaths` the downstream `aiVault.listSessions` carries, and the sender args are recorded with it. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): correct three operation and mutant comments Comment-only, no product behaviour and no golden movement. - `worktreeCatalogRead` says two readers; there are three. Names the third (the agent-history panel's `scopePaths` seed) and drops the stale count from the module header, which described call sites rather than the two operations. - `newTabRepoListRead`'s census counted the two operations over `repo.list`, not its own two callers, and claimed both read a workspace's connection id. The tasks route keeps the whole list for its repo pickers. The split from `nativeChatRepoListRead` stays where it belongs: acceptance. - The `aiVault.history-screen` mutant note pointed at the reply matrix as the accepted-vs-refused oracle. Decoding `matrix-aivault.history-screen-worktree.ps-1.json` through the value pool shows `normal`'s projected state is identical to all seven non-crashing partitions (spinner, two labels, zero rows). The real oracles are the next request's `scopePaths` (`["/repo/feature"]` vs `[]`) and the crash channel the three `inner-*` partitions land in. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): give the second files.list reader its real reason Comment-only, no product behaviour and no golden movement. `legacyFileListRead` claimed "the member reader rejects this consumer's input". Nothing rejects: `rpcUncheckedMemberReader` returns the member, and reusing it here would simply drop `truncated`. The reason the explorer declares its own operation is the other direction. Widening `files.list-or-skip` to a payload reader would split the `workspace-files` variant it shares with `nativeChatFileSearchRead` over `files.searchPaths`, whose only caller feeds both through one `extractPaths` in `use-mobile-native-chat-file-search.ts`, so the member read would move into that hook rather than disappear. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * style(mobile): indent the six scenario entries spliced during the merge The conflict on `pilot-scenarios.json` was resolved by id rather than by hunk, splicing this branch's six entries into main's text at the array's close. The splice started at the entry's `{` instead of at its line, so those six lines lost their indentation. oxfmt's only change is those six lines; the parsed document is identical, and the recording suite still matches all 667 goldens, so no scenario digest depends on the raw text. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): re-record the merged goldens once at the pin One record for the whole merged tree, at the unchanged baseline e7206f6, through a detached worktree reset to that pin with this branch's rpc-recording tree, scenarios and recorder script overlaid. Product source in that worktree was proven identical to the baseline before the run, so the recordings describe the pre-refactor product. 13 goldens move, all of them the ones #20915 added. They arrived carrying the recorder digest from before this branch edited `screen-native-substitutes.ts`, and `recorderSha256` is the only key that moves on any of them; every recording body is identical after decoding through the value pool. The other 654 were re-recorded byte-for-byte and are not in this commit. All 667 goldens now carry one `recorderSha256`, one `baseline` and one `lockfileSha256`. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): state the real gates on two screen holdouts Comment-only, no product behaviour and no golden movement. The accounts route said "the screen now mounts". It does not, at this commit: it reads `expo-router.useFocusEffect` and `react-native.ScrollView`, neither is a substituted member, and the trap refuses before any effect runs. The note now names that as the first gate and the `accounts.subscribe` effect as the second, and says why the two members are not added here. The host-screen overlay note blamed a "reanimated timing driver" for deciding when the drawer's children exist. Nothing gates them: `resolveBottomDrawerMounted` returns `visible || mounted`, `BottomDrawer` renders `MountedBottomDrawer` on that, and that component renders its children unconditionally inside its `Modal`. The blocker is the module's own imports of reanimated and gesture-handler, neither substituted. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): drop the tasks route adapter's unreachable reload action No scenario names `reload-repos`, and no schedule driver can generate it: the drivers emit only disconnect, cutover, reset, unmount, blur and remount. Every other action on this adapter is reached by a scenario. Deleting the branch leaves the remount and unmount branches, which are driven. Re-recorded once at the pin e7206f6 with the product source in that worktree proven identical to the baseline first. Two goldens move, both in the `tasks.route-repo-list` family, with `adapterSha256` the only moved key and both recording bodies identical after decoding through the value pool. The other 665 re-recorded byte-for-byte. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…rations (step 4, wave 3) (stablyai#20915) * test(mobile): record the terminal input surface before migrating it (step 4) Three families the recorder could not reach before, recorded against the pinned baseline's product code so the migration that follows has a parity oracle. The device state these hooks read is real, not declared. The pasteboard is the engine's existing per-recording fixture, so a paste reads the bytes a recorded copy put there one action earlier; the buffered draft store is the product's own useBufferedTerminalDrafts mounted in the same tree. No engine file is touched, so no existing golden moves and no header re-digests: 13 new goldens, 641 unchanged. Only the clipboard's text path is driven. The image path decodes a raster through expo-image-manipulator and stages it on expo-file-system, and recording it would mean inventing image and file-system behaviour. Both paths reach the same send. Two family mutants, one per family whose state() can observe a reply: keeping a refused send's draft cleared, and resolving the first repo's connection instead of the workspace's own. The paste family gets none — the hook returns void and calls onSuccess for an accepted and a refused send alike, so its only reply-dependent behaviour is the takeover report, which lives in the sender list. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): send the device-state holdouts through typed RpcOperations (step 4) Ten references over six files, the last of the raw-port sites whose blocker was that a recording could not reach them. Zero goldens move: every one of the six was recorded first, and the suite replays them against the rewritten code. Two operations are new and four sites reuse one that already fixes their method: - accounts.consumeCodexResetCredit, throw-message, payload unread — the call site's decodeResetResult is one scope-and-snapshot check and splitting it across a reader would put one refusal rule in two places. - notifications.getMissedSince, skip — a background pass with no screen to raise a host message on. The member read stays where the optional chaining was. - repo.list: the accessory's connection lookup joins the new-tab reader, which already threw the host's message; the new-workspace dialog joins the skip reader, which already left the list it had. Same reader, same policies, no new acceptance rule and no third operation on that method. - terminal.send: the composed send, the live keystroke send and the clipboard paste all join terminal.input-send, which the accessory raw send already used and which reads acceptance the same way isTerminalSendRpcAccepted did. The typed contract is stricter than the client's own scope type on the redeem: the catalog pairs each runtime with the distro it may name, while the shared CodexResetCreditExpectedScope does not. The invariant is real and held by the attempt journal's schema, so the narrowing is asserted at the send with that named; the bytes are unchanged. Widening the catalog would be a wire change. Two source-shape ratchets pinned the old call text and move with it. The route parity suite's runtime strings drop from 540 to 537: the three method literals that became operation definitions, and nothing else. Every hook, callback identity, effect, JSX and style pin is unchanged. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): correct the terminalInputSend and PTY-mode holdout comments `terminalInputSend`'s doc still claimed two call sites. It now has five non-test consumers, all on the same acceptance: the query-reply responder, the live accessory raw send, the session screen's composed draft send and live keystroke send, and the clipboard paste. That comment is where the next person narrowing `object-result-or-null` learns whose lost-ack meaning they are changing, so it names all five and their files. The session inventory block closed with "opens or rides a subscription, or takes its method as a parameter", which no longer covers every holdout below it: `use-mobile-session-terminal-input.ts` is held out for a webview handle. Its own reason also said PTY mode was unavailable in the runner, which this branch's terminal-input adapter contradicts by fixturing the mode map a paste reads. The sentence is narrowed and the holdout restated: PTY mode is recordable, the live webview handle is what is left. Comments only. No product behaviour, no golden, no parity hash moves. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): pair the draft-restore mutant with the refused send `terminal-send-refusal-restores-draft` documents the harm of a refused send that leaves the composed draft cleared, but it was driven by the accepted scenario, where the kill comes from the inverse (a draft restored after a send that landed). The refused scenario shows the documented harm directly: without the restore the input stays empty after the runtime says no. Still one mutant per family, and it kills there — verified by running the suite, `terminal-input-send-refused: kills terminal-send-refusal-restores- draft`. No golden, no product change. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): correct the gesture-input holdout and drop a dead repo type Three round-2 corrections, comments and one dead type; no behaviour. The gesture-input holdout claimed a recorder gap that does not exist. The flush path reads refs only — client, connection state, PTY modes, the gesture buckets, active handle and tab type — and the clear-buffer reference optional-chains the webview ref, so a mount with a null terminal ref puts both sends on the wire. The reason now says what is true: those 2 references are migratable as they stand and were out of this PR's bucket. The session summary sentence no longer offers a webview reason. `RuntimeRepoSummary` in mobile-session-route-types.ts lost its last consumer when the accessory hook moved to `MobileRuntimeRepoSummary`; `git grep RuntimeRepoSummary` now finds only the `Mobile`-prefixed type. Deleted. Both refreshed route-parity hashes still credited the `interpretOrThrowRefusalMessage` refresh for their current value. They now state the invariant they pin and this PR's reason for the move: the sends and repo reads inside those bodies name their `RpcOperation` instead of the raw `sendRequest` port. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…cOperations (step 4, wave 3) (stablyai#20919) * test(mobile): record six screen-mounted call sites before migrating them Five new mount adapters and six scenarios, recorded against the pinned baseline's product code so the goldens are main's behaviour, not the refactor's. Each site is a screen the recorder could not previously mount: - `home.host-accounts` mounts `fetchMobileHomeAccounts`, whose decoder is re-exported through `AccountUsage.tsx`. That module loads under the mount loader, so the inventory's "no recording can load it" was already stale. - `notifications.display-test-screen` mounts the settings push probe and presses its button by reading the handler back off the rendered inert `Pressable`. - `aiVault.history-screen` mounts the history panel, which is where the last `worktree.ps` lives. Split in two: the base stops once the worktree list has seeded the scopes, because a reply partition there changes the scopePaths the downstream `aiVault.listSessions` carries, and a matrix variant cannot assert params it moved. The full chain is a second scenario, driven as a pilot only. - `tasks.route-repo-list` mounts the tasks screen-root hook and calls its own `ensureLoaded`, which is the only thing that fires `repo.list`. - `linear.select-workspace-picker` calls the render helper the tasks surface calls and invokes the `onSelect` on the element it returns. The picker draws inside `BottomDrawer`, whose reanimated timing driver and gesture builder the recorder would have to impersonate for a row to exist; the closure is the same either way, and the workspace a selection carries comes from the scenario. Five substitute members are added, each with the recording that reads it: `react-native-safe-area-context.useSafeAreaInsets` and `expo-router.useLocalSearchParams` for `tasks.route-repo-list`, and `react-native.TextInput`, `.SectionList` and `.RefreshControl` for `aiVault.history-screen` once its list renders. `useLocalSearchParams` answers one pinned route for the same reason the window size is pinned: a screen's own address is not a device reading, and the one screen that reads it sends `repo.list`, which takes no params. Touching the substitute table moves `recorderSha256`, so all 641 existing goldens are re-recorded. Recorded from a detached worktree at the pinned baseline with this branch's recorder laid over it: every pre-existing golden is header-only, verified by resolving both sides through the value pool — 641 header-only, 0 body, 0 deleted, one distinct `recorderSha256`, `baseline` and `lockfileSha256` across all of them. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): type the linear workspace picker's model fixture `mobile/tsconfig.json` covers the recorder, and the fixture's setters were written with the argument the product happens to pass rather than the `SetStateAction` the model declares. Typing them moves `adapterSha256` on the two goldens recorded through this module, so they are re-recorded here rather than in the refactor commit, which must move none. Re-recorded at the pinned baseline: `linear-select-workspace` and its reply matrix, header-only, bodies unchanged. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): send six screen-mounted call sites through typed RpcOperations Nine references off the raw request port, across six files. Every one is proven against the goldens recorded in the previous commit from the pinned baseline's product code: this commit moves no file under mobile/rpc-foundation/goldens. Reused rather than redefined: - `worktree.ps` in the history panel sends through `worktreeCatalogRead`. Same question, same acceptance — a refused list leaves the screen on what it holds. - `repo.list` in the tasks screen-root hook sends through `newTabRepoListRead`. Its policy raises the host's message and its reader takes `repos` off the payload while preserving the property-read exception a null result used to throw at the cast, which is what this call site did by hand. Its name still says new-tab; a third consumer does not make renaming it this bucket's business. Four operations are new, each because no existing reader on the method takes this consumer's input: - `files.read-directory-or-skip` and `files.legacy-explorer-list-or-skip` for the explorer. Both skip, because neither refusal is the operation's to decide: the readDir refusal code selects the legacy fallback and the list refusal supplies the message. The existing `files.list-or-skip` reads the `files` member alone, and the explorer also needs `truncated` for the "Showing first 5000" note. - `accounts.home-snapshot-or-skip` for the Home card, decoded by `decodeAccountsSnapshot` at the call site as before. - `notifications.test-push-or-skip` for the settings probe, whose `forbidden` and `method_not_found` refusals mean "try the next desktop". - `linear.select-workspace-or-skip` for the filter sheet. Two behaviours are preserved rather than repaired, both recorded: - The workspace switch never read its reply. `.then(() => loadLinearContext())` runs on a refusal exactly as on a success, so only a transport rejection reaches the error copy. Interpreting the operation here would surface a refused switch for the first time; that is a product change with its own re-record. - `app/terminal-settings.tsx` still reads `ms` off the reply envelope instead of off its result, so the value is always undefined. It did not migrate, and the inventory now carries the defect as its own note. Four mutants are added, one per new family that admits a state-only one: the Home snapshot, the push test result and the tasks repo list each decoded one level above the envelope, and the workspace switch with its context reload dropped. `aiVault.history-screen` gets none and says why in the suite: everything `worktree.ps` publishes also moves the `scopePaths` the next scripted completion asserts, so a mutant aborts the sequence instead of diverging from it. Its evidence is the reply matrix at that request. The tasks source-parity ratchet moves with the family it guards: hook, statement, declaration, render and style counts are unchanged, and the semantic source is a pure deletion of four lines — two `rpc:` call signatures and the two method literals they carried. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): matrix the six new screen families' replies One golden per scripted reply, eleven partitions each, recorded at the pinned baseline alongside the pilots. Seven sites: `accounts.list`, `notifications.testPush`, `repo.list`, `linear.selectWorkspace`, and all three of the history screen's — `worktree.ps` and the two `status.get` reads its scan chains off the worktree list. The history matrix is also that family's defect evidence in place of a mutant: every partition at `worktree.ps` changes the `scopePaths` the downstream `aiVault.listSessions` carries, and the sender args are recorded with it. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): correct three operation and mutant comments Comment-only, no product behaviour and no golden movement. - `worktreeCatalogRead` says two readers; there are three. Names the third (the agent-history panel's `scopePaths` seed) and drops the stale count from the module header, which described call sites rather than the two operations. - `newTabRepoListRead`'s census counted the two operations over `repo.list`, not its own two callers, and claimed both read a workspace's connection id. The tasks route keeps the whole list for its repo pickers. The split from `nativeChatRepoListRead` stays where it belongs: acceptance. - The `aiVault.history-screen` mutant note pointed at the reply matrix as the accepted-vs-refused oracle. Decoding `matrix-aivault.history-screen-worktree.ps-1.json` through the value pool shows `normal`'s projected state is identical to all seven non-crashing partitions (spinner, two labels, zero rows). The real oracles are the next request's `scopePaths` (`["/repo/feature"]` vs `[]`) and the crash channel the three `inner-*` partitions land in. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): give the second files.list reader its real reason Comment-only, no product behaviour and no golden movement. `legacyFileListRead` claimed "the member reader rejects this consumer's input". Nothing rejects: `rpcUncheckedMemberReader` returns the member, and reusing it here would simply drop `truncated`. The reason the explorer declares its own operation is the other direction. Widening `files.list-or-skip` to a payload reader would split the `workspace-files` variant it shares with `nativeChatFileSearchRead` over `files.searchPaths`, whose only caller feeds both through one `extractPaths` in `use-mobile-native-chat-file-search.ts`, so the member read would move into that hook rather than disappear. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * style(mobile): indent the six scenario entries spliced during the merge The conflict on `pilot-scenarios.json` was resolved by id rather than by hunk, splicing this branch's six entries into main's text at the array's close. The splice started at the entry's `{` instead of at its line, so those six lines lost their indentation. oxfmt's only change is those six lines; the parsed document is identical, and the recording suite still matches all 667 goldens, so no scenario digest depends on the raw text. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): re-record the merged goldens once at the pin One record for the whole merged tree, at the unchanged baseline e7206f6, through a detached worktree reset to that pin with this branch's rpc-recording tree, scenarios and recorder script overlaid. Product source in that worktree was proven identical to the baseline before the run, so the recordings describe the pre-refactor product. 13 goldens move, all of them the ones stablyai#20915 added. They arrived carrying the recorder digest from before this branch edited `screen-native-substitutes.ts`, and `recorderSha256` is the only key that moves on any of them; every recording body is identical after decoding through the value pool. The other 654 were re-recorded byte-for-byte and are not in this commit. All 667 goldens now carry one `recorderSha256`, one `baseline` and one `lockfileSha256`. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): state the real gates on two screen holdouts Comment-only, no product behaviour and no golden movement. The accounts route said "the screen now mounts". It does not, at this commit: it reads `expo-router.useFocusEffect` and `react-native.ScrollView`, neither is a substituted member, and the trap refuses before any effect runs. The note now names that as the first gate and the `accounts.subscribe` effect as the second, and says why the two members are not added here. The host-screen overlay note blamed a "reanimated timing driver" for deciding when the drawer's children exist. Nothing gates them: `resolveBottomDrawerMounted` returns `visible || mounted`, `BottomDrawer` renders `MountedBottomDrawer` on that, and that component renders its children unconditionally inside its `Modal`. The blocker is the module's own imports of reanimated and gesture-handler, neither substituted. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): drop the tasks route adapter's unreachable reload action No scenario names `reload-repos`, and no schedule driver can generate it: the drivers emit only disconnect, cutover, reset, unmount, blur and remount. Every other action on this adapter is reached by a scenario. Deleting the branch leaves the remount and unmount branches, which are driven. Re-recorded once at the pin e7206f6 with the product source in that worktree proven identical to the baseline first. Two goldens move, both in the `tasks.route-repo-list` family, with `adapterSha256` the only moved key and both recording bodies identical after decoding through the value pool. The other 665 re-recorded byte-for-byte. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

Step 4, wave 3 (device-state holdouts): the six sites that were held out of the step-4 migration because their sends are gated on device state (async-storage journal, last-visited repo, OS notification tray, pasteboard, buffered drafts, keyboard) now send through typed
RpcOperations. 10 references → 0. No wire change, zero existing goldens moved, no recorder engine change.Diff composition (head
45c7c2a4ed, vs0869d997c8)pilot-scenarios.jsonmutants/is outside the digests)recorderSha256did not move: no engine file or substitute table touchedCommit order (the contract)
958298222d— scenarios + goldens for the three unrecorded hooks, recorded against the pine7206f62a8before any product edit. No substitute member added: the pasteboard fixture already innative-mounting-substitutes.tsis a per-recording cell that remembers what a recorded action wrote, so the paste scenario copies through the accessory hook then pastes, the sequence a phone performs; the buffered draft store is the product's ownuseBufferedTerminalDraftsmounted in the same tree.45c7c2a4ed— the refactor. Touches no golden.Two commits, not three:
familyGoldensderives the reply matrices in the same recording pass andfamily-recordings.test.tsreads them from the same directory, so a commit 1 without them fails its own suite. The matrices therefore ride in commit 1, recorded at the pin against pre-migration source and replayed green against the migrated source, which is stronger than freezing them after the refactor.The three sites #20884 had already recorded (codex reset credit, new-workspace repositories, push dismissal) migrate against those existing scenarios.
Inventory
Pending list 28 files / 44 refs → 22 files / 34 refs. All six bucket lines deleted, none rewritten:
codex-reset-credit.ts3→0,use-new-workspace-repositories.ts1→0,push-dismissal-reconciliation.ts2→0,use-mobile-session-accessory-selection.ts1→0,use-mobile-terminal-paste.ts1→0,use-mobile-session-terminal-send-actions.ts2→0.Readers and policies
Zero new acceptance policies, zero new readers. Two new operations:
accounts.consumeCodexResetCredit(throw-message, payload unread) andnotifications.getMissedSince(skip, member read stays at the call site). Four sites joined existing operations:repo.list→newTabRepoListRead(accessory connection lookup) andnativeChatRepoListRead(new-workspace dialog);terminal.send× 3 →terminalInputSend.Evidence
mobile/rpc-foundation/. 13 A / 0 M / 0 D vs main; onerecorderSha256,baseline,lockfileSha256across all 654 goldens; refusal texts absent (golden-recorder-failure-absencepasses). Lead-reproduced; recording + boundary suites 18 files / 764 passed; mobile typecheck 0.handleSend(it wraps the send in try/catch/finally, never reads the error, restores the draft on both arms, anddismissKeyboardAfterAgentSendwithaccepted: falseis a no-op), both classes shown to kill where a rejection is read. Two family mutants added, both killing (draft cleared on a refused send; first listed repo's connection resolved instead of the workspace's own). The paste family has no state-killable mutant: the hook returns void and callsonSuccessfor accepted and refused alike; stated in the commit rather than invented.isRpcDeliveryUnknownmarks.Files touched outside the six, and why
Two source-shape ratchets pinned the old call text:
agent-send-keyboard-dismissal-wiring.test.tsasserts on the literalclient.sendRequest(/isTerminalSendRpcAccepted(response);mobile-session-route-parity.test.ts's runtime-string count drops 540 → 537, exactly the three method literals that became operation definitions, with every hook, callback identity, effect, JSX and style pin unchanged. The doc comment on the tworepo.listoperations inmobile-session-read-operations.tssaid two call sites; it is now four.Ticket owed, not fixed here
The params catalog pairs each runtime with the distro it may name (
{runtime:'host',wslDistro:null} | {runtime:'wsl',wslDistro:string}) while the sharedCodexResetCreditExpectedScopeinsrc/shared/codex-reset-credit-scope.tsis one type wider. The invariant is enforced at runtime byCodexResetAttemptSchema's refinement inmobile/src/storage/codex-reset-attempt-journal.ts, so the bytes were always correct. The send asserts the narrowing with that invariant named in aSAFETYcomment; narrowing the shared type is the right fix and is outside this bucket.Measurements
61 min start to green. Golden weight 641 files / 12.22 MB → 654 / 12.37 MB.
Gates
ORCA_BACKGROUND_LAUNCH=1: mobile typecheck 0; mobile test 593 files / 5531 passed / 6 skipped;pnpm tc0;check:code-quality:changed0 new across 16 files;check:react-doctor:changed0;audit:anti-slop0;oxfmt --check .frommobile/clean;oxlinton every changed file 0.Review round 1 (2026-09-16)
Ship as-is. Independently verified: refactor commit touches nothing under
mobile/rpc-foundation/; 13 A / 0 M / 0 D; no migrated site changed method, params, options or timeout (bindDeferredRpcOperation.requestforwardssendRequestverbatim; the redeem'stimeoutMs: 90_000stays pinned by its test); every joined operation reproduces main's acceptance (throw-message =new Error(error.message)with no code prefix, including the empty-message case; skip =if (!ok) return, null result admitted asresult?.did); the two equivalent mutants athandleSendreproduced straight from the matrix golden (transport-rejection leg records state identical to every refusal leg) and each class kills at the paste and redeem sites; two policy-swap probes moved 1 and 3 goldens. Two comment corrections applied (bc7d499fe2):terminalInputSend's doc now lists its five consumers; the inventory's session summary no longer claims everything left is subscription- or method-parameter-bound, anduse-mobile-session-terminal-input.tsis restated as "PTY mode is recordable now, the live webview handle is the remaining blocker". Nit taken (64b28cb7d3): the draft-restore mutant now pairs with the refused-send scenario it documents; still kills. Zero goldens.Review round 2 (2026-09-16, fresh reviewer)
Ship after three comment/dead-code fixes, applied as
9694f5e4c9(+10/−14, 0 goldens, no behaviour). Reviewer reproduced every contract claim: the refactor commit touches 0 files undermobile/rpc-foundation/; 13 goldens added, 0 modified, one baseline across all 654; every migrated site keeps method, params, options and timeout (recorded args confirmrepo.listwith params and options absent,terminal.sendwith{failWhenDisconnected:true}at the two send-actions sites and absent at paste); all four join-sites keep acceptance; both mutants kill non-vacuously; the CodexSAFETYnarrowing is sound because the journal schema's refinement matches the catalog's discriminated union.Fixes: (1) the
use-mobile-session-terminal-input.tsholdout reason claimed a webview the runner cannot mount; the reviewer mounted the hook through the recorder with a null terminal ref and got bothterminal.sendandorchestration.workerTerminalUserInputon the wire, so the inventory now says these 2 refs are migratable and were simply outside this PR's scope. (2)RuntimeRepoSummarylost its last importer here and duplicatedMobileRuntimeRepoSummary; deleted. (3) The two route-parity pin comments now state the invariant and this PR's reason for the move instead of narrating the previous refresh.