Repository navigation
Conversation
First slice of #10927 (shells v1 slice 1): the browser shell now keeps the offline read model the design record specifies — a snapshot store (world-snapshot-store.ts) keyed per host+world, written through from world.ts on every snapshot/event/view/records frame, and restored on page load so the world reads fully offline (participants, view, records) with an offline/read-only status. The resume cursor is seeded from the stored sequence, so a join after a reload presents the last applied journal sequence instead of restarting at 0. Store entries are validated with the frame validators' shape discipline; a corrupt entry is ignored. Behavioral tests in world-offline.test.ts cover the store round-trip/rejection, write-through, offline render after reload, reader-not-writer offline, and resume-after-reload. Refs #10927
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 5 minutes. View limit details
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. |
This was referenced Nov 23, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First slice of #10927 (shells v1 slice 1 — PWA offline read model + catch-up). The browser shell (
pkgs/id/web/src/world.ts) held all session state in memory: a reload lost the world entirely, and the reconnect cursor restarted at 0.world-snapshot-store.ts: a snapshot store keyed per host + world name, holding {world_id, last applied sequence, participants, rendered view (screen surface or text), view revision, records}. Entries are validated on load with the frame validators' shape discipline (safe non-negative integer sequences/ids, string fields, a surface the renderer accepts); a corrupt or foreign entry is ignored, never rendered and never adopted as the resume cursor. Storage failures are swallowed — the store is best-effort and never breaks the live session.world.tswrites the store through on every snapshot / event / view (full, patched, form) / completed-records frame, and restores it on page load and on a world switch inconnect(): participants, view and records render with no socket, the status reads "Offline — saved snapshot" with a read-only log line, and the resume cursor is seeded from the stored sequence so the join frame'safterpresents the last applied journal sequence across a reload. Offline stays reader-not-writer: the existing send paths refuse without an open socket (covered by test).Refs #10927 — partial slice. Remaining on the issue: re-snapshot on divergence with a history-identity check (the snapshot frame carries no history identity today — needs host/contract support), push as a re-sync hint via an F12.5 provider (the record's follow-on slice 4), and the conformance run for the shell.
Evidence
Ran locally in the sandbox (bun 1.4.4, vitest/happy-dom) at e836c39:
bunx vitest run src/world-offline.test.ts— the 2 behavioral tests fail (no store entry written; no offline render/resume), the 3 store tests pass against the new module.bunx vitest run src/world-offline.test.ts— 5/5 pass. Full web suite:bun run test— 42 files, 871 passed, 9 skipped, 0 failed.bun run typecheckclean.bash .github/scripts/check-suite-registry.shhas no complaint for the new test file (thepkgs/id/web/src/*.test.tsrow covers it).Merge Danger
Low. Web-shell-only change (TypeScript, no Rust, no wire/contract change, no new frame kinds). The store is additive: with no entry present, page behavior is byte-for-byte the old behavior. localStorage is per-origin and the key is namespaced per host+world.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.