Skip to content

feat(mobile): paint browser screencast frames through web siblings (OTA phase C, C6.2) - #21754

Merged
Jinwoo-H merged 5 commits into
mainfrom
ota-c6-2-frame-path
Sep 20, 2026
Merged

Jinwoo-H merged 5 commits into
mainfrom
ota-c6-2-frame-path

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​803 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​796
Prod 15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​329 $\color{#cf222e}{\Huge{\mathbf{−}}}$​82 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​247

Summary

Phase C, C6.2: the browser pane's frame path on the web (design-ota-c6.md §1 (b), §4; rulings rulings-ota-c6.md 5 and 6). Five commits on ee61e3bd41, inert: no route reaches the pane (it mounts from the session screen, C7's route), no manifest entry, no grant declared by any route.

The pane's frame writes are written against React Native's native-prop writer, which does not exist on React Native Web: an Image or View ref there is the DOM node itself, so both writes throw (setNativeProps is not a function, pinned by the sibling's test against a DOM node) and the pane never shows a frame. Three .web.ts siblings, each for a measured gap and each with its reason in web-entry/web-overrides.json:

gap sibling what it does
the image and layer writes browser-frame-layer-paint.web.ts (the two writers move out of mobile-browser-frame-state.ts into browser-frame-layer-paint.ts first) paints the frame as a background-image on the element RN Web sizes and flips the double buffer with one opacity write per layer; the pane still never re-renders while it streams
the flip whenBrowserFrameDisplayable in the same sibling, armed from use-mobile-browser-frame-apply.ts a background-image write fires no load event, so the offscreen layer would never become visible; the sibling arms the flip from new Image() + decode(), the flip itself shared with the native onLoad path through browser-frame-layer-flip.ts, and a stale decode cannot flip (guarded on the current frame URI)
the data URI browser-frame-data-uri.web.ts keeps the base64 the bridge already carried (BrowserScreencastFrame gains an optional b64, set only by decodeBridgeScreencastFrame; image stays the field every consumer reads) instead of encoding the bytes back into the same string

Per ruling 5 the pane asks for binary frames only when the shell granted the lane (use-browser-binary-screencast-grant.ts answers true natively, its .web.ts reads init.grants.native), and otherwise withholds the binary listener and renders its existing stream-error state with "Update the Orca app to stream browser tabs here." The grant name is screencastBinary (C6.1's, #21758; verified against the manifest's one-token pattern and both open readers; a local constant here until both have landed, then an import of bridge/bridge-screencast-grant.ts); it is absent from the shell's implemented set until C6.1 lands, so today every web pane takes the error branch, which is the correct and inert answer.

commit what
8917dd8280 pullfrog: the accessibility <img> note said it keeps the mount frame for the life of the pane; measured against the real RN Web Image, a render from the pane's other state moves its src with the source prop while the background stays where the imperative write put it, so it holds the frame the pane last rendered with rather than the one on screen; the one case became two (streaming writes leave it alone; a render moves it)
0d9d5feaeb round 2: a test renders the real react-native-web Image through react-dom into happy-dom, finds the child it painted by the mounted frame rather than by position, hands the host to the sibling and asserts the write lands on that element (red-first: pointing the sibling at lastElementChild reds it while the four hand-built cases stay green; the host is a DIV with children DIV, IMG, the first carrying the inline background-image); a second case pins that the accessibility <img> keeps the source it mounted with, because the streaming path writes styles and never props. react-native-web ships no type declarations, so the component comes through createRequire with its one prop declared rather than asserted (a bare import is an implicit any and drops the file out of the tests-typecheck ratchet). The docstring now says the frame path adds no render, and that a render from the pane's other state (address focus, a dialog, the view mode, zoom) repaints both layers from renderedFrameSource, natively too through setNativeProps, with the next streamed frame restoring the buffering
1bdda61add round 1, CodeRabbit and pullfrog (the same finding three times): onUndecodable freed the pending layer unguarded while onDisplayable was guarded on the current frame, so an older frame's late decode failure stranded a newer frame repointed onto the same layer at opacity 0 (web-only; native's single Image source cancels the older load); both arms now answer for the frame they were armed with through one isCurrentFrame() predicate, red-first with exactly that sequence; a case for the stale-decode guard that reds when it is deleted (the harness settles one decode at a time, keyed on its source); the "no re-render" claim counted where React is (ten frames, each of the three state setters called once, on the mount frame) instead of asserted by two opacity strings; the overrides list rebuilt from main's bytes plus the new entries so the diff touches only them
00223f75fb the grant is screencastBinary (C6.1's), pinned against MobileWebBundleRouteSchema itself with the dotted placeholder beside it as the failing case: the placeholder browser.screencast.binary failed GRANT_NAME_PATTERN, so a route declaring it would have been refused by the bundle before any shell saw it
401884e8bd the three siblings and the grant gate described above

Measured

Re-encode cost per frame with the buffer shim the page bundle resolves (not Node's builtin, which is ~20× faster and would understate it; the test imports the shim and says why):

jpeg bytes re-encode carried b64
45,815 0.256 ms < 0.0001 ms
60,528 0.336 ms < 0.0001 ms
161,349 0.941 ms < 0.0001 ms
463,942 2.608 ms < 0.0001 ms

Red first

  • Paint siblings: the test failed to resolve both modules before they existed; it also drives the native writers against a DOM node and pins the throw.
  • Flip: with the arm removed, "flips only once it has decoded" and "keeps streaming past the second frame" red.
  • b64 passthrough: the bridge frames test red on the decode assertion until the decoder set it.
  • Grant gate: with the guard removed, "never subscribes, and says so with the stream-error state it already has" red.

Not in this PR

  • The shell's encoder, drop rule and the screencastBinary grant in the implemented set (C6.1, in flight). Until it lands the granted branch of the web hook's test is a page-side read: the port-pair harness passes route grants straight into init without filtering through the shell's implemented set, so it is not an end-to-end shell verdict.
  • The mobile-mode area budget and the two inputs on the 16 px seam (C6.3 + C6.4, next PR); certification and the render check (C6.5); device proof (C6.6).

Verified

  • Lane gates on 401884e8bd: mobile tsc, ratchet, whole-tree oxlint, oxfmt, root oxlint on the changed files, full mobile suite (733 files, 8267 passed, no Errors line; the lane reported 8268, both reviewers and the lead measured 8267), config/scripts with mobile deps required (223 files, 2053 passed; the overrides census green on the three new entries), changed-code quality (20 files, 0 findings) and react-doctor against ee61e3bd41, merge-tree max-lines clean, machine-path grep clean.
  • Round 1 (on 401884e8bd): approve with folds, all in 1bdda61add; the frame-loss sequence reproduced in a throwaway tree; CodeRabbit (Major) and pullfrog found the same guard.
  • Round 2 (on 1bdda61add): approve; all six mutations red as claimed; notes: no test pinned the real RN Web <Image> DOM shape the sibling rests on (folded); a render from the pane's other state rewrites the imperative frame write from renderedFrameSource, natively too (docstring corrected); the accessibility <img> keeps the mount frame (recorded, not fixed: the frame is not readable content); frame identity is the URI, so two byte-identical frames share one, which only matters for a decode failure on bytes that just decoded.
  • Lead reproduction: verify-gates.sh on 401884e8bd, 1bdda61add, 0d9d5feaeb and 8917dd8280 against ee61e3bd41 (mobile 733/8267, 733/8272, 733/8274 and 733/8275, config 2053, exit 0, machine paths 0; merge-tree clean against 8dee68a8d1); on 1bdda61add, dropping the guard on onUndecodable reds the new case and nothing else ; removing the grant guard reds the never-subscribes case; commenting out the flip arm reds both web frame-apply cases; the only casts without a SAFETY: line predate the PR.

Part of the mobile OTA plan (Phase C). Reference PR #13386, never merged.

…TA phase C, C6.2)

The pane's frame path is written against React Native's native-prop writer, which does
not exist on React Native Web: a ref there is the DOM node, so both writes throw and the
pane never shows a frame. Three `.web.ts` siblings, each for a measured gap.

- The image and layer writes move out of `mobile-browser-frame-state.ts` into
  `browser-frame-layer-paint.ts`, whose sibling paints the frame as a `background-image`
  on the element RN Web sizes and flips the double buffer with one opacity write per
  layer. The pane still never re-renders while it streams.
- A `background-image` write fires no load event, so the offscreen layer would never
  become visible. The sibling arms the flip from an image decode instead, and the flip
  itself is shared with the native `onLoad` path rather than written twice.
- The data URI keeps the base64 the bridge already carried instead of encoding the bytes
  back into the same string. Measured in this tree against the `buffer` shim the page
  bundle resolves: 0.256 ms per frame at 45,815 bytes and 2.61 ms at 463,942, against
  under a microsecond for the carried string.

Per C6 ruling 5 the pane asks for binary frames only when the shell granted the lane, and
renders its existing stream-error state otherwise, so a page never waits on frames a shell
without the encoder cannot send. The grant name is a placeholder until C6.1 reports it.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 2acf2e22-3593-4880-9358-2c5c0793e3c0

📥 Commits

Reviewing files that changed from the base of the PR and between 0d9d5fe and 8917dd8.

📒 Files selected for processing (2)
  • mobile/src/browser/browser-frame-layer-paint.web.test.ts
  • mobile/src/browser/browser-frame-layer-paint.web.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • mobile/src/browser/browser-frame-layer-paint.web.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The browser pane now checks binary screencast grants before creating a stream subscription. Bridge frames preserve sender-provided base64 data, with byte encoding as a fallback. Frame painting and layer state logic moved into shared native and web modules. Web frame application now waits for image decoding before flipping double-buffered layers. Tests cover grant handling, URI generation, platform painting, decoding, and stale frame replacement.

Priority: ➖ Normal

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 34.78% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 46 functions across 20 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description gives detailed change scope, rationale, implementation details, exclusions, tests, and verification results. It does not follow the required template structure and omits the required l… Add the required template sections. Include a valid Fixes #... issue reference, attach before/after visual proof or state N/A with a reason, complete the testing and checklist items, and address AI disclosure, review, agent-skill bounda…
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the primary change: web-specific rendering of browser screencast frames in the mobile OTA Phase C work.
Full details: Description check

Explanation

The description gives detailed change scope, rationale, implementation details, exclusions, tests, and verification results. It does not follow the required template structure and omits the required linked issue declaration, visual proof or an explicit N/A explanation, checklist status, and several required review sections.

Resolution

Add the required template sections. Include a valid Fixes #... issue reference, attach before/after visual proof or state N/A with a reason, complete the testing and checklist items, and address AI disclosure, review, agent-skill boundary, and notes sections.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 46f0162a-7ca1-4cf1-83a2-8eccebf42470

📥 Commits

Reviewing files that changed from the base of the PR and between ee61e3b and 401884e.

📒 Files selected for processing (21)
  • mobile/src/browser/MobileBrowserPane.tsx
  • mobile/src/browser/browser-frame-data-uri.ts
  • mobile/src/browser/browser-frame-data-uri.web.test.ts
  • mobile/src/browser/browser-frame-data-uri.web.ts
  • mobile/src/browser/browser-frame-layer-flip.ts
  • mobile/src/browser/browser-frame-layer-paint.ts
  • mobile/src/browser/browser-frame-layer-paint.web.test.ts
  • mobile/src/browser/browser-frame-layer-paint.web.ts
  • mobile/src/browser/mobile-browser-frame-state.ts
  • mobile/src/browser/mobile-browser-frameless-stream.test.tsx
  • mobile/src/browser/use-browser-binary-screencast-grant.ts
  • mobile/src/browser/use-browser-binary-screencast-grant.web.test.tsx
  • mobile/src/browser/use-browser-binary-screencast-grant.web.ts
  • mobile/src/browser/use-mobile-browser-frame-apply.ts
  • mobile/src/browser/use-mobile-browser-frame-apply.web.test.tsx
  • mobile/src/browser/use-mobile-browser-pane-layers.ts
  • mobile/src/browser/use-mobile-browser-stream.ts
  • mobile/src/mobile-web-shell/bridge/bridge-rpc-client-frames.test.ts
  • mobile/src/mobile-web-shell/bridge/bridge-screencast-binary.ts
  • mobile/src/transport/browser-screencast-protocol.ts
  • mobile/web-entry/web-overrides.json

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

C6.1 has decided the name: `screencastBinary`, one camelCase token. Replaces the
placeholder this PR landed with while C6.1 was still choosing.

The placeholder was also unusable, which the test added here would have caught:
`GRANT_NAME_PATTERN` in the manifest contract admits a bare name or a `native.`-prefixed
verb and nothing else, so a route declaring `browser.screencast.binary` would have been
refused by the bundle before any shell saw it, and the pane would have taken its
stream-error branch for a reason no screen could report. The name is now checked against
`MobileWebBundleRouteSchema` itself rather than against a restated regex, with the dotted
spelling as the failing case beside it.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

One real bug in the new web flip path: onUndecodable is missing the stale-frame guard that onDisplayable has, so a late decode rejection from an older frame can free the pending layer and strand the pane on the previous frame. Fix is a few lines. Everything else reads clean — the RN Web DOM assumptions check out against [email protected].

Reviewed changes

  • Web paint siblings — browser-frame-layer-paint.web.ts paints each frame as a background-image on the RN Web <Image>'s first child and flips the double buffer with one style.opacity write per layer, replacing the native setNativeProps writes that throw on a DOM ref.
  • Web flip arming — whenBrowserFrameDisplayable is a no-op natively and, on the web, arms the flip from a new Image() + decode() probe because a background-image write fires no load event; the flip itself is shared with the native onLoad path through browser-frame-layer-flip.ts.
  • Base64 passthrough — BrowserScreencastFrame.b64 is added and set only by decodeBridgeScreencastFrame; the web data-URI sibling reuses it instead of re-encoding through the page's JS buffer shim, with the native encoding as fallback for frames that carried none.
  • Grant gate — the pane requests binary frames only when the shell granted browser.screencast.binary (native always answers true); otherwise it withholds the subscription and renders the existing stream-error state with the app-update message.
  • Writer extraction — the two native writers move out of mobile-browser-frame-state.ts into browser-frame-layer-paint.ts; web-overrides.json gains three reasoned entries for the new siblings.

ℹ️ Nitpicks

  • use-browser-binary-screencast-grant.web.ts:9 defines the placeholder grant as 'browser.screencast.binary', but the PR description names it screencastBinary. Since the web lane turns on only if this string matches the name C6.1 adds to MOBILE_WEB_SHELL_GRANTS, it is worth confirming the exact token before C6.1 lands. The test already restates the constant, so a rename touches both.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…phase C, C6.2)

