Repository navigation
feat: Minigraf::verify and rebuild_indexes (#373) - #458
Merged
Merged
Conversation
Page checksums catch torn and rotted pages, but not pages that are valid and say the wrong thing. verify() walks every committed page and reports one structured error per finding: an index whose facts differ from EAVT (compared by an order-independent digest, no per-fact memory), keys out of order or a page reached twice, DICT maps that disagree or ids with no entry, and leaked or doubly used pages. rebuild_indexes() rebuilds EAVT, AEVT, AVET and VAET from an intact index that agrees with another one (or the only intact one), derives the free list again, and commits like a checkpoint, including pending facts. It writes only pages the active meta does not reference, so a crash at any point keeps the previous checkpoint. With no usable source or a damaged DICT it fails with STG-041 and writes nothing. New codes STG-038..STG-041. Design: docs/superpowers/specs/2026-10-06-verify-rebuild-indexes-design.md Refs #373, #383 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Oct 6, 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.
Refs #373 (data-integrity; left open per the known-issues process), part of #383.
What
Minigraf::verify() -> IntegrityReport— walks every committed page and reports logical damage that page CRCs can't see, one structured error per finding:fact_count(order-independent digest, no per-fact memory) — STG-038Minigraf::rebuild_indexes()— rebuilds EAVT/AEVT/AVET/VAET from an intact index that agrees with another (else the only intact one), re-derives the free list, commits like a checkpoint (pending facts included, WAL deleted). Writes only pages the active meta doesn't reference → crash-safe. No usable source or damaged DICT → STG-041, file untouched.IntegrityReportis#[non_exhaustive], re-exported from the crate root.Design spec:
docs/superpowers/specs/2026-10-06-verify-rebuild-indexes-design.md.Decisions to review
gafter STG-033, BrowserDb exposure.Tests
1248 total (1239 passing, 9 ignored), +10:
tests/integrity_test.rs): in-memory, clean file, rebuild commits WAL + deletes it, flip each leaf of a real file → always reported, then repaired or refused (STG-041, file unchanged).cargo clippy --all-features -- -D warningsclean; wasm32--features browserbuilds.🤖 Generated with Claude Code
https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn