Repository navigation
fix(mobile): the page bridge accepts every reply native accepts and settles what it refuses (OTA phase C, C0.8) - #21511
Conversation
… C0.8) C0.5 pinned `baseline` to its own branch commit, which the squash-merge made unreachable, so `rpc-recording-pin-guard.mts ancestry` fails on main and `--record` refuses to run at all. Repin to main's tip and refresh every header from it. Header-only, and the corpus proves it: across all 787 goldens exactly two distinct lines changed, the old `baseline` and the new one. `recorderSha256` did not move, because nothing under the recorder's own directory did. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…accepts
`BridgeReplyPayloadSchema` required `_meta` on both arms. The predicate the
native client applies to a reply off the wire, `transport/rpc-response-shape.ts`,
requires none, and `src/shared/runtime-rpc-envelope.ts` — the envelope clients
and runtimes share — makes `_meta` optional on a failure with a nullable
`runtimeId`. The page's reader was strictly narrower than the transport it
stands in for, so replies the phone accepts today were refused, dropped with a
diagnostic, and settled nothing.
The reader is now that predicate itself, imported rather than restated: one
module owns the shape, and a widened reader is safe in both directions. `{ ok:
true }` with no `result` key stays refused, because `isRpcResponse` drops it too.
Killer test: `the reply reader is the native acceptance predicate` compares the
page's verdict against `isRpcResponse` over eleven payloads; six of them were
red before this change.
Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
A host frame the page's reader refuses was reported and dropped, and the request it answered stayed pending for the life of the document. A screen has no recovery from that: `sendRequest` never settles, so nothing rerenders and nothing retries. The page now salvages the id out of the refused frame, through the same caps the reader applies, and settles it — but only when it already holds that exchange, so a salvaged id reaches nothing the page did not open itself. A request rejects with `BridgeReplyRefusedError`, which carries the refusal and is now marked delivery-unknown at construction: the shell answered, so the desktop has already run the request and a caller told this was a definite failure would offer to retry what already happened. A subscription ends the way a refused `subscribe` ends today. `bridge-rpc-client.ts` was at the 300-line ceiling, so the inbound routing moved to `bridge-client-inbound-frames.ts` and the diagnostic vocabulary, which both sides raise, to `bridge-client-diagnostics.ts`. No `max-lines` disable. Killer tests: `settles the request a reply it could not read was answering, on the same turn` (hung to a 5s timeout before) and `ends the stream an event it could not read belonged to`. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…t the pin
The class this harness was landed to name is closed, so the pin says so:
`reply-meta-required` is 0 and has no exclusion reason, which is what
`divergence-classes.test.ts` now requires of any class the run is allowed to
count. `BRIDGED_PARITY_EXCLUSIONS` gives each remaining class the reason it is a
bound on the claim rather than a defect, the run prints the excluded total
beside those reasons, and one assertion states the whole claim: nothing diverges
that no predicate has named.
Measured, not argued, for `params-undefined`: all ten scenarios that send an own
property valued `undefined` already record the key as absent from the bytes
their request put on the wire — `tw-smart-search-all-providers` records
`{"filter":"assigned","limit":50}` with `workspaceId` already gone — so the
bridged run sends the identical frame. What differs is the object
`ScriptedRpcTransport.complete` matches a scenario step against, one level above
any serialization. The projection named as the fix is not where it lives:
`projectMobileRpcRequestParams` rewrites `worktree.ps` alone, none of the ten
calls it, and the bridge host forwards into the same `StableLogicalRpcClient`
the native screens hold, so there is no shell-side copy to move.
`divergence-evidence.test.ts` asserted the narrow reader that the `_meta`
widening removed; it now pins that the counterfactual changes no verdict, which
is what makes it a detector for that reader coming back.
Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…enario The `params-undefined` arm named a class from two facts that never met: the run threw, and the scenario somewhere scripts a param key valued `undefined`. Any failure inside those ten scenarios was that class, reported by nothing. A seeded wire bug — one extra own key on every request's params — put 627 goldens in `unclassified` and still left `params-undefined` at exactly 33, all corrupted; scoped to `linear.listIssues` alone it stayed green. The evidence now carries the step the scripted transport refused, the paths the scenario values `undefined` on it, and every path where the params that arrived differ from the ones it scripts — read off the frames the page posted, not off the message. The class needs every path that moved to be one of the scripted `undefined` ones, and at least one to have moved. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
Important
The new refused-frame path ends a page subscription without telling the shell, which leaks the host's subscription slot. One inline comment.
Reviewed changes — full diff (799 files): the 787 golden changes are a baseline-only repin, verified below; the behavioral surface is 11 source files under mobile/src/mobile-web-shell/bridge/ and mobile/src/test-support/.
_metawidening.BridgeReplyPayloadSchemais nowz.custom<RpcResponse>(isRpcResponse), the native acceptance predicate imported rather than restated. It is strictly wider than the oldz.looseObjectunion on both arms, so no reply the phone accepted before is refused now; the new test pins agreement withisRpcResponseover 11 payloads.- Refused-frame settlement. New
createBridgeInboundFrameReaderreports a refused frame, salvages its id viareadRefusedBridgeFrameId, and settles the exchange the frame named: a refusedreplyrejects the request delivery-unknown, a refusedeventends the stream.BridgeReplyRefusedErrornow carries the delivery-unknown mark. - File split.
BridgeRpcClientDiagnosticand the inbound reader move intobridge-client-diagnostics.ts/bridge-client-inbound-frames.ts. - Parity ratchet.
BRIDGED_PARITY_EXCLUSIONSnames each remaining class;reply-meta-requiredcloses to 0,identicalrises 24→396, andresult-absent-settlement338→341 absorbs a shuffle out ofwrite-ordinal13→10.
Verified independently: every changed golden line is exactly one of two distinct values (b4dfad0a… → f24f38bd…, 787 each), so no golden body moved; the repin commit touches only mobile/rpc-foundation; and the new pin is an ancestor of origin/main.
ℹ️ Nitpicks
divergence-evidence.ts:19-25—withReplyMeta's doc still calls_meta"the one field the page's reader demands and the wire the page stands in for does not." After this PR the reader demands no_metaon either arm, which the PR's own envelope comment states; the helper's doc is now false.divergence-classes.ts:56-57—classifyBridgedParity's doc still says "nearly every golden here is refused some reply for the missing field," which the widening removes.divergence-classes.ts:116—BRIDGED_PARITY_BASELINE's doc says the ratchet "moves down as a class closes and never up," butresult-absent-settlementrose 338→341. The inline comment explains the shuffle; the top-level sentence now contradicts the table.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…end it Ending a stream deletes the page's record and posts nothing back. That is right for `end` and `error`, where the shell has already retired it, and wrong for a frame this reader refused: the shell is still serving that stream, so later valid frames on the id were dropped with no diagnostic, no ack went back, and the only release left was the host's overflow backstop, which counts unacked frames and so never fires on a stream that has gone quiet. A newer shell adding a member to a closed list — a new `binary.format`, say — lands exactly there. `abandon` posts the cancel and tells the listener; `failExchange` picks it over `end` for the one path where the shell has not let go. Six goldens move to a new named class for what the cancel changes in the replay. The unsubscribe it publishes is a physical payload the native run has no counterpart for, and it takes the recorder's next occurrence name for that method, so the scenario stops matching before there is a recording. Four came from `result-absent-observation` and two from `write-ordinal`; the sum over the corpus is unchanged and nothing stopped replaying byte-identically. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Each class in the pin is an upper bound and `identical` a lower one, so nothing stopped a single class being loosened on its own: raising `params-undefined` by one passed every assertion the flagged run makes. The comment already claimed the total was fixed at the corpus; this counts the goldens on disk and checks it. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
`oversized` is decided on the raw string and `malformed-json` on a parse that did not finish, so neither frame ever yields an id and neither can settle the exchange it was answering. Nothing on the page settles those: `close` or a shell replacement releases the slot, and otherwise it is held for the life of the document. Neither arises from a host that is behaving — it chunks at the frame cap and answers a body over `BRIDGE_MAX_REPLY_BYTES` with an `error` frame — but the boundary was unstated and untested, which is how it reads as covered. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The comment said the pin moves down and never up, two lines above a class that went from 338 to 341 when a fix changed which difference a run meets first. Both are true of different halves of it, so say which: `identical` only moves up, a class only moves down, and two excluded classes may trade members in one edit that leaves the sum alone. The sum is now checked, so that trade cannot hide a golden that stopped replaying byte-identically. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
|
Round 1 fixed on |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the incremental delta since the prior pullfrog review (a1f37c39 → b6897e70, 9 files): the refused-frame path now releases the host subscription it was leaking, and the parity classifier was reworked around the throw it has to name.
- Refused-frame settlement releases the shell slot.
failExchangenow distinguishes a stream the shell already retired (anerror/endframe, still routed to the silentend) from one it still serves (a frame the reader refused, routed to the newBridgeClientSubscriptions.abandon, which posts thecancelthat is the host's only per-stream teardown before notifying the listener). This closes the leak the prior review flagged. params-undefinedreads evidence, not the message. The class now requires every param that moved to be one the scenario valuedundefined, read from the refused step, the scriptedundefinedpaths, and the params on the request frames the page posted, so a seeded wire bug inside the same scenarios lands inunclassifiedinstead of being excluded by name.- New
result-absent-stream-releaseclass (6). The absent-result partition delivered on a stream now throws, because thecancelrenames the recorder's later occurrences before there is a recording to compare;result-absent-observation7→3 andwrite-ordinal10→8 pay for the six members. - Corpus-size pin. A test pins the sum of
BRIDGED_PARITY_BASELINEto the golden files on disk, so one class cannot be loosened without another paying, and the unparseable refusals (oversized,malformed-json) are named as the two that can settle nothing.
Verified by running the flagged suite (RPC_FOUNDATION_BRIDGE=1): 788 passed, 787 goldens, unclassified 0, and the counts reproduce the new baseline exactly (identical 396; 341 / 3 / 6 / 33 / 8). The three changed unit suites pass (75 tests).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
A count is blind to a trade. Every predicate reads the scenario rather than the frame the page refused, so a golden that started refusing for real can walk into an excluded class while another walks out, and the counts, the sum and the `identical` floor all still hold. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the incremental delta since the prior pullfrog review (b6897e70 → 2f3ccb76, 1 commit, 3 files): the three small excluded classes are now pinned golden by golden, not only by count.
- Membership pin. New
BRIDGED_PARITY_MEMBERSnames the golden in each class at or belowBRIDGED_PARITY_NAMEABLE(8):result-absent-observation(3),result-absent-stream-release(6),write-ordinal(8).bridgedParityMembershipDriftreports both an arrival and a departure, so one golden leaving a class as another arrives no longer moves no number. - List tied to the count. A unit test requires every class with a baseline of 8 or fewer to be listed with exactly
BRIDGED_PARITY_BASELINEdistinct ids, so the membership and the count cannot drift apart; two more tests pin the drift rule on a synthetic trade and confirm a too-large class is not named. - Suite consumes it. The flagged replay asserts
bridgedParityMembershipDrift(members)is empty against the run's own members, and the summary prints member ids for nameable classes through the sharedBRIDGED_PARITY_NAMEABLEconstant.
Verified on this head: the classifier unit suite passes (15 tests), and the flagged replay (RPC_FOUNDATION_BRIDGE=1) passes 788 tests over 787 goldens, unclassified 0, with the printed membership matching BRIDGED_PARITY_MEMBERS exactly.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

What this is
OTA phase C, step C0.8: the page bridge carries every golden the native transport carries, minus the classes a named predicate excludes with its reason printed. Bridged replay goes from 763 divergences to 391, all excluded; 396 of 787 goldens now replay byte for byte, up from 24. Released phones unchanged; no RPC operation changes; no golden body moved.
Fixes
_metawidening (372 goldens → 0).BridgeReplyPayloadSchemais nowz.custom<RpcResponse>(isRpcResponse): the native acceptance predicate imported, not restated, so the bridge is the fourth call site of the one module. Killer test: "agrees with the native predicate on …" (six of eleven payloads red before), "hands a reply with no_metaback verbatim".replythe page cannot read now settles the request it was answering on the same turn (hung to a five-second timeout before), and aneventit cannot read ends the stream it belonged to. Killer tests: "settles the request a reply it could not read was answering, on the same turn", "ends the stream an event it could not read belonged to". Forced a file split at the 300-line cap, no disable.result-absent-settlementandresult-absent-observation(recorder-injected{ok:true}withoutresult, refused by the bridge and byisRpcResponsealike),write-ordinal(the recorder stamps the logical send above the wrapper and the subscribe payload below it; wire order is proven preserved on every frame), andparams-undefined(below). The pinned baseline moves only down; the excluded count is printed.Members moved between excluded classes, never out of the identical set: the refused-reply settlement makes a rejection arrive, and it now differs before the ordinal that also moved does; the refused-event cancel (round 1) makes the shell publish an unsubscribe the native run has no counterpart for, which takes the recorder's next occurrence name for that method, so six recorder-injected goldens throw before there is a recording to compare (
result-absent-stream-release, same injected cause). A test holds the baseline to the corpus size on disk, so a shuffle cannot hide a regression, and the comment states which half of each pin moves which way.params-undefinedis a recorder observation, not a wire differenceThe brief asked for a page-side projection. Measured: all ten scenarios that send an own property valued
undefinedrecord a wire payload with the key already absent (tw-smart-search-all-providersrecords{"filter":"assigned","limit":50}forlinear.listIssues,workspaceIdgone), and the native path drops it too. What diverges is the objectScriptedRpcTransport.completematches a scenario step against, which is the params as the shell's client received them, one level above serialization (Request params mismatch, not a moved byte).projectMobileRpcRequestParamsrewritesworktree.psonly and none of the ten call it, and the shell builds its host from the sameStableLogicalRpcClientthe native screens hold, so there is no separate path to keep. Excluded by predicate with that proof in the classifier and the suite header; a wire encoding forundefinedwould serve no product consumer.Repin
C0.5 pinned the corpus to its own branch commit, which the squash made unreachable, so main's RPC recording pin was red at
f24f38bd41. The first commit here repinsbaselineto main's tip and refreshes 787 headers (exactly two distinct changed lines across the corpus, zero non-baselinelines,recorderSha256unmoved because nothing under the recorder's directory changed); it also ships alone as #21510 so main goes green first.Review round 1 (SHIP AFTER FIXES)
The
params-undefinedpredicate classified on any throw in the affected scenarios: a seeded wire bug (one extra own key on every request's params) left all 33 excluded while 627 others went unclassified. It now reads the refused step, the paths the scenario valuesundefinedon that step, and every path where the arrived params (read off the request frames the page posted) differ from the scripted ones; the class requires every moved path to be a scripted-undefinedone, so a key that arrived unscripted lands inunclassified. A refusedeventwent throughfailExchange→subscriptions.end, deleting the page record with nocancel, so the shell's stream leaked until the overflow backstop; the reader now abandons it (cancel posted, listener told) and keepsendforerror/endframes the shell already retired. The baseline is held to the number of golden files on disk. A test pins thatoversizedandmalformed-jsonrefusals salvage no id and settle only onclose, delivery-unknown, and that neither arises from a host that chunks at the frame cap.Verification
Mobile tsc 0; full mobile suite 666 files / 6805 tests; flagged parity 788 passed (about six minutes now that 396 goldens replay twice; C1.6 shards it when it becomes the default gate); recorder suites unflagged 979 tests; ratchet OK at 126 grandfathered; changed-code quality 0 new findings across 11 files; React Doctor changed-lines clean; oxlint 0 with the client split into
bridge-client-inbound-frames.tsandbridge-client-diagnostics.tsat the 300-line cap; anti-slop 0; oxfmt clean; pin guard ancestry and reproduce OK. Two intermediate commits leavedivergence-evidence.test.tsred in isolation because it pinned the narrow reader the first fix widens; the fourth commit corrects it and the head is green.Round 2
Fresh reviewer at
b6897e7043: SHIP AS-IS, with one hardening request taken: the three classes of eight or fewer goldens are now pinned by member id (BRIDGED_PARITY_MEMBERS), not only by count, and the flagged parity summary reports membership drift in both directions. A count is blind to a trade; the ids are what notice. Verified on a detached tree at2f3ccb7648: mobile tsc clean, classifier tests green, flagged parity 788 passed, full mobile suite 6821 passed, goldens byte-identical to main.