feat(lifeboard): export and restore - #325
Open
ivanmkc wants to merge 1 commit into
Open
Conversation
…way from gone The persistence audit called this the largest remaining risk and the cheapest thing on the list to fix: everything lifeboard knows lived in one browser's IndexedDB, and "clear site data" took the calendar, the lists and the vaccination dates with it. The durable state is an array of entries, so export is serialising it and restore is putting it back. Restore replaces; it does not merge. Two logs that grew independently both number their entries from 1, and deciding which "seq 7" wins is a guess dressed up as a policy. Merging devices is a real feature that needs a real design, and pretending this is that would lose someone's records quietly. So the screen says what is here, what is in the file, and that there is no undo -- and waits. Reading a backup is strict on purpose. This is the one path that overwrites everything, so a cheerful "looks close enough" here costs a household its records: the format, the version, every entry's shape and collection, and duplicate sequence numbers are all checked, and the error names the entry. Also adds Backend.replace and Store.restore, which is the only thing in the code allowed to discard the log. The next write after a restore continues the restored numbering rather than colliding with it, and history and undo keep working -- both covered by tests. 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: 15 of 19. Base:
lifeboard/13-practice.Closes the finding the persistence audit called the largest remaining risk, and the cheapest to fix: everything lifeboard knew lived in one browser's IndexedDB, and "clear site data" took the calendar, the lists and the vaccination dates with it. The durable state is an array of entries, so export is serialising it and restore is putting it back.
Restore replaces; it does not merge. Two logs that grew independently both number their entries from 1, and deciding which "seq 7" wins is a guess dressed up as a policy. Merging devices is a real feature that needs a real design; pretending this is that would lose someone's records quietly. So the screen shows what is here, what is in the file, and that there is no undo — and waits.
Reading a backup is strict on purpose. This is the one path that overwrites everything: the format, the version, every entry's shape and collection, and duplicate sequence numbers are all checked, and the error names the offending entry.
Adds
Backend.replaceandStore.restore— the only thing in the codebase allowed to discard the log. The next write after a restore continues the restored numbering rather than colliding with it, and history and undo keep working; both are covered.Verified: lifeboard 389 (+17), all packages green, offline e2e passes.