Round 1 folds on #21754.

The undecodable arm freed the pending slot without checking whose frame had failed, while
the displayable arm checked. Reproduced: frame 2 goes pending on layer 1, frame 3 repoints
the same layer, frame 2's decode rejects and clears the slot layer 1 is holding for frame
3, then frame 3 decodes and the flip is refused because the slot no longer names its
layer. The newest frame sits decoded at opacity 0 behind an older one, and a page that has
gone still sends no further frame to recover with. Web only; native never calls this.

Both arms now answer for the frame they were armed with.

The displayable arm's own guard had no test: deleting it left `src/browser/` and the full
suite green, because the case that exercised it settled both decodes and asserted an end
state both orders produce. The harness now settles one decode at a time, keyed on the
source it was given, and the ordered case reds without the guard.

Also: the paint sibling's opacity test claimed "no re-render" while asserting two style
strings, so it is named for what it checks and the claim is counted where React is —
across ten streamed frames the three state setters are called once each, on the mount
frame. And the overrides allowlist is rebuilt from main's bytes plus the new entries, so
two pre-existing reasons keep their literal em dash instead of a re-serialized escape.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

The delta since the prior pullfrog review (401884e8bd → 1bdda61add) closes the reported stale-decode hole and tightens the two contracts it rests on.

  • Stale decode guarded symmetrically — onUndecodable now answers through the same isCurrentFrame() predicate as onDisplayable, so a late failure from a frame the layer has moved past no longer frees a pending slot a newer frame owns. Verified by tracing the 2→3 repoint path: with the guard, frame-2's rejection is a no-op and frame-3's resolve still settles layer 1.
  • Red-first ordering tests — the new cases settle one held decode at a time, keyed on its source, so the stale-success and stale-failure orderings are observable rather than collapsed into the same end state. Deleting the guard reds the stale-failure case.
  • "No re-render" claim counted — the frame-apply test now counts the three render-triggering setters across ten streamed frames and asserts exactly one write each, replacing the weaker two-opacity-string assertion.
  • Grant renamed to screencastBinary — the placeholder is gone. Confirmed against C6.1 (#21758): its bridge-screencast-grant.ts declares BRIDGE_SCREENCAST_BINARY_GRANT = 'screencastBinary' and adds it to MOBILE_WEB_SHELL_GRANTS, so the web lane's reader matches the shell's implemented set. The new test pins the name against MobileWebBundleRouteSchema and uses the old dotted spelling as the failing case, which GRANT_NAME_PATTERN refuses.

Prior review's inline thread on the missing guard is resolved.

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

…mage (OTA phase C, C6.2)

Round 2 folds on #21754.

Every test for the web paint sibling handed it a `div > div` of its own making, so the
assumption it rests on — that the host's first element child is the one carrying the
frame — was only ever checked against a shape written to match it. React Native Web also
renders an accessibility `<img>` in there, and a release that reorders those children
would keep all of them green while the pane painted nothing.

One test now renders the real component, asks it which child it painted, and checks the
write lands on that one. Pointing the sibling at `lastElementChild` reds it and leaves the
hand-built cases passing, which is the gap. A second case records what the `<img>` does:
the streaming path writes styles and never props, so it keeps the source it mounted with
for the life of the pane, and that is what a screen reader and the image context menu see.

react-native-web ships no type declarations, so the component comes through
`createRequire`, whose return is `any` at its own signature; the one prop it renders with
is declared rather than asserted, and the file stays inside the tests-typecheck ratchet.

The module docstring also claimed more than the code does. The frame path adds no render,
but a render from any of the pane's other state — address focus, a dialog, the view mode,
zoom — repaints both layers from `renderedFrameSource`, which reads `frameUriRef.current`,
so both land on the newest frame whether or not it has decoded. Native clobbers the same
way through `setNativeProps`. Said plainly, along with what restores the buffering.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
mobile/src/browser/browser-frame-layer-paint.web.test.ts (1)

183-212: 🎯 Functional Correctness | 🔵 Trivial | 🏗️ Heavy lift

Add browser coverage for the RN Web painted frame.

browser-frame-layer-paint.web.test.ts runs in happy-dom and checks only style.backgroundImage and the accessibility <img> source. It does not verify raster output. Add a Playwright test with a decodable image fixture, such as FRAME_URI, and assert that the streamed frame renders while the accessibility image remains present.

Source: Learnings


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: ec7757ec-a551-4da1-af31-1877cf317b06

📥 Commits

Reviewing files that changed from the base of the PR and between 1bdda61 and 0d9d5fe.

📒 Files selected for processing (2)
  • mobile/src/browser/browser-frame-layer-paint.web.test.ts
  • mobile/src/browser/browser-frame-layer-paint.web.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • mobile/src/browser/browser-frame-layer-paint.web.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one docstring claim to reconcile with the code it describes.

Reviewed changes

The delta since the prior pullfrog review (1bdda61add → 0d9d5feaeb) is test-and-comment only, and it pins the RN Web DOM shape the new paint sibling stands on.

  • Real RN Web <Image> test — a new describe renders react-native-web's actual Image through react-dom into happy-dom, finds the child carrying the mounted background-image by its URI rather than by child position, and asserts the sibling's write lands on that element. It also records that the accessibility <img> keeps its mounted src across that imperative write.
  • Web paint docstring expanded — browser-frame-layer-paint.web.ts now states that the frame path adds no render at any rate (rather than "never re-renders") and documents the re-render clobber from renderedFrameSource.

The one comment below asks that the accessibility-<img> sentence be scoped the same way, since a re-render also updates its src (and the parallel reason in web-overrides.json still carries the older phrasing).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…phase C, C6.2)

