feat(lifeboard): the offline foundation — fact log, boards, service worker - #313
Open
ivanmkc wants to merge 4 commits into
Open
feat(lifeboard): the offline foundation — fact log, boards, service worker#313ivanmkc wants to merge 4 commits into
ivanmkc wants to merge 4 commits into
Conversation
Static PWA built with the viewer's esbuild shape, but targeting es2022 rather than es2020: the entry point uses top-level await, which es2020 rejects. Ships its own css.d.ts so tsc resolves the CSS-as-text imports the canvas renderers make. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Departs from the written plan, which specified a row-shaped store. The design doc requires provenance and undo (spec 8b, decisions 27-28), and neither can be recovered once a row has been overwritten in place -- so the durable artefact is the log of assert/correct/retract entries and the list is a fold over it. Every entry records its author as human, code or model. That distinction is load-bearing later: deterministic steps may be re-derived automatically, while model-authored facts must never be silently recomputed. Mutations addressing a record that is not in the view are dropped rather than throwing -- they come from stale boards and retried agent steps, neither of which is worth interrupting the user for -- and an apply that resolves to no entries writes nothing and notifies nobody. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Boards are built from the records, not fetched: same records and same day in, byte-identical component spec out. The specs go through the canvas's own validator in test, so a board this app builds is a board an agent could have pushed -- one render path, not two. Vertical is the main axis. A reader scanning a family board follows one column down; columns of equal weight make them hunt for where to start. Empty sections are omitted rather than rendered empty. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The canvas Checklist posts toggles through the transport seam; here that writes an entry to the local log instead of an HTTP endpoint, so a tick is durable and attributed. A toggle we originated does not redraw the board -- the widget already shows it, and re-rendering would tear down its React root and flash. Adds a service worker, which the plan did not call for but its acceptance criterion requires: Chromium will not serve the document from disk cache with the network off, so without a worker an offline reload fails before any of the locally stored data matters. Shell precached on install, content-hashed renderer chunks cached on first fetch, cache name versioned so a stale chunk cannot outlive the app.js that asked for it. First run seeds a short list, attributed to code rather than to a person: an empty log renders an empty screen, which reads as broken rather than new. e2e proves the whole claim with the network switched off -- render, switch board, tick, reload, tick survived -- with zero console errors. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Sep 2, 2026
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.
The stack
localStoragefor the test suite on Node 25@ivanmkc/termchart-canvas; injectable interact transportEvery branch in the stack was checked out on its own and verified independently:
npm install,tsc --noEmitfor every package,npm testacross the workspace, and the offline e2e where it exists. All twenty are green — no branch depends on a later one to build or pass. Full viewer e2e (11 suites, 106 assertions) was run on #312 as the behaviour-preservation evidence for the extraction.Stack position: 3 of 10. Base:
lifeboard/01-canvas.The lifeboard PWA: a static bundle over a local log that renders on the canvas and works with the network switched off.
Two departures from the written plan, both deliberate.
The store is an append-only fact log, not a table of rows. The plan specified
applyMutation(items, m) -> Item[]. The design doc requires provenance and undo (§8b, decisions 27–28) and neither can be recovered once a row has been overwritten in place. So the durable artefact is a log ofassert/correct/retractentries and the list is a fold over it. Every entry records its author ashuman,codeormodel— a distinction that matters later, when deterministic steps may be re-derived automatically while model-authored facts must never be silently recomputed.There is a service worker, which the plan did not call for. Its own acceptance criterion — "works with the network switched off" — cannot hold without one: Chromium will not serve the document from disk cache when offline, so an offline reload fails at the document request no matter what is in IndexedDB.
es2022 rather than the viewer's es2020, because the entry point uses top-level await.
Verified:
e2e/offline.e2e.mjsruns the whole claim with the network off — first render, service worker takes control, offline reload, switch board, tick a box, reload, tick survived — with zero console errors. Unit tests: 40.🤖 Generated with Claude Code