Repository navigation
fix(mobile): a refused update serves the cached generation while the host is up - #22237
Conversation
…host is up A newer generation that fails to fetch or stage was refused with a named reason and then painted a wall with "Try again" over an intact generation already on disk — the same one the offline branch opens without being asked the moment the host goes away. `onDownloadFailed` now branches on what is cached rather than on which side refused: with nothing on disk the refusal is still the screen, and with a generation on disk it is opened through the offline branch, judged by its own route list. The refused generation is never staged, committed or persisted, and nothing about the refusal is written, so the next launch asks the host again. The bundle-side refusal is named as a dismissible notice above the page, on the existing host-route banner. It says what happened and promises no retry, because the shell schedules none. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…h before serving it The fallback served a cached generation on the strength of the offline rule, which skips the compat check because a host nobody can reach cannot have changed. On this path the host has just answered, and an update usually exists precisely because it moved — so bytes that were inside the protocol window when they were written may be outside it now. `CachedGeneration` now carries the three fields the compat verdict reads, projected in `openCache` off the manifest stored beside the assets. That manifest is never absent: `readActiveGeneration` answers null for a generation whose manifest did not parse, and the read schema requires all three. `cachedGenerationWall` lives beside `gateVerdict`, because only an `open` gate is judged further. The other verdicts already have answers there: an absent capability is the native-route rule, and an unreadable status leaves the same empty list, so walling on either would be the `bundle-unavailable` wall that file exists to keep off a host that simply did not reply. A generation outside the window now earns the wall with its verdict, not the download-failed screen, and nothing is deleted: the bytes are intact and a newer host is not what makes them wrong. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 mobile web shell now preserves compatible cached generations when an update download is refused. It records compatibility metadata, blocks incompatible cached generations, and exposes an Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to Refused updates can preserve a compatible cached generation and show a dismissible accessible notice. The current change has no remaining merge-blocking risk. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the cause, fix, compatibility guard, user-visible behavior, and test coverage, but it does not follow the required template. It omits the required Linked Issue, Visual Proof, Testing, AI Disclosure, Review, boundary, Notes, and Checklist sections. Resolution Rewrite the description using the repository template. Add an issue link after “Fixes #”, attach before-and-after visual proof or state N/A with a reason, complete the Testing section and checkboxes, provide AI disclosure when applicable, complete Review and Agent skill upstream boundary, address the Notes items, and complete the Checklist. ✨ 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: e419496b-364f-4a42-8f10-13b525fea1b2
📒 Files selected for processing (12)
mobile/src/mobile-web-shell/MobileWebShellScreen.test.tsxmobile/src/mobile-web-shell/MobileWebShellScreen.tsxmobile/src/mobile-web-shell/catch-all-page-route-states.test.tsxmobile/src/mobile-web-shell/mobile-web-shell-failed-update-fallback.test.tsmobile/src/mobile-web-shell/mobile-web-shell-gates.tsmobile/src/mobile-web-shell/mobile-web-shell-refused-update-decision.test.tsmobile/src/mobile-web-shell/mobile-web-shell-session-contract.tsmobile/src/mobile-web-shell/mobile-web-shell-session-effects.tsmobile/src/mobile-web-shell/mobile-web-shell-session-test-fixtures.tsmobile/src/mobile-web-shell/mobile-web-shell-session.test.tsmobile/src/mobile-web-shell/mobile-web-shell-session.tsmobile/src/mobile-web-shell/use-mobile-web-shell-session.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
There was a problem hiding this comment.
ℹ️ No critical issues — one edge-case ordering inconsistency inline.
Reviewed changes
Reviewed f5b35f1 and 5d037e9 in full (all 12 files).
- Refused-update fallback —
onDownloadFailednow branches on what is on disk rather than which side refused. With a cached generation it opens it through the extractedopenByOwnRouteshelper (previously the transport-only branch), taggingupdateNotice: 'update-failed'for a bundle-side refusal and no notice for a transport drop; with nothing cached the refusal screen is unchanged. - Compat guard on the cached generation — the new
cachedGenerationWallre-judges the cached manifest against the host's stated window, but only whengateVerdictisopen, so a host that simply did not answer stays the native-route rule instead of becoming abundle-unavailablewall.CachedGeneration.compatcarries the three fields this needs, populated from the stored manifest and refreshed on a same-build hit. - Notice surface —
updateNoticeis cleared by every flow entry and by retry, and the screen renders a dismissibleHostRouteNoticeBannerabove the page. Keying the dismiss onsessionIdis sound: session ids are 32 random bytes, so a later refusal cannot be silenced by an earlier tap. - Tests — reducer suite for the decision, a new end-to-end suite over the real store and a fake disk (including the wall case read back off the committed tree), and screen tests for the banner and its dismissal. No retry affordance is promised, matching the reducer.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
The compat wall ran before the route question, so a cached generation that does not carry this route — or predates route listing entirely, `routes: undefined` — earned a terminal `bundle-incompatible` wall where the answer is `native-route`. `onManifestRead` has always taken the other order: a route that stays native has nothing to wall about. `openByOwnRoutes` now asks the route first and applies the wall only on the served branch, and the update notice moved to `served`, so a native answer carries no notice about a screen it is not showing. The other half is the verdict the gates hold at the moment of the refusal. A `fetching` session does not await the gates, so a refusal can land under a verdict the flow never started on. `gateState` is now the one mapping from a gate verdict to a screen, shared by the entry into the flow and by the fallback, so the two cannot answer the same verdict differently: a host that stopped serving a bundle is `native-route`, a status that went unreadable says so and re-arms, a dial in progress or a pending status waits in `checking`, an unreachable host keeps the offline rule and serves the cache unjudged, and `open` is the only answer that leaves a host to judge the generation against. That inverts two round-2 assertions that expected the cached page to be served when the capability list had gone empty. Both were wrong for the same reason: an empty list is the gate's question, not a verdict about a bundle. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…tone The banner is inserted into a screen that is already on screen, so a reader who has moved past the top of the list never arrives at it. It carried no live region and no role, so nothing carried it to them. The urgency follows `tone` rather than being assertive for everything. The failure tone is an action that did not happen — a refused worktree action, or the shell's refused update — and interrupts with `alert` and an assertive region. The notice tone is a bounced route, context for a list already being read, and waits its turn politely; interrupting for that would train people to ignore the first. No role on that arm: React Native has no `status` role, so the polite region is the whole of the answer. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the delta since the prior pullfrog review (5d037e9 → b8ea9bf): two fix commits and a merge of main.
- Fixed the compat-wall ordering the prior review flagged —
openByOwnRoutesnow asks the cached bundle's own route list before the wall, so an unserved route (or one from beforerouteswas listed,routes: undefined) answersnative-routewith no notice instead of a terminalbundle-incompatiblewall. - Unified the gate-verdict-to-screen mapping into
gateState, shared bystartFlowandonDownloadFailed, so a refusal landing under gates that moved mid-download answers the samenative-route/wall/status-unreadable/checkingthe rest of the shell gives;cachedGenerationWallnow takes the caller's already-computed verdict and applies only on the served branch. - Announced the notice banner —
alertandassertivefor the failure tone,politewith no role for the default notice tone, with a dedicated component test. - Inverted the two round-2 cases that asserted
activatingfor a host that stopped advertising the bundle capability tonative-route, matchinggateVerdicteverywhere else.
Verification: the focused suites (27 tests) and the full mobile/src/mobile-web-shell directory (68 files / 1159 tests) both pass on b8ea9bf.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the new head f494ecc. The only commit added since the prior review is a merge of origin/main; the PR's net diff (14 files) is byte-identical to b8ea9bf, so there are no author-side changes. Re-ran the shell suites on the merged head (69 files / 1162 tests) and they pass.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

