8000 test(wal): Wave 3 PR 2 — WAL crash-recovery matrix, fault-injection, fuzz targets (#209, #210, #214) by adityamukho · Pull Request #257 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

test(wal): Wave 3 PR 2 — WAL crash-recovery matrix, fault-injection, fuzz targets (#209, #210, #214) - #257

Merged
adityamukho merged 6 commits into
mainfrom
wave3/pr2-wal
May 16, 2026
Merged

adityamukho merged 6 commits into
mainfrom
wave3/pr2-wal

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

Wave 3 PR 2 — WAL Cluster Reliability

Closes #209, #214, #210.

Changes

tests/wal_test.rs — 9 new tests:

#209 crash-recovery matrix (7 cases):

  • wal_recover_truncated_length_header — header truncation: discards entry, prior entries intact
  • wal_recover_truncated_payload — payload truncation: discards entry
  • wal_recover_bad_checksum_second_entry — bad CRC on second entry: discards from that point
  • wal_recover_committed_tx_crash_before_checkpoint — committed tx survives crash
  • wal_recover_rollback_crash — crash mid-rollback: uncommitted facts not replayed
  • wal_recover_multiple_committed_corrupt_tail — multiple committed + corrupt tail: valid entries intact
  • wal_corrupt_tail_never_applied — junk appended after valid entries: ignored

#214 lock-leak tests (2 cases):

  • write_lock_not_leaked_after_rollback — lock released after explicit rollback
  • write_state_clean_after_drop — lock released when WriteTransaction is dropped

src/storage/persistent_facts.rs — 3 unit tests in fault_injection_tests (#214):

  • save_returns_error_when_write_fails — FaultInjectingBackend triggers write failure
  • save_returns_error_when_sync_fails — sync failure propagated correctly
  • save_error_message_is_non_empty — error messages are non-empty

fuzz/fuzz_targets/ — 4 real fuzz targets replacing stubs (#210):

  • wal_entry.rs, file_header.rs, fact_page.rs, btree_page.rs
  • Each writes input bytes to a temp file and calls Minigraf::open() — any panic is a bug

fuzz/corpus/ — seed corpus for all 4 targets:

  • wal_entry/: 2 seeds (empty, truncated)
  • file_header/: 3 seeds (bad magic, truncated, valid v7)
  • fact_page/: 1 seed (valid v7 2-page file)
  • btree_page/: 1 seed (valid v7 3-page file with btree root pointer)

Notes

  • fault_injection_tests nested inside #[cfg(all(test, not(target_arch = "wasm32")))] for correct access to FaultInjectingBackend
  • All assert messages use plain strings — no {:?} on Uuid-containing types

🤖 Generated with Claude Code

adityamukho and others added 5 commits May 17, 2026 00:06
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
#219 = coverage gates (not XTDB/Datomic compat)
#221 = XTDB/Datomic compat corpus (not proptest)
#212 = proptest reference evaluator (not coverage gates)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
codecov Bot commented May 16, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@adityamukho
adityamukho merged commit 2d1d7fd into main May 16, 2026
36 checks passed
@adityamukho
adityamukho deleted the wave3/pr2-wal branch May 16, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant

0