Repository navigation
fix(mobile): stop a created tab from jumping when the host snapshot lands - #20069
Conversation
…ands
Creating a tab from the mobile session strip painted the new tab at the end
of the strip and then visibly jumped it to a different slot a beat later.
The client asked the host to insert the tab after the active tab, but then
predicted a different placement for its own optimistic paint:
afterTabId: activeSessionTabId ?? undefined // host: splice(insertAfter + 1)
...
return [...prev, { ...created, isActive: true }] // client: append
Two independent placements that disagree, so the optimistic frame is wrong by
construction and the tab snaps to its real slot on the next published snapshot.
The disagreement dates to 57a70d2 ("Fix mobile session tab authority"),
which introduced afterTabId and left the append in place. Before that the
client used terminal.create with no anchor, so both sides appended and agreed.
Rather than teach the client to re-derive the host's rule, both sides now call
one shared placeCreatedSessionTab, and the client captures a single afterTabId
for the request and the paint so they cannot drift apart again.
The host change is a pure refactor onto the shared helper; the 1260-test
runtime characterization suite is unchanged. The mobile route-parity hash pin
moves once because handleCreateTerminal's body changed - it is the only one of
the 12 extracted functions that differs.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
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 (8)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe change adds configurable Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The tab-placement change aligns mobile optimistic state with host ordering while preserving legacy-host behavior. No current merge-blocking risk was identified. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description is detailed and covers the required change, rationale, testing, visual proof, compatibility, and checklist items. However, it explicitly states that there is no linked issue, while the template requires one.
✨ 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 |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Shared placement helper — new
src/shared/session-tab-placement.tswithplaceCreatedSessionTab(tabs, created, afterTabId)(dedupe bycreated.id, splice after the anchor, else append) plus exact-assertion unit tests for every branch. - Client paint/request unification —
use-mobile-session-terminal-create-actions.tscaptures a singleafterTabIdand feeds it to both thesession.tabs.createTerminalrequest and the optimisticsetSessionTabspaint, replacing the previous[...prev, created]append. - Host refactor —
orca-runtime-create-runtime-owned-mobile-session-terminal.tsswaps its hand-rolledfilter/findIndex/splicefor the helper. I traced the map/filter reordering and it is genuinely behavior-preserving; the untouched 1260-test runtime characterization suite corroborates. - Parity pin —
mobile-session-route-parity.test.tshash moves once for the changedhandleCreateTerminalbody.
The helper is correct, the tests pin real behavior (the ablation in the PR body is honest), and the refactor is a true no-op.
ℹ️ One residual in the same family, out of scope
The client and the runtime-owned host path now share one definition, but the common host path does not. In orca-runtime-run-create-mobile-session-terminal.ts, a terminal anchor is resolved to afterDesktopTabId = anchor.parentTabId and the renderer places it via insertUnifiedTabAfterAnchor against the desktop parent. So for a split parent whose active leaf is not its last leaf, the client paints after the full parent::leaf id while the published snapshot lands the tab after the parent's last leaf — the same "placement disagreement" family the author already documents for structured chats, just not called out for split terminals. Pre-existing and unchanged by this PR (the request always sent the full leaf id), so not blocking, but worth a follow-up issue if split terminals are reachable from the mobile strip.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Split-terminal placement now matches the host —
placeCreatedSessionTabwalks forward past every consecutive leaf sharing the anchor'sparentTabId, so a created tab lands after the whole split group. This aligns the client's optimistic paint and the runtime-owned host path with the common host path (afterDesktopTabId = anchor.parentTabId→ after the parent's tab-order slot). - Tests across three layers — new exact-assertion cases in the helper unit test, the mobile call-site test, and the runtime-owned host spec all pin the split placement (
['split::left', 'split::right', created, trailing]).
The prior review's residual — split terminals still disagreed between the client and the common host path — is now resolved: all three placement sites agree on the split-group anchor.
ℹ️ PR description still describes the runtime-owned refactor as a no-op
The second commit (ff8ebfb) changed the runtime-owned path's split-anchor behavior — it no longer splices directly after the anchored leaf — but the body still says "Pure refactor — no behavior change", and the ELI5 / "What Changed" / "Testing" sections don't mention the split-terminal fix. Worth a one-line refresh before merge.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
7e4e5be to
2cb0eaf
Compare
2cb0eaf to
37568ef
Compare
There was a problem hiding this comment.
ℹ️ No critical issues — one coverage gap worth closing before this ships, plus a description refresh.
Reviewed changes
- Added bidirectional capability negotiation — a new
session-tabs.split-group-placement.v1capability is now advertised by both the host (RUNTIME_CAPABILITIES→status.get) and the client (MOBILE_RUNTIME_CLIENT_CAPABILITIES→runtime.clientCapabilities.update); the client gates its optimisticafterParentGrouppaint on the host's capability, and the host gates its placement on the client's. - Gated host placement on the client's capability —
runCreateMobileSessionTerminalnow overridesafterTabIdtoundefinedfor a legacy paired client (supportsSplitGroupPlacement === false) so the host appends exactly as that client's optimistic paint does. - Forwarded the capability through the RPC layer —
session.tabs.createTerminalreadsclientCapabilitiesand forwards a booleansupportsSplitGroupPlacement(only whenpairedDeviceIdis set) tocreateMobileSessionTerminal. - Added tests — an RPC test for the
truepath, a helper unit test for legacy leaf placement, a mobile call-site test for the legacy-host path, and a runtime-owned spec for grouped placement.
I traced all four mixed-version quadrants and they agree (new/new grouped, new-host/old-client append, old-host/new-client legacy leaf, old/old append). The mobile client sends its capability update and does not publish connected until that request resolves or times out, so the host has the client's capability set before any user-initiated create arrives on the same ordered transport — no negotiation race.
ℹ️ Mixed-version append path is untested on the host
The supportsSplitGroupPlacement === false branch is the entire reason this commit exists — it is what stops a new host from overriding a legacy client's optimistic append with a grouped placement. But no test exercises it. The RPC test only asserts the true path (supportsSplitGroupPlacement: true), and the runtime-owned spec only covers the default (undefined → grouped). A regression in that undefined override would silently re-break every legacy mobile client against a new host, and the current suite would stay green.
Technical details
# Missing test: host appends for a legacy (non-advertising) paired client
## Affected sites
- src/main/runtime/orca-runtime-run-create-mobile-session-terminal.ts:47 — the `afterTabId` override (`opts.clientNavigationId && opts.supportsSplitGroupPlacement === false ? undefined : opts.afterTabId`)
- src/main/runtime/rpc/methods/session-tabs.test.ts:503 — only asserts `supportsSplitGroupPlacement: true`
- src/main/runtime/orca-runtime-tests/mobile-session-tabs-part-03.spec.ts:306 — only exercises the grouped path
## Required outcome
- A host-side test that drives `createMobileSessionTerminal` (or `runCreateMobileSessionTerminal`) with `clientNavigationId` set and `supportsSplitGroupPlacement: false` and asserts the created tab is appended (ignores `afterTabId`), matching the legacy client's optimistic append.
## Suggested approach (optional)
- Mirror the split-placement spec in `mobile-session-tabs-part-03.spec.ts` but pass `clientNavigationId` + `supportsSplitGroupPlacement: false` and expect the created tab appended rather than placed after the split group.ℹ️ Nitpicks
- The PR description still calls the runtime-owned change "Pure refactor — no behavior change" and claims "no wire change … mixed client/host versions behave exactly as before". This commit adds
session-tabs.split-group-placement.v1to both advertised capability lists and deliberately changes mixed-version placement, so both claims are now inaccurate.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No new issues in this delta — both changes are correct improvements on the negotiation commit.
Reviewed changes
- Restored anchor validation for legacy clients —
runCreateMobileSessionTerminalnow keepsrequestedAfterTabIdand still throwsafter_tab_not_foundwhen the requested anchor is missing, gating only theafterDesktopTabIdmapping (append) on a non-advertising paired client. This preserves the pre-PR error surface that the prior revision had accidentally dropped for the legacy-append path. - Generalized the split-sibling walk —
placeCreatedSessionTabnow scans past interleaved tabs to place after the last leaf sharing the anchor'sparentTabId(previously only consecutive leaves), with a new unit test for the interleaved case.
The requestedAfterTabId split is equivalent to the prior revision for every non-legacy path, and the for-loop scan is behaviorally identical for consecutive siblings, so no regression to the already-reviewed placement agreement across client, runtime-owned host, and common host paths.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Review status: ready to land after fixesReviewed at commit 37568ef. The implementation is clean and remains in scope. Fixed and verified:
Validation:
Additional QA:
Residual risk is limited to the unexercised live Electron/mobile host flow; the relevant capability combinations and placement behavior are covered by the focused tests above. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Merged
main— refreshed the branch against the latestmain(relay region idle-cutover work, host create-error surfacing, and a large batch of unrelated commits). The merge is clean: no conflict markers, and the two directly affected mobile suites pass. - Refreshed the route-parity pins —
HEAD_MAIN_HOOK_SHA256,HEAD_HOOK_BINDING_SHA256,HEAD_NESTED_FUNCTION_SHA256, and themain.hookscount (266 → 267) were re-derived for the mergedhandleCreateTerminalbody.mobile-session-route-parity.test.tspasses.
ℹ️ Merge pulled formatting-only churn into three unrelated relay files
The merge re-formatted relay-control-client-options.ts, relay-control-protocol.ts, and relay-origin-pool.ts — files this PR never touches. The changes are whitespace-only and semantically identical to main, which currently carries those files in a non-prettier state (e.g. an over-indented let rebound = false and a trailing ) on its own line in relay-origin-pool.ts). Worth a quick decision: if a formatter ran incidentally during conflict resolution, dropping these three files keeps the diff scoped to tab placement; if the cleanup is welcome, it lands as an incidental fix to main's broken relay formatting.
Technical details
# Merge pulled formatting-only churn into three unrelated relay files
## Affected sites
- src/main/runtime/relay/relay-control-client-options.ts — type import collapsed to one line
- src/main/runtime/relay/relay-control-protocol.ts — `graceMs` schema chain re-wrapped
- src/main/runtime/relay/relay-origin-pool.ts — over-indented `let rebound = false` and trailing `)` re-formatted
## Required outcome
- Confirm the three files are intended to stay, or drop them so the diff stays scoped to tab placement.
## Open questions for the human (optional)
- Was a formatter run across the tree during the merge (which would also explain the `graceMs`/import re-wraps)?DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
CI diagnosis and fix confirmedAt Root cause: this was not transient. The first-paint test collected its measurements only in Fix and architectural fit: run the frame-dependent benchmark in the existing headful project on an isolated Xvfb display. Keep user-desktop background launches protected, preserve scheduled/full-suite coverage with one explicit invocation, and retain the existing assertions and thresholds. No production rendering policy, retry behavior, or timing budgets changed. The main-based fix is in #20197 and the same patch is applied here. Independent review: the final three-file CI fix returned clean, with no proven correctness, regression, or performance findings. It reuses the existing fixture-owned window lifecycle and headful CI infrastructure; it does not add renderer workarounds. Applicable end-readiness checks found no changed production security, persistence, mobile-wire, or resource surface. A companion mobile-compatibility checklist was unavailable for this final CI-only review; no mobile-facing code changed in this patch. Validation: three isolated Linux repetitions passed (15 worktree switches); CI-contract tests passed 42/42; the actual GitHub E2E run passed with a 192.5 ms median content-restoration measurement. CI's existing policy does not enforce the latency budget, so this is not a release-scale performance guarantee. Explicit background launch was verified to skip this mapped-window test safely. Mobile evidence and remaining gap: the simulator subsequently paired to a fresh dev host, and the mobile UI created the initial tab. Anchored insertion was seeded through runtime RPC because the Expo dev menu obstructed the mobile New Tab control; a fully UI-driven anchored-creation journey is therefore not claimed. This screenshot is supporting state evidence, not proof of that complete gesture flow: No merge performed. The main-based fix remains in a visible child worktree. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Moved the first-paint benchmark onto a mapped window — added a dedicated step to the sharded
e2ejob (shard1/14) that runstests/e2e/worktree-switch-first-paint.spec.tsunderxvfb-runplus the window manager with--project=electron-headful --workers=1. - Retagged the spec
@headful— the describe now carries@headfulso the headless shards'grepInvertskips it, and it self-skips whenORCA_BACKGROUND_LAUNCH=1because the animation-frame probe needs a mapped window. - Pinned the lane in the gate contract —
pr-e2e-gate-contract.test.mjsnow asserts the step exists exactly once, runs only on shard1/14, and usesxvfb-run --auto-servernumwith--project=electron-headful --workers=1.
I traced the retag against tests/playwright.config.ts (electron-headless excludes @headful, electron-headful greps it) and confirmed the changes route the spec out of the headless shards and into the new mapped-window step. The four contract suites that parse e2e.yml (pr-e2e-gate-contract, release-e2e-dispatch-contract, ssh-localhost-e2e-routing, package-electron-runtime-contract) pass locally — 73 tests — and oxlint is clean on the two changed JS/TS files.
ℹ️ The new benchmark lane is outside this PR's stated mobile scope
This commit adds an E2E CI lane and retags an existing spec, neither of which relates to the mobile tab-placement fix the PR describes. The "What Changed" and "Testing" sections still describe only the mobile placement work, so the added lane reads as an unexplained drive-by change to a reviewer scanning the description.
Technical details
# Benchmark lane is unrelated to the PR's mobile tab-placement scope
## Affected sites
- `.github/workflows/e2e.yml:177` — new `Run worktree first-paint benchmark` step
- `tests/e2e/worktree-switch-first-paint.spec.ts:376` — `@headful` retag plus `ORCA_BACKGROUND_LAUNCH` skip
- `config/scripts/pr-e2e-gate-contract.test.mjs:182` — new step pin
## Required outcome
- Confirm the e2e lane is intended to ship with this PR, and mention it in the PR body so the added scope is legible.
## Open questions for the human (optional)
- Shard `1/14` now runs the sharded headless suite and then a benchmark whose own budget is 15 minutes, inside the job's 30-minute timeout. Is that headroom measured, or could the benchmark push shard 1 over the cap?openrouter/deepseek/deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
Native iOS UI validation: PASSTested revision: Environment:
Ordinary anchored creationSetup created The first accessibility frame containing the created tab had
The host's authoritative Before: After: Split-group placementUsing the hidden desktop host UI, I split The first frame containing the new tab showed
The host's authoritative list placed Before: After: No pairing code, device token, QR payload, redbox, or Expo overlay is present in the attached evidence. Remaining gap: this run covered native iOS only; Android was not exercised. The screenshots are genuine device frames captured from the Orca-managed simulator stream because the long-running Simulator app had no desktop window, and focus/restore was intentionally not used. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Gated the optimistic paint on the host capability —
use-mobile-session-terminal-create-actions.tsnow computeshostSupportsGroupedPlacementfrom the host'ssession-tabs.split-group-placement.v1capability and only paints the created tab when it is set; against a legacy host it paints nothing and lets the snapshot land. This replaces the previous behavior of always painting, which mis-guessed the leaf slot when the older headed host placed after the parent. - Closed the prior host-side coverage gap — the runtime-owned spec gained an
it.eachcoveringsupportsSplitGroupPlacement: true(after the split parent) andfalse(append), and a new headed-host spec assertsterminal:requestTabCreateis sent withafterTabId: undefinedfor a legacy paired client. - Typed the placement updater in the mobile test —
setSessionTabsis nowvi.fn<(updater: PlacementUpdater) => void>()with aPlacementTabtype, replacing a hand-rolled cast. - Merged
main— the merge absorbed the first-paint e2e lane and the relay formatting churn (neither is in this PR's 16-file diff anymore) and re-derived the route-parity pins for the mergedhandleCreateTerminalbody, withmain.hooksnow 270. - Pinned the capability on
status.get—runtime-availability.spec.tsnow asserts the advertised list containssession-tabs.split-group-placement.v1.
I re-traced the four mixed-version quadrants against the new gate: new/new paints grouped and the host places grouped; new host/old client has the host append to match the legacy append; old host/new client now defers; old/old is unchanged. The deferral is safe because applySessionTabs keeps the pending tab selected until the host snapshot includes it — resolveActiveSessionTab retains pendingActiveSessionTabId while the tab is present and only clears it once the snapshot confirms. Locally, the placement unit tests and session-tabs.test.ts pass (38), and the full runtime suite passes (1284 pass, 1 skip), including the new specs.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Visual QA (iOS Simulator + hidden Electron host)Validated fixed behavior only. The pre-fix “paints last, then jumps left” frame was not reproduced on this rig (same race the PR notes: host snapshot can beat the optimistic paint). Repeated mobile AX reads from first appearance through settlement never showed an append-then-reorder. Host identity: Path: direct/local-only pairing. Relay was not exercised. 1. Ordinary tab — create after a non-final active tabSetup: strip
Before (host / mobile / New Tab sheet): After (mobile / host): 2. Split-terminal anchorHost split of Terminal 2 (two panes). Mobile strip: 5 tabs, two
Paired workspace list (direct fixture host): |
Final review status: READYReviewed and fixed at Bug verificationThe underlying bug is real and deterministic. Before the fix, starting from Applying the host snapshot changes the created tab's index. The visible jump is timing-dependent and was not independently reproduced from a baseline build during this review, so this is a state-level reproduction rather than a claim that the animation was captured again. Final implementation
Review and validation
Visual QA with screenshots validated the fixed ordinary and split-anchor flows through an iOS Simulator paired to a hidden/background Electron host. The created tab kept the same position from first observation through settlement. This run covered direct/local pairing; Android, relay, SSH, Windows, Linux, and WSL were not visually exercised. No merge was performed. |
Main re-recorded ten session create-terminal goldens in #20069. Those ten take main's bytes verbatim; every other golden stays this branch's, and the manifest needed no union because main did not touch it. No product file under mobile/src/tasks moved on main. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Main's #20069 re-recorded ten session create-terminal goldens and moved twenty-one files under src/shared, both inside the recorder's fence, so `--record` refused until the pin caught up. The re-record moves one key, `baseline`, in all 760 goldens and nothing else; the ten taken from main reproduce byte-for-byte apart from that pin. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…omain (step 7) (#21169) * refactor(mobile): checked reply readers for the tasks item and list domain (step 7) Thirty-eight unchecked reply readers across four tasks files become checked zod readers, so a malformed host reply surfaces as one `RpcIncompatibleReplyError` naming the method instead of a downstream `TypeError`, a rendered `undefined`, or a sheet left ready over garbage. Deliberately a behaviour change on malformed replies only; nothing on the wire moves. mobile-task-item-state-operations.ts 17 mobile-task-item-detail-operations.ts 8 mobile-task-item-comment-operations.ts 7 mobile-task-list-operations.ts 6 Two rules decide every schema, and both are stated in task-provider-entity-reply-schema.ts: 1. A member is required only where a tasks consumer reads it with no guard. Everything reached through `?.`, `??` or a `typeof` test stays optional, because a reply without it rendered the same fallback then and now. 2. No member is required that the site's own recorded `normal` reply lacks. The corpus is the only evidence of what a host really sends at each site, and requiring a member absent from that control would turn a good reply into an incompatible one. Rule 2 holds two schemas at the container: `github.prFileContents`, whose recorded reply is `{ oldContent, newContent, truncated }` where `getPRFileContents` returns `{ original, modified, ... }`, and `gitlab.todos`, whose recorded row is not a `GitLabTodo` and whose `normal` partition therefore records main crashing in `actionName.replace`. Both still gain their container, which is what names a reply that is not an object or not a list. Correcting those two scenarios is the follow-up that unlocks narrowing the rows. Nine writes share one envelope reader and five comment writes share another: `ok === false` and `error` are one host convention across them, and no input would make two of them want different answers. The acceptance, the name and the recorded family stay per operation. Three readers are reused rather than re-declared — the session domain's boolean confirmation for `setPRFileViewed` and `resolveReviewThread`, and its salvaged-member combinators throughout. Three call-site shape tests the reader now answers for are deleted: both `Array.isArray(payload)` guards on the checks read and the `typeof count === 'number'` fallback on the item count. `GitHubPRFileContents` is widened to optional members, which is what the reader can promise, and `buildGitHubPrFileDiffPreview` takes the widened sides — `splitContentLines` already treated a falsy side as no content, so no runtime behaviour moves. The tasks source-parity hashes are refreshed: hook, statement, declaration and render-token counts are unchanged, the render-token hash does not move at all, and `semantics` is a pure deletion of ten lines. Inventory: 137 unchecked readers over 30 files becomes 99 over 26. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin the RPC recording corpus and re-record the tasks reply deltas `baseline` moves to 9133c02, the commit that made the tasks item and list readers checked, and the whole corpus is re-recorded from it. The repin rewrites the `baseline` header of every golden; the body moves are the disclosed behaviour change and nothing else. What moved, and why: a malformed reply at one of the thirty-eight migrated read sites used to reach the consumer as the declared type and fail downstream — a property read on `null`, `.map` on a string, a rendered `undefined`. It now stops at the operation boundary as one `RpcIncompatibleReplyError` naming the method, which each call site's existing `catch` shows where it showed the `TypeError` before. Every move is confined to a malformed reply partition of a `tasks.*` or `linear.issue-detail` family; no `normal` partition moves, and no family outside the tasks domain moves at all. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): anchor the tasks reply readers' null-collapse mutant One registered mutant for the class the session domain shipped twice before a review caught it: the assignable-user row's explicit `avatarUrl: null` collapsed into absence. `tk-item-detail-metadata` records that null in visible state, so the pilot suite kills it; it also fails the unit pin beside the schema and both of that family's matrix goldens, including their `normal` partitions. Three by-hand experiments back the other two claims the corpus should hold. Applied to the product source, run, reverted: - Loosening a required member the consumer reads with no guard — `linearIssueSchema`'s `title` to a salvaged optional — fails the unit pin `one Linear issue: refuses a reply missing a member createLinearTask reads with no guard`, and `tsc` rejects it, because the loosened output is no longer a `LinearMobileIssue`. No golden moves: the reply matrix varies the envelope a host sends, never the shape of a row inside a result, so a row requirement is unreachable from the corpus and the unit pin is the only thing holding it. - Loosening a *container* requirement is reachable: making `linearAccountStatusSchema` `.nullable()` fails one matrix golden, `tasks.provider-load: reply partitions at linear.status#1`, on the `result-null` partition, as well as its unit pin. - Swapping one checked reader back to unchecked — `githubPullRequestChecksRead` to `rpcUncheckedPayloadReader` — fails two matrix goldens, `tasks.item-review-github` and `tasks.project-row-review-checks`, both at `github.prChecks#1`. Nothing under `mutants/` is pinned by a golden header, so this moves no recording. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): correct the gitlab.todos fixture to a real GitLabTodo row The `tk-list-gitlab-todos` reply sent `[{ id, targetType, target: { … } }]`, a shape `listTodos` never produces: the host returns `GitLabTodo[]`, whose row carries `actionName`, `targetTitle`, `targetUrl`, `projectPath` and `updatedAt` flat. Main crashed on it — `Cannot read properties of undefined (reading 'replace')` from `createGitLabTodoTask`, with the list rendering as an empty inbox and a raw TypeError on screen. That crash was being read as evidence: a reader could not narrow this row without "refusing the site's only success control", when the control was never a success. The fixture is the defect, so the fixture is what moves. The row is now a real `GitLabTodo` (src/shared/gitlab-types.ts:219) and main renders it: one item titled "A GitLab todo", subtitle `group/project #4`, status `review requested`. Recorded from the pinned main tree, not from this branch, so the corrected fixture's main projection exists as a golden before any reader touches it: a detached worktree at `4b876758d3158a8eb6b798055d8db7c58d1cd4a9` with this branch's manifest laid over it and its `baseline` set to that commit, per the recorder README's detached-pin recipe. Control: all 756 other goldens reproduced the base corpus byte for byte; only these two moved. Both keep `baseline: 4b87675`, which is the tree that produced them. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): check the GitLab to-do row and drop its cast With the fixture corrected, the row is readable, so the reader reads it. `gitlabTodoSchema` requires the five members the screen reaches with no guard — `id`, `actionName` (read as `actionName.replace`), `targetUrl` (what tapping the row opens, and the title's fallback), `projectPath` (the subtitle and the repository badge's key and label) and `updatedAt` — and leaves every guarded member optional: `targetTitle` behind `targetTitle || targetUrl`, `targetType` and `targetIid` behind the two tests in `gitLabTodoTargetRef`, and `authorUsername` and `state`, which this screen carries but never reads. The list salvages: one unreadable to-do drops and the rest of the inbox still renders, which is what the rest of this domain does with a row it cannot place. Nullish still reads as the empty inbox the call site already read. `GitLabTodo` in mobile-tasks-provider-detail-types.ts now says what the reader proves rather than what the host declares, which is what lets the `as GitLabTodo[]` assertion at the call site go. It was the last cast in this domain's consumers, and it was re-typing rows nothing had checked — the phantom-field shape this series exists to remove. Parity: the same three hashes the step-7 commit moved move once more, for the deleted cast and the widened row type. Counts are unchanged and `semantics` does not move. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin the corpus after the to-do fixture and row check Repins `baseline` to the commit that checked the GitLab to-do row and re-records all 758 goldens, so the whole corpus is pinned to one tree again: the two `gitlab.todos` goldens were still pinned to main's, which is the tree that produced their before-picture. The disclosed move is the `normal` partition of `tasks.task-list-gitlab-todos`. That is the fixture correction showing through, not a reader change: with a real `GitLabTodo` on the wire the list renders one item where it used to render a TypeError. Every other body move in this refresh is a malformed-reply partition, as before. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): correct the github.prFileContents fixture to the host's shape The recorded `normal` reply at both `github.prFileContents` sites was `{oldContent, newContent, truncated}`, which `getPRFileContents` never returns: it answers `{original, modified, originalIsBinary, modifiedIsBinary, originalTooLarge, modifiedTooLarge}` (src/main/github/pull-request-file-contents .ts:121-128), with the two too-large flags set only where a side was skipped for size (:54). Both sites' `normal` partitions therefore proved nothing about the success path, and `githubPullRequestFileContentsSchema` cited that fiction as the reason it could require nothing. Same defect class as the `gitlab.todos` fixture corrected in 32bd65c, found by round-1 review. Before-picture recorded against main's own product tree, not this branch's: a detached worktree at `4b876758d3`, this branch's `pilot-scenarios.json` copied in with `baseline` set to that commit, per the recorder README's detached-pin recipe. Control: 744 of the 758 goldens reproduce the base corpus byte for byte; the 12 copied here are the two affected families, and the remaining two are the already-corrected to-do pair, which reproduced 32bd65c's bytes exactly. The 12 carry `baseline: 4b87675`, the tree that produced them. The next commit's reader change and the repin that follows it re-record them. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): record main's reaction rendering for both providers No scenario in the corpus carried a comment reaction, so nothing in the 758 goldens could see what a reader does to one. Round-1 review found the consequence: this branch closed `reactions[].content` to a mobile vocabulary (`thumbs_up`) that no producer sends, and the corpus stayed green because the member was never on the wire. Two scenarios, one per provider, each a second scenario in an existing family so no matrix base and no existing golden moves. The GitHub one carries `GitHubReactionContent` as the host sends it — `'+1'` and `'heart'` (src/shared/github/comment-types.ts:3-17, normalised from GraphQL at src/main/github/comment-reactions.ts:19-27). The GitLab one carries `GitLabReaction`, which is `{ name, count }` with no `content` at all (src/shared/gitlab-types.ts:60-72). Recorded against main's product tree at `4b876758d3` through the detached-pin worktree, so the `normal` partition now pins what main renders rather than what this branch renders. Control: all 758 existing goldens reproduce the previous pin recording byte for byte; the only difference is these two added files. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): forward a comment reaction instead of matching mobile's vocabulary `DETAIL_REACTION_CONTENT` was `thumbs_up | thumbs_down | ...`, a vocabulary no producer of this list sends. GitHub answers `github.workItemDetails` with `PRComment[]` whose reactions are `GitHubReactionContent` — `'+1'`, `'-1'`, `laugh`, ... (src/shared/github/comment-types.ts:3-17), normalised from GraphQL at src/main/github/comment-reactions.ts:19-27 — and GitLab answers with `GitLabReaction`, `{ name, count }` with no `content` member (src/shared/gitlab-types.ts:60-72). The closed arm set dropped every real reaction row on both providers, which is a good-reply path this PR must not change. `content` is forwarded now, salvaged the way every other guarded member here is; `count` stays required, because the `count > 0` filter at mobile-tasks-item-comments.tsx:145 is the one unguarded read. `DetailComment`'s eight phantom arms go with it: mobile's declared type was written from memory, not from the wire, and widening the type is the fix rather than narrowing what the host may send. `COMMENT_REACTION_EMOJI` was keyed by that same phantom vocabulary, so it resolves no glyph for a real reaction and the chip renders without one. That is a pre-existing defect and it stays exactly as it is: the map is typed `Record<string, string>` and the lookup takes `?? ''`, which resolves to the same `undefined` main resolved for both providers. The two scenarios recorded in 68a3db2 pin that rendering, so a future arm set cannot drop the rows unseen. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): stop citing the file-contents fiction as the reason nothing is required The schema comment and its unit pin both named `{ oldContent, newContent, truncated }` as "the recorded reply", which d26aeec corrected. The rule that keeps every member optional is unchanged and is now stated from the reads instead: the call site files the payload under the file path and reads nothing off it, the review panels reach each flag through `?.`, and `splitContentLines` takes `string | undefined` behind a falsy guard. The pins move to the host's own shape, plus the too-large pair a skipped side carries and the empty object that shows no member is required. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): import MERGEABLE_STATE instead of redeclaring it `task-item-detail-reply-schema.ts` declared its own copy of `['MERGEABLE', 'CONFLICTING', 'UNKNOWN']` while already importing four member helpers from `../session/github-pr-entity-reply-schema`, which exports that arm set and uses it in the identical expression three times. Two copies of one wire arm set is one place to fix when a provider gains a fourth state. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): inline the alias-only bindings the deleted casts left behind Each of the eight was `const result = x as { ok?: boolean; error?: string }`. With the cast gone the line is a rename of a binding that already has a name, and every one of them is followed immediately by the same `ok === false` check. Reading `created.ok` / `updated.ok` / `written.ok` / `replyResult.ok` directly leaves one name per value. The parity constants move with it and with the reaction change before it. The comment there names both: ten string literals leave `semantics` with the phantom reaction vocabulary and one arrives with the `?? ''` fallback, and the alias deletions move the hook and statement hashes. No `rpc:` or `jsx:` signature moves, the render-token hash does not move, and the hook, statement and declaration counts are unchanged at 350, 417 and 194. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): register the container-requirement mutant the matrix kills `f1b695f161` proved by hand that making `linearAccountStatusSchema` `.nullable()` fails the `result-null` partition of `tasks.provider-load`'s matrix, and left it unregistered. Registering it in `pilot-mutants.test.ts` is not available: that suite drives the manifest scenario as written, and `tk-provider-load` scripts a fulfilled `linear.status`, which a nullable container accepts exactly as the required one does. The mutation only has somewhere to diverge under a partition the pilot never reaches. `family-mutants.test.ts` drives one named variant of a family's matrix instead, against that variant's own slice of the golden, and each entry names both the partition that kills the mutation and one that cannot see it — so the entry records where the coverage is rather than that some golden went red. The comparison is the whole recorded variant, the way the family suite compares: under a last-state projection this mutant survives, because the divergence is in the settlement and both paths reach the same final screen state. Nothing under `mutants/` is pinned by a golden header, so this moves no recording. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin the corpus after the round-1 review fixes `baseline` moves to 542c1c3, the last fenced commit, and the whole corpus is re-recorded against it. The two fixture corrections and the two added reaction scenarios were recorded at main's pin first, so this run is what carries them onto the branch's own reader. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): keep the Linear create arm's own binding out of the inlining The alias inlining swept one line further than the finding it answers: the Linear arm's `const result = linearIssueCreate.interpret(reply)` is a declaration with a name, not an alias for one, and renaming it put a pre-existing `createLinearTask(...) as Extract<TaskItem, …>` assertion from #17438 inside this branch's changed lines, where the changed-code casting gate attributes it to this PR. Reverted to `result`; the eight bindings the review listed stay inlined. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): let each module build its own Linear team reader `linearTeamListReader` was exported from the detail-operations module only so the list-operations module could import it, which adds an operations-to-operations import edge that buys nothing: `rpcResultVariant` is a pure factory, so two calls with the same schema produce two functionally identical readers. What keeps the composer's picker and the saved-selection reconciler agreeing about a team row is that both build from `linearTeamsSchema`, which is already exported. Deleting the export also puts the composer-policy JSDoc back on `linearComposerTeamListRead`. JSDoc binds to the next declaration, so the block explaining why this method carries two operations with different acceptance policies had drifted onto the reader, leaving the operation it is about undocumented. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin the corpus to the last round-1 commit `baseline` moves to 75c568c and all 760 goldens are re-recorded against it. Nothing but the `baseline` header moves: the two product commits since the previous repin — the Linear create arm's binding restored and the team reader built per module — change no observation in any recording, which is what a pure refactor should look like here. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * chore(mobile): repin the RPC recording corpus to the main merge The merge of origin/main moved both lockfiles, which the recorder fences, so --record refused until the pin named a commit whose fenced tree matches this one. Repinned to the merge commit and re-recorded: 760 goldens, header only, `baseline` and `lockfileSha256`. No observation moved. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): point the reply-schema citations at the lines they name The alias inlining and the detail-loader rewrite moved fifteen of the consumer lines these comments cite, and the comments are the evidence for requiring a member only where the consumer reads it unguarded. Every citation re-checked by opening it; the host-side ones were already right. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): stop repeating the file-contents fiction on the type The corrected fixture carries four of the six members at both call sites, so "the recorded reply carries none of these" is false. The reason is the one the schema already gives: no reader reaches a member without `?.` or splitContentLines' falsy guard. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): forward a file's viewed state instead of closing it No scenario reply carries a file row, so no golden can observe either of this schema's two arm sets. `viewerViewedState` is read only by two `=== 'VIEWED'` tests, so it is forwarded and an arm this build predates reaches them as itself. `status` stays closed: its only consumer sends it straight back as a `github.prFileContents` param, which the host validates against the same seven arms (github-pull-request-params.ts:62). Forwarding could not reach the wire without a cast, and the host would refuse the arm on its own params, so the drop to absent that becomes `?? 'modified'` is the compatible read. Parity: one declaration and three arm literals, no executable change. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): say that a Linear state-update refusal is ignored, as on main `require-result-or-throw-message` throws only on an outer refusal, and `linear.updateIssue` refuses in band as `{ ok: false, error }` on a successful envelope, so the refusal reaches no `catch`. Main read the same payload unchecked and discarded it, so nothing here changes. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin the RPC recording corpus to the origin/main merge Main's #20069 re-recorded ten session create-terminal goldens and moved twenty-one files under src/shared, both inside the recorder's fence, so `--record` refused until the pin caught up. The re-record moves one key, `baseline`, in all 760 goldens and nothing else; the ten taken from main reproduce byte-for-byte apart from that pin. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…, terminal, transport, home, worktree and browser (step 7) (#21176) * refactor(mobile): checked reply readers for notifications, components, terminal, transport, home, worktree and browser (step 7) Twenty-one unchecked reply readers across thirteen files become checked zod readers, so a malformed host reply surfaces as one `RpcIncompatibleReplyError` naming the method instead of a downstream `TypeError`, a rendered `undefined`, or a card left "proven" over a reply that carried no rows. Deliberately a behaviour change on malformed replies only. What each domain required, and why it required no more: - notifications (5 readers). All four call sites read the payload through `?.`, so every schema is nullish at the top level and no member is required. The test-push `reason` and the register `reason` become closed enums, because the two comparisons against them are the whole of what they decide and an arm this build does not know took the generic copy on main too. The stream unsubscribe and the unregister read no body at all. - components (4). `repo.hooks` requires `source` and nothing else: the drawer assigns it straight into `SetupHookDetails.source`, whose type is `string | null`, with no guard in between — nullable so the "no hooks file" answer keeps its explicit null. `setupTrust` is nullable as well as optional because the `components-setup-ask` fixture sends an explicit null, and salvaging that would move a `normal` golden. `ui.get`'s trust record salvages per repo, so one unreadable repo cannot cost the others their approvals. The Codex redeem reply stays `z.unknown()`: `decodeResetResult` is a real scope-and-snapshot validator and splitting it would give one reply two refusal rules. - terminal (4). The send verdict and the viewport pair keep main's exact `=== true` projections. `terminalSendAcceptedSchema` moves here from the session domain, which now re-exports it: terminal is the lower layer and two identical copies could drift on what "delivered" means. `terminal-send-rpc-response.ts` is deleted, its projection now being the schema's. - transport (3). `status.get` declares its five members and requires the object; the three callers disagree about what an unreadable status means, so each keeps its own verdict behind a named reader — the gate wants the failure, and the probe and the pairing race must not have it, because both call `interpret` inside a `.then` fulfilment handler where a throw becomes a detached rejection. `capabilities` salvages whole rather than per element, which is main's own rule and what `transport-capability-probe-non-string-capabilities-drop` records. The two pairing readers are the shared credential contract itself, moved off the four call sites that each ran `.parse()` on the interpreted value; its `.strict()` is main's shipped rule for that released surface, not a new one. - home (2), worktree (2), browser (1). The stats row is checked as an object and nothing more, `totalHomeStats` being the reader that says so itself; its per-host slot is now typed as the wire row it holds rather than as the computed total. `worktree.ps` cannot require `worktrees`: the host answers a union whose unchanged arm carries `{ unchanged, snapshotId }` and no rows. The twelve browser commands read no body; `browser.goto`'s settled URL stays nullish because `navigateToAddress` is inline in `MobileBrowserPane.tsx`, which no adapter mounts, and a move there would ship unevidenced. Three fixtures were wrong and are corrected, each disclosed rather than worked around: the runtime-context test kept a content hash directly under a repo key, which is not a shape `ui.get` sends; and two snapshot-client tests ran their reply list dry and handed `fetch` an absent result while claiming to model a transport failure. `push-test-envelope` is re-anchored at the same defect's new home, the cast having been deleted. The boundary test's offender floor comes down from 20 to 10 with the list, which is what its own comment says it is for. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin the corpus and re-record step 7's checked reply readers `baseline` moves to this branch's product commit, which is what `--record` compares the fenced tree against, and every one of the 758 goldens is re-recorded from it. The repin is what rewrites the `baseline` header on all of them; nothing else about the corpus moves except the bodies disclosed below. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): mutate the workspace catalog's reader back to unchecked The step-7 defect evidence needs a scenario whose reply is the one the change moves. Every pilot scenario in the catalog family scripts a well-formed reply, so a mutant that only changes how a *malformed* reply reads has nowhere to diverge — which is why the pilot's own suite passed against an unchecked catalog reader while its matrix golden failed. `worktree-catalog-snapshot-unreadable` scripts `worktree.ps` answering `{ ok: true }` with no result at all, which is what `result-absent` drives at the matrix site, and records the fetch rejecting with `RpcIncompatibleReplyError`. `worktree-catalog-unchecked-reader` then swaps the operation's reader for one that answers `compatible: true` for every payload — main's reader, in one line — and the recording moves back to a fulfilled fetch carrying `admission: { kind: 'invalid' }`, which is the answer that let a broken catalog render as an empty host (STA-3123). One golden added and none moved: the manifest sits outside the fenced paths, the family's matrix base is still `worktree-catalog-snapshot`, and the mutation registry is not part of `recorderSha256`. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): pin the push-test reason arms the closed enum constrains `pushDeliveryTestResultSchema.reason` closes over the four arms of the host's `MobilePushTestResult` (src/shared/mobile-push-contract.ts:99), but no scenario carried the member, so the corpus could not have caught a wrong vocabulary. Three scenarios on the existing display-test mount carry it now: the two arms the screen branches on and one arm no build knows. Each golden was recorded first at the main pin 4b87675 and reproduces there byte for byte, so the `normal` partition pins main's rendering rather than this branch's. The unknown arm is the load-bearing one: main renders "Could not send through Orca's push service." for an unrecognised string, and the salvage drop renders the same sentence, so the closed enum costs a recorded `reply-salvage` observation and no screen text. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): cite the host union behind each closed reply enum A closed `z.enum` is only as good as the vocabulary it was checked against, and mobile's own declared types are written from memory. Each of the three enums now names the host type it mirrors, so the next reader re-checks it in one grep rather than trusting the arms. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin the corpus to the commit that carries the host-union citations `--record` compares the fenced tree against `baseline`, so a comment in `mobile/src` moves the pin like any other product edit. Every one of the 762 goldens changes by exactly its `baseline` line and nothing else, which is the evidence that the citation commit is inert. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): keep the agent-history panel rendering when the catalog omits its rows `worktrees` is a salvaged member, so it is absent on the three envelopes that read as an object without rows, and `use-mobile-agent-history-state.ts:61` calls `.find` on it with no guard. The cast erased that and the corpus recorded the result: `matrix-aivault.history-screen-worktree.ps-1` carried `crash: Cannot read properties of undefined (reading 'find')` on `inner-ok-missing`, `inner-false-string-error` and `inner-false-object-error`. `?? []` is what the sibling Home card already does. The SAFETY note cited that card's golden, which is the opposite site, and now cites this panel's own family. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): keep a malformed worktree.ps reply reported as invalid_response `host-workspace-list-states.tsx` prints this code to the user verbatim, so the checked reader's throw landing in the generic catch renamed a host-payload defect into a connectivity failure. STA-3123 exists to make a broken remote host diagnosable, which `network_error` is not. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): give the browser page commands back their one-line form Only `browser.goto` reads a reply body, so the reader belongs on a two-argument wrapper rather than on all thirteen call sites. The exported type of every command is unchanged, and the doc comment no longer promises a shape the file did not have. 109 lines to 72. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): import the terminal send verdict from the terminal domain The re-export forwarded to two callers, which a direct import already gives them, and the session suite re-pinned three cases `terminal-reply-schema.test.ts` owns. One definition, one pin, one file hop fewer. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): move the codex reset-credit pins next to their schema They sat in the New Workspace suite, so a reader looking for the capability whole-list drop by filename did not find it. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin and re-record after the round-1 fixes Three checkpoints of `matrix-aivault.history-screen-worktree.ps-1` move from a recorded white screen to the loading list: `inner-ok-missing`, `inner-false-string-error` and `inner-false-object-error` answer the panel an object with no rows, and the `?? []` now seats an empty list instead of letting `.find` throw. Every other golden changes by its `baseline` line alone, which is the evidence the other four fixes move nothing the recorder observes. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): stop requiring the stats row its own reader guards Round-2 findings 1 to 3. `homeHostStatsSchema` required an object that `totalHomeStats` already guards (`if (!host || typeof host !== 'object') continue`), so the requirement bought nothing at the read and cost the row upstream: the refusal reached `fetchMobileHomeStats`'s `.catch`, the per-host slot was never written, `hostIds.filter` found no host and the Home header drew no stats row where main drew `0 / 0s / 0`. It takes `.nullish()`, and `HomeStatsRow` admits the `null | undefined` main always had. The unit pin now says the slot keeps a null summary and the total skips it, and sums one through `totalHomeStats` to show the zeroed row survives. The Home card's `SAFETY:` note claimed the reader proves `worktrees` is an array. It does not; the `?? []` does. That is the same false sentence round 1 removed from the agent-history panel, and a reader who believed it would delete the `??` and reintroduce the white screen. The `catalogError` branch on `RpcIncompatibleReplyError` had nothing holding it: no adapter mounts the host screen, so no golden can reach it. One case in the snapshot client pins the class the `catch` keys on. Mutation-checked by forwarding the catalog schema as `z.unknown()`, which fails that case alone. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin and re-record after the round-2 fixes and main's merge Pin moves to 0b8bd1c, this branch's last fenced commit. The re-record normalises the ten session create-terminal goldens main re-recorded in #20069 without repinning, and writes the Home stats family's bodies back to what main records now that the summary reader no longer requires the object its own consumer guards. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin and re-record the corpus at the merge with main The merge took main's goldens verbatim at main's pin, so the four goldens this branch adds were the only ones whose header did not name a commit in this history. Repinning to the merge commit and re-recording gives all 764 one pin and one recorder, which is what the new ancestry guard asks of the corpus. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): point the reply schemas' citations at the lines they claim Every `file:line` in this branch's diff was resolved against the tree and its target line compared to the claim beside it. Fourteen were wrong. Most had drifted one to four lines onto a closing brace or the line after the code they quote, which reads exactly like a good citation and can only be caught by resolving it. Two were wrong in kind rather than by a few lines. The viewport comment credited the `=== true` projection to the refit call site, which reads plain truthiness; the rule was main's reader, and the refit's two decisions are the lines now cited. The capability comment cited a line for main's `every(typeof === 'string')` rule inside the code this change deletes, so it resolved to an unrelated brace; it now states the behaviour and says why no line carries it. Two more pointed at the head or tail of the statement they named and are tightened to the line that does the work. Comment-only: no schema, no reader and no call site moves. The corpus is repinned and re-recorded on top because the recorder fences `mobile/src`. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin and re-record after the citation fixes The citation commit is comment-only, and the corpus says so: all 764 goldens move on the `baseline` header line and nothing else. The re-record is needed only because the recorder fences `mobile/src`, which a comment is inside. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): keep the three unguarded-site reply schemas total so a malformed result cannot throw where main tolerated it The ui.get reader is interpreted inside a fire-and-forget IIFE with no catch, and the home stats and push delivery readers sit behind handlers that would print the reader's own sentence where main drew a zeroed row or the generic copy. Each schema now decodes any unreadable result as absent, which lands in the fallback main already took. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin and re-record the corpus over the total schemas Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): name the host-status gate reader by its export Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…ands (stablyai#20069) * fix(mobile): stop a created tab from jumping when the host snapshot lands Creating a tab from the mobile session strip painted the new tab at the end of the strip and then visibly jumped it to a different slot a beat later. The client asked the host to insert the tab after the active tab, but then predicted a different placement for its own optimistic paint: afterTabId: activeSessionTabId ?? undefined // host: splice(insertAfter + 1) ... return [...prev, { ...created, isActive: true }] // client: append Two independent placements that disagree, so the optimistic frame is wrong by construction and the tab snaps to its real slot on the next published snapshot. The disagreement dates to 57a70d2 ("Fix mobile session tab authority"), which introduced afterTabId and left the append in place. Before that the client used terminal.create with no anchor, so both sides appended and agreed. Rather than teach the client to re-derive the host's rule, both sides now call one shared placeCreatedSessionTab, and the client captures a single afterTabId for the request and the paint so they cannot drift apart again. The host change is a pure refactor onto the shared helper; the 1260-test runtime characterization suite is unchanged. The mobile route-parity hash pin moves once because handleCreateTerminal's body changed - it is the only one of the 12 extracted functions that differs. * fix(mobile): keep split terminal placement stable * fix(mobile): negotiate split tab placement * fix(e2e): run worktree first-paint probe on a mapped window * test(mobile): type tab placement updater * test(mobile): model current host in create recordings --------- Co-authored-by: Merge Sim <sim@local>
…omain (step 7) (stablyai#21169) * refactor(mobile): checked reply readers for the tasks item and list domain (step 7) Thirty-eight unchecked reply readers across four tasks files become checked zod readers, so a malformed host reply surfaces as one `RpcIncompatibleReplyError` naming the method instead of a downstream `TypeError`, a rendered `undefined`, or a sheet left ready over garbage. Deliberately a behaviour change on malformed replies only; nothing on the wire moves. mobile-task-item-state-operations.ts 17 mobile-task-item-detail-operations.ts 8 mobile-task-item-comment-operations.ts 7 mobile-task-list-operations.ts 6 Two rules decide every schema, and both are stated in task-provider-entity-reply-schema.ts: 1. A member is required only where a tasks consumer reads it with no guard. Everything reached through `?.`, `??` or a `typeof` test stays optional, because a reply without it rendered the same fallback then and now. 2. No member is required that the site's own recorded `normal` reply lacks. The corpus is the only evidence of what a host really sends at each site, and requiring a member absent from that control would turn a good reply into an incompatible one. Rule 2 holds two schemas at the container: `github.prFileContents`, whose recorded reply is `{ oldContent, newContent, truncated }` where `getPRFileContents` returns `{ original, modified, ... }`, and `gitlab.todos`, whose recorded row is not a `GitLabTodo` and whose `normal` partition therefore records main crashing in `actionName.replace`. Both still gain their container, which is what names a reply that is not an object or not a list. Correcting those two scenarios is the follow-up that unlocks narrowing the rows. Nine writes share one envelope reader and five comment writes share another: `ok === false` and `error` are one host convention across them, and no input would make two of them want different answers. The acceptance, the name and the recorded family stay per operation. Three readers are reused rather than re-declared — the session domain's boolean confirmation for `setPRFileViewed` and `resolveReviewThread`, and its salvaged-member combinators throughout. Three call-site shape tests the reader now answers for are deleted: both `Array.isArray(payload)` guards on the checks read and the `typeof count === 'number'` fallback on the item count. `GitHubPRFileContents` is widened to optional members, which is what the reader can promise, and `buildGitHubPrFileDiffPreview` takes the widened sides — `splitContentLines` already treated a falsy side as no content, so no runtime behaviour moves. The tasks source-parity hashes are refreshed: hook, statement, declaration and render-token counts are unchanged, the render-token hash does not move at all, and `semantics` is a pure deletion of ten lines. Inventory: 137 unchecked readers over 30 files becomes 99 over 26. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin the RPC recording corpus and re-record the tasks reply deltas `baseline` moves to 9133c02, the commit that made the tasks item and list readers checked, and the whole corpus is re-recorded from it. The repin rewrites the `baseline` header of every golden; the body moves are the disclosed behaviour change and nothing else. What moved, and why: a malformed reply at one of the thirty-eight migrated read sites used to reach the consumer as the declared type and fail downstream — a property read on `null`, `.map` on a string, a rendered `undefined`. It now stops at the operation boundary as one `RpcIncompatibleReplyError` naming the method, which each call site's existing `catch` shows where it showed the `TypeError` before. Every move is confined to a malformed reply partition of a `tasks.*` or `linear.issue-detail` family; no `normal` partition moves, and no family outside the tasks domain moves at all. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): anchor the tasks reply readers' null-collapse mutant One registered mutant for the class the session domain shipped twice before a review caught it: the assignable-user row's explicit `avatarUrl: null` collapsed into absence. `tk-item-detail-metadata` records that null in visible state, so the pilot suite kills it; it also fails the unit pin beside the schema and both of that family's matrix goldens, including their `normal` partitions. Three by-hand experiments back the other two claims the corpus should hold. Applied to the product source, run, reverted: - Loosening a required member the consumer reads with no guard — `linearIssueSchema`'s `title` to a salvaged optional — fails the unit pin `one Linear issue: refuses a reply missing a member createLinearTask reads with no guard`, and `tsc` rejects it, because the loosened output is no longer a `LinearMobileIssue`. No golden moves: the reply matrix varies the envelope a host sends, never the shape of a row inside a result, so a row requirement is unreachable from the corpus and the unit pin is the only thing holding it. - Loosening a *container* requirement is reachable: making `linearAccountStatusSchema` `.nullable()` fails one matrix golden, `tasks.provider-load: reply partitions at linear.status#1`, on the `result-null` partition, as well as its unit pin. - Swapping one checked reader back to unchecked — `githubPullRequestChecksRead` to `rpcUncheckedPayloadReader` — fails two matrix goldens, `tasks.item-review-github` and `tasks.project-row-review-checks`, both at `github.prChecks#1`. Nothing under `mutants/` is pinned by a golden header, so this moves no recording. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): correct the gitlab.todos fixture to a real GitLabTodo row The `tk-list-gitlab-todos` reply sent `[{ id, targetType, target: { … } }]`, a shape `listTodos` never produces: the host returns `GitLabTodo[]`, whose row carries `actionName`, `targetTitle`, `targetUrl`, `projectPath` and `updatedAt` flat. Main crashed on it — `Cannot read properties of undefined (reading 'replace')` from `createGitLabTodoTask`, with the list rendering as an empty inbox and a raw TypeError on screen. That crash was being read as evidence: a reader could not narrow this row without "refusing the site's only success control", when the control was never a success. The fixture is the defect, so the fixture is what moves. The row is now a real `GitLabTodo` (src/shared/gitlab-types.ts:219) and main renders it: one item titled "A GitLab todo", subtitle `group/project stablyai#4`, status `review requested`. Recorded from the pinned main tree, not from this branch, so the corrected fixture's main projection exists as a golden before any reader touches it: a detached worktree at `4b876758d3158a8eb6b798055d8db7c58d1cd4a9` with this branch's manifest laid over it and its `baseline` set to that commit, per the recorder README's detached-pin recipe. Control: all 756 other goldens reproduced the base corpus byte for byte; only these two moved. Both keep `baseline: 4b87675`, which is the tree that produced them. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): check the GitLab to-do row and drop its cast With the fixture corrected, the row is readable, so the reader reads it. `gitlabTodoSchema` requires the five members the screen reaches with no guard — `id`, `actionName` (read as `actionName.replace`), `targetUrl` (what tapping the row opens, and the title's fallback), `projectPath` (the subtitle and the repository badge's key and label) and `updatedAt` — and leaves every guarded member optional: `targetTitle` behind `targetTitle || targetUrl`, `targetType` and `targetIid` behind the two tests in `gitLabTodoTargetRef`, and `authorUsername` and `state`, which this screen carries but never reads. The list salvages: one unreadable to-do drops and the rest of the inbox still renders, which is what the rest of this domain does with a row it cannot place. Nullish still reads as the empty inbox the call site already read. `GitLabTodo` in mobile-tasks-provider-detail-types.ts now says what the reader proves rather than what the host declares, which is what lets the `as GitLabTodo[]` assertion at the call site go. It was the last cast in this domain's consumers, and it was re-typing rows nothing had checked — the phantom-field shape this series exists to remove. Parity: the same three hashes the step-7 commit moved move once more, for the deleted cast and the widened row type. Counts are unchanged and `semantics` does not move. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin the corpus after the to-do fixture and row check Repins `baseline` to the commit that checked the GitLab to-do row and re-records all 758 goldens, so the whole corpus is pinned to one tree again: the two `gitlab.todos` goldens were still pinned to main's, which is the tree that produced their before-picture. The disclosed move is the `normal` partition of `tasks.task-list-gitlab-todos`. That is the fixture correction showing through, not a reader change: with a real `GitLabTodo` on the wire the list renders one item where it used to render a TypeError. Every other body move in this refresh is a malformed-reply partition, as before. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): correct the github.prFileContents fixture to the host's shape The recorded `normal` reply at both `github.prFileContents` sites was `{oldContent, newContent, truncated}`, which `getPRFileContents` never returns: it answers `{original, modified, originalIsBinary, modifiedIsBinary, originalTooLarge, modifiedTooLarge}` (src/main/github/pull-request-file-contents .ts:121-128), with the two too-large flags set only where a side was skipped for size (:54). Both sites' `normal` partitions therefore proved nothing about the success path, and `githubPullRequestFileContentsSchema` cited that fiction as the reason it could require nothing. Same defect class as the `gitlab.todos` fixture corrected in 32bd65c, found by round-1 review. Before-picture recorded against main's own product tree, not this branch's: a detached worktree at `4b876758d3`, this branch's `pilot-scenarios.json` copied in with `baseline` set to that commit, per the recorder README's detached-pin recipe. Control: 744 of the 758 goldens reproduce the base corpus byte for byte; the 12 copied here are the two affected families, and the remaining two are the already-corrected to-do pair, which reproduced 32bd65c's bytes exactly. The 12 carry `baseline: 4b87675`, the tree that produced them. The next commit's reader change and the repin that follows it re-record them. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): record main's reaction rendering for both providers No scenario in the corpus carried a comment reaction, so nothing in the 758 goldens could see what a reader does to one. Round-1 review found the consequence: this branch closed `reactions[].content` to a mobile vocabulary (`thumbs_up`) that no producer sends, and the corpus stayed green because the member was never on the wire. Two scenarios, one per provider, each a second scenario in an existing family so no matrix base and no existing golden moves. The GitHub one carries `GitHubReactionContent` as the host sends it — `'+1'` and `'heart'` (src/shared/github/comment-types.ts:3-17, normalised from GraphQL at src/main/github/comment-reactions.ts:19-27). The GitLab one carries `GitLabReaction`, which is `{ name, count }` with no `content` at all (src/shared/gitlab-types.ts:60-72). Recorded against main's product tree at `4b876758d3` through the detached-pin worktree, so the `normal` partition now pins what main renders rather than what this branch renders. Control: all 758 existing goldens reproduce the previous pin recording byte for byte; the only difference is these two added files. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): forward a comment reaction instead of matching mobile's vocabulary `DETAIL_REACTION_CONTENT` was `thumbs_up | thumbs_down | ...`, a vocabulary no producer of this list sends. GitHub answers `github.workItemDetails` with `PRComment[]` whose reactions are `GitHubReactionContent` — `'+1'`, `'-1'`, `laugh`, ... (src/shared/github/comment-types.ts:3-17), normalised from GraphQL at src/main/github/comment-reactions.ts:19-27 — and GitLab answers with `GitLabReaction`, `{ name, count }` with no `content` member (src/shared/gitlab-types.ts:60-72). The closed arm set dropped every real reaction row on both providers, which is a good-reply path this PR must not change. `content` is forwarded now, salvaged the way every other guarded member here is; `count` stays required, because the `count > 0` filter at mobile-tasks-item-comments.tsx:145 is the one unguarded read. `DetailComment`'s eight phantom arms go with it: mobile's declared type was written from memory, not from the wire, and widening the type is the fix rather than narrowing what the host may send. `COMMENT_REACTION_EMOJI` was keyed by that same phantom vocabulary, so it resolves no glyph for a real reaction and the chip renders without one. That is a pre-existing defect and it stays exactly as it is: the map is typed `Record<string, string>` and the lookup takes `?? ''`, which resolves to the same `undefined` main resolved for both providers. The two scenarios recorded in 68a3db2 pin that rendering, so a future arm set cannot drop the rows unseen. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): stop citing the file-contents fiction as the reason nothing is required The schema comment and its unit pin both named `{ oldContent, newContent, truncated }` as "the recorded reply", which d26aeec corrected. The rule that keeps every member optional is unchanged and is now stated from the reads instead: the call site files the payload under the file path and reads nothing off it, the review panels reach each flag through `?.`, and `splitContentLines` takes `string | undefined` behind a falsy guard. The pins move to the host's own shape, plus the too-large pair a skipped side carries and the empty object that shows no member is required. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): import MERGEABLE_STATE instead of redeclaring it `task-item-detail-reply-schema.ts` declared its own copy of `['MERGEABLE', 'CONFLICTING', 'UNKNOWN']` while already importing four member helpers from `../session/github-pr-entity-reply-schema`, which exports that arm set and uses it in the identical expression three times. Two copies of one wire arm set is one place to fix when a provider gains a fourth state. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): inline the alias-only bindings the deleted casts left behind Each of the eight was `const result = x as { ok?: boolean; error?: string }`. With the cast gone the line is a rename of a binding that already has a name, and every one of them is followed immediately by the same `ok === false` check. Reading `created.ok` / `updated.ok` / `written.ok` / `replyResult.ok` directly leaves one name per value. The parity constants move with it and with the reaction change before it. The comment there names both: ten string literals leave `semantics` with the phantom reaction vocabulary and one arrives with the `?? ''` fallback, and the alias deletions move the hook and statement hashes. No `rpc:` or `jsx:` signature moves, the render-token hash does not move, and the hook, statement and declaration counts are unchanged at 350, 417 and 194. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): register the container-requirement mutant the matrix kills `f1b695f161` proved by hand that making `linearAccountStatusSchema` `.nullable()` fails the `result-null` partition of `tasks.provider-load`'s matrix, and left it unregistered. Registering it in `pilot-mutants.test.ts` is not available: that suite drives the manifest scenario as written, and `tk-provider-load` scripts a fulfilled `linear.status`, which a nullable container accepts exactly as the required one does. The mutation only has somewhere to diverge under a partition the pilot never reaches. `family-mutants.test.ts` drives one named variant of a family's matrix instead, against that variant's own slice of the golden, and each entry names both the partition that kills the mutation and one that cannot see it — so the entry records where the coverage is rather than that some golden went red. The comparison is the whole recorded variant, the way the family suite compares: under a last-state projection this mutant survives, because the divergence is in the settlement and both paths reach the same final screen state. Nothing under `mutants/` is pinned by a golden header, so this moves no recording. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin the corpus after the round-1 review fixes `baseline` moves to 542c1c3, the last fenced commit, and the whole corpus is re-recorded against it. The two fixture corrections and the two added reaction scenarios were recorded at main's pin first, so this run is what carries them onto the branch's own reader. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): keep the Linear create arm's own binding out of the inlining The alias inlining swept one line further than the finding it answers: the Linear arm's `const result = linearIssueCreate.interpret(reply)` is a declaration with a name, not an alias for one, and renaming it put a pre-existing `createLinearTask(...) as Extract<TaskItem, …>` assertion from stablyai#17438 inside this branch's changed lines, where the changed-code casting gate attributes it to this PR. Reverted to `result`; the eight bindings the review listed stay inlined. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): let each module build its own Linear team reader `linearTeamListReader` was exported from the detail-operations module only so the list-operations module could import it, which adds an operations-to-operations import edge that buys nothing: `rpcResultVariant` is a pure factory, so two calls with the same schema produce two functionally identical readers. What keeps the composer's picker and the saved-selection reconciler agreeing about a team row is that both build from `linearTeamsSchema`, which is already exported. Deleting the export also puts the composer-policy JSDoc back on `linearComposerTeamListRead`. JSDoc binds to the next declaration, so the block explaining why this method carries two operations with different acceptance policies had drifted onto the reader, leaving the operation it is about undocumented. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin the corpus to the last round-1 commit `baseline` moves to 75c568c and all 760 goldens are re-recorded against it. Nothing but the `baseline` header moves: the two product commits since the previous repin — the Linear create arm's binding restored and the team reader built per module — change no observation in any recording, which is what a pure refactor should look like here. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * chore(mobile): repin the RPC recording corpus to the main merge The merge of origin/main moved both lockfiles, which the recorder fences, so --record refused until the pin named a commit whose fenced tree matches this one. Repinned to the merge commit and re-recorded: 760 goldens, header only, `baseline` and `lockfileSha256`. No observation moved. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): point the reply-schema citations at the lines they name The alias inlining and the detail-loader rewrite moved fifteen of the consumer lines these comments cite, and the comments are the evidence for requiring a member only where the consumer reads it unguarded. Every citation re-checked by opening it; the host-side ones were already right. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): stop repeating the file-contents fiction on the type The corrected fixture carries four of the six members at both call sites, so "the recorded reply carries none of these" is false. The reason is the one the schema already gives: no reader reaches a member without `?.` or splitContentLines' falsy guard. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): forward a file's viewed state instead of closing it No scenario reply carries a file row, so no golden can observe either of this schema's two arm sets. `viewerViewedState` is read only by two `=== 'VIEWED'` tests, so it is forwarded and an arm this build predates reaches them as itself. `status` stays closed: its only consumer sends it straight back as a `github.prFileContents` param, which the host validates against the same seven arms (github-pull-request-params.ts:62). Forwarding could not reach the wire without a cast, and the host would refuse the arm on its own params, so the drop to absent that becomes `?? 'modified'` is the compatible read. Parity: one declaration and three arm literals, no executable change. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): say that a Linear state-update refusal is ignored, as on main `require-result-or-throw-message` throws only on an outer refusal, and `linear.updateIssue` refuses in band as `{ ok: false, error }` on a successful envelope, so the refusal reaches no `catch`. Main read the same payload unchecked and discarded it, so nothing here changes. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin the RPC recording corpus to the origin/main merge Main's stablyai#20069 re-recorded ten session create-terminal goldens and moved twenty-one files under src/shared, both inside the recorder's fence, so `--record` refused until the pin caught up. The re-record moves one key, `baseline`, in all 760 goldens and nothing else; the ten taken from main reproduce byte-for-byte apart from that pin. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…, terminal, transport, home, worktree and browser (step 7) (stablyai#21176) * refactor(mobile): checked reply readers for notifications, components, terminal, transport, home, worktree and browser (step 7) Twenty-one unchecked reply readers across thirteen files become checked zod readers, so a malformed host reply surfaces as one `RpcIncompatibleReplyError` naming the method instead of a downstream `TypeError`, a rendered `undefined`, or a card left "proven" over a reply that carried no rows. Deliberately a behaviour change on malformed replies only. What each domain required, and why it required no more: - notifications (5 readers). All four call sites read the payload through `?.`, so every schema is nullish at the top level and no member is required. The test-push `reason` and the register `reason` become closed enums, because the two comparisons against them are the whole of what they decide and an arm this build does not know took the generic copy on main too. The stream unsubscribe and the unregister read no body at all. - components (4). `repo.hooks` requires `source` and nothing else: the drawer assigns it straight into `SetupHookDetails.source`, whose type is `string | null`, with no guard in between — nullable so the "no hooks file" answer keeps its explicit null. `setupTrust` is nullable as well as optional because the `components-setup-ask` fixture sends an explicit null, and salvaging that would move a `normal` golden. `ui.get`'s trust record salvages per repo, so one unreadable repo cannot cost the others their approvals. The Codex redeem reply stays `z.unknown()`: `decodeResetResult` is a real scope-and-snapshot validator and splitting it would give one reply two refusal rules. - terminal (4). The send verdict and the viewport pair keep main's exact `=== true` projections. `terminalSendAcceptedSchema` moves here from the session domain, which now re-exports it: terminal is the lower layer and two identical copies could drift on what "delivered" means. `terminal-send-rpc-response.ts` is deleted, its projection now being the schema's. - transport (3). `status.get` declares its five members and requires the object; the three callers disagree about what an unreadable status means, so each keeps its own verdict behind a named reader — the gate wants the failure, and the probe and the pairing race must not have it, because both call `interpret` inside a `.then` fulfilment handler where a throw becomes a detached rejection. `capabilities` salvages whole rather than per element, which is main's own rule and what `transport-capability-probe-non-string-capabilities-drop` records. The two pairing readers are the shared credential contract itself, moved off the four call sites that each ran `.parse()` on the interpreted value; its `.strict()` is main's shipped rule for that released surface, not a new one. - home (2), worktree (2), browser (1). The stats row is checked as an object and nothing more, `totalHomeStats` being the reader that says so itself; its per-host slot is now typed as the wire row it holds rather than as the computed total. `worktree.ps` cannot require `worktrees`: the host answers a union whose unchanged arm carries `{ unchanged, snapshotId }` and no rows. The twelve browser commands read no body; `browser.goto`'s settled URL stays nullish because `navigateToAddress` is inline in `MobileBrowserPane.tsx`, which no adapter mounts, and a move there would ship unevidenced. Three fixtures were wrong and are corrected, each disclosed rather than worked around: the runtime-context test kept a content hash directly under a repo key, which is not a shape `ui.get` sends; and two snapshot-client tests ran their reply list dry and handed `fetch` an absent result while claiming to model a transport failure. `push-test-envelope` is re-anchored at the same defect's new home, the cast having been deleted. The boundary test's offender floor comes down from 20 to 10 with the list, which is what its own comment says it is for. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin the corpus and re-record step 7's checked reply readers `baseline` moves to this branch's product commit, which is what `--record` compares the fenced tree against, and every one of the 758 goldens is re-recorded from it. The repin is what rewrites the `baseline` header on all of them; nothing else about the corpus moves except the bodies disclosed below. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): mutate the workspace catalog's reader back to unchecked The step-7 defect evidence needs a scenario whose reply is the one the change moves. Every pilot scenario in the catalog family scripts a well-formed reply, so a mutant that only changes how a *malformed* reply reads has nowhere to diverge — which is why the pilot's own suite passed against an unchecked catalog reader while its matrix golden failed. `worktree-catalog-snapshot-unreadable` scripts `worktree.ps` answering `{ ok: true }` with no result at all, which is what `result-absent` drives at the matrix site, and records the fetch rejecting with `RpcIncompatibleReplyError`. `worktree-catalog-unchecked-reader` then swaps the operation's reader for one that answers `compatible: true` for every payload — main's reader, in one line — and the recording moves back to a fulfilled fetch carrying `admission: { kind: 'invalid' }`, which is the answer that let a broken catalog render as an empty host (STA-3123). One golden added and none moved: the manifest sits outside the fenced paths, the family's matrix base is still `worktree-catalog-snapshot`, and the mutation registry is not part of `recorderSha256`. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): pin the push-test reason arms the closed enum constrains `pushDeliveryTestResultSchema.reason` closes over the four arms of the host's `MobilePushTestResult` (src/shared/mobile-push-contract.ts:99), but no scenario carried the member, so the corpus could not have caught a wrong vocabulary. Three scenarios on the existing display-test mount carry it now: the two arms the screen branches on and one arm no build knows. Each golden was recorded first at the main pin 4b87675 and reproduces there byte for byte, so the `normal` partition pins main's rendering rather than this branch's. The unknown arm is the load-bearing one: main renders "Could not send through Orca's push service." for an unrecognised string, and the salvage drop renders the same sentence, so the closed enum costs a recorded `reply-salvage` observation and no screen text. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): cite the host union behind each closed reply enum A closed `z.enum` is only as good as the vocabulary it was checked against, and mobile's own declared types are written from memory. Each of the three enums now names the host type it mirrors, so the next reader re-checks it in one grep rather than trusting the arms. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin the corpus to the commit that carries the host-union citations `--record` compares the fenced tree against `baseline`, so a comment in `mobile/src` moves the pin like any other product edit. Every one of the 762 goldens changes by exactly its `baseline` line and nothing else, which is the evidence that the citation commit is inert. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): keep the agent-history panel rendering when the catalog omits its rows `worktrees` is a salvaged member, so it is absent on the three envelopes that read as an object without rows, and `use-mobile-agent-history-state.ts:61` calls `.find` on it with no guard. The cast erased that and the corpus recorded the result: `matrix-aivault.history-screen-worktree.ps-1` carried `crash: Cannot read properties of undefined (reading 'find')` on `inner-ok-missing`, `inner-false-string-error` and `inner-false-object-error`. `?? []` is what the sibling Home card already does. The SAFETY note cited that card's golden, which is the opposite site, and now cites this panel's own family. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): keep a malformed worktree.ps reply reported as invalid_response `host-workspace-list-states.tsx` prints this code to the user verbatim, so the checked reader's throw landing in the generic catch renamed a host-payload defect into a connectivity failure. STA-3123 exists to make a broken remote host diagnosable, which `network_error` is not. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): give the browser page commands back their one-line form Only `browser.goto` reads a reply body, so the reader belongs on a two-argument wrapper rather than on all thirteen call sites. The exported type of every command is unchanged, and the doc comment no longer promises a shape the file did not have. 109 lines to 72. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): import the terminal send verdict from the terminal domain The re-export forwarded to two callers, which a direct import already gives them, and the session suite re-pinned three cases `terminal-reply-schema.test.ts` owns. One definition, one pin, one file hop fewer. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): move the codex reset-credit pins next to their schema They sat in the New Workspace suite, so a reader looking for the capability whole-list drop by filename did not find it. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin and re-record after the round-1 fixes Three checkpoints of `matrix-aivault.history-screen-worktree.ps-1` move from a recorded white screen to the loading list: `inner-ok-missing`, `inner-false-string-error` and `inner-false-object-error` answer the panel an object with no rows, and the `?? []` now seats an empty list instead of letting `.find` throw. Every other golden changes by its `baseline` line alone, which is the evidence the other four fixes move nothing the recorder observes. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): stop requiring the stats row its own reader guards Round-2 findings 1 to 3. `homeHostStatsSchema` required an object that `totalHomeStats` already guards (`if (!host || typeof host !== 'object') continue`), so the requirement bought nothing at the read and cost the row upstream: the refusal reached `fetchMobileHomeStats`'s `.catch`, the per-host slot was never written, `hostIds.filter` found no host and the Home header drew no stats row where main drew `0 / 0s / 0`. It takes `.nullish()`, and `HomeStatsRow` admits the `null | undefined` main always had. The unit pin now says the slot keeps a null summary and the total skips it, and sums one through `totalHomeStats` to show the zeroed row survives. The Home card's `SAFETY:` note claimed the reader proves `worktrees` is an array. It does not; the `?? []` does. That is the same false sentence round 1 removed from the agent-history panel, and a reader who believed it would delete the `??` and reintroduce the white screen. The `catalogError` branch on `RpcIncompatibleReplyError` had nothing holding it: no adapter mounts the host screen, so no golden can reach it. One case in the snapshot client pins the class the `catch` keys on. Mutation-checked by forwarding the catalog schema as `z.unknown()`, which fails that case alone. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin and re-record after the round-2 fixes and main's merge Pin moves to 0b8bd1c, this branch's last fenced commit. The re-record normalises the ten session create-terminal goldens main re-recorded in stablyai#20069 without repinning, and writes the Home stats family's bodies back to what main records now that the summary reader no longer requires the object its own consumer guards. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin and re-record the corpus at the merge with main The merge took main's goldens verbatim at main's pin, so the four goldens this branch adds were the only ones whose header did not name a commit in this history. Repinning to the merge commit and re-recording gives all 764 one pin and one recorder, which is what the new ancestry guard asks of the corpus. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): point the reply schemas' citations at the lines they claim Every `file:line` in this branch's diff was resolved against the tree and its target line compared to the claim beside it. Fourteen were wrong. Most had drifted one to four lines onto a closing brace or the line after the code they quote, which reads exactly like a good citation and can only be caught by resolving it. Two were wrong in kind rather than by a few lines. The viewport comment credited the `=== true` projection to the refit call site, which reads plain truthiness; the rule was main's reader, and the refit's two decisions are the lines now cited. The capability comment cited a line for main's `every(typeof === 'string')` rule inside the code this change deletes, so it resolved to an unrelated brace; it now states the behaviour and says why no line carries it. Two more pointed at the head or tail of the statement they named and are tightened to the line that does the work. Comment-only: no schema, no reader and no call site moves. The corpus is repinned and re-recorded on top because the recorder fences `mobile/src`. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin and re-record after the citation fixes The citation commit is comment-only, and the corpus says so: all 764 goldens move on the `baseline` header line and nothing else. The re-record is needed only because the recorder fences `mobile/src`, which a comment is inside. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): keep the three unguarded-site reply schemas total so a malformed result cannot throw where main tolerated it The ui.get reader is interpreted inside a fire-and-forget IIFE with no catch, and the home stats and push delivery readers sit behind handlers that would print the reader's own sentence where main drew a zeroed row or the generic copy. Each schema now decodes any unreadable result as absent, which lands in the fallback main already took. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin and re-record the corpus over the total schemas Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): name the host-status gate reader by its export Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
















ELI5
When mobile created a tab after the active tab, it asked the host for one position but briefly predicted another. With tabs
A | BandAactive, mobile could showA | B | Newwhile the host had already chosenA | New | B. The next host snapshot then moved the tab.Current clients and hosts now use one negotiated placement rule. During version skew, the client leaves placement to the host instead of guessing.
What Changed
afterTabIdfor the request and optimistic update. It applies that update only when the host advertises the matching placement contract.Reproduction
The underlying bug is real and deterministic in the pre-fix production state transitions:
Applying the authoritative snapshot necessarily changes the created tab's index. The visible animation is timing-dependent because it appears only when the create response paints before the host notification. That visual baseline was not reproduced on the review rig, so this PR does not claim an independent before/after animation reproduction.
Architecture
The host remains authoritative for tab order. Optimistic placement is enabled only after capability negotiation proves that both sides use the same grouped-placement rule. Capability absence does not map to a guessed legacy rule because older headed and runtime-owned hosts place split anchors differently.
This adds one string to the existing capability exchange and no polling, retry loop, cache, timer, or new RPC method. Placement is
O(n)over one tab strip and runs once per successful tab creation.Linked Issue
No linked issue. The finding originated in automated review and was independently substantiated from the pre-fix production paths.
Visual Proof
Fixed-state iOS Simulator and hidden Electron validation covered ordinary and split-terminal anchors. From first observed appearance through settlement, the created tab stayed in its host-selected position. The run used direct/local pairing; Android and relay were not exercised.
Testing
Platforms exercised manually: macOS host and iOS Simulator. The production change is platform-neutral array and capability bookkeeping; it adds no path, shell, process, or native-module behavior.
AI Disclosure
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
A response-watermarked optimistic overlay could make settlement explicit across all future create mutations. It is broader than this verified ordering defect and is not required for this fix; this PR keeps that architecture unchanged.
Checklist