On the page shell (inert today,
EXPO_PUBLIC_MOBILE_SHELL=otaonly), a refused update walled the workspace even though an intact, previously accepted generation was on disk. Found by the emulator run's failed-update drill: truncate one asset of a newer generation and the shell painted "Try again" while the host was reachable, while the very same cached generation is served the moment the host goes away.Cause.
onDownloadFailedonly fell back to the cache for a transport-side failure; a bundle-side refusal (a truncated asset rejects with a plain error) skipped the cache and returned the failed state.Fix. The branch is now on what is on disk, not on which side refused. Nothing cached: the refusal is still the screen. Something cached: the shell serves it through the same "open by its own routes" path the offline branch uses (extracted as one function, both call sites), and surfaces a dismissible
HostRouteNoticeBannerabove the page: "Couldn't update the workspace from this host. Showing the last version that worked." No retry is promised because none happens until the next entry into the flow. The refused generation is never staged, committed or persisted, and the notice is cleared on every flow entry.Compat guard. A reachable host may have moved past the cached generation (that is usually why an update exists), so before serving,
cachedGenerationWalljudges the cached generation's own manifest facts against the host's capabilities and status. Outside the protocol window → the compat wall with its verdict, exactly as a fresh manifest would get. It runs only when the gate verdict isopen, so an empty capability list from a host that did not answer stays the native-route rule rather than becoming abundle-unavailablewall.CachedGenerationnow carriescompat(the parsed manifest's schema/protocol fields, which every readable generation already has).Tests. Reducer suite (refused-update cases moved into
mobile-web-shell-refused-update-decision.test.ts): red on main for "opens the cached generation rather than walling a host it can still reach" and "walls the cached generation the host has moved past rather than serving it". New end-to-end suite over the real store and a fake disk: 4 → all green, including the wall case reading the manifest back off the committed tree. Screen tests for the banner, mutation-probed.Two max-lines forced moves, no behaviour change: two byte-identical
onCacheReadbranches merged; the refused-update describe block moved to its own file.