Repository navigation
fix(mobile): keep an in-page hop local only when the session's grants cover it (OTA phase C, C2.9) - #21723
Conversation
…C, C2.9) The page decides an in-page hop from `init.pageRoutes`, which says which patterns this shell would render and nothing about what each one costs. So a push kept local on the strength of the pattern alone runs the target under the opener's grants — which is how the tasks page is reached from the wide-layout sidebar without `native.clipboard.write`, and why its copy actions refuse silently. `init` now also carries `pageRouteGrants`, the manifest's own route/grant pairs, from the manifest the shell already holds. Optional in both directions: an older shell omits it and an older page ignores it, and a page that receives none keeps today's rule. No new frame kind, no cap change, no protocol bump. The grammar is the manifest's, imported rather than restated (`MobileWebBundleGrantNameSchema`, now exported for this), so a grant name the bundle could not have declared cannot reach the page through this field either. The host validates the pairs before it builds the frame and refuses the session when they fail, for the reason it already refuses a malformed route: an `init` the page would reject whole is worse than no session at all. Two files were at their line ceiling and are split rather than bumped. The pairs schema moves to `bridge-page-route-grants.ts`, which is read by both the envelope and the host, so it belonged in one place anyway. In the session reducer the three sites that each spelled out "patterns, their grants, this route's grants" become one `routeViewOf`; that is a net reduction and removes the fourth spelling before it is written. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The rule the page was using is "the shell would render this pattern", and that is not the question. Grants are resolved once, from the route the shell opened, so a push kept local runs the target under the opener's list. On a wide layout the sidebar renders beside every `/h` route and pushes `/h/<id>/tasks` through this seam, so from the worktree list, agent history or the files pages the tasks page ran without `native.clipboard.write` and its copy actions refused with nothing on screen to say why. `servedHere` now means served here *and* covered: the target's declared grants must be a subset of this session's. An uncovered page route is handed to the shell exactly like a non-page route, and the shell opens it as its own session with its own grants — which is the mechanism that already exists, rather than a new one. Three answers, not two, because an absent field is not an empty one. A shell that sent no pairs keeps the old behaviour: `null` is "nobody told me", and an older shell has to keep working. A target the shell lists but names no entry for is *not* covered — the page cannot justify that hop, so it hands it over rather than guessing in the direction that loses grants. This is C3.1's explorer ⊇ preview finding without its pairwise pin: that hop is covered by this rule and stays local, and the rule scales to the sidebar, which reaches every route and which no pairwise list can keep up with. Red first on the two cases only the new rule answers; the other four are the regression guards and passed before and after. Two whole-session assertions gained `pageRouteGrants: null`, which is what the reader now returns. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
… own grants
The unit tests pin the decision; only a browser shows the control exists, is
reachable at the viewport where the sidebar renders, and that the document does
not move when the hop is handed over.
Four cases on the shared harness, which now forwards `pageRouteGrants` (omitted
when a caller names none, because an absent field is not an empty one and the
page reads the difference).
- Wide, session without `native.clipboard.write`: tapping Tasks posts exactly one
`navigate` notify, the document stays on the worktree list, and **no new chunk
is fetched** — which is what says the page did not quietly render tasks under
the wrong grants.
- Wide, same tap with the grant added: no notify, the document moves to `/tasks`.
Without this the first case would pass on a page that simply never navigates.
- Wide, shell sending no pairs at all: the old behaviour, local. An older shell
must not start handing every hop over on a field nobody sent.
- Narrow: asserts the absence rather than a tap. `app/h/_layout.tsx` renders the
sidebar only on a wide layout, and only that header branch labels its Accounts
and Tasks controls; the narrow header's are unlabelled pressables. So the hop
does not exist at that viewport, and `getByLabel('Tasks')` finding nothing is
the honest assertion. That unlabelled narrow header is a real accessibility gap
and is not this lane's to fix.
Registered in `pr.yml`'s `mobile_web_app` job beside the other render checks.
Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The rule landed in the commit before this one decides each hop; this says which hops those are, so a route's grants growing — or a new push between two page routes — shows up here rather than as a verb that silently refuses on a device. Openers are every page route, not the one that happens to push. On a wide layout `app/h/_layout.tsx` renders the worktree-list sidebar beside every `/h` route and its header pushes tasks, which is exactly why a pairwise pin is the wrong shape: the sidebar reaches everything, so the census has to be the cross product of what the manifest declares against what the source actually builds. Targets come from the hrefs the app builds, read out of `mobile/src` and `mobile/app` and reduced to route patterns, so a hop nobody writes is not pinned and a hop someone adds is. A presence case asserts the sidebar's tasks push is among them, because a census that stopped finding hops would go quietly green. Two hops are pinned as handed off today, both into tasks, which is the only route declaring more than `navigate` and `storage`. A third case asserts the other half of the rule on the manifest: a target asking for no more than its opener stays in the document. Checked that it discriminates rather than assuming: widening the worktree list's grants to cover tasks fails the pin, and restoring them passes it. **No pin was deleted.** The brief expected C3.1's pairwise explorer/preview pin to be replaced here, but C3.1 is not on this base — `MOBILE_WEB_PAGE_ROUTES` has three routes and no `files` entry, so there is nothing to remove. When C3.1 lands, its pin is this census's to subsume. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
`statSync` was imported and never used; `oxlint` fails it. My error: I committed the census on a green test run without waiting for lint, the same order mistake I made earlier in this lane. Fixed forward rather than amended, because the lane forbids rewriting a commit that exists. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
C3.1 landed while this branch was open, and it brought the case this lane generalises: the explorer pushes to its own preview, that push stays in the document, so the preview runs under the explorer's grants. Its pin asserted that one pair by name. The census now covers it as a consequence rather than a rule. With the files routes in the manifest the cross product finds six more hops the session cannot cover — the sidebar into files from the worktree list and from agent history, and both files routes into tasks — and it does **not** find explorer → preview, because the preview declares no more than the explorer. That absence is the pairwise pin, derived. So the pairwise block is deleted, with its import. The rest of that file stays: its external-link seam checks and its clipboard-absence control are about what the files closure contains, which this census says nothing about. Checked the extended census still discriminates: granting the explorer `native.clipboard.write` fails the pin, restoring it passes. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…worktree list The defect is not "the worktree list pushes tasks". On a wide layout the sidebar renders beside every `/h` route, so the same hop exists from the files explorer, whose session carries `externalLink` but not `native.clipboard.write`. One opener proving the rule would have left the general case to inference, which is the inference C3.1's pairwise pin already made once. Opened on `/h/<id>/files/<wt>` with the files route's own grants, the sidebar's Tasks control posts exactly one `navigate` notify, the document stays on the files route, and no new chunk is fetched. The harness helper now takes the route and the text to wait for, so a case can open on something other than the worktree list without a second copy of it. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The `awaitText` parameter I added in the commit before this one was never wired into the wait, so it was dead and `oxlint` failed it. The case still passed, because the files route renders the host name in its sidebar and that is what the helper was still waiting on — which is exactly the kind of accident a dead parameter hides. Third time in this lane I have committed on a green test run before lint finished. Fixed forward, not amended. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
`onManifestRead`'s download branch set `pageRoutes` and `routeGrants` from the new manifest and dropped `pageRouteGrants`; nothing downstream recomputes it, so every first install and every OTA update reached `ready` with the default or the previous generation's pairs. The page then read each target as listed-with-no- entry and handed off every in-page hop. `routeViewOf` moves to `page-route-policy.ts`, beside the two functions it calls, to keep the reducer under its line cap without a bump; its stale neighbouring comment, which described a filter that moved into it, goes. Red first: the cold-cache and generation-change cases failed, the cached-hit case already passed. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. 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 (11)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe mobile web shell now carries per-route grant declarations through session state and bridge initialization. The page keeps route hops local only when the target route’s grants are covered by the current session. Invalid grant declarations refuse route initialization. Older shells preserve the previous local-navigation behavior. New static census, unit, integration, and browser render tests validate route coverage, handoff behavior, viewport variants, and legacy compatibility. Priority: ➖ Normal 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description gives detailed coverage of the change, rationale, implementation, testing, and compatibility behavior. However, it does not follow the required template structure and omits a Resolution Restructure the description using all required template headings. Add a
✨ 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
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟠 Major · Store pageRouteGrants on the fresh-download path. · mobile-web-shell-session.ts:211-214
mobile/src/mobile-web-shell/mobile-web-shell-session.ts:211-214
🎯 Functional Correctness | 🟠 Major | ⚡ Quick winStore
pageRouteGrantson the fresh-download path.
onManifestReadderivespageRouteGrants, but the download patch stores onlypageRoutesandrouteGrants. The session therefore keeps its initial empty array. The bridge sends that array explicitly, so matching page routes have no grant entry and are handed to the shell.Proposed fix
{ pageRoutes, + pageRouteGrants, routeGrants, state: {
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 3059d760-4b23-450d-92be-324665de11ea
📒 Files selected for processing (25)
.github/workflows/pr.ymlconfig/scripts/mobile-web-app-files-external-links.test.mjsconfig/scripts/mobile-web-app-handoff-grants-render.test.mjsconfig/scripts/mobile-web-app-render-harness.mjsconfig/scripts/mobile-web-page-route-hop-coverage.test.mjsmobile/src/mobile-web-shell/MobileWebShellScreen.tsxmobile/src/mobile-web-shell/bridge-host-contract.tsmobile/src/mobile-web-shell/bridge-host-init.test.tsmobile/src/mobile-web-shell/bridge-host-test-harness.tsmobile/src/mobile-web-shell/bridge-host.tsmobile/src/mobile-web-shell/bridge/bridge-client-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-page-route-grants.tsmobile/src/mobile-web-shell/bridge/bridge-port-pair-test-harness.test.tsmobile/src/mobile-web-shell/bridge/bridge-rpc-client-frames.test.tsmobile/src/mobile-web-shell/mobile-web-shell-session-contract.tsmobile/src/mobile-web-shell/mobile-web-shell-session.tsmobile/src/mobile-web-shell/page-route-policy.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.tsmobile/src/navigation/route-handoff.web.test.tsxmobile/src/navigation/route-handoff.web.tssrc/shared/mobile-web-bundle/manifest-contract.ts
💤 Files with no reviewable changes (1)
- config/scripts/mobile-web-app-files-external-links.test.mjs
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
The reachability filter was inert. Harvesting every `/h/${…}` template caught the
five screens that declare their own mount pathname, two `pathname ===`
comparisons and the route template types, so every declared route was reachable
through its own mount: the pinned table was the all-pairs one, eight hops with
the filter and eight without.
Targets now come from the arguments of `router`/`navigation` `push`, `replace`
and `navigate`, and of `navigateFromHostList`; mounts, comparisons and types are
excluded by construction because they are not navigation arguments. Two real
hops are not written as a literal, so a local binding or a call is followed one
step to the function that returns the pathname: the files explorer is pushed as
`{ pathname: descriptor.pathname }` and the preview as
`push(createMobileFilePreviewHref(...))`. A call site whose target cannot be read
is returned rather than dropped.
Derived patterns go from 11 to 10; the pinned table stays at eight because all
five page routes are genuinely pushed to. What changes is that the filter now
discriminates: deleting the header's two tasks pushes reds the presence case and
drops the four `-> tasks` rows from the pin, where the old derivation stayed
green on the same deletion because `app/h/[hostId]/tasks.tsx` still declared the
pathname. A push added at a real call site appears in the set.
Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The pairwise pin this case replaced asserted the preview declares at least one grant before asserting the explorer covers them all; without it two empty lists satisfy the subset check and a route that lost its grants passes. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Two passages described the world before this PR: the explorer's note said the census pins its pair with the preview, and a closing paragraph left the sidebar's tasks hop open for a later PR. This is that PR. Covering the preview now buys the in-document hop rather than making it correct, an uncovered target is handed to the shell and reopened under its own grants, and the census reads the explorer to preview relation off this list rather than pinning it by name. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
CodeRabbit on #21723: both fixtures declared the tasks route as `navigate`, `storage`, `native.clipboard.write` while the manifest also declares `externalLink`, so no covered-session case ever required it. Both now mirror the manifest's four, and the covered sessions hold them. That alone does not make an `externalLink`-blind rule fail, since those sessions hold every grant either way, so the unit suite gains the case that does: a session holding the clipboard but not `externalLink` must still hand the hop off. Mutating the rule to treat `externalLink` as always held reds that one case and no other. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
Caution
The new pageRouteGrants is not carried through the download step in the session reducer, so on a fresh download the page receives [] and hands off every in-page hop — the exact opposite of this PR's fix, and a later manifest read can leave stale pairs that keep an uncovered hop local. Details inline.
Reviewed changes
init.pageRouteGrantscrosses the wire. The manifest's{pathname, grants}pairs are added to the host contract/init frame/envelope as an optional field (absent = older shell, old rule), validated by the same grammar as the manifest (MobileWebBundleGrantNameSchema), and the host refuses the session on a malformed pair.routeViewOfcollapses three spellings.mobile-web-shell-session.tsderivespageRoutes,pageRouteGrants, androuteGrantstogether from one manifest read, andimplementedPageRouteEntriesis added topage-route-policy.ts.servedHererequires coverage.route-handoff.web.tskeeps a hop local only when the matched pattern has a pair whose grants are all insession.grants.native; a listed pattern with no pair, or a pair with an uncovered grant, is handed to the shell.- Test assets. A Playwright wide/narrow render check proves the sidebar hop hands over without moving the document or fetching the target chunk, unit tests pin the rule, and a source-scanning census pins which hops must be handed off (folding in C3.1's pairwise pin).
ℹ️ The census pins the manifest, not the rule
config/scripts/mobile-web-page-route-hop-coverage.test.mjs derives its handed-off set from MOBILE_WEB_PAGE_ROUTES and compares it to the hand-written HANDED_OFF list. It is a useful tripwire for a manifest grant change, but it cannot fail if servedHere itself regresses to matching pageRoutes alone. It also derives "the hops the app actually builds" from every `/h/${…}` template literal under mobile/src and mobile/app, which includes shell route declarations (app/h/[hostId]/tasks.tsx:31) and pathname comparisons (host-screen/use-host-worktree-actions.ts:171) as well as real pushes — so deleting the sidebar's actual push would not fail its first case. Not a merge blocker; flagged so the pin is not read as covering more than it does.
Technical details
# Census scope
## Affected sites
- `config/scripts/mobile-web-page-route-hop-coverage.test.mjs:5,113-123` — imports only the manifest; no reference to `page-route-policy.ts` or `route-handoff.web.ts`.
- `config/scripts/mobile-web-page-route-hop-coverage.test.mjs:24,40-56` — `HOST_HREF` scans every non-test `.ts`/`.tsx` under `src` and `app`, not `router.push` / `navigateFromHostList` call sites.
## Required outcome
- (Optional) If the census is meant to be the tripwire for "a new push appears", note in its header that removals and non-push literals are out of scope. The runtime rule is already pinned by `route-handoff.web.test.tsx` tests 1 and 6.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Caution
The two new commits are clean test additions, but the blocker from the previous review is still present and these commits do not touch it: mobile-web-shell-session.ts:209-223 (onManifestRead's fetching step) still patches pageRoutes and routeGrants without pageRouteGrants, so a fresh-download session hands off every in-page hop. See the inline comment on the prior review for the full trace. This PR should not merge until that field is carried through the download step (and the reducer output pinned by a test).
Reviewed changes (delta since review 5257545979 at 1f1425c)
- Files-route render case.
config/scripts/mobile-web-app-handoff-grants-render.test.mjsopens the shell on/h/<id>/files/<wt>with that route's grants (externalLink, no clipboard) and proves the sidebar's Tasks control posts exactly onenavigatenotify, the document stays on the files route, and no target chunk is fetched. It fails under the pre-fix rule, so it is a real regression guard. - Render helper signature.
openHostRoutegainsrouteandawaitTextparameters (the wait had been hardcoded toSHELL_HOST.name), andpageRoutesnow lists the files pattern alongside host and tasks. Defaults preserve the existing four cases.
The prior critical finding (pageRouteGrants not carried through the download step) is unchanged by this delta.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Both waits for the hop to land read as a bare 30 s timeout when it does not. The CI failure that sent this file back was a `TypeError` inside React Navigation that blanked the document, and it was invisible here because the error assertions run after a wait that never returns. The wait now throws with the page's own account: the pathname it stayed on, the collected page and console errors, the `navigate` notifies posted, the first 300 characters of the body, and every `.js` response since the click with its status. The response listener records every script answer rather than only the 200s, so a chunk the navigation waits on can be seen failing; the 200-only list the no-new-chunk assertions read is unchanged, as is everything the five cases assert. Kept in this file because no other render file waits on the pathname moving. Proved by mutating the rule to hand every hop off: the covered case fails naming the pathname it stayed on, an empty error list, the notify it posted and no scripts since the click — which is the handoff signature, distinct from the crash signature CI saw. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
✅ No new issues found.
The blocker from the previous review is fixed, and the new test assets discriminate. Reviewed the delta since the prior pullfrog review (5257557052 at 411c105).
Reviewed changes
pageRouteGrantsnow survives the download path.onManifestRead'sfetchingstep spreads the samerouteViewOfresult as its sibling sites, so a cold-download or post-updatereadysession carries the pairs derived from its own manifest rather than the empty default.mobile-web-shell-session-grants.test.tspins the cold-download, cached-hit, and generation-change outputs with exacttoEqual.- The hop census derives targets from call sites. New
config/scripts/mobile-app-navigation-targets.mjsreadspush/replace/navigate/navigateFromHostListarguments (following one local binding or builder call), replacing the old every-/h-template harvest that made the reachability filter inert. Removing the sidebar's tasks pushes now reds the presence case. - Preview guard restored and route comments rewritten.
mobile-web-page-routes.mjsdocuments the new handoff rule, and the census re-asserts the explorer ⊇ preview relation the deleted pairwise pin used to hold. - Fixtures mirror the manifest and one case withholds
externalLinkalone. Both render/unit fixtures give tasks the same four grants the manifest declares; the new unit case fails a rule that reads only the verb grants. - A stalled hop names its cause. The render test's
waitForTasksRoutetimeout reports pathname, page errors, notifies, body text, and script responses since the click.
Verified locally: mobile-web-shell-session-grants (6), bridge-host-init (21), use-mobile-web-shell-bridge (22), route-handoff.web (35), mobile-web-shell-session (67), and the census (3) all pass.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
# Conflicts: # .github/workflows/pr.yml # config/scripts/mobile-web-app-render-harness.mjs # mobile/src/mobile-web-shell/use-mobile-web-shell-bridge.test.ts
The narrow case asserted the absence of a labelled Tasks control, which was true only because the narrow toolbar carried no accessibility props. C2.10 gave it the wide sibling's role and label, so the assertion was red on the merge and, worse, the rule this file is about went unproven on the branch the phone actually presses. It taps that control now: at 390 px there is exactly one, and the tap posts exactly one navigate notify for the tasks route while the document stays on the worktree list and fetches no new chunk. Red first against the merged header (count 1, expected 0); with the session given native.clipboard.write the hop goes local and the case reds, which is what says the assertions discriminate. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes (delta since prior pullfrog review 5257684890 at adfcbaf)
- Narrow-viewport hop is now exercised, not assumed. After main's C2.10 gave the narrow host header's Tasks control the same role and label as the wide sidebar's, the
390 pxrender case inmobile-web-app-handoff-grants-render.test.mjstaps that control instead of asserting it absent, and proves the same handoff: exactly onenavigatenotify for/h/<id>/tasks, the document stays on the host route, and no new chunk is fetched. It reaches the handoff throughnavigateFromHostList→router.push(the non-embedded branch), so it genuinely pinsservedHereon this branch. - Two merges of
origin/main.086c192f9aandf3facf1501carry C2.10's header labels and later Phase C work into the branch; no PR-authored product change in this delta. pageRouteGrantsstill derived throughrouteViewOf. The prior review's blocker fix (carried through the download path) is untouched here, and the census and unit cases remain as reviewed.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
The pre-C2.9 summary said the answer is whether this document renders the target, which is exactly the claim the block comment below it replaced: the predicate now also requires the target's grants to be covered. Two doc comments on one declaration, the first of them wrong. Comment only; the 35 handoff cases are unchanged and green. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The host builds `pageRouteGrants: <issue>` so a refusal says which of the two checked inputs failed, and nothing read it: the case counted refusals, so a host that reported the route's own verdict for a malformed pair would have stayed green while sending whoever reads the refusal to a pathname that was never the problem. The case pins the prefix, a non-empty issue behind it, and that the diagnostic and the callback carry the same string. The control is an opener that fails the other way: a malformed route reports its own issue and does not take this prefix, without which the pin would hold on any reason at all. Red first with the field branch dropped from the reason: the prefix assertion fails and the control stays green. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
… calling `implementedPageRouteEntries` and `implementedPageRoutes` were the reducer's two ways in before it moved to `routeViewOf`. The entries form had no caller anywhere afterwards and the patterns form had only this test, so the module's public surface advertised two functions no product code reaches. Both are module-local now; the surface is `matchesRoutePattern`, `pageRendersRoute`, `grantsForRoute`, `routeViewOf` and the grant list. The test reads the same list through `routeViewOf(...).pageRoutes`, which is the reducer's own view of it, so no assertion changed and no export is kept for a test. Red first: with both un-exported and the test untouched, seven cases fail with `implementedPageRoutes is not a function`; routed through the view all nineteen pass. Still discriminating, as a control: with the grant filter dropped from the entries helper, four of them fail. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
# Conflicts: # mobile/src/mobile-web-shell/bridge/bridge-envelope.ts # mobile/src/mobile-web-shell/page-route-policy.ts
PR E's two haptics cases arrived with the merge calling `implementedPageRoutes`, which this branch had already made module-local, so the merged file was red with `implementedPageRoutes is not defined` on both of them. They read the same list through `pageRoutesOf`, the view the rest of the file already uses, so neither assertion changes. PR E's paragraph named that function for the filter it describes; the filter now sits in the entries helper the view is built on, so the sentence says that instead of naming a function the reader cannot see. Red: the two cases above on the merge. Green: all 21, PR E's two included. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
PR E put `haptics` on all five manifest routes, and these fixtures still carried the pre-E grant lists: tasks with four grants where the manifest now declares five. A fixture that is short the same token on both sides of the subset check agrees with the rule by accident, and would have gone on agreeing after the token stopped being universal. The pairs mirror the manifest now, and each session carries what its opener route would actually be granted, since the host narrows a route's declared grants to what the shell implements and the shell implements the token. Red first, with the token added to the pairs alone: the two covered-hop cases flip to handed-off, `stays in this document when the session already covers the target` and `keeps the hop in the document when the session covers tasks`. Green once the sessions carry it, 35 and 5. The hop census needed nothing: it reads `MOBILE_WEB_PAGE_ROUTES` itself. Measured there, all 5 routes declare the token and it is the missing grant in 0 of the 8 uncovered pairs, so it cannot decide a hop and the rule still reads only `pageRouteGrants`. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…osure #21908 recorded this pin at 4,324 for the haptics notify module. C2.9 adds two more that the same closure reaches: the page-route-grants schema and the manifest contract whose grant grammar it imports rather than restates, both pulled in by `bridge-envelope.ts`, which the page reads to parse `init`. Named in the docstring beside #21908's sentence rather than folded into its number, because the three modules arrived from two PRs and a single count with one reason invites the next author to assume the rest. Red first against 4,324: expected 4,326. Measured on this head, not inferred -- a control worktree at pristine main gives 4,324, so the two are this branch's. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes (delta since prior pullfrog review 5263031024 at f3facf1)
- Refusal prefix pinned by a discriminating case.
bridge-host-init.test.tsasserts a malformedpageRouteGrantspair is refused with apageRouteGrants:prefix and that the diagnostic and the callback carry the same string, with a malformed-route control that must not take the prefix — so the pin cannot hold on any reason at all (a4dc78acb0). - Handoff fixtures mirror the manifest's
hapticstoken again. The merged PR E puthapticson all five page routes; the render/unit fixture pairs and the sessions both carry it now, so the subset checks no longer agree by accident (c28271172a,62bccfd7f7). - The route filter left the module's public surface.
implementedPageRouteEntries/implementedPageRoutesare module-local now that the reducer readsrouteViewOf; the test reads the same list throughrouteViewOf(...).pageRoutes(7cf2532ef6). - Session route closure re-recorded at 4,326. #21908's haptics module plus C2.9's
bridge-page-route-grants.tsandmanifest-contract.ts, both reaching every page closure throughbridge-envelope.ts(1cf1b302b7). - Two merges of
origin/mainbring C7.10 E haptics, C7.10 B mermaid, and #21908; no PR-authored product change in this delta (c3372948e5,0a6fdb1c90). - The contradicted pre-C2.9 predicate one-liner is gone (
671bedcd01).
The product rule (servedHere requiring the target's grants to be covered) is unchanged since the reviewed and resolved blocker fix, and the merged haptics token is on both sides of every coverage check, so it cannot decide a hop.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Summary
Phase C, C2.9 (seventeen commits: five product, two merges of main with their folds, a files-route render case with its helper fix, the round-1 fold, two test folds, and the narrow case aimed at C2.10's header): an in-page hop is taken only to a route the session's grants cover. Otherwise the page hands the hop to the shell, which opens the target natively under a session carrying the target's own grants.
The defect
Grants are resolved once per session from the route the shell opened:
init.grants.nativeon the page andgrantsForRoute(session.routePathname)on the host.useRouteHandoffkept a push local whenever the target matched any pattern ininit.pageRoutes, so a page route reached by a local push ran under the opener's grants. On a wide layout the shared host layout renders the sidebarHostScreenbeside every/hroute, and its header pushes/h/<id>/tasksthrough the handoff, so from the worktree list, agent history or the files pages the tasks page ran withoutnative.clipboard.writeand its copy actions refused silently (found by pullfrog and round 3 on #21710). C3.1 patched the one hop it owned by widening a grant list; the sidebar reaches every route, so no pairwise list keeps up.The rule
init.pageRouteGrantsCommits
83b3041de5init.pageRouteGrants, the manifest's own route/grant pairs, optional in both directions; grammar imported from the manifest contract (MobileWebBundleGrantNameSchema) rather than restated; the host validates the pairs before building the frame and refuses the session on failure, as for a malformed route; schema split intobridge-page-route-grants.tsand the session reducer's three spellings of "patterns, their grants, this route's grants" collapsed into onerouteViewOf(two files at their line cap, split not bumped)b41312bb13servedHeremeans served and covered, three answers as above; the explorer ⊇ preview case stays local under the rule0ad04f967apageRouteGrants: wide viewport without the clipboard grant posts exactly onenavigatenotify, the document stays put and no new chunk is fetched (the page did not quietly render tasks under the wrong grants); wide with the grant moves the document with no notify; no pairs keeps the old behaviour; narrow asserts the hop does not exist there (only the wide header labels its controls)e2d7816650,1f1425c566ac024d4f05, C3.1) and the fold of C3.1's pairwise pin: run against the merged manifest the census failed immediately and named six new uncovered hops (the sidebar into the files explorer from the worktree list and from agent history, and both files routes into tasks), all now pinned handed-off; it does not name explorer → preview, because the preview declares no more than the explorer, which is C3.1's pairwise pin derived rather than stated, so that block and its import are deleted and the case asserts the relation through the manifest; the file's seam and clipboard-absence checks stay (they are about the closure's contents, which the census does not cover)2fcb999128,411c105423/h/<id>/files/<wt>with that route's own grants, the sidebar's Tasks control posts exactly onenavigatenotify, the document stays on the files route and no new chunk is fetched (five cases in the file); the render helper now waits on the text its caller names (a deadawaitTextparameter had let the case pass only because the files route happens to render the host name the helper was waiting on)706b07807bpageRouteGrants, so every first install and every OTA update handed off every in-page hop; now every branch derives through onerouteViewOf, moved topage-route-policy.tsbesidegrantsForRoute(the reducer sat at its line cap; split, not bumped); three reducer cases (cold download, cached hit, generation change), two red before the fixe23bc80c29mobile-app-navigation-targets.mjs: arguments topush/replace/navigateon a router, plusnavigateFromHostList; a local binding or href builder followed one step), not from every route template in the sources, which had made the reachability filter inert; with the header's two tasks pushes removed the presence case and the pin both red, where the old derivation stayed green359001f9f8,8870d40e04mobile-web-page-routes.mjscomments rewritten for the ruledae6ea7553externalLinknot: still handed off)adfcbaf685fc61b73177,079e84e4eeconfig/scriptscensus: every page route is an opener (the sidebar reaches all of them), targets derived from the hrefs the app builds, so an unwritten hop is not pinned and a new one is; two hops pinned as handed off, both into tasks; a presence case keeps the sidebar's tasks push found; widening the worktree list's grants to cover tasks fails the pin; an unused import dropped086c192f9aorigin/main(169bccc544, carrying #21727'squery-stringpatch and C2.10's header labels; three conflicts:pr.ymltook main's side, whoseconfig/scripts/mobile-web-app-prefix already registers the render file; the render harness and the bridge hook test took unions,pageRouteGrantsbeside main'sstreams/windowCapsandBRIDGE_SCREENCAST_BINARY_GRANT)d5a9a9f7fenavigatenotify for/h/<id>/tasks, the document stays on/h/<id>, no new script chunk is fetched, no page errors; the old absence case reds against the merged header (expected 1 to be +0); granting the sessionnative.clipboard.writereds the new case (expected [] to deeply equal [ { …name: 'navigate', href: '/h/render-check-host/tasks' } ])f3facf1501origin/main(8a3a119052)671bedcd01a4dc78acb0pageRouteGrants:refusal reason and that the diagnostic and callback carry the same string; control: a malformed route reports its own issue without that prefix (round 2)7cf2532ef6implementedPageRouteEntriesandimplementedPageRoutesmodule-local; the test reads the list throughrouteViewOf(...).pageRoutes(round 2; red 7 failed with the exports gone and the test untouched)c3372948e5origin/main(35005fb65c, PR E haptics and PR B mermaid):bridge-envelope.tsas a union (now exactly 300 of 300 lines);page-route-policy.tskeeps the split with PR E's paragraph re-homed onto the entries helper andBRIDGE_HAPTICS_GRANTcarried; PR E's two policy cases routed throughrouteViewOfc28271172a0a6fdb1c90origin/main(2d697a4012, #21908)1cf1b302b7bridge-haptics-notify.tsplus this PR'sbridge/bridge-page-route-grants.tsandmobile-web-bundle/manifest-contract.ts, reaching every page closure throughbridge-envelope.ts(redexpected [ …(4326) ] to have a length of 4324)No frame kind, no cap change, no
BRIDGE_PROTOCOL_VERSIONbump. The host side stays bound to the opened route.Verified
Lead gate on
1cf1b302b7(round-2 folds, the fixture fix, merges of main through2d697a4012) against2d697a4012(verify-gates.shin the lane tree with the patched install, four artifacts rebuilt): tsc 0, ratchet 0, oxlint 0, oxfmt 0, changed-code quality 0, react-doctor 0, oxlint-config 0, anti-slop 0, merge-max-lines 0 (bridge-envelope.tsat exactly 300 of 300), root oxlint over 29 changed files 0, machine paths 0; config/scripts 240 files / 2,177 passed, 0 failed; mobile 774 files / 8,671 passed, 0 failed.Round 2 (delta, on
d5a9a9f7fe): approve, four lows, all folded above; merge integrity, both engines, three narrow-case controls, the patchedquery-stringresolution and the census reproduced by the reviewer.Lane gates on
411c105423: mobile tsc, ratchet, oxlint from mobile and root (0 errors), oxfmt, full mobile suite (718 files, 8186 passed, noErrors), config/scripts suite with mobile deps required (222 files, 2006 passed), changed-code quality, react-doctor, merge-tree clean, machine-path grep clean.Parity: no family moved; 787 goldens, classes unchanged; nothing under
mobile/rpc-foundation/.Lead reproduction:
verify-gates.shon1f1425c566,411c105423,8870d40e04,dae6ea7553andadfcbaf685againstac024d4f05; the stripped-tasks-pushes mutation reds the presence case and drops the four-> tasksrows; machine-path grep over every changed file.Round 1 (on
1f1425c566): one blocker and two majors, all reproduced and folded above.CI on
411c105423: the two local-hop render cases time out. Not this PR: on a lockfile-faithful install the local push crashes in React Navigation'sgetPathFromState(queryString.stringify is not a function), because fix(deps): update vulnerable transitive packages #21652'squery-string9.5.1 override exports onlydefault; every lane tree still ran 7.1.3. Fixed by fix(mobile): restore query-string's named exports under the 9.5.1 override #21727 (169bccc544); merged here as086c192f9a. In the lane's tree with a lockfile-faithfulmobile/install, expo-router resolves[email protected]_patch_hash=8624f1be…whoseindex.jsendsexport * from './base.js',query-string-named-exports.test.tspasses, and both local-hop render cases pass. Lead gate ond5a9a9f7feagainst169bccc544(verify-gates.sh, run in the lane tree with the patched install, artifacts rebuilt): tsc 0, ratchet 0, oxlint 0, oxfmt 0, changed-code quality 0, react-doctor 0, oxlint-config 0, anti-slop 0, merge-max-lines 0, root oxlint over 27 changed files 0, root oxfmt over 7 files 0, machine paths 0; config/scripts 238 files / 2,137 passed, 0 failed; mobile 771 files / 8,616 passed, 0 failed. These cases are the first in CI to make a real expo-router push in a browser, which is why main stayed green.Noted, not changed
The narrow-viewport host header's Accounts control: C2.10 (
cef4416115) named the header's controls, and this PR's narrow case now taps the labelled Tasks control (d5a9a9f7fein the commit table); nothing else in that header is asserted here.Part of the mobile OTA plan (Phase C). Reference PR #13386, never merged.