Repository navigation
[M11] Crash proof tiles that run real recovery in the browser (M11.7) - #96
Merged
Merged
Conversation
…tabase Story M11.7. Six tiles, one per failure the test suite already covers: torn write, flipped byte, crash mid flush, crash mid compaction, a footer that no longer verifies, and an expired record. Pressing one copies the database inside the worker, damages the copy that way, opens an engine on it and reports the keys before, the keys after and what recovery dropped, in the engine's own words from its recovery and discovery reports. The damage is ledgerlog.faults, not demo code. tests/test_faults.py drives the same functions to assert the same recoveries, so the demonstration on the page and the assertion in the suite cannot drift: they are one implementation. Every scenario is also checked to leave the directory it was pointed at byte for byte unchanged, because a visitor stages these on the database they have been typing into. Each tile names the pytest that covers its failure, and a pytest checks that every name a tile gives is a test that exists. Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QWNkuNh5Bysnfo2KrxL9Sp
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 tile board from section 6: six failures, each one run for real on a copy of the visitor's database inside the worker.
The arrangement that matters
The damage is not demo code.
src/ledgerlog/faults.pyholds it,tests/test_faults.pydrives the same functions to assert the same recoveries, andsession.pydoes nothing but name the directory. Two implementations of "cut the log in half" would be two different claims, and the one on the page would be the one nobody checks. There is one, and both the page and the suite run it.Each scenario copies the database first. A visitor stages these on the database they have been typing into, so "show me what a crash would do" must not be a way to lose it. A pytest fingerprints every file before and after each of the six scenarios and asserts nothing moved, and a Playwright test asserts the same thing from the page's side.
Every number on a tile is the engine's:
LedgerLog.recoveryfor the log andLedgerLog.discoveryfor the tables. The page does not compare files or decide what counts as lost.Acceptance criteria
LedgerLogon it and reports keys before, keys after recovery and what was dropped, from the engine's own reports; the visitor's database is untouched.tests/, each tile names the pytest covering the same failure, and a pytest checks every name incrash-scenarios.jsonexists.What ran, and what passed
pytest: 1304 passed (40 new).ruff check src testsandruff format --check src tests: clean.web/:npm ci, lint, typecheck, build: clean.npx playwright test: 102 passed across both projects. Playwright ran locally, not only in CI.The six scenarios produce six genuinely different results, which is what makes the board worth having:
record claims a 25 byte payload but only 8 bytes remainSSTable footer magic mismatch ... the footer was never fully writtenSSTable footer checksum mismatchI drove the board by hand at 1440 and 390 and read the results.
Two findings from reviewing the screenshots
overflow: hiddenon a grid item zeroes its automatic minimum size, so the 3:2 ratio stopped being a floor and became a cap. Removing it lets the ratio behave as section 6 intends: a shape until there is a result, then whatever the result needs.Decisions taken without asking
faults.pyis a new module insrc/ledgerlog/, whichCLAUDE.md's target layout does not list. The criterion asks for Python scenario code with pytest tests that also runs in Pyodide, and the package is the only place that is both importable by pytest and copied into the browser bysync-assets. Nothing inengine.pyimports it and it is on no read or write path.--step-lead(20 to 26px), not the 28 to 32px section 6 names, because 28 to 32px would be a sixth type size and section 4 allows five.Closes #85
Generated by Claude Code