pullfrog is right, and the test carried the same wrong claim. The note said the hidden
`<img>` keeps the frame it mounted with for the life of the pane, two paragraphs after
saying a render from the pane's other state passes `renderedFrameSource` as `source` —
and React Native Web derives that image's `src` from the same prop it paints the
background from, so the first such render moves it.

Measured here rather than reasoned about: rendering the real component, writing a frame
imperatively, then re-rendering with a new source moves the `src` and leaves the
background where the imperative write put it. The two halves are now two cases, named for
what each one shows, and the note says the streaming writes never touch it while a render
does — so it holds the frame the pane last rendered with, not the one on screen.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

The delta since the prior pullfrog review (0d9d5feaeb → 8917dd8280) is doc-and-test only, and it resolves the one docstring claim flagged last round.

  • Accessibility-<img> docstring scoped — browser-frame-layer-paint.web.ts no longer reads as a lifetime guarantee: the streaming writes never touch the hidden <img>, and a render from the pane's other state moves its src because RN Web derives it from the same source the background is painted from.
  • Re-render case added — the real-RN-Web test grew a rerenderWith(uri) harness and a second case asserting the hidden <img>'s src follows a new source prop, so the old "for the life of the pane" claim is now pinned as false. The imperative-only case stays, and accessibilityImageSource throws unless exactly one <img> is present. Verified locally: 11 tests pass.

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

