Repository navigation
refactor(mobile): checked reply readers for files, dictation, host-screen and agent-history (step 7) - #21269
Merged
Conversation
…eplies Four of this branch's read sites had no malformed-reply coverage, so the reader change would have had nothing to move at them. `familyGoldens` matrixes only the first scenario of each family, and `files.preview-load`'s base is the grant-refresh chain while `session.tab-documents`' is the served markdown tab — which left `files.read` and `files.readPreview` on the worktree preview path, the artifact image read, and the markdown tab's on-disk fallback recorded on their success path only. This commit is the before picture, taken from main's own tree with no product edit in it. Three new families, five scenarios, ten goldens: - `files.preview-worktree-text` / `files.preview-worktree-image` — `files.read` and `files.readPreview` as the preview screen asks them for a worktree file. - `files.preview-artifact-image` — `files.readTerminalArtifactPreview`. - `session.markdown-disk-fallback` — the `files.read` leg a headless host's `renderer_unavailable` sends the markdown tab down. It carries a second scenario that serves `markdown.readTab`, because a matrix site needs a fulfilled reply recorded somewhere in its own family to replay as the `normal` partition. No existing scenario moved to a new family and no adapter changed, so every pre-existing golden keeps its `adapterSha256` and `scenarioSha256`. Recorded in a detached worktree at the manifest's pin (`4b876758d3`) with this manifest copied in; the control is that all 748 pre-existing goldens came back byte-identical to origin/main's, which `git diff c2962a7 -- mobile/rpc-foundation/goldens` confirms as empty. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…reen and agent-history Thirty-five unchecked reply readers across seven files become checked zod readers, so a malformed host reply surfaces as one readable error at the operation boundary instead of a downstream TypeError, a rendered `undefined`, or a screen left ready over garbage. Deliberately a behaviour change on malformed replies only: every good reply decodes to the same value it did, which the `normal` partition of every matrix golden holds byte for byte. Nothing on the wire moves — no method, params, options, timeout or acceptance policy changes at any site. The inventory drops from 137 readers over 31 files to 102 over 24. What each domain checks, and what it deliberately does not: - files/preview — one schema for `files.read` and `files.readTerminalArtifact`, one for the two preview methods. `content` is required on the text pair because the markdown disk fallback publishes it into the tab with no guard; the image pair requires nothing, because normalizeImagePreviewResult guards all four members and the host's own "binary I cannot preview" and "not actually an image" arms are good replies the screen renders today. - files/tab-doc — stricter than the preview screen on the same two methods, because a tab publishes what it read into a typed ready document with no guard. `git.diff` reads as two variants, and an arm this build has not heard of takes the binary one rather than refusing the reply. - files/explorer — the directory listing is an array and a row needs the name and the directory flag the tree projection turns on; the legacy capped list needs its rows' paths and the truncation flag its note draws. - files/ownership — the two members that decide *where a write lands* are fatal on a wrong type rather than salvaged, because absence reads as `local` downstream and a salvage would send a mutation to the wrong host. `hostId`'s absent/null/string states stay distinct, and the SSH connection generation passes through at its own type because the mutation echoes it back to the host. - dictation — the setup the sheet renders is checked; the model rows need the `id` the sheet keys and sends back. The five sends whose reply body no call site reads keep an unknown payload, and so does `speech.dictation.finish`, whose transcript is read past a staleness guard that a reader throw would move the failure across. - host-screen — the repo catalog, the SSH labels and the host platform. The four writes read no reply body; `worktree.activate` stays opaque because the session route's second report site awaits it outside any catch. - agent-history — the capability gate and both scan containers. The session rows stay unknown on purpose: `agent` is a vocabulary that grows with every agent CLI Orca learns to scan and that this client echoes back on resume, so narrowing it would refuse a newer host's reply or drop the very sessions it added. Two shared readers were widened to take the strings the reply readers hand them — `getRepoExecutionHostId` and `buildRepoHostIdByRepoId` — because both already answer `local` for a host-id spelling they cannot parse, and closing that spelling in a reply schema would refuse a newer host's own catalog. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
`baseline` moves to this branch's last fenced commit, which is what `--record` refuses without: main's fenced tree drifted past the session domain's pin when #21114 and the dependency bump landed, and the product edit in the commit before this one moves it again. Every body move is confined to a malformed partition of a family this branch touched. No `normal` partition moved, which is the byte-for-byte control on good replies, and no golden outside the seven files' families moved at all. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
… without The setup sheet's `normal` partition refused after the reader landed, which is the success control saying the schema was wrong rather than the fixture: `dictationMode` was declared required because the one unguarded consumer pushes it into a `useState<'toggle' | 'hold'>` and cannot invent a value, but main rendered a sheet whose reply omitted it, and requiring a member no consumer crashes on is exactly the version claim Rule 1 of the remote-wire contract warns about. The member is salvaged now and keeps its open arm set, so an unknown mode still degrades to `toggle` rather than to one that matches no segment. The native-chat refresh spells that same `toggle` for an absent mode, which is the value its state already started at, and the route parity pins are refreshed for the one literal and the two callback bodies that moved. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Second repin of the branch: the fix to the setup reader is a fenced-tree change, so `--record` refuses until `baseline` names it. The speech family's `normal` partition is back to main's projection, which is what said the first reader was wrong. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Three mutations applied by hand, run, and reverted, recorded beside the adapter family mutations in the same shape. They are kept in their own file because a reader mutation is not killed by a pilot scenario: a pilot serves a good reply, and a schema that has stopped checking a member reads a good reply exactly as before. What kills them is a matrix golden's malformed partition, the schema's unit pin, or a consumer pin, and each is named against its mutation. Two survived their first run, and both survivals were defects in the gates: - Loosening the file tab's `content` was invisible, because the pin dropped members only in pairs and each pair is refused by the sibling. The pin now drops exactly one member per iteration, and the preview text schema and the legacy file list got the same treatment. - Collapsing the hostId tri-state was invisible, because no golden serves an explicit null host — the local ownership scenario omits the member. The ownership test now captures all three states end to end, which is where a tri-state belongs. `repo-metadata-platform` is re-anchored where this branch moved the read it mutates: the hand-rolled `readHostPlatform` became the reply schema's own projection. The defect it injects is unchanged. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The closed enums this branch introduced had no fixture behind them. `provider`, `dictationMode` and `repoIcon` were carried by no scenario at all — the fulfilled repo-metadata golden records `repoIconsByName: []` — so the corpus could not have moved whatever arm set the schemas declared, which is how a reader can pin a vocabulary the host does not speak and still decode to a zero-move delta. Two scenarios, both appended to an existing family so `familyGoldens` adds no matrix golden, recorded from main's own tree at the pin with no product edit in it: - `settings-repo-metadata-icons` — all three `RepoIcon` arms, a github-sourced image with a label, an explicit `badgeColor`, and a mixed-host catalog so the ssh/settings/platform wave runs too. - `speech-setup-sheet-model-vocabulary` — `provider` on both arms, `status` on two, `dictationMode: "hold"`, and null and numeric `sizeBytes`/`progress`. Control: re-recording the whole corpus at the pin reproduces every committed golden body, including this branch's five earlier before-pictures; only `baseline` and the masked `lockfileSha256` move. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The image arm of `repoIcon` declared `source` as the four values `RepoIconImageSource` spells today (src/shared/repo-icon.ts:3). MobileRepoIcon reads `type`, `src`, `label`, `emoji` and `name`, and never `source`, so the only thing that enum could do was fail the union arm for a source a later host adds — dropping the whole icon and drawing the Folder default where main drew the image. That is the one arm set on this branch whose degrade was not already main's own behaviour for an unknown value. Dropping the declaration keeps the member: `looseObject` passes it through verbatim, so the decoded object is byte-identical to the one main published, which `settings-repo-metadata-icons` now records. The two type sites that hold an icon move to the decoded type. A host `RepoIcon` still satisfies the rendered union, so the worktree rows that carry one are unaffected. Every other closed enum on this branch was checked against the host's own shared type and left alone: speech `provider`/`status`/`dictationMode` (runtime-worktree-contracts.ts:83/85/86), `groupBy`/`sortBy` (persisted-ui-state-types.ts:41-42), `platform` (Node's own domain; the handler answers `process.platform`). For each, a salvaged member lands on the same branch main's unknown value did: `=== 'openai'` and `=== 'ready'` stay false, a missing `groupBy` and an unmapped one both answer null, and an unknown platform and a null one both label the host "This computer". Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Header-only: all 770 goldens move on `baseline` alone, including the two recorded from main's tree two commits back. The icon fix and the two new fixtures decode to the bytes main published. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
readSshTargets and readHostPlatform answered [] and null for any payload at all. The checked schemas threw for a non-object, and because the label write runs first in the same sequence that throw also skipped the platform write, so a malformed reply left both decorative labels at their previous values instead of degrading. A .catch on each restores main's answer without giving up the row filter or the checked reader. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…ault The reader closed the mode to two arms and the native-chat refresh spelled `?? 'toggle'`, which is a good-reply change no golden covers: main left the state undefined for a reply that omits the mode, and undefined binds no press handler on the terminal input mic. Head gave that mic a working toggle. The member is forwarded as the string the host sent and the refresh is main's line again, so an absent or unknown mode leaves the mic exactly as inert as main's. The route-parity runtime-string pin is main's own sha again. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The repo-metadata readers are total again, so both families' `result-absent` and `result-null` checkpoints decode to main's bytes instead of the caught throw, and the two delta rows they cost go away. The dictation mode forwards verbatim, which no recorded reply exercises differently. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
#20069 re-recorded the ten session create-terminal goldens. Those ten take main's bytes verbatim; every other golden on this branch is the branch's own and gets re-recorded at the new pin in the next commit. The manifest keeps this branch's seven added scenarios and is repinned next. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Pins the corpus to the merge commit so main's ten create-terminal goldens and this branch's own are recorded from one tree. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The ownership schema said an explicit null hostId means the host said local; the code refuses it, which is the whole reason mutant (c) exists. The AiVault sessions cast cited a golden whose fixture row carries three members, not the sixteen the cast claims — the full row is in aivault-history-screen-listed — and both the issues cast and the schema doc said the rows are rendered when the only read anywhere is issues.length. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…schemas Resolved every citation in the seven reply-schema modules and the SAFETY notes against the tree and diffed each target line against the claim beside it. Twelve were wrong, two of them past the end of a file that had shrunk, so they read as evidence while pointing at a closing brace. - file-explorer: the entries put is :157 not :160, the relativePath split is file-list-fallback.ts:48 not :42, and the truncated publish is :136 not :141. buildFileExplorerRows is no symbol at all; the sort-and-walk is flattenDirectoryCache (file-tree.ts:58). - file-ownership: the !summary throw is :68 not :64. - file-preview: the markdown disk fallback reads content at :60 not :65. - file-tab-doc: the html body render is :68 not :81 and the file arm is :73-75 not :86-88 (the file has 78 lines); the isImage guard is :58 not :66; the kind !== 'text' branch is :41 not :44; mobileDiffImageDataUri spans :22-33 not :20-31; the unguarded content.length is mobile-diff-lines.ts:35, the function that does it rather than :34. - agent-history: both members land at :133-135; :135 alone is issues. - dictation: the parenthetical read as citing the staleness guard when it named the rpcPayloadMember read. Both are cited now, :237 and :225. Comments only. No schema, type, or runtime behaviour changes. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
… opaque schema Handler audit over all 33 interpret sites in the four domains found one site that is structurally unguarded: use-mobile-session-startup.ts:170 reports the activation verdict from inside a fire-and-forget `void (async …)()` whose only `.catch` sits on the request, not on the chain. A throw there would be an unhandled rejection and would also skip the terminal fetch below it. Nothing throws there today, because `worktree.activate` reads hostScreenUnreadReplySchema, which is `z.unknown()`. That totality is load bearing rather than incidental, so the doc now names the line it protects and contrasts it with the first report site at :141, which is chained `.then(…).catch(…)` and would survive a throw. Comments only. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…detached bindDeferredRpcOperation builds interpret as a shorthand method closing over the captured operation, never `this`, which is what lets eleven call sites pass it as a bare function reference. Nothing named that invariant. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Goldens take main's bytes; pilot-scenarios.json keeps the union of both sides' families. Both sides deleted the other's inventory sections, so UNCHECKED_RPC_READERS is now empty and its prose says so. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Contributor
There was a problem hiding this comment.
️ No critical issues — one description/coverage mismatch worth a look. The rest of the batch's throw paths and oracle separation hold up under audit.
Reviewed changes
- 35 readers switched to checked schemas — files (explorer / ownership / preview / tab-doc), dictation, host-screen and agent-history operations now use
rpcResultVariant(variant, schema)instead ofrpcUncheckedPayloadReader/rpcUncheckedMemberReader. A malformed accepted reply now throwsRpcIncompatibleReplyErrornaming the method where main readundefinedor crashed. - Seven new
*-reply-schema.tsmodules — root containers (repos,sessions/issues, the directory array,models,ui) are required; row members are salvaged or passed through;fileTabTextSchemarequires content/truncated/byteLength because the tab publishes them unguarded;fileTabDiffis a two-variant union so a text diff with missing contents can't be re-read as binary. - Two host-screen reads stay total —
ssh.listTargetSummariesandhost.platformkeep main's.catch(() => [])/null. The repo-iconsourceenum is dropped to passthrough and dictationmodeis forwarded as a string rather than defaulted, both avoiding a good-reply change. - Ownership tri-state preserved —
fileOwnershipWorktreeSchemakeeps absent /null/ string distinct so a wrong-typed owner can't silently route a write to the runtime-local host, with a new end-to-end consumer pin. - Inventory closed —
UNCHECKED_RPC_READERSis empty; the boundary test is now a hard ratchet backed by its 400-file scan floor. - Corpus re-recorded — verified the refactor commit
c86fe077btouches nomobile/rpc-foundationpath; its parent550c5e62dholds the before-pictures, so the replay is meaningful rather than post-hoc.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…looks pullfrog: the PR body promised a Record<HostUnion, true> pin for every closed enum in this batch and the code had none. Adding them in the schema tests would have changed nothing: mobile/tsconfig.json excludes *.test.ts, so a coverage record there is never typechecked (a mutation that dropped a key stayed green). hostUnionArms(coverage) in zod-salvage spells the arm list as a Readonly<Record<U, true>> in the schema module itself, called with the host union as the explicit type argument: an arm the host adds is a missing property, one it drops is an excess property. Used for the speech provider and status (RuntimeSpeechModelSummary), the workspace groupBy and sortBy (PersistedUIState) and Node's platform list, which host-screen now imports from mobile-runtime-host-platform instead of duplicating. The repo icon branches satisfy Readonly<Record<RepoIcon['type'], z.ZodType>>. Three mutations (drop `manual`, add `bogus`, drop the image branch) each fail tsc. The tests iterate the exported lists; the platform mutant is re-anchored to the renamed constant. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Closed reply enums pinned to the host unions where
tsclooks — newhostUnionArms<Union>({...})insrc/shared/zod-salvage.tsspells each arm set asReadonly<Record<Union, true>>, so an arm the host adds is a missing property and one it drops is excess. Applied to speechprovider/status(RuntimeSpeechModelSummary), workspacegroupBy/sortBy(PersistedUIState) and Node's platform list; the repo-icon branches usesatisfies Readonly<Record<RepoIcon['type'], z.ZodType>>. Placing them in the schema modules rather than their tests is what makes the pin effective, sincemobile/tsconfig.jsonexcludes*.test.ts. - Node platform list de-duplicated —
NODE_PLATFORM_NAMESnow lives inmobile/src/transport/mobile-runtime-host-platform.tsandhost-screen-reply-schema.tsimports it instead of holding a second copy. The values and their order are unchanged, so no runtime behavior moves. - Tests iterate the exported arm lists — new loops in the dictation and host-screen schema tests prove every pinned arm survives the parse rather than just the hand-picked cases; the
repo-metadata-platformmutant is re-anchored to the renamed constant.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Jinwoo-H
added a commit
that referenced
this pull request
Sep 17, 2026
…21287) The last step-7 squash orphaned the pin again. Repin to 4a86b2d and re-record: 778 goldens and the manifest move only on the baseline field. With this the unchecked-reader inventory on main is empty. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Jinwoo-H
added a commit
that referenced
this pull request
Sep 17, 2026
…y enums where tsc looks (#21298) * fix(mobile): move the last six reply-enum pins where tsc looks mobile/tsconfig.json excludes *.test.ts, so a `Record<HostUnion, true>` coverage record in a schema test is never typechecked: the two that existed (SshConnectionStatus, GitHubProjectOwnerType) checked nothing, and the four closed enums beside them had only a doc citation of the host type. Each arm list moves into its schema module as hostUnionArms<Union>(), which #21269 introduced for the same reason, and each test iterates the exported list instead of holding its own copy: - SSH_CONNECTION_STATUS to SshConnectionStatus - PROJECT_OWNER_TYPE to GitHubProjectOwnerType - DETAIL_FILE_STATUS to GitHubPRFile['status'] - PUSH_TEST_REFUSAL_REASONS and PUSH_REGISTER_REFUSAL_REASONS to the refusal arms of MobilePushTestResult and MobilePushRegisterResult - SETUP_RUN_POLICIES to SetupRunPolicy openEnum's parameter widens from a non-empty tuple to `readonly string[]` so a hostUnionArms list can feed it. z.enum already accepts the same, so the tuple constraint only excluded callers zod itself takes; behaviour unchanged. Twelve mutations prove the pins: dropping one arm and adding a bogus one each fail mobile tsc in all six places. Zero goldens move, the schemas' behaviour being unchanged, and the 21 recording suites pass at the existing baseline. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): fix the type errors in eighteen test files Found by typechecking the tests for the first time (see the config that follows). All mechanical, none weakens a product type: - 67 `act(() => vi.advanceTimersByTime(...))` callbacks return VitestUtils where act wants void, so each becomes a block. The async ones await only a genuinely promise-returning call, so no extra microtask tick is introduced. - Four fixtures were stale against a product type that gained a required member: MobileViewState.alwaysShowDefaultBranch, PrSidebarData.checksError, the branch-compare summary's errorMessage, and SessionOptionDescriptor's transport, which #20884 added precisely so a producer could not inherit the wrong lane's rendering by omission. - `getLastConnectedAt` on the shared relay fake was typed `() => null`, which refused the timestamp two escalation suites assign to it. - Two holders used before assignment take `!`, one `advance!.kind === ...` becomes `advance?.kind`, one widened status arm takes `as const`, and the Expo notification fixture keeps `data` required because the dismissal cases assign through it. 631 test files pass, 6222 tests, unchanged. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): typecheck the test files, on a ratchet mobile/tsconfig.json excludes *.test.ts so Metro never compiles tests into the release bundle, and vitest transpiles without checking types. Nothing had ever typechecked a mobile test, which is why a `Record<HostUnion, true>` pin written in one proved nothing and why 144 of the 630 test files had drifted. tsconfig.test.json is that program with the tests put back, behind `typecheck:tests`. Four files stay out: they import the desktop main process or src/shared/child-process, which are written against @types/node, and this program's libs are React Native's, where setTimeout answers a number rather than a NodeJS.Timeout. Pulling that graph in reports ~280 errors about the desktop rather than about mobile; vitest runs those four under Node, which is where they belong. The CI gate is a ratchet rather than the raw typecheck, modelled on check-ts-nocheck-ratchet.mjs: 126 files still fail, so the gate freezes that set and fails when a file that checks today stops checking, or when a baseline entry starts checking and was not pruned. The list may only shrink. Why not zero: 180 of the remaining 510 errors are one seam — tests locate mocked react-native components by string name, which `ElementType` does not admit — and closing it means either 180 casts or a global JSX declaration for the mocked names. That is a design decision, not a mechanical fix, so it is left for a follow-up rather than made here. The rest are smaller clusters of the same kind: vi.fn mocks assigned into typed slots, call-arg tuple indexing, and createElement props fixtures. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile-recorder): correct the corpus counts and the salvage claim The oracle section still quoted the corpus as 368 scenarios and 727 goldens; it is 393 and 778, and the three replay suites report 781 tests. Each number now names the command that measures it. "No golden carries one" was the load-bearing error: 44 goldens carry a recorded `reply-salvage` today, starting with the push-test unknown-reason scenario #21176 added for exactly that purpose. The paragraph claimed the observation pins an absence when on those families it pins a recorded drop. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): pin the tests-typecheck ratchet's parser The gate reads tsc's output, and tsc indents the "Overload 1 of 2, ..." detail under an error. Counting those as filenames would write unparseable entries into the baseline and leave the gate unprunable, so the parser is pinned on that shape as well as on the added/stale diff. Written against the gate itself: it flagged this file before the directive it carried was removed, which is the end-to-end proof the spawn half works. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): await the timer advances the act() rewrite dropped Rewriting `await act(async () => vi.advanceTimersByTimeAsync(n))` into a braced body left the returned promise floating at 27 sites, so the advance was no longer ordered before the assertions that follow it. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): unshadow MobileHostCard's .tsx suite A wildcard `include` keeps only the higher-priority extension, so MobileHostCard.test.tsx sat outside every tsc program while MobileHostCard.test.ts existed beside it. Its one error is the same react-test-renderer seam its sibling is baselined for. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): census every test file into the typecheck program The ratchet diffs only files that error, so a test excluded from tsconfig.test.json or shadowed by a sibling extension left the gate silently. Every *.test.ts(x) on disk must now be in the program or named in TESTS_OUTSIDE_PROGRAM with its reason. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(shared): make the enum helpers refuse the ways they can prove nothing openEnum takes a `const` T so a bare literal keeps its arms rather than widening to string. hostUnionArms blocks inference of U with NoInfer and defaults it to never, so a call that omits the host union — where the record would only pin itself — no longer compiles. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): describe the census and correct the baseline count Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): give the push fixture cast its SAFETY rationale Widening the pre-existing cast made the changed-code gate attribute it as a new finding. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): build the push fixtures as typed notifications Replaces the `as unknown as` cast with Expo's own types, filling FirebaseRemoteMessage and its notification once in two builders, and passes the data payload in rather than mutating through an optional member. Typing the fixture showed one assertion comparing the scheduled content against the whole arriving content, which only held while the cast let the fixture omit the two members the presenter drops; it now names the four members the presenter forwards. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): keep the grouped-question advance read non-optional `advance?.kind` let an absent advance take the null-draft branch instead of failing. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): run the tests-typecheck ratchet on Windows Spawns tsc's JS entry on this Node instead of the node_modules/.bin shim, which is a POSIX shell script that Windows resolves to tsc.CMD and then appends .exe to. Parsed paths are normalised to POSIX so a Windows run does not read every baseline entry as both stale and added. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): close the ratchet's @ts-nocheck hole and read tsc once tsc exits 0 on a @ts-nocheck file, so a baselined test could be "fixed" with one line, pruned, and never checked again; the census now names any program test file whose leading comment carries the directive. `--noEmit --listFiles` answers both questions in one pass, so the gate spawns tsc once rather than twice. Corrects the two stale counts, and states hostUnionArms' real reason for living in the schema module now that tests are typechecked. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
ivanvykopal
pushed a commit
to ivanvykopal/orca
that referenced
this pull request
Sep 20, 2026
…reen and agent-history (step 7) (stablyai#21269) * test(mobile): record main's file-preview and markdown-disk-fallback replies Four of this branch's read sites had no malformed-reply coverage, so the reader change would have had nothing to move at them. `familyGoldens` matrixes only the first scenario of each family, and `files.preview-load`'s base is the grant-refresh chain while `session.tab-documents`' is the served markdown tab — which left `files.read` and `files.readPreview` on the worktree preview path, the artifact image read, and the markdown tab's on-disk fallback recorded on their success path only. This commit is the before picture, taken from main's own tree with no product edit in it. Three new families, five scenarios, ten goldens: - `files.preview-worktree-text` / `files.preview-worktree-image` — `files.read` and `files.readPreview` as the preview screen asks them for a worktree file. - `files.preview-artifact-image` — `files.readTerminalArtifactPreview`. - `session.markdown-disk-fallback` — the `files.read` leg a headless host's `renderer_unavailable` sends the markdown tab down. It carries a second scenario that serves `markdown.readTab`, because a matrix site needs a fulfilled reply recorded somewhere in its own family to replay as the `normal` partition. No existing scenario moved to a new family and no adapter changed, so every pre-existing golden keeps its `adapterSha256` and `scenarioSha256`. Recorded in a detached worktree at the manifest's pin (`4b876758d3`) with this manifest copied in; the control is that all 748 pre-existing goldens came back byte-identical to origin/main's, which `git diff c2962a7 -- mobile/rpc-foundation/goldens` confirms as empty. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile): checked reply readers for files, dictation, host-screen and agent-history Thirty-five unchecked reply readers across seven files become checked zod readers, so a malformed host reply surfaces as one readable error at the operation boundary instead of a downstream TypeError, a rendered `undefined`, or a screen left ready over garbage. Deliberately a behaviour change on malformed replies only: every good reply decodes to the same value it did, which the `normal` partition of every matrix golden holds byte for byte. Nothing on the wire moves — no method, params, options, timeout or acceptance policy changes at any site. The inventory drops from 137 readers over 31 files to 102 over 24. What each domain checks, and what it deliberately does not: - files/preview — one schema for `files.read` and `files.readTerminalArtifact`, one for the two preview methods. `content` is required on the text pair because the markdown disk fallback publishes it into the tab with no guard; the image pair requires nothing, because normalizeImagePreviewResult guards all four members and the host's own "binary I cannot preview" and "not actually an image" arms are good replies the screen renders today. - files/tab-doc — stricter than the preview screen on the same two methods, because a tab publishes what it read into a typed ready document with no guard. `git.diff` reads as two variants, and an arm this build has not heard of takes the binary one rather than refusing the reply. - files/explorer — the directory listing is an array and a row needs the name and the directory flag the tree projection turns on; the legacy capped list needs its rows' paths and the truncation flag its note draws. - files/ownership — the two members that decide *where a write lands* are fatal on a wrong type rather than salvaged, because absence reads as `local` downstream and a salvage would send a mutation to the wrong host. `hostId`'s absent/null/string states stay distinct, and the SSH connection generation passes through at its own type because the mutation echoes it back to the host. - dictation — the setup the sheet renders is checked; the model rows need the `id` the sheet keys and sends back. The five sends whose reply body no call site reads keep an unknown payload, and so does `speech.dictation.finish`, whose transcript is read past a staleness guard that a reader throw would move the failure across. - host-screen — the repo catalog, the SSH labels and the host platform. The four writes read no reply body; `worktree.activate` stays opaque because the session route's second report site awaits it outside any catch. - agent-history — the capability gate and both scan containers. The session rows stay unknown on purpose: `agent` is a vocabulary that grows with every agent CLI Orca learns to scan and that this client echoes back on resume, so narrowing it would refuse a newer host's reply or drop the very sessions it added. Two shared readers were widened to take the strings the reply readers hand them — `getRepoExecutionHostId` and `buildRepoHostIdByRepoId` — because both already answer `local` for a host-id spelling they cannot parse, and closing that spelling in a reply schema would refuse a newer host's own catalog. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin the corpus and re-record the checked reply readers `baseline` moves to this branch's last fenced commit, which is what `--record` refuses without: main's fenced tree drifted past the session domain's pin when stablyai#21114 and the dependency bump landed, and the product edit in the commit before this one moves it again. Every body move is confined to a malformed partition of a family this branch touched. No `normal` partition moved, which is the byte-for-byte control on good replies, and no golden outside the seven files' families moved at all. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): stop the dictation reader requiring a mode main rendered without The setup sheet's `normal` partition refused after the reader landed, which is the success control saying the schema was wrong rather than the fixture: `dictationMode` was declared required because the one unguarded consumer pushes it into a `useState<'toggle' | 'hold'>` and cannot invent a value, but main rendered a sheet whose reply omitted it, and requiring a member no consumer crashes on is exactly the version claim Rule 1 of the remote-wire contract warns about. The member is salvaged now and keeps its open arm set, so an unknown mode still degrades to `toggle` rather than to one that matches no segment. The native-chat refresh spells that same `toggle` for an absent mode, which is the value its state already started at, and the route parity pins are refreshed for the one literal and the two callback bodies that moved. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin past the dictation fix and re-record Second repin of the branch: the fix to the setup reader is a fenced-tree change, so `--record` refuses until `baseline` names it. The speech family's `normal` partition is back to main's projection, which is what said the first reader was wrong. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): mutant evidence for the checked reply readers Three mutations applied by hand, run, and reverted, recorded beside the adapter family mutations in the same shape. They are kept in their own file because a reader mutation is not killed by a pilot scenario: a pilot serves a good reply, and a schema that has stopped checking a member reads a good reply exactly as before. What kills them is a matrix golden's malformed partition, the schema's unit pin, or a consumer pin, and each is named against its mutation. Two survived their first run, and both survivals were defects in the gates: - Loosening the file tab's `content` was invisible, because the pin dropped members only in pairs and each pair is refused by the sibling. The pin now drops exactly one member per iteration, and the preview text schema and the legacy file list got the same treatment. - Collapsing the hostId tri-state was invisible, because no golden serves an explicit null host — the local ownership scenario omits the member. The ownership test now captures all three states end to end, which is where a tri-state belongs. `repo-metadata-platform` is re-anchored where this branch moved the read it mutates: the hand-rolled `readHostPlatform` became the reply schema's own projection. The defect it injects is unchanged. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): record main's repo-icon and speech-vocabulary replies The closed enums this branch introduced had no fixture behind them. `provider`, `dictationMode` and `repoIcon` were carried by no scenario at all — the fulfilled repo-metadata golden records `repoIconsByName: []` — so the corpus could not have moved whatever arm set the schemas declared, which is how a reader can pin a vocabulary the host does not speak and still decode to a zero-move delta. Two scenarios, both appended to an existing family so `familyGoldens` adds no matrix golden, recorded from main's own tree at the pin with no product edit in it: - `settings-repo-metadata-icons` — all three `RepoIcon` arms, a github-sourced image with a label, an explicit `badgeColor`, and a mixed-host catalog so the ssh/settings/platform wave runs too. - `speech-setup-sheet-model-vocabulary` — `provider` on both arms, `status` on two, `dictationMode: "hold"`, and null and numeric `sizeBytes`/`progress`. Control: re-recording the whole corpus at the pin reproduces every committed golden body, including this branch's five earlier before-pictures; only `baseline` and the masked `lockfileSha256` move. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): stop the repo icon narrowing a member no consumer reads The image arm of `repoIcon` declared `source` as the four values `RepoIconImageSource` spells today (src/shared/repo-icon.ts:3). MobileRepoIcon reads `type`, `src`, `label`, `emoji` and `name`, and never `source`, so the only thing that enum could do was fail the union arm for a source a later host adds — dropping the whole icon and drawing the Folder default where main drew the image. That is the one arm set on this branch whose degrade was not already main's own behaviour for an unknown value. Dropping the declaration keeps the member: `looseObject` passes it through verbatim, so the decoded object is byte-identical to the one main published, which `settings-repo-metadata-icons` now records. The two type sites that hold an icon move to the decoded type. A host `RepoIcon` still satisfies the rendered union, so the worktree rows that carry one are unaffected. Every other closed enum on this branch was checked against the host's own shared type and left alone: speech `provider`/`status`/`dictationMode` (runtime-worktree-contracts.ts:83/85/86), `groupBy`/`sortBy` (persisted-ui-state-types.ts:41-42), `platform` (Node's own domain; the handler answers `process.platform`). For each, a salvaged member lands on the same branch main's unknown value did: `=== 'openai'` and `=== 'ready'` stay false, a missing `groupBy` and an unmapped one both answer null, and an unknown platform and a null one both label the host "This computer". Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin past the repo-icon fix and re-record Header-only: all 770 goldens move on `baseline` alone, including the two recorded from main's tree two commits back. The icon fix and the two new fixtures decode to the bytes main published. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): keep the repo-metadata readers total the way main's were readSshTargets and readHostPlatform answered [] and null for any payload at all. The checked schemas threw for a non-object, and because the label write runs first in the same sequence that throw also skipped the platform write, so a malformed reply left both decorative labels at their previous values instead of degrading. A .catch on each restores main's answer without giving up the row filter or the checked reader. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): forward the dictation mode instead of substituting a default The reader closed the mode to two arms and the native-chat refresh spelled `?? 'toggle'`, which is a good-reply change no golden covers: main left the state undefined for a reply that omits the mode, and undefined binds no press handler on the terminal input mic. Head gave that mic a working toggle. The member is forwarded as the string the host sent and the refresh is main's line again, so an absent or unknown mode leaves the mic exactly as inert as main's. The route-parity runtime-string pin is main's own sha again. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin past the review fixes and re-record The repo-metadata readers are total again, so both families' `result-absent` and `result-null` checkpoints decode to main's bytes instead of the caught throw, and the two delta rows they cost go away. The dictation mode forwards verbatim, which no recorded reply exercises differently. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): repin onto the merge and re-record Pins the corpus to the merge commit so main's ten create-terminal goldens and this branch's own are recorded from one tree. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): correct three reader comments round 2 caught The ownership schema said an explicit null hostId means the host said local; the code refuses it, which is the whole reason mutant (c) exists. The AiVault sessions cast cited a golden whose fixture row carries three members, not the sixteen the cast claims — the full row is in aivault-history-screen-listed — and both the issues cast and the schema doc said the rows are rendered when the only read anywhere is issues.length. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): correct stale file:line citations in the batch-A reply schemas Resolved every citation in the seven reply-schema modules and the SAFETY notes against the tree and diffed each target line against the claim beside it. Twelve were wrong, two of them past the end of a file that had shrunk, so they read as evidence while pointing at a closing brace. - file-explorer: the entries put is :157 not :160, the relativePath split is file-list-fallback.ts:48 not :42, and the truncated publish is :136 not :141. buildFileExplorerRows is no symbol at all; the sort-and-walk is flattenDirectoryCache (file-tree.ts:58). - file-ownership: the !summary throw is :68 not :64. - file-preview: the markdown disk fallback reads content at :60 not :65. - file-tab-doc: the html body render is :68 not :81 and the file arm is :73-75 not :86-88 (the file has 78 lines); the isImage guard is :58 not :66; the kind !== 'text' branch is :41 not :44; mobileDiffImageDataUri spans :22-33 not :20-31; the unguarded content.length is mobile-diff-lines.ts:35, the function that does it rather than :34. - agent-history: both members land at :133-135; :135 alone is issues. - dictation: the parenthetical read as citing the staleness guard when it named the rpcPayloadMember read. Both are cited now, :237 and :225. Comments only. No schema, type, or runtime behaviour changes. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): name the unguarded activation report site that pins the opaque schema Handler audit over all 33 interpret sites in the four domains found one site that is structurally unguarded: use-mobile-session-startup.ts:170 reports the activation verdict from inside a fire-and-forget `void (async …)()` whose only `.catch` sits on the request, not on the chain. A throw there would be an unhandled rejection and would also skip the terminal fetch below it. Nothing throws there today, because `worktree.activate` reads hostScreenUnreadReplySchema, which is `z.unknown()`. That totality is load bearing rather than incidental, so the doc now names the line it protects and contrasts it with the first report site at :141, which is chained `.then(…).catch(…)` and would survive a throw. Comments only. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): pin that a bound descriptor's interpret survives being detached bindDeferredRpcOperation builds interpret as a shorthand method closing over the captured operation, never `this`, which is what lets eleven call sites pass it as a bare function reference. Nothing named that invariant. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * chore(mobile): repin the RPC recording baseline to the main merge Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): pin the closed reply enums to the host unions where tsc looks pullfrog: the PR body promised a Record<HostUnion, true> pin for every closed enum in this batch and the code had none. Adding them in the schema tests would have changed nothing: mobile/tsconfig.json excludes *.test.ts, so a coverage record there is never typechecked (a mutation that dropped a key stayed green). hostUnionArms(coverage) in zod-salvage spells the arm list as a Readonly<Record<U, true>> in the schema module itself, called with the host union as the explicit type argument: an arm the host adds is a missing property, one it drops is an excess property. Used for the speech provider and status (RuntimeSpeechModelSummary), the workspace groupBy and sortBy (PersistedUIState) and Node's platform list, which host-screen now imports from mobile-runtime-host-platform instead of duplicating. The repo icon branches satisfy Readonly<Record<RepoIcon['type'], z.ZodType>>. Three mutations (drop `manual`, add `bogus`, drop the image branch) each fail tsc. The tests iterate the exported lists; the platform mutant is re-anchored to the renamed constant. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
ivanvykopal
pushed a commit
to ivanvykopal/orca
that referenced
this pull request
Sep 20, 2026
…i#21269 (stablyai#21287) The last step-7 squash orphaned the pin again. Repin to 4a86b2d and re-record: 778 goldens and the manifest move only on the baseline field. With this the unchecked-reader inventory on main is empty. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
ivanvykopal
pushed a commit
to ivanvykopal/orca
that referenced
this pull request
Sep 20, 2026
…y enums where tsc looks (stablyai#21298) * fix(mobile): move the last six reply-enum pins where tsc looks mobile/tsconfig.json excludes *.test.ts, so a `Record<HostUnion, true>` coverage record in a schema test is never typechecked: the two that existed (SshConnectionStatus, GitHubProjectOwnerType) checked nothing, and the four closed enums beside them had only a doc citation of the host type. Each arm list moves into its schema module as hostUnionArms<Union>(), which stablyai#21269 introduced for the same reason, and each test iterates the exported list instead of holding its own copy: - SSH_CONNECTION_STATUS to SshConnectionStatus - PROJECT_OWNER_TYPE to GitHubProjectOwnerType - DETAIL_FILE_STATUS to GitHubPRFile['status'] - PUSH_TEST_REFUSAL_REASONS and PUSH_REGISTER_REFUSAL_REASONS to the refusal arms of MobilePushTestResult and MobilePushRegisterResult - SETUP_RUN_POLICIES to SetupRunPolicy openEnum's parameter widens from a non-empty tuple to `readonly string[]` so a hostUnionArms list can feed it. z.enum already accepts the same, so the tuple constraint only excluded callers zod itself takes; behaviour unchanged. Twelve mutations prove the pins: dropping one arm and adding a bogus one each fail mobile tsc in all six places. Zero goldens move, the schemas' behaviour being unchanged, and the 21 recording suites pass at the existing baseline. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): fix the type errors in eighteen test files Found by typechecking the tests for the first time (see the config that follows). All mechanical, none weakens a product type: - 67 `act(() => vi.advanceTimersByTime(...))` callbacks return VitestUtils where act wants void, so each becomes a block. The async ones await only a genuinely promise-returning call, so no extra microtask tick is introduced. - Four fixtures were stale against a product type that gained a required member: MobileViewState.alwaysShowDefaultBranch, PrSidebarData.checksError, the branch-compare summary's errorMessage, and SessionOptionDescriptor's transport, which stablyai#20884 added precisely so a producer could not inherit the wrong lane's rendering by omission. - `getLastConnectedAt` on the shared relay fake was typed `() => null`, which refused the timestamp two escalation suites assign to it. - Two holders used before assignment take `!`, one `advance!.kind === ...` becomes `advance?.kind`, one widened status arm takes `as const`, and the Expo notification fixture keeps `data` required because the dismissal cases assign through it. 631 test files pass, 6222 tests, unchanged. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): typecheck the test files, on a ratchet mobile/tsconfig.json excludes *.test.ts so Metro never compiles tests into the release bundle, and vitest transpiles without checking types. Nothing had ever typechecked a mobile test, which is why a `Record<HostUnion, true>` pin written in one proved nothing and why 144 of the 630 test files had drifted. tsconfig.test.json is that program with the tests put back, behind `typecheck:tests`. Four files stay out: they import the desktop main process or src/shared/child-process, which are written against @types/node, and this program's libs are React Native's, where setTimeout answers a number rather than a NodeJS.Timeout. Pulling that graph in reports ~280 errors about the desktop rather than about mobile; vitest runs those four under Node, which is where they belong. The CI gate is a ratchet rather than the raw typecheck, modelled on check-ts-nocheck-ratchet.mjs: 126 files still fail, so the gate freezes that set and fails when a file that checks today stops checking, or when a baseline entry starts checking and was not pruned. The list may only shrink. Why not zero: 180 of the remaining 510 errors are one seam — tests locate mocked react-native components by string name, which `ElementType` does not admit — and closing it means either 180 casts or a global JSX declaration for the mocked names. That is a design decision, not a mechanical fix, so it is left for a follow-up rather than made here. The rest are smaller clusters of the same kind: vi.fn mocks assigned into typed slots, call-arg tuple indexing, and createElement props fixtures. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile-recorder): correct the corpus counts and the salvage claim The oracle section still quoted the corpus as 368 scenarios and 727 goldens; it is 393 and 778, and the three replay suites report 781 tests. Each number now names the command that measures it. "No golden carries one" was the load-bearing error: 44 goldens carry a recorded `reply-salvage` today, starting with the push-test unknown-reason scenario stablyai#21176 added for exactly that purpose. The paragraph claimed the observation pins an absence when on those families it pins a recorded drop. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): pin the tests-typecheck ratchet's parser The gate reads tsc's output, and tsc indents the "Overload 1 of 2, ..." detail under an error. Counting those as filenames would write unparseable entries into the baseline and leave the gate unprunable, so the parser is pinned on that shape as well as on the added/stale diff. Written against the gate itself: it flagged this file before the directive it carried was removed, which is the end-to-end proof the spawn half works. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): await the timer advances the act() rewrite dropped Rewriting `await act(async () => vi.advanceTimersByTimeAsync(n))` into a braced body left the returned promise floating at 27 sites, so the advance was no longer ordered before the assertions that follow it. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): unshadow MobileHostCard's .tsx suite A wildcard `include` keeps only the higher-priority extension, so MobileHostCard.test.tsx sat outside every tsc program while MobileHostCard.test.ts existed beside it. Its one error is the same react-test-renderer seam its sibling is baselined for. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): census every test file into the typecheck program The ratchet diffs only files that error, so a test excluded from tsconfig.test.json or shadowed by a sibling extension left the gate silently. Every *.test.ts(x) on disk must now be in the program or named in TESTS_OUTSIDE_PROGRAM with its reason. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(shared): make the enum helpers refuse the ways they can prove nothing openEnum takes a `const` T so a bare literal keeps its arms rather than widening to string. hostUnionArms blocks inference of U with NoInfer and defaults it to never, so a call that omits the host union — where the record would only pin itself — no longer compiles. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * docs(mobile): describe the census and correct the baseline count Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): give the push fixture cast its SAFETY rationale Widening the pre-existing cast made the changed-code gate attribute it as a new finding. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): build the push fixtures as typed notifications Replaces the `as unknown as` cast with Expo's own types, filling FirebaseRemoteMessage and its notification once in two builders, and passes the data payload in rather than mutating through an optional member. Typing the fixture showed one assertion comparing the scheduled content against the whole arriving content, which only held while the cast let the fixture omit the two members the presenter drops; it now names the four members the presenter forwards. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): keep the grouped-question advance read non-optional `advance?.kind` let an absent advance take the null-draft branch instead of failing. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): run the tests-typecheck ratchet on Windows Spawns tsc's JS entry on this Node instead of the node_modules/.bin shim, which is a POSIX shell script that Windows resolves to tsc.CMD and then appends .exe to. Parsed paths are normalised to POSIX so a Windows run does not read every baseline entry as both stale and added. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(mobile): close the ratchet's @ts-nocheck hole and read tsc once tsc exits 0 on a @ts-nocheck file, so a baselined test could be "fixed" with one line, pruned, and never checked again; the census now names any program test file whose leading comment carries the directive. `--noEmit --listFiles` answers both questions in one pass, so the gate spawns tsc once rather than twice. Corrects the two stale counts, and states hostUnionArms' real reason for living in the schema module now that tests are typechecked. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What this is
The last step-7 PR of the mobile RPC foundation: the 35 unchecked reply readers in the files, dictation, host-screen and agent-history operations become zod-checked readers through
rpcResultVariant, the same shape as the session (#21089), tasks (#21169, #21246) and notifications/terminal/transport (#21176) domains. With this mergeUNCHECKED_RPC_READERSis empty andunchecked-rpc-reader-boundary.test.tsfails on the first unchecked reader anywhere undermobile/appormobile/src.A checked reader validates the reply at arrival. A good reply produces the same screen and the same bytes as before; the recorded goldens prove that for every scenario. A reply the old code would have crashed on, or rendered as an empty list with no error line, now fails on purpose with a message naming the method, or the call site's own copy where it had one.
This is a behaviour change on the malformed-reply path only. No method, params, options, timeout or acceptance policy moved at any site, and released native-app RPCs are untouched.
Diff composition (head
8bce8107fd, vsorigin/mainat7e2ebac318)*-reply-schema.tsmodules (files ×4, dictation, host-screen, agent-history) with unit pins; 35 readers switched; consumer casts the checked value makes unnecessary deleted, the two AiVault row casts kept with aSAFETY:line (rows stay opaque becauseagentis echoed back to the host)modeis forwarded as a string instead of a closed enum with a?? 'toggle'default (round 1 F3: the default would have been a good-reply change with no golden); the repo iconsourceenum is removed from the schema and the mobile types widened, because no consumer reads it and a closed enum would have dropped a whole icon on a future host source;src/shared/execution-host.tswidensgetRepoExecutionHostId's parameter to loose strings (source-compatible; desktop callers passRepo).catch(() => [])/null(round 1 F2), so decorative labels fall back exactly as on mainunchecked-rpc-reader-inventory.ts: the seven lines of this batch dropped; after main's #21176 and #21246 that leaves the list empty; the boundary test keeps main'sobserved.size === inventory.lengthform and its 400-file scan floor is what keeps that equality from being vacuoussettings-read-operations.test.tspins that a bound descriptor'sinterpretsurvives being passed detached (settlePreviewSendrelies on it; mutation-checked)The delta, complete
Decode against
origin/mainthrough each golden'svaluespool, committed trees, reproduced by the lead.baselinealone)Every moved checkpoint in the 22 sits on
result-absent,result-null,inner-ok-missing,inner-false-string-errororinner-false-object-error. Nonormalorpreludecheckpoint moved. Families: aivault-history, files-explorer, files-ownership, files-preview, files-tab-doc, session-content-create, settings-resume-metadata, speech-setup-sheet.What the checked reader projects where main projected something else:
TypeError: Cannot read properties of undefined (reading 'content' / 'isImage' / 'kind' / 'worktree' / 'state' / 'capabilities' / 'sessions' / 'repos')The host sent a reply this app could not read (<method>)files is not iterable/entries.filter is not a functionas the screen's error row, or "No files found" over a refused reply{content: undefined, truncated: undefined}; preview/diff: "Binary preview unavailable" for a refusalmodels: undefinedand crashed the next refresh on.someUnable to load previewpreviewErrormaps the named error back to the same text)Enums
Six closed arm sets: speech
providerandstatus, workspacegroupByandsortBy, Node's platform list, and the three repo-icon branches. Each is pinned to the host's own union in the schema module, where mobile'stsclooks:hostUnionArms<HostUnion>({ arm: true, … })inzod-salvage.tsspells the list as aReadonly<Record<Union, true>>, so an arm the host adds is a missing property and one it drops is an excess property; the icon branchessatisfies Readonly<Record<RepoIcon['type'], z.ZodType>>. Three mutations (dropmanual, add abogusprovider, drop the image branch) each failtsc. The tests iterate the exported lists so every pinned arm is proved to survive the parse.pullfrog caught that the first push promised these pins and had none. Adding them in the test files, as the earlier step-7 PRs did, would have pinned nothing:
mobile/tsconfig.jsonexcludes*.test.ts, and a coverage record there stays green when a key is dropped. Those earlier test-side pins are a follow-up.The dictation
modeis forwarded as a string rather than pinned (round 1 F3) and the repo iconsourceis left to pass through (round 1 F1), for the reasons in the diff table. Everything else staysz.string().Sites left unchecked, and why
Seven sites read nothing from the reply beyond the acceptance verdict, or discard the interpretation (
files.writeTerminalArtifact,speech.models.download,speech.dictation.start/chunk/cancel,ui.set).speech.dictation.finishreads the transcript through a guarded member read after a staleness guard, and a schema check would run before that guard, reporting an unreadable reply for a dictation the user had already superseded where main returned silently; that read is fenced by the raw-port inventory. The full table is in the lane report.Review
Round 1 (simplicity): four findings, all applied. F1 the repo-icon
sourceenum; F2 the repo-metadata total-schema containment; F3 the dictation-mode default; F4 a pre-existing preview staleness guard (note only). Round 2 (fresh reviewer): ship as-is; three round-1 fixes reproduced, before-pictures verified at main, decode rebuilt independently; four low items folded (two wrong comments, a report overstatement, two dead exported types). Then a citation audit (12 of 42file:linecitations wrong, two past end of file, one naming a symbol that does not exist; all fixed), a throw-path audit (33 interpret sites, none unhandled; the one fire-and-forget site is total viaz.unknown()), and the detached-interpretpin.Gates (all on
8bce8107fd, frommobile/)tsc0 (mobile, and roottsconfig.node.jsonfor the shared helper) · fullvitest run631 files, 6217 passed, 6 skipped on2d9b581b56; the enum-pin commit re-ran host-screen, dictation, transport and the shared salvage suites · recording suites with the four mutant suites 22 files, 965 passed, 3 skipped ·oxfmt --checkclean ·oxlint0 (2 pre-existing warnings in onboarding tests this PR does not touch) · recording pin5052501588is an ancestor of head and the corpus reproduces from it.The red
tests node 24 7/8shard isterminal-pane-hook-order-parity.test.tsexpecting 209 hooks and finding 211; it fails identically onorigin/mainat7e2ebac318and this PR touches nothing undersrc/renderer/src/components/terminal-pane.A main repin follows this merge, as with every step-7 PR. After it, the unchecked-reader inventory is closed.