Repository navigation
feat(mobile): the page owns its safe area, like a native screen (OTA phase C follow-up) - #22570
Conversation
The shell reserved both system-bar strips outside the WebView and painted them bgBase, so every page screen showed a flat band above its header, sheet scrims stopped short of the status bar, and the dock floated above the gesture bar. For a page that declares `safe-area-insets` in `ready.accepts`, the shell now draws the WebView edge-to-edge and keeps only the keyboard strip off it. `init` carries the insets the view sits under (bottom 0 while the keyboard ends the view, top 0 under the update banner), and a move is re-sent over the existing route-update `init`. An older page keeps the reserved strips, since it has no reader for the insets. On the page, a root layout (`app/_layout.web.tsx`) feeds those insets to react-native-safe-area-context below ExpoRoot's env()-measuring provider. It also replaces expo-router's DefaultNavigator, an all-edges SafeAreaView that padded a second time. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The page's route tree gained `./_layout.tsx` (its web sibling of the native root), so every pin that counts the tree moved: - Script sweep re-measured by building `routes.slice(0, n)` for each n. It reads 69 scripts at 16 routes, which matches the real build. The asset-ceiling crossing moves from 31 routes to 32. - Route closures now enter through both layouts. `entryNames` gains `[dir]` because `app/_layout` and `app/h/_layout` share a name. - Session closure pin 4216 -> 4219. The added modules are bridge-safe-area-insets, page-safe-area-provider and _layout.web. - The web-overrides allowlist names `app/_layout.web.tsx`. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Review fixes on the page-owns-safe-area change. - Ownership is page-document state now. `page-ready` carries `accepts` beside `reports`, the patch sets `pageOwnsSafeArea` from `safe-area-insets`, and the session hook projects it like `backClaimed`. The screen's own per-session copy is gone. - Insets moves re-send `init` only to a page that declared `safe-area-insets`. A page that took route updates but not insets was sent a useless `init` on every keyboard show and hide. - The banner wrapper is gone. The root pads the status bar strip while the banner shows. - The shell session defaults the insets inline, with no predicate that mutated its argument. - The provider is folded into its single caller, `app/_layout.web.tsx`. The session closure pin reads 4218 (local 1032). - The screen tests share their module mocks, and the safe-area cases move to a suite of their own: owned page, banner, iOS and Android keyboard, and an older page that gets no re-init. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the whole PR (3 commits, 42 files) at 4624fc9b5a.
- Optional
safeAreaInsetsoninit—bridge-safe-area-insets.tsbounds each edge0..4096, absent reads as zeros, and all-zero is omitted; the page's host-message reader is non-strict, so an old page strips the new key rather than refusing the frame. - Page declares the accept —
createPageReadyFrame()addssafe-area-insetstoready.accepts, the only element added to an existing array, so an old shell ignores it. - Ownership lives in per-document state —
page-readycarries{reports, accepts};pageDocumentStatePatchrecordspageOwnsSafeArea, gated onstate.kind === 'ready'and cleared withCLEAR_PAGE_DOCUMENT_STATE, so a declaration never outlives its document. - Edge-to-edge layout — the shell keeps the keyboard strip and reserves the status-bar strip only while the banner shows;
pageSafeAreaInsetszeroestopunder the banner andbottomwhile the keyboard ends the view, so the page pads each edge exactly once. - Inset re-send —
publishSafeAreaInsetsmoves the held value and re-inits only for a deliverable page that declared the accept; the client firesonSafeAreaInsetsUpdateonly on a real move and preserves object identity otherwise. - Page root layout —
app/_layout.web.tsxreplaces expo-router'sDefaultNavigator, feeding the shell insets into the safe-area contexts with no padding of its own. - Build pins re-measured — route manifest/closure gain
app/_layout(with[dir]/[name]output), script sweep 67→69, ceiling crossing 31→32, session modules 4216→4218.
I checked the four shell/page combinations: the accepts gate keeps an older page on the reserved strips, and a new page under an old shell reads zeros and sits inside those strips, so the rollout is safe in both directions.
ℹ️ Nitpicks
config/scripts/verify-mobile-web-app-bundle.mjsstill describes "the subtree's one layout,h/_layout.tsx", but this PR makes it two (app/_layout.web.tsxjoinsh/_layout.tsx). Doc-only, not blocking.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughThe mobile web shell bridge now carries validated safe-area insets in init frames and reports page acceptance in ready declarations. The shell adjusts padding for pages that handle insets, keyboard state, and update notices, while the web root layout provides shell insets to safe-area context. Route discovery and bundle closure include the web root layout, with directory-qualified multi-entry outputs and updated sweep measurements. Tests cover bridge updates, shell rendering, route discovery, and bundle limits. Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to Pages that draw edge-to-edge can stop receiving safe-area updates after the shell rebuilds its bridge connection. Their content can then sit under the status bar, navigation bar, or keyboard with stale padding until the page reloads. Carry the page's declared capabilities across host replacement before merging. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the motivation, implementation, compatibility behavior, testing results, and native-build requirement. However, it omits several required template sections, including ELI5, Linked Issue, Visual Proof, Testing, Review, Notes, and Checklist details. Resolution Add the required template sections. Include a Linked Issue entry such as Full details: Docstring CoverageExplanation Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 40 functions across 41 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 7981570e-92db-4370-9621-649cab49c58f
📒 Files selected for processing (42)
config/scripts/build-mobile-web-app-bundle.mjsconfig/scripts/build-mobile-web-app-bundle.test.mjsconfig/scripts/mobile-web-app-render-harness.mjsconfig/scripts/mobile-web-app-route-manifest.mjsconfig/scripts/mobile-web-app-route-manifest.test.mjsconfig/scripts/mobile-web-app-safe-area-render.test.mjsconfig/scripts/mobile-web-app-session-terminal-closure.test.mjsconfig/scripts/verify-mobile-web-app-bundle.mjsmobile/app/_layout.web.tsxmobile/src/mobile-web-shell/MobileWebShellScreen.test.tsxmobile/src/mobile-web-shell/MobileWebShellScreen.tsxmobile/src/mobile-web-shell/bridge-host-contract.tsmobile/src/mobile-web-shell/bridge-host-route.tsmobile/src/mobile-web-shell/bridge-host-test-harness.tsmobile/src/mobile-web-shell/bridge-host.tsmobile/src/mobile-web-shell/bridge/bridge-client-init-handshake.tsmobile/src/mobile-web-shell/bridge/bridge-client-session.tsmobile/src/mobile-web-shell/bridge/bridge-client-shell-session.tsmobile/src/mobile-web-shell/bridge/bridge-envelope.tsmobile/src/mobile-web-shell/bridge/bridge-init-frame.tsmobile/src/mobile-web-shell/bridge/bridge-port-pair-test-harness.test.tsmobile/src/mobile-web-shell/bridge/bridge-port-pair-test-harness.tsmobile/src/mobile-web-shell/bridge/bridge-rpc-client-frames.test.tsmobile/src/mobile-web-shell/bridge/bridge-rpc-client.tsmobile/src/mobile-web-shell/bridge/bridge-safe-area-insets.test.tsmobile/src/mobile-web-shell/bridge/bridge-safe-area-insets.tsmobile/src/mobile-web-shell/mobile-web-shell-back-claim-state.test.tsmobile/src/mobile-web-shell/mobile-web-shell-safe-area-screen.test.tsxmobile/src/mobile-web-shell/mobile-web-shell-safe-area-state.test.tsmobile/src/mobile-web-shell/mobile-web-shell-screen-test-harness.tsxmobile/src/mobile-web-shell/mobile-web-shell-screen-test-mocks.tsxmobile/src/mobile-web-shell/mobile-web-shell-session-contract.tsmobile/src/mobile-web-shell/mobile-web-shell-session.test.tsmobile/src/mobile-web-shell/mobile-web-shell-session.tsmobile/src/mobile-web-shell/page-document-state.tsmobile/src/mobile-web-shell/page-safe-area-insets.test.tsmobile/src/mobile-web-shell/page-safe-area-insets.tsmobile/src/mobile-web-shell/use-mobile-web-shell-bridge.test.tsmobile/src/mobile-web-shell/use-mobile-web-shell-bridge.tsmobile/src/mobile-web-shell/use-mobile-web-shell-session.test.tsmobile/src/mobile-web-shell/use-mobile-web-shell-session.tsmobile/web-entry/web-overrides.json
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
| } | ||
| insets = next | ||
| // Only to a page that reads them: a re-init to one that does not is a wasted frame per move. | ||
| if (deliverable && accepts.includes(BRIDGE_SAFE_AREA_ACCEPT)) { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Preserve inset delivery when a host is rebuilt under a live page.
A replacement host can inherit an established session without receiving another ready. Its route handler starts with an empty accepts list, so this check blocks later inset updates. If the inset value changed during the rebuild, the new handler already holds that value and also rejects the subsequent publish as unchanged. The page then keeps its old padding while the shell keeps the WebView edge-to-edge. Carry the document's acceptance into the replacement host and synchronize its current insets with the page when the host takes over.
…22576) #22570 pinned its own branch commit, which the squash left off main; the corpus now pins main at 37820f9, the tree its fenced paths match. Every golden changes only its baseline line. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Measured, not derived: 4220 without the DSH icon entry, 4221 with it. Two of the three modules above main's 4218 pin are not this change's — they arrived with the mobile work after #22570 and were never repinned; the changelog records that split explicitly.
* feat(agents): add first-class DeepSeek Harness (dsh) support Register DSH as a supervised Orca agent: catalog entry and detection for its dsh-tui profile, status/question hooks through DeepSeek's own Claude-Code hook bridge, composer-ready prompt delivery, session resume, headless Source Control AI, and title identity that no longer collides with Gemini's. * fix(dsh): reach Orca through DSH's credential scrub and stop reading its title as Gemini DSH runs command hooks through its own shell executor, which drops every env var whose name contains KEY, TOKEN, SECRET or PASSWORD — taking ORCA_PANE_KEY and ORCA_AGENT_LAUNCH_TOKEN with it, so every hook exited without posting. Mirror both onto scrub-safe aliases at spawn and restore them at the top of the DSH hook script. Its title collided too: DSH rests on the same glyph Gemini works on, so a resting DSH pane was relabelled Gemini CLI and reported working forever. Defer both the Gemini classifier and the title status detector on DSH's whale, in the base module both copies of that classifier read. * test(mobile): repin the session-route closure for the DSH agent icon * fix(dsh): address review — never splice user rows, cover remote panes, keep the diff off argv - findManagedDshPatchRegion paired an orphan start marker with a later block's end, so a truncated write made install/remove delete the user's own rows. Pair each end with the nearest preceding start; regression test fails without the fix. - The relay PTY env builder never applied the scrub-safe aliases, so remote DSH status silently never appeared even with the remote hook installed. - Source Control AI sent the whole diff on argv; send it over stdin with DSH's '-' marker. - dsh-tui/dst already chose the interactive profile, so a workspace folder named 'web' or 'plugin' no longer marks a live agent pane non-interactive. - Isolate USERPROFILE as well as HOME so a Windows run cannot edit the real home. - Drop the duplicate README badge and revert an incidental doc reformat. * refactor(dsh): share the managed-hooks reader and tighten the new modules Reuse before reimplementing: readManagedDshHookEvents was a near-verbatim copy of Muse's, with byte-identical private helpers. Both now call one readManagedHookEventsFromJson. Also: one readTextOrAbsent instead of two spellings of the same read (dropping an existsSync TOCTOU), one status() builder instead of four inline literals, rmSync(force) instead of exists-then-unlink, and a redundant empty-string guard before JSON.parse. The patch-file transforms lose their index juggling for a predicate plus a filter. * fix(dsh): refuse a flow-style patch file, keep its mode, and stop the relay inheriting a pane - applyManagedDshPatch matched only an exact `[]`, so `[] # keep empty` or a non-empty flow sequence got a block entry appended after it — invalid YAML that would leave DSH unable to load the user's own patch layer either. It now strips the token from an empty sequence (keeping a trailing comment) and returns null for a non-empty one; install reports that and changes nothing. - The patch rewrite dropped an owner-only file to the umask default (CWE-732); pass preserveMode. - The relay PTY env never dropped inherited pane identity the way the local and daemon builders do, so a spawn that specified none could inherit the relay's own and every agent's hook would report against that pane. * fix(dsh): keep the flow-style refusal in every status read, and scope the mode test to POSIX A refused patch file carries no managed region, so getStatus() fell through to a bare not_installed with detail null — the actionable 'rewrite it as a block sequence' message only ever reached the one-shot install() return. Export the predicate and check it first, behind one shared message constant. The owner-only mode assertion cannot hold on Windows, where chmod only toggles the read-only attribute and mode & 0o777 reads 0o666 for any writable file. * docs(readme): restore the DeepSeek Harness badge lost in the rebase * test(mobile): repin the session-route closure to the measured 4221 Measured, not derived: 4220 without the DSH icon entry, 4221 with it. Two of the three modules above main's 4218 pin are not this change's — they arrived with the mobile work after #22570 and were never repinned; the changelog records that split explicitly. * fix(dsh): settle tui-idle on the agent's own hook, so supervised workers see it ready Reported by a tester on the adhoc build: `terminal wait --for tui-idle` ran to its 90s timeout against an already-ready DSH composer, so a supervised worker never sees the agent as ready. Every existing tier reads the title, and DSH deliberately carries no title status: its rest prefix is Gemini's working glyph, so the detector reports none. A fresh first-party `done` is better evidence than any title anyway — it is the agent's own account of its own turn, and normalizeDshEvent drops subagent events, so it is the lead's. Scoped to DSH: for agents whose hooks report child turns, a mid-turn `done` is the #6011 class this file prevents. * test(daemon): record the DSH transcript's true-colour I2 divergences Adding the dsh-tui capture to __fixtures__ enrolled it in the serialize replay sweep, where it reports 10 I2 divergences and failed the unlisted-transcript default of 0. Every one is the same shape — visible-grid row=0, a 24-bit background the round trip does not restore to default — which is DSH's whale intro painting whole rows of true colour. Verified as an upstream limitation rather than a regression by replaying against the previous build (build-serialize-addon-at-ref.mjs --ref origin/main): I1 and I3 both hold. * fix(dsh): return the new tui-idle verdict from the first-party done lane Main refactored isTuiIdleSatisfied into evaluateTuiIdle, which returns a verdict rather than a boolean. The DSH lane still returned `true`; it is tier-1 positive evidence, so it returns READY_STRONG like the title/body lane above it. Re-verified the regression test still fails without the lane. * test(relay): pin the scrub-safe pane-identity aliases on the relay spawn path The relay builds a remote pane's env itself, so the alias mirroring there had no test: removing the call left every suite green while remote DSH status silently vanished. Both cases fail without it. * docs(dsh): point the hook service at the integration reference The reference doc had no inbound link from anywhere in the repo.