@Jinwoo-H
Jinwoo-H merged commit 6f0fb3f into main Sep 20, 2026
24 checks passed
@Jinwoo-H
Jinwoo-H deleted the ota-c6-2-frame-path branch September 20, 2026 08:30
Jinwoo-H added a commit that referenced this pull request Sep 20, 2026
… carries (OTA phase C, C6) (#21769)

C6.1 (#21758) pinned the frame `decodeBridgeScreencastFrame` hands back with an exact
`toEqual`; C6.2 (#21754) made that decoder carry the wire's `b64` on the frame so the page's
data URI can reuse it. Each PR was green against the main it branched from, and their
squashes together red two of C6.1's cases on main. The pins stay exact and gain the field,
with the encoded string spelled out rather than wildcarded.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Jinwoo-H added a commit that referenced this pull request Sep 20, 2026
…the web seam (OTA phase C, C6.3+C6.4) (#21760)

* feat(mobile): paint browser screencast frames through web siblings (OTA phase C, C6.2)

The pane's frame path is written against React Native's native-prop writer, which does
not exist on React Native Web: a ref there is the DOM node, so both writes throw and the
pane never shows a frame. Three `.web.ts` siblings, each for a measured gap.

- The image and layer writes move out of `mobile-browser-frame-state.ts` into
  `browser-frame-layer-paint.ts`, whose sibling paints the frame as a `background-image`
  on the element RN Web sizes and flips the double buffer with one opacity write per
  layer. The pane still never re-renders while it streams.
- A `background-image` write fires no load event, so the offscreen layer would never
  become visible. The sibling arms the flip from an image decode instead, and the flip
  itself is shared with the native `onLoad` path rather than written twice.
- The data URI keeps the base64 the bridge already carried instead of encoding the bytes
  back into the same string. Measured in this tree against the `buffer` shim the page
  bundle resolves: 0.256 ms per frame at 45,815 bytes and 2.61 ms at 463,942, against
  under a microsecond for the carried string.

Per C6 ruling 5 the pane asks for binary frames only when the shell granted the lane, and
renders its existing stream-error state otherwise, so a page never waits on frames a shell
without the encoder cannot send. The grant name is a placeholder until C6.1 reports it.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* feat(mobile): budget the mobile view's frame area against the bridge cap (OTA phase C, C6.3)

A screencast frame crosses the bridge as one message under BRIDGE_MAX_MESSAGE_BYTES.
Measured here: the phone's mobile view at the native device scale factor asks for a
390x712 viewport at 2x, which is 1,110,720 device pixels, and at the worst case JPEG has
at quality 72 that is a 807,559-byte message against a 655,360-byte cap — 123% of it.

The `.web.ts` sibling holds the mobile view inside that. The budget is computed rather
than written down: the cap, less an envelope this measures from the frame's own shape at
its widest (435 bytes), is what the base64 may occupy; three quarters of that is the JPEG;
divided by one named worst-case constant of 0.545 bytes per pixel it is an area of 901,271
pixels. The phone lands on a device scale factor of 1.80 and a 654,205-byte message, 99.8%
of the cap. A cap that moved and a budget that did not would be a pane going dark on a
page it could have streamed.

Web view mode is untouched, and byte-identical to the native request: there the frame is a
desktop viewport letterboxed into maxWidth/maxHeight, which the page cannot predict, so C6
ruling 1's drop-the-over-cap-frame rule is its only protection. Native is unchanged.

The constants and the assembly move to a third module because a `.web.ts` cannot import a
value from the file it shadows — the bundler resolves the specifier back to the sibling
itself — and two copies of them would drift.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* feat(mobile): put the browser pane's text inputs on the web font-size seam (OTA phase C, C6.4)

The pane has two text inputs, the address bar at 12px and the key row's "Type on page…"
at 14px, and neither went through TEXT_INPUT_FONT_SIZE. In a browser an input under 16px
makes iOS zoom the page on focus and never zoom back, and keyboard-occlusion.web.ts reads
a visual viewport scale other than 1 as "no keyboard" — so one focus would leave the
pane's keyboard lift at 0 for the rest of the typing session. C4.2's failure exactly, on a
screen its census does not walk: that census walks the source-control hub and the review
route, and the pane is in neither until C7 lists a route that mounts it.

The key row's input goes straight onto the seam, whose native value is the theme's body
size, so it renders at the 14px it already did. The address bar is a `.web.ts` split
instead, so native keeps the 12px meta size it has always shown; the input and the label
painted over it move together, or the address would resize on every focus.

The address bar also gets inputMode="url" on the web only. keyboardType is a native enum a
browser does not read, so the page's address bar was falling back to a plain keyboard;
inputMode takes precedence over keyboardType, so it stays undefined on both native
platforms.

One consequence recorded rather than fixed, and pinned in
config/scripts/mobile-web-app-browser-pane-text-inputs.test.mjs: the C4.2 census resolves
an import through .ts/.tsx only, never .web.ts, so it reads the native address style that
no browser loads and reports it as an offender. Whoever lists the pane's route either
teaches resolveLocal the extensions the builder already prefers, or moves the address bar
onto the seam natively at 14px.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* fix(mobile): name C6.1's binary screencast grant (OTA phase C, C6.2)

C6.1 has decided the name: `screencastBinary`, one camelCase token. Replaces the
placeholder this PR landed with while C6.1 was still choosing.

The placeholder was also unusable, which the test added here would have caught:
`GRANT_NAME_PATTERN` in the manifest contract admits a bare name or a `native.`-prefixed
verb and nothing else, so a route declaring `browser.screencast.binary` would have been
refused by the bundle before any shell saw it, and the pane would have taken its
stream-error branch for a reason no screen could report. The name is now checked against
`MobileWebBundleRouteSchema` itself rather than against a restated regex, with the dotted
spelling as the failing case beside it.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* fix(mobile): keep the address field test inside the typecheck ratchet (OTA phase C, C6.4)

`findByType('TextInput')` does not typecheck: a host-component string is not an
`ElementType`, so the file fell out of `tsc -p tsconfig.test.json` and the tests-typecheck
ratchet reported it. Found by reading the ratchet's exit code rather than its piped tail,
which is how it was missed the first time. The element is looked up by its placeholder
instead, and the ratchet is green with 732 test files in the program.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* fix(mobile): answer a frame decode for the frame, not the layer (OTA phase C, C6.2)

Round 1 folds on #21754.

The undecodable arm freed the pending slot without checking whose frame had failed, while
the displayable arm checked. Reproduced: frame 2 goes pending on layer 1, frame 3 repoints
the same layer, frame 2's decode rejects and clears the slot layer 1 is holding for frame
3, then frame 3 decodes and the flip is refused because the slot no longer names its
layer. The newest frame sits decoded at opacity 0 behind an older one, and a page that has
gone still sends no further frame to recover with. Web only; native never calls this.

Both arms now answer for the frame they were armed with.

The displayable arm's own guard had no test: deleting it left `src/browser/` and the full
suite green, because the case that exercised it settled both decodes and asserted an end
state both orders produce. The harness now settles one decode at a time, keyed on the
source it was given, and the ordered case reds without the guard.

Also: the paint sibling's opacity test claimed "no re-render" while asserting two style
strings, so it is named for what it checks and the claim is counted where React is —
across ten streamed frames the three state setters are called once each, on the mount
frame. And the overrides allowlist is rebuilt from main's bytes plus the new entries, so
two pre-existing reasons keep their literal em dash instead of a re-serialized escape.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* test(mobile): find the address input by its imported type (OTA phase C, C6.4)

`findByType('TextInput')` does not typecheck — a host-component string is not an
`ElementType` — so the file dropped out of `tsc -p tsconfig.test.json` and the
tests-typecheck ratchet reported it. The imported component is what the element is looked
up by now; the react-native mock stands it up as that same string at runtime, so the
lookup is unchanged and the file is back inside the ratchet's program.

Why the earlier run reported 0: the command was
`node scripts/check-tests-typecheck-ratchet.mjs 2>&1 | tail -2; echo $?`, and `$?` after a
pipeline is the exit code of `tail`, which is always 0. The banner line that printed was
the last line of the failure banner, not the success one. Every gate in this branch's
report is now read from the command itself, unpiped.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* fix(scripts): read a text input's size from the file the page loads (OTA phase C, C6.4)

The census followed an import through `.ts`/`.tsx` only, while the closure it walks comes
from esbuild, which prefers `.web.tsx`/`.web.ts`. So a style module with a platform
sibling was judged on the half no browser loads. That fails in the direction that matters:
a split whose web half sits under the focus-zoom floor reads as clean because its native
half is on the seam, which is the exact shape the seam exists to catch.

`resolveLocal` now tries the extensions in the builder's own order. The seam comparison
collapses a resolved path onto its module identity before matching, because the seam is
itself a split — `text-input-font-size.web.ts` is where the raise lives — and without that
every binding in the tree would stop naming the seam: deleting it reds both C4 route
closures.

The browser pane's own census flips from pinning its address field as an offender to
expecting none. The two C4 route closures still answer 0 offenders and 0 unresolved, run
with the closure tests enabled.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* fix(mobile): bound the frame envelope above every double it can carry (OTA phase C, C6.4)

Round 1 folds on #21760.

The envelope estimate serialized each metadata field as a 16-character double, so the
bound was 435 where a real frame event at its widest measures 516. Since the budget spends
whatever the cap leaves, that 81-byte shortfall was the whole margin: a frame on the budget
would have gone over the cap and been dropped. The bound is now the skeleton plus the
widest a double can print, for the nine metadata keys imported from the protocol module
rather than copied, so a tenth field cannot be added without being paid for.

Two corrections to the fold as written, both measured here.

The widest is 25 characters, not 24. Exponential form tops out at 24
(`-1.7976931348623157e+308`), but ToString only leaves fixed notation below 1e-6, and just
above it a double prints as sign, `0.`, five zeros and seventeen digits:
`-0.0000012345678901234567`. A sweep over four million random bit patterns found 25 and
nothing longer; a deterministic sweep over both forms is in the test.

And the base64 expansion has to count padding. Three quarters of the room claims up to two
characters base64 does not have for an image of 3k+1 bytes, which at a margin the budget
now spends exactly is a dropped frame. The two agree at today's envelope size because the
room happens to divide by four, so this is a latent fix rather than a reproduced one, and
the test pins the discrepancy directly instead of implying it.

Budget moves from 901,271 to 901,161 pixels; the phone's mobile view stays at a device
scale factor of 1.80. Pinning the bound against C6.1's real encoder is C6.5's, once both
are on main; the docstring says so, and says what the bound does not cover: the metadata
object is loose, so unknown keys and web view mode's letterboxed frame are ruling 1's to
drop rather than this budget's to predict.

Also: the pane census listed its own closure by hand, so "no unresolved styles" said the
walk read those files, not that they are the pane's set. It now scans `src/browser` for
every non-test module that renders a `TextInput` and asserts the list matches; a third
module planted there reds it. And the seam's native-consumer pin names the key row and the
address bar directly rather than transitively, matched at the `fontSize` property instead
of anywhere in the file — a file-wide search survives the change, because the import line
does.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* test(mobile): check the frame write against a real react-native-web Image (OTA phase C, C6.2)

Round 2 folds on #21754.

Every test for the web paint sibling handed it a `div > div` of its own making, so the
assumption it rests on — that the host's first element child is the one carrying the
frame — was only ever checked against a shape written to match it. React Native Web also
renders an accessibility `<img>` in there, and a release that reorders those children
would keep all of them green while the pane painted nothing.

One test now renders the real component, asks it which child it painted, and checks the
write lands on that one. Pointing the sibling at `lastElementChild` reds it and leaves the
hand-built cases passing, which is the gap. A second case records what the `<img>` does:
the streaming path writes styles and never props, so it keeps the source it mounted with
for the life of the pane, and that is what a screen reader and the image context menu see.

react-native-web ships no type declarations, so the component comes through
`createRequire`, whose return is `any` at its own signature; the one prop it renders with
is declared rather than asserted, and the file stays inside the tests-typecheck ratchet.

The module docstring also claimed more than the code does. The frame path adds no render,
but a render from any of the pane's other state — address focus, a dialog, the view mode,
zoom — repaints both layers from `renderedFrameSource`, which reads `frameUriRef.current`,
so both land on the newest frame whether or not it has decoded. Native clobbers the same
way through `setNativeProps`. Said plainly, along with what restores the buffering.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* docs(mobile): say what a render does to the accessibility image (OTA phase C, C6.2)

pullfrog is right, and the test carried the same wrong claim. The note said the hidden
`<img>` keeps the frame it mounted with for the life of the pane, two paragraphs after
saying a render from the pane's other state passes `renderedFrameSource` as `source` —
and React Native Web derives that image's `src` from the same prop it paints the
background from, so the first such render moves it.

Measured here rather than reasoned about: rendering the real component, writing a frame
imperatively, then re-rendering with a new source moves the `src` and leaves the
background where the imperative write put it. The two halves are now two cases, named for
what each one shows, and the note says the streaming writes never touch it while a render
does — so it holds the frame the pane last rendered with, not the one on screen.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant