Repository navigation
feat(mobile): serve the files explorer and preview from the page (OTA phase C, C3.1) - #21710
Conversation
Inside the shell's page a screen is one document standing in for one screen, so a target the page does not render has to be handed back to the app that does. `useRouteHandoff` is where that decision lives, and its web sibling is the only thing that makes it; both files screens held expo-router's own `useRouter`, so on the web the explorer's Back and the preview's Back would post nothing and a target outside the page would paint Unmatched over the page it is on. Natively this is the same object — `route-handoff.ts` is `useRouter()` — so no behaviour moves here, and `back()` stays expo-router's until the navigate-back verb lands and the seam starts wrapping it. A census rather than a behaviour test: neither screen's own tests can see the difference, because a push that is never handed off still works for a target inside the page. It walks this directory, refuses a value import of expo-router, and names the two screens that must hold a router so a walk that found nothing fails instead of passing empty. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Both route files take the index.tsx shape — flag, MobileWebShellScreen, native screen as fallback — and both gain the `.web.tsx` sibling that shape forces. Inert until the manifest lists these routes: the shell answers `native-route` for a route the bundle does not name, which is what `fallback` renders, and the flag is `__DEV__`-only besides. Listing them waits on C2.3 and C2.5. The sibling is not a precaution. The manifest defers every route behind `import()`, so a native-only route module is invisible until the page opens that route; the render check now opens both and, without the siblings, painted `expo-modules-core.requireNativeViewManager is not available on web` instead of the screen. That is also why the two cases render the route rather than asserting a file exists. The file path never becomes a path segment: only `hostId` and `worktreeId` are spelled into the pathname, encoded, and everything else — `relativePath`, `absolutePath`, `cwd`, `pathText` — is a param, which is how a `/`, a space or a `..` stays out of the segment vocabulary the bridge holds a route to. The preview render case proves the round trip on `docs/my notes/readme.md`. `mobileFilePreviewShellParams` drops a param the normalizer left `undefined` rather than sending it empty, because the page reads these back through useLocalSearchParams where `line: ''` and no `line` are different screens. Its test drives the normalizer rather than a hand-written literal: the literal omits the key entirely, so it held with the filter removed. The preview case also records what React Native Web says out loud — BackHandler is inert on web, so Android back inside the page skips the unsaved-draft prompt. Named in the assertion rather than filtered out, so closing it is a change to that line. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
React Native Web's `Alert` is `static alert() {}`. Inside the shell's page that
made Back with an unsaved terminal-artifact draft a button that did nothing at
all: no prompt, because the dialog is a no-op, and no navigation either, because
the code took the branch that shows one. Silently, with nothing on the console.
The prompt is now a row under the header. Not `ConfirmModal`, which every other
confirm here uses: that is a `BottomDrawer`, and C1.9 has Reanimated's animated
styles never reaching the DOM node on WKWebView, so on iOS in the page the
drawer parks off-screen and Back would be dead a second way. This paints the
same on every platform with no animation behind it.
Hardware back is registered natively only. React Native Web's
`BackHandler.addEventListener` logs "BackHandler is not supported on web and
should not be used." and hands back an inert subscription, so the guard never
armed there regardless; the render check asserted that console error on main and
now asserts none. The degradation is real and stated rather than hidden: Android
back inside the page pops the native stack without asking, and the page's own
Back control is where the question lives.
The decision moved to a hook so it is testable without a screen: the prompt also
drops itself when the draft it was about is saved or reverted, which is a state
`Alert` had no way to be in.
Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
expo-haptics has a web build, and with no `navigator.vibrate` — iOS Safari,
which is the WebView the page runs in — it fakes a haptic by appending a hidden
`<label><input type="checkbox" switch>` to `document.head`, clicking it, and
removing it, once per call. C1.9 traced a long press that never fired on the
worktree list to exactly that stray click, and the file explorer calls
`triggerSelection` on every row tap, so C3 is the first domain to fire it per
tap rather than per long press.
`haptics.web.ts` answers the same five names with nothing. A phone holding the
page is a phone whose native app is right there with the real haptics, and a
missing tap feedback is worth less than a tap that does not register.
The test reads the shipped bytes rather than the import, because that is the
claim: with the override removed the bundle carries `ariaHidden` and
`pointer: coarse`; with it, neither, nor the `setAttribute("switch"` that does
the clicking. Not `navigator.vibrate` — react-native-web's own Vibration export
calls that and touches no DOM until something invokes it, which cost this test
one wrong red before it was narrowed.
Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…given one A file path is a param, so `/`, spaces and `..` all cross safely — but `BRIDGE_MAX_ROUTE_PARAM_CHARS` is 1024 and a Windows long path is not bounded by anything the user cannot exceed. The symptom is not the blank document the design predicted, and the correction matters: `bridge-host.ts` already parses the route against the page's own schema and drops it to `null` when it fails, so `init` arrives naming no screen and the page paints "Update Orca to open this workspace" — a wrong message about a fine app, over a native screen that works. Deciding before the switch instead leaves the route native, which is where every route starts. The schema is the predicate rather than a copy of its bounds, so the rule cannot drift from the half that matters, which is the half the page reads. The same call also refuses a `worktreeId` the segment rule will not route: `..` survives `encodeURIComponent`, which is the C1.8 class. The tests assert the schema really refuses each input before asserting the guard does, so neither case can pass by being impossible. This belongs in the shell beside the schema; it is in the files domain while the contract files are the C2 lane's. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Seven shapes, one case each rather than a representative: a plain path, a space,
a dot segment, an already-encoded slash, a fragment, non-ASCII, and an absolute
path. Each is checked in the two directions a path travels — the href the shell
writes into the page's history, and the href the page would hand back — for both
the pattern accepting it and the path coming back out of the query unchanged.
The counterfactual is in the file: the same paths spelled as a segment are
refused. Without that, the cases above would hold for a rule that was never
doing any work. Mutating `stringifyRouteHref` to join its query by hand instead
of through `URLSearchParams` fails three of them.
Also fixes two new test files the tests-typecheck ratchet caught: the partial
`react-native` mock needs a typed `addEventListener`, `act` will not take a
callback that returns a value, and `findAllByType('Pressable')` does not
typecheck against `ElementType` — the neighbouring files that do it are
grandfathered, so the tag comparison goes through a helper instead.
Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…ffect Both changed-code gate findings, which the lane had not run until the last commit. React Doctor is right: the effect that cleared the prompt when the draft went away adjusted state after a prop changed, so a save landing while the prompt was up painted one frame still offering to discard nothing. The prompt is now `asking && hasUnsavedDraft`, which cannot be stale by construction, and the test that covers it passes unchanged. The hoisted mock's `as` on a string literal is gone too: the literal narrows on its own and the tests reassign it, so the holder is annotated instead. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The census pins every file that reads `useMobileWebShellEnabled`, because a reader nobody listed is how a dark feature stops being dark. C3's two routes are deliberate entries: each has a native screen behind it as `fallback`, and each is inert until the manifest lists the route. Found by the full mobile suite rather than by the files subset this lane had been running per commit. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
# Conflicts: # mobile/src/mobile-web-shell/mobile-web-shell-flag-census.test.ts # mobile/web-entry/web-overrides.json
# Conflicts: # mobile/src/mobile-web-shell/mobile-web-shell-flag-census.test.ts
The last C3 commit: both routes join MOBILE_WEB_PAGE_ROUTES, and the shell starts rendering the page for them on a phone with the dev flag on. Grants are not the same for the two, and the difference is the point. Both take `navigate` (Back pops the native stack, and the explorer's rows open the preview beside it) and `storage` (the shared components the host layout renders above them). Only the preview takes `externalLink`: a Markdown preview renders links and `MobileMarkdown` opens them through the platform seam. The explorer does not, and measuring is what says so rather than reading. Every page route reaches `external-link.web.ts` — `/h/[hostId]` and agent-history included, both granted nothing for it — because the protocol wall in the shared host layout imports it. So closure membership is not the oracle for a grant; the question is whether the route's own screens call it, and only the preview's do. `MobileMarkdown` is in the preview closure and absent from the explorer's, which the census now asserts in both directions. Neither route writes a clipboard, so neither takes `native.clipboard.write`; the census pins that as the absence of both `ExpoClipboard.web.js` and the clipboard seam, with the tasks closure as the control that the probe can see one when there is one. The seam predicate moved into a module both censuses import rather than being restated per series: two spellings of one rule drift, and this one is a regex. Red-first: both manifest assertions failed on the new entries before they were updated, and routing `MobileMarkdown` around the seam fails the preview's census while leaving the explorer's passing, which is the asymmetry the grants encode. Closure sizes as the page ships them, extensionless so the `.web.tsx` is what is measured: explorer 3439 modules / 302 local / 10 under src/files, preview 3667 / 331 / 20. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe PR adds web-shell support for mobile file explorer and preview routes. It adds route normalization, validation, parameter serialization, web route modules, and remount behavior. File navigation now uses route handoff, and preview discard handling uses a shared hook and confirmation modal. Web haptics are replaced with no-op exports. New tests cover route rendering, encoding, bridge validation, bundle boundaries, external-link closures, and navigation behavior. Priority: ➖ Normal 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 38.89% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 36 functions across 29 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.
Important
The preview's externalLink grant never applies on the in-page path this PR adds. Grants are scoped to the route the shell opened, and the handoff keeps the preview inside the explorer's document, so a Markdown link tap in a preview opened from the file explorer is refused by notifyExternalLink and silently does nothing. Details inline.
Reviewed changes
- Files explorer and preview become page routes — both native route files switch to
MobileWebShellScreenwith the native screen asfallback, gain.web.tsxsiblings, and are listed inMOBILE_WEB_PAGE_ROUTES. - Router taken from the handoff seam —
MobileFileExplorerPanelandMobileFilePreviewScreencalluseRouteHandoff()so a target inside the page stays in the document and everything else is handed to the native stack. - Route guard before the switch —
mobileFileShellRouteparses a candidate route againstBridgeInitRouteSchema, so an over-long param or a..worktree id stays native instead of reaching the page as aninitnaming no screen. - Unsaved-draft prompt moves into the screen —
useMobileFilePreviewBackandMobileFilePreviewDiscardPromptreplaceAlert.alert(a no-op on RN Web) with an inline row, and skipBackHandleron web where it is inert and logs. - Haptics web shim —
haptics.web.tsanswers the five names with nothing, keeping expo-haptics' DOM-checkbox web build out of the page. - Census, encoding and render pins — route-vocabulary/encoding cases, a files router-seam census, an external-link/clipboard closure census, and browser render checks for both routes.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| expect(errors).toEqual([]) | ||
| // The title is the last segment of the path param, so this is also the proof the param | ||
| // survived the round trip through `URLSearchParams` that `/` and the space go through. | ||
| expect(text).toContain('readme.md') |
There was a problem hiding this comment.
The comment above claims this proves the param survived the URLSearchParams round trip, but the rendered title is only the last path segment — a mangled space (docs/my+notes/readme.md) would still pass toContain('readme.md'). Asserting the full docs/my notes/readme.md (which also appears in the header's meta text) would match the claim.
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: cc5e0386-f7ac-4d53-81b1-6e00e52b157b
📒 Files selected for processing (27)
.github/workflows/pr.ymlconfig/scripts/build-mobile-web-app-bundle.test.mjsconfig/scripts/mobile-web-app-external-link-seam.mjsconfig/scripts/mobile-web-app-files-external-links.test.mjsconfig/scripts/mobile-web-app-render.test.mjsconfig/scripts/mobile-web-app-tasks-external-links.test.mjsconfig/scripts/mobile-web-page-routes.mjsmobile/app/h/[hostId]/files/[worktreeId].tsxmobile/app/h/[hostId]/files/[worktreeId].web.tsxmobile/app/h/[hostId]/files/preview/[worktreeId].tsxmobile/app/h/[hostId]/files/preview/[worktreeId].web.tsxmobile/src/files/MobileFileExplorerPanel.tsxmobile/src/files/MobileFilePreviewDiscardPrompt.test.tsmobile/src/files/MobileFilePreviewDiscardPrompt.tsxmobile/src/files/MobileFilePreviewScreen.tsxmobile/src/files/files-router-seam-census.test.tsmobile/src/files/mobile-file-path-route-encoding.test.tsmobile/src/files/mobile-file-preview-route.test.tsmobile/src/files/mobile-file-preview-route.tsmobile/src/files/mobile-file-preview-styles.tsmobile/src/files/mobile-file-shell-route.test.tsmobile/src/files/mobile-file-shell-route.tsmobile/src/files/use-mobile-file-preview-back.test.tsmobile/src/files/use-mobile-file-preview-back.tsmobile/src/mobile-web-shell/mobile-web-shell-flag-census.test.tsmobile/src/platform/haptics.web.tsmobile/web-entry/web-overrides.json
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.
…l on them Two round-1 findings, both reproduced before the fix. A repeated query key reaches `useLocalSearchParams` as an array, and the explorer read `hostId` and `worktreeId` bare. `String(['a','b'])` is `a,b`, so the template built `/h/host-a%2Chost-b/files/wt-1%2Cwt-2` — a single segment the bridge's rule accepts, and the shell would open a page for a host nobody has. Read through `firstParam` now, as the tasks and agent-history switches do. The preview already went through `singleParam` and is unchanged. Neither switch keyed `MobileWebShellScreen`, where `index.tsx`, `tasks.tsx` and agent-history all do. A host captures the grants its session opened with, so a screen reused across a route change keeps authorising frames under the grants of the route the page has left; only a remount drops that bridge. Both are keyed on the route pathname now, with agent-history's reason. The new route test is the agent-history one's shape. It caught both: the array case landed on no route at all, because `name` was an array too and the schema refuses a non-string param value, and the two lifecycle cases saw a prop update where a remount was owed. It also needs agent-history's `lucide-react-native` mock, since `firstParam` lives in the source-control barrel. `name` is now omitted when empty rather than sent as `name=`, matching the two switches beside it: an absent label lets the panel derive its own. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Round-1 findings 3, 4, 5 and the minor one. **ConfirmModal, not the bespoke row.** The row existed because C1.9 had Reanimated's animated styles never reaching the DOM node on WKWebView, which left every BottomDrawer parked off-screen. C1.10 (`b7c06900e2`, an ancestor of this branch) fixed that with a dependency array on the mapper hooks, and the drawer render check now holds it on WebKit as well as Chromium. With the reason gone the row does not stand on its other merits: `Alert.alert` was modal on native before the page existed, and the row quietly changed that for phones too, so the app's own confirm is both the idiom and the closer behaviour. `MobileFilePreviewDiscardPrompt`, its test and its thirty style keys are gone; the hook's state machine and its tests are unchanged. **The encoding test claimed more than it pinned.** Hand-joining the query reds only three of the seven shapes; `docs/readme.md`, `../etc/passwd`, `docs/日本語.md` and `/logs/run.txt` are encoding-neutral in the query, whose pattern half is `[^#\s]*` and admits a slash, a dot segment and non-ASCII verbatim. Rather than narrow the claim in a comment, the split is now pinned by behaviour: each neutral shape must survive the query unencoded, each load-bearing one must not. Moving `docs/readme.md` between the lists fails it. **The manifest comment named one shared-layout opener and there are two.** The New Workspace source field, which the sidebar renders on a wide layout, opens a URL through the seam as well. Both are the shared layout's and every `/h` route reaches both, `/h/[hostId]` included with no `externalLink`, so the tablet tap is dead on all of them — recorded here as pre-existing rather than fixed, since the grants do not move. **Minor:** the dot-segment case in the guard test now asserts the schema refuses the route before asserting the guard returns null, as the length case does. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
Important
The round-1 manifest comment argues the explorer needs no externalLink, but the runtime path it describes — a file tap opening the preview inside the same page document — still runs under the explorer session's grants, so a Markdown link in that in-page preview is refused. Details inline.
Reviewed changes
- Read both files routes' ids through
firstParam, so a repeated query key can't be joined into a phantom host, and omit an emptynamerather than sendname=, which the route schema refuses. - Keyed both
MobileWebShellScreenmounts on the route pathname, so a native route change remounts the bridge instead of leaving the previous route's grants in force. - Replaced the in-screen unsaved-draft row with the app's own
ConfirmModal, deletingMobileFilePreviewDiscardPromptand its styles, on the strength of C1.10's Reanimated mapper-dependency fix. - Split the file-path encoding pin into load-bearing and neutral groups, added a schema-first assertion to the shell-route test, added a native-route shell-handoff test, and extended the flag census to both files routes.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
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: 1c509be2-3633-43ef-859b-85f2da426c95
📒 Files selected for processing (8)
config/scripts/mobile-web-page-routes.mjsmobile/app/h/[hostId]/files/[worktreeId].tsxmobile/app/h/[hostId]/files/preview/[worktreeId].tsxmobile/src/files/MobileFilePreviewScreen.tsxmobile/src/files/mobile-file-path-route-encoding.test.tsmobile/src/files/mobile-file-shell-route.test.tsmobile/src/files/use-mobile-file-preview-back.tsmobile/src/mobile-web-shell/mobile-web-shell-files-route.test.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
- config/scripts/mobile-web-page-routes.mjs
- mobile/src/files/use-mobile-file-preview-back.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
…it opens Round-2 findings. **The registration belongs to the drawer, and that is where the guard went.** `mounted-bottom-drawer.tsx` armed `hardwareBackPress` whenever a drawer was visible and interactive, with no platform check, so the hook's claim to have dropped that console line held only while its prompt was closed — and every page drawer since C1 has logged it on open. Platform-gated at the drawer now; the hook's comment says so rather than claiming the credit. **Nothing had ever opened a modal in a browser.** The render check next door mounts both files routes and reads what they paint but taps nothing, so `ConfirmModal` inside the page — a BottomDrawer, so Reanimated, a portal and a gesture handler — was unproved. A new render file loads an editable terminal artifact through the harness's scripted reply, edits it, taps the page's Back, and asserts the prompt's title is up and no BackHandler line is on the console. Red first on exactly that line; the prompt itself painted, which is also the first proof on a browser that C1.10's fix carries a real drawer in the page. A second case answers Stay and checks the draft survives. Its own file rather than the render check's, which is at 482 of the 600-line cap; registered in pr.yml. **The encoding rule was stated wrong.** Two rules decide it and neither is about paths: the pattern's query half refuses whitespace and `#`, and `URLSearchParams` is form-urlencoded, so it reinterprets `&`, `+` and a valid `%XX`. `a+b.ts` reads back `a b.ts` and `a&b.ts` reads back `a`, so both are load-bearing; `a=b.ts` and `a%b.ts` are not, because only the first `=` splits the pair and a lone `%` begins no escape. A newline joins the load-bearing list as the refused shape rather than the altered one. **The web sibling read its params bare** where the native one uses `firstParam`. Not reachable — the page only arrives through `init.route`, whose params are already `Record<string, string>` — but the two files are meant to be one screen. The preview keys on the pathname alone, and the comment now says why that is enough: every caller in this tree pushes. Closures after this: explorer 3441 / 304 / 10, preview 3666 / 330 / 19. The explorer grew two modules because its web sibling now reaches `firstParam`. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
ℹ️ No new issues found in this delta. The round-2 fold is clean and its browser check holds the fix; this is not an approval only because the previously flagged in-page
externalLinkgap on the explorer entry is still open.
Reviewed changes
- Platform-gated the drawer's hardware-back registration —
MountedBottomDrawernow skipsBackHandler.addEventListeneron web, where react-native-web logs "BackHandler is not supported on web" and hands back an inert subscription, so every page drawer no longer prints that line when it opens. Native behavior is unchanged. - Added a browser render check for the preview's discard prompt —
mobile-web-app-files-render.test.mjsloads an editable terminal artifact, edits it, taps Back, asserts theConfirmModaltitle paints and that noBackHandlerline reached the console, and adds the Stay case; it is registered in themobile_web_appCI job. - Restated the path-encoding pin from both governing rules — the encoding test now separates whitespace/
#/&/+/valid-%(load-bearing) from=and a lone%(neutral), with the doc comment namingBRIDGE_ROUTE_HREF_PATTERNandURLSearchParams. - Read the explorer web sibling's params through
firstParam— the page sibling now matches the native file, so a repeated query key cannot reach the panel as an array. - Comment and CI changes — the preview route's mount-key rationale and
use-mobile-file-preview-back's JSDoc now name the drawer as the secondBackHandlerregistrant.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…on the route Bot findings, one of them a real gap. **Pullfrog is right, and my grant oracle was half a rule.** Grants resolve once, from the route the shell opened: `grantsForRoute` reads `session.routePathname` and `init.grants.native` carries the answer for that session. The explorer's rows push to the preview, and because the preview is a page route that push stays inside the same document — no second `init`. So a preview opened that way runs under the explorer's grants, and a Markdown link in it was refused by `notifyExternalLink` with nothing on screen to say why. "Does the route's own screen call it" was right for a route's own screens and wrong for the routes it reaches in-page, so the explorer now declares `externalLink` as a transitive grant, with the comment saying that rather than claiming it opens links. The census pins the pair as a superset; removing the grant reds it. **The seam regexes matched one quote style.** A double-quoted `react-native` specifier walked past both censuses unseen. Both styles now, with the predicate tested directly for the first time. **The discard request outlived its draft.** `asking` stayed set after a save or a revert, so the next edit re-showed the prompt with no Back request behind it. The request is now dropped when the draft it was about goes, adjusted during render rather than in an effect — the shape React Doctor named in the round-1 fold. Red first: save with the prompt up, edit again, prompt is back. **CodeRabbit's keying comment is a correctness point, not the question I answered.** The page learns its route exactly once, out of `init`, so a same-path param change — another file in the same worktree — left the shell mounted and the page still showing the file it was opened on. My comment claimed "the screen reloads the preview from the param either way", which is true only with the shell absent. Both switches key on the whole route now, params included; two tests cover the same-path case and both red on a pathname-only key. `build-mobile-web-app-bundle.test.mjs` hit 601 of its 600-line cap on the way, so the two manifest assertions now share one expected list instead of repeating it. Closures unchanged: explorer 3441 / 304 / 10, preview 3666 / 330 / 19. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
# Conflicts: # .github/workflows/pr.yml
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: 5762f1bd-5c5e-48fe-ac39-55a510623bcf
📒 Files selected for processing (11)
config/scripts/build-mobile-web-app-bundle.test.mjsconfig/scripts/mobile-web-app-external-link-seam.mjsconfig/scripts/mobile-web-app-external-link-seam.test.mjsconfig/scripts/mobile-web-app-files-external-links.test.mjsconfig/scripts/mobile-web-page-routes.mjsmobile/app/h/[hostId]/files/[worktreeId].tsxmobile/app/h/[hostId]/files/preview/[worktreeId].tsxmobile/src/files/mobile-file-shell-route.tsmobile/src/files/use-mobile-file-preview-back.test.tsmobile/src/files/use-mobile-file-preview-back.tsmobile/src/mobile-web-shell/mobile-web-shell-files-route.test.tsx
🚧 Files skipped from review as they are similar to previous changes (8)
- mobile/src/files/mobile-file-shell-route.ts
- mobile/app/h/[hostId]/files/preview/[worktreeId].tsx
- mobile/src/mobile-web-shell/mobile-web-shell-files-route.test.tsx
- config/scripts/build-mobile-web-app-bundle.test.mjs
- mobile/src/files/use-mobile-file-preview-back.ts
- mobile/src/files/use-mobile-file-preview-back.test.ts
- mobile/app/h/[hostId]/files/[worktreeId].tsx
- config/scripts/mobile-web-app-external-link-seam.mjs
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| @@ -0,0 +1,14 @@ | |||
| import { describe, expect, it } from 'vitest' | |||
| import { reachesReactNativeLinking } from '/Users/jinwoo/orca-lanes/ota-c3-design/config/scripts/mobile-web-app-external-link-seam.mjs' | |||
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '1,80p' config/scripts/mobile-web-app-external-link-seam.test.mjs
rg -n 'mobile-web-app-external-link-seam\.test|config/scripts/.*test\.mjs|vitest' package.json .github/workflows config/scripts --glob '!**/node_modules/**'Repository: stablyai/orca
Length of output: 50369
🏁 Script executed:
set -eu
printf '%s\n' '--- test and sibling module ---'
cat -n config/scripts/mobile-web-app-external-link-seam.test.mjs
cat -n config/scripts/mobile-web-app-external-link-seam.mjs
printf '%s\n' '--- vitest config and package scripts ---'
rg -n -C 4 'include|exclude|alias|config/scripts|vitest run|test:|test"' config/vitest.config.ts config/vitest.performance.config.ts package.json
printf '%s\n' '--- exact repository references to this test and sibling path ---'
rg -n -F 'mobile-web-app-external-link-seam.test.mjs' . --glob '!**/node_modules/**'
rg -n -F 'mobile-web-app-external-link-seam.mjs' . --glob '!**/node_modules/**'Repository: stablyai/orca
Length of output: 30015
Use a repository-relative import.
Vitest discovers this test through the shared config/vitest.config.ts include pattern. The absolute path can fail in CI or another checkout because it points to the author’s local filesystem. Import the sibling module with a relative path.
Proposed fix
-import { reachesReactNativeLinking } from '/Users/jinwoo/orca-lanes/ota-c3-design/config/scripts/mobile-web-app-external-link-seam.mjs'
+import { reachesReactNativeLinking } from './mobile-web-app-external-link-seam.mjs'📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { reachesReactNativeLinking } from '/Users/jinwoo/orca-lanes/ota-c3-design/config/scripts/mobile-web-app-external-link-seam.mjs' | |
| import { reachesReactNativeLinking } from './mobile-web-app-external-link-seam.mjs' |
There was a problem hiding this comment.
Caution
The new seam-predicate test imports its subject through an absolute path on the author's machine, so the config/scripts suite cannot load it — CI shard test / tests node 24 3/8 is red on exactly this. One-line fix inline.
Reviewed changes
- Closed the in-page grant gap — the explorer entry now declares
externalLink, and a new census pins explorer grants ⊇ preview grants, so a Markdown link in a preview reached from the page-served explorer is no longer refused. - Shared one expected route list —
EXPECTED_PAGE_ROUTESbacks both manifest assertions, so the added files routes are pinned once and the file stays under its line cap. - Widened the seam predicate —
reachesReactNativeLinkingnow matches both quote styles, with a direct predicate test (whose import is the blocker above). - Keyed both shell switches on the whole route —
mobileFileShellRouteKeyserializes the params the same way the page's bootstrap does, so a same-path param change remounts and the page learns the new route; tests cover both the explorer and the preview. - Derived the discard request from its draft —
useMobileFilePreviewBackdrops the pending request when the draft it was about empties, so a save while the prompt is up no longer re-shows it on the next edit.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Round 3. **The blocker is mine and the reviewer's diagnosis is exact.** The seam predicate test imported an absolute path into this lane's worktree. On CI that module does not exist and it takes the whole `config/scripts` suite down; here it resolved to the same file by accident, so the test was green against a tree rather than against the checkout — which is why reverting the double-quote fix left it passing and the predicate untested. Relative now, and proved: reverting the fix in place reds both double-quoted cases, which is the first time this test has failed for the right reason. Every file this PR touches is grepped for `/Users/` and `orca-lanes`; none carries a path. **Three comments outlived the grant change.** The two lists became equal when the explorer took `externalLink`, so "longer than the explorer's" and "declared with different grants" were both false. Corrected to what is actually true: the lists are equal and the reasons are not — the preview has its own consumer in `MobileMarkdown`, the explorer has none and declares the grant because its rows push to the preview in-page. **The duplicated serializer is pinned rather than imported.** `shellRouteHref` lives in `page-bootstrap.ts` beside the page's RPC client and its document channel, so a native route file importing it would pull both into the app. The copy stays, and a test asserts the two agree on three routes; dropping the empty-search branch reds it. **Recorded, not fixed:** the sidebar `HostScreen` pushes to `/h/<id>/tasks` through the handoff, which is local, so on a tablet the tasks page runs without `native.clipboard.write` from any page route and its copy actions refuse silently. Pre-existing since C2.1 for the worktree list and agent history. Named in the explorer's manifest comment as the known remaining hop, with the fix being a handoff rule in its own PR. The equality pin needed `it.each<BridgeInitRoute>`: the inferred table is a union whose members carry `?: undefined`, which the ratchet caught. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
ℹ️ No new issues in this delta — the round-3 blocker is fixed. Not an approval only because the earlier minor thread on
config/scripts/mobile-web-app-render.test.mjs:452(a comment that over-claims whattoContain('readme.md')proves) is still open and untouched by these commits.
Reviewed changes
Since the prior pullfrog review (4aa39e7ba8):
- Fixed the seam predicate test's import —
mobile-web-app-external-link-seam.test.mjsnow imports./mobile-web-app-external-link-seam.mjsinstead of the author's absolute lane path, so theconfig/scriptssuite (and the redtest / tests node 24 3/8shard) can load it; a repo-wide search finds no other machine paths. - Pinned the shell-route key against the page's serializer —
mobile-file-shell-route.test.tsassertsmobileFileShellRouteKey(route) === shellRouteHref(route)for a plain route, a route with anameparam, and a preview route, holding the deliberate copy equal topage-bootstrap's serializer that must not be imported into a native route file. - Updated the grant and route comments — the files external-links census and
mobileFileShellRouteKey's JSDoc now name the transitive-grant and copy-vs-import reasons, and the known sidebar → tasks hop. - Merged
origin/main— thepr.ymlmobile-web-app list resolved as a union, keepingmobile-web-app-drawer-render.test.mjsand adding the two files checks.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Summary
Phase C, C3.1: the file explorer and the file preview become page-served routes. Nine product commits off the C2.1 merge, each inert until the route entries list the routes, then two folding round 1, one folding round 2, one folding the bots, a merge of main and one folding round 3.
3397837302fbf743899f.web.tsxsiblings for both routes and the native switches with the screens as fallback157bf9b1eeAlert.alertinto the screen (RN Web'sAlertis a no-op, so Back with a draft did nothing at all); first as a row under the header, then, in the round-1 fold, as the app's ownConfirmModal, since C1.10 fixed the drawer bug the row was written around and the row had quietly made a modal question non-modal on phones too. Stated degradation: RN Web'sBackHandleris inert, so Android hardware back inside the page pops the native stack without asking; the page's own Back control is where the question lives, and the render check pins the console line that says soa0079fe91ehaptics.web.tsanswers the five haptic names with nothing: expo-haptics' web build fakes a haptic by appending and clicking a hidden checkbox indocument.head, the stray click C1.9 traced, and the explorer fires it per row tap69e618e19amobileFileShellRoute: the route is parsed againstBridgeInitRouteSchemabefore the switch, so a path overBRIDGE_MAX_ROUTE_PARAM_CHARSor a..worktree id stays native instead of reaching the page as aninitnaming no screen112101c4f69e421d13bcasking && hasUnsavedDraft) instead of cleared in an effect7deb63ed5111eb343d5e,53ee48114d76063e7ab1, thepr.ymllist conflict with C2.6 resolved as the union, ten files) and the round-3 fold: the seam predicate test imports its subject relatively and was proved red-first (reverting the quote fix reds both double-quoted cases); the three stale "longer than the explorer's" comments corrected;mobileFileShellRoute's copy ofshellRouteHrefpinned equal by a test rather than imported (the dependency direction forbids the import:page-bootstrap.tswould pull the page's RPC client into the app); the explorer's manifest comment names the sidebar → tasks hop as the known remaining gap4aa39e7ba8externalLinkfor the transitive reason above, with a census case pinning explorer ⊇ preview; seam regexes match both quote styles with a direct predicate test; the discard request drops when the draft it was about goes (adjusted during render, no prop-driven effect) so a save while the prompt is up does not re-show it on the next edit; both switches key on the whole route (mobileFileShellRouteKey) because the page learns its route once frominit, so a same-path param change must remount the shell; the bundle test's two manifest assertions share one expected list (the file had reached 601 of its 600-line cap; no disable, no bump)d780961b07MountedBottomDrawerno longer registershardwareBackPresson web (RN Web'sBackHandler.addEventListeneris aconsole.error; every page drawer since C1 logged it on open and armed nothing); a files render checkmobile-web-app-files-render.test.mjson the shared harness loads an editable artifact, edits, taps Back, asserts theConfirmModaltitle is in the DOM and noBackHandlerline is on the console (red on exactly that line before the guard), plus a Stay case; the encoding pin restated from the grammar with+and&load-bearing (URLSearchParamsis form-urlencoded),=and lone%neutral, newline refused; the explorer web sibling reads throughfirstParam2bf384ba36,d0090544dcfirstParam(an array param joined tohost-a%2Chost-bpassed the segment rule and opened a page for a host that does not exist); both switches keyed on the route pathname; the discard prompt isConfirmModal; the route-encoding pin splits shapes by behaviour (ENCODING_NEUTRALsurvives the query unencoded,ENCODING_LOAD_BEARINGmust not: whitespace,#, an encoded%); the manifest comment names both shared-layout link openers; the shell-route test asserts the schema first in every casea4c73bd749MOBILE_WEB_PAGE_ROUTES; external-link census for both routes; the seam predicate shared with the tasks census inmobile-web-app-external-link-seam.mjs; registered in themobile_web_appjobGrants
/h/[hostId]/files/[worktreeId]navigate,storage,externalLink(transitive: the preview is reachable in-page)/h/[hostId]/files/preview/[worktreeId]navigate,storage,externalLinkThe preview renders Markdown and
MobileMarkdownopens links through the seam, so it needsexternalLink; the explorer's own screens have no consumer of it (closure membership is not the oracle for a grant, because every page route reachesexternal-link.web.tsthrough the protocol wall in the shared host layout). The explorer declares it anyway, for a reason pullfrog found: grants resolve once per session from the route the shell opened (C2.4 ruling 8), and the explorer → preview hop is a local push inside that session, so a preview reached that way ran under the explorer's grants and a Markdown link tap in it was refused silently. Ruling 5 (C3): a route's declared grants are a superset of every page route its screens push to locally. The census pins both facts:MobileMarkdownpresent in the preview closure and absent from the explorer's, explorer grants ⊇ preview grants with the in-page hop as the reason, and neither closure reaching a clipboard. The general invariant over the in-page reachability graph is a Phase D item.What the closure carries
files.watchis a desktop method absent from the mobile allowlist and frommobile/src; C3 reads through the existing request path and the existing reply chunking. Both closures do carry C1's one stream,host-worktree-refresh.ts'sruntime.clientEvents.subscribe, through the shared host layout, as every page route does.src/files(3439 / 302 before the web sibling reachedfirstParam); preview 3666 / 330 / 19 (3667 / 331 / 20 before the round-1 fold deleted the in-screen prompt). The design's 3681 / 254 / 26 was measured from the native route file before C2.1 made the builder resolve the.web.tsx; C3.2 re-derives against this base.matrix-*goldensresult-absent-settlement, 12 pilotsidentical). Two of the six are image previews,files.preview-artifact-imageandfiles.preview-worktree-image, which depend on C3.0'simg-src 'self' data:(fix(mobile): let the shell's page paint a file preview (OTA phase C, C3.0) #21591, landed). Pinned in C3.2, not here.files.mutation-ownershipandfiles.tab-dochave sites undermobile/src/filesand are outside this closure; they are session file-tab operations and belong to C7.Verified
53ee48114d: mobile tsc, ratchet (714 files), whole-tree oxlint, oxfmt, full mobile suite (718 files, 8178 passed, noErrors), config/scripts suite (220 files, 1997 passed, noErrors), themobile_web_appjob's ten-file list underORCA_MOBILE_WEB_APP_DEPS_REQUIRED=1(105 tests), root oxfmt and oxlint on the changed root files, merge-tree max-lines. Parity unmoved: 787 goldens, 396 / 341 / 33 / 0; C1 closure 103 in 22 families.MobileMarkdownaround the seam fails the preview's census and leaves the explorer's passing; the haptics test reads the shipped bytes (ariaHidden,pointer: coarse,setAttribute("switch") rather than the import.verify-gates.shona4c73bd749,d0090544dc,d780961b07,4aa39e7ba8(againstb6e8b1a7b2) and53ee48114d(against76063e7ab1, with a machine-path grep over every changed file).HostScreenpushes to the tasks page locally from any page route, so tasks runs withoutnative.clipboard.writethere; pre-existing on main for/h/[hostId]and agent history since C2.1, fixed by a handoff rule in its own PR.externalLinkreach; the preview keyed on the pathname, correct because every caller pushes), one body correction. The page-level case is also the first browser proof that a realConfirmModalopens inside the shell's page./h/[hostId], grants unchanged).Not covered here
C3.2 certification (
c3-page-closure.ts) and C3.3 device proof follow.RightDrawer.tsxcarries the same unguardedBackHandlerregistration; it is outside both files closures and is left for its own change. The image-preview paint under the C3.0 policy is proved on device in C3.3.Part of the mobile OTA plan (Phase C). Reference PR #13386, never merged.