Repository navigation
test(desktop): prove a power cut loses derived rows and derived_seq together - #189
Merged
1 commit merged intoNov 22, 2026
Merged
1 commit merged into
1 commit merged into
Conversation
…ogether The condition on D-A6's amendment: after a FULL append and a NORMAL derive, a dropped last commit or a torn WAL tail keeps the append, loses the derived rows with their derived_seq, and leaves the document stale for the next derive to restore. The spec's amendment note points here.
HMarzban
marked this pull request as ready for review
November 22, 2026 15:40
44d48d8
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 condition on the D-A6 amendment in #185 (approved 2026-11-22 by the coordinator, under the owner's delegation). Derived rows commit at
synchronous=NORMAL, so a power cut may lose the last derive while the FULL content append before it survives. This proves the derived rows andderived_seqare lost together, so the document reads as stale and is derived again.The test
tests/unit/desktop/storage/derive-crash-loss.test.tssimulates the power cut on the files.The harness can't do it by closing the connection: closing the last connection checkpoints the WAL into the main file. So the test works on copies:
putDerived, then crashes the library.-shm, so the WAL index is rebuilt from the WAL, and reopens. The reopen sees an unclean exit andquick_checkreports ok.In both cases:
nextStale()returns the document, soderived_seqwent with its rows;putDerivedrestores the rows.Control: with the whole WAL kept, the derive survives.
Base
The base is
main(2764fb5), as asked. The test passes with or without #185, because it simulates the loss itself.One line will conflict with #185. It's the D-A6 row in
docs/superpowers/specs/2026-11-15-desktop-architecture.md:To resolve, keep #185's amendment and add this PR's "Proven by …" sentence to it.
Test plan
bun run typecheck; Biome on the new file