Why
Native screens draw edge-to-edge and each header's
SafeAreaViewpaints its own colour under the status bar; sheets dim the whole screen; the command dock sits over the gesture bar. The hybrid-shell page could not: the shell reserved both bar strips outside the WebView and painted them a flat bgBase, so every page screen showed a band above its header, sheet scrims stopped at the band, and the dock floated above the gesture bar. Jinwoo's call: make the page look like native.What
paddingBottom: keyboardInset), and the status-bar strip only while the update banner shows.initcarries an optionalsafeAreaInsets(the shell's insets; bottom 0 while the keyboard is up, top 0 under the banner), re-sent through the existing route-updateinitwhen they change. NoBRIDGE_PROTOCOL_VERSIONbump: a new optional field.app/_layout.web.tsxfeeds those insets into react-native-safe-area-context's insets and frame contexts and replaces expo-router's injectedDefaultNavigator(an all-edgesSafeAreaViewthe page got because its route tree had no root layout). Every existingSafeAreaViewin the page then pads once, like native.readyreport now carriesacceptsbesidereports; the shell goes edge-to-edge only for a page that declaredsafe-area-insets(older pages keep the strips), tracked in the existing per-document page state like the Back claim. A new page under an old shell reads the missing field as zeros and the old shell still pads. Inset re-sends go only to pages that accept them.bridge-safe-area-insets.ts,app/_layout.web.tsx), asset-ceiling crossing 31 → 32 routes, script sweep unchanged at 69;web-overrides.jsonallowlists the root layout.Relies on #22549 (native inset zeroing) on WebView 144+ so
env()does not add on top.Proof
{paddingTop:44,paddingBottom:8}vs{paddingBottom:0}); real-browser render with a CDP env inset (header 34 px low without the root layout); route-manifest test; "older page gets no re-init" (3 inits vs 1) before the accept gate.#111111/ title 189 vs native#111111/ 186; session strip#1a1a1a/ 171 vs#1a1a1a/ 168; sheet scrim#080808in the strip on both; dock bottom 2783 both; keyboard up: input row / dock / IME top 1830 / 1847 / 1848 on both; landscape clean; 0 page faults.Needs a new native build to take effect.