Repository navigation
feat: migrate WAL call sites to WAL-0xx error codes — #277 (4/6) - #363
Merged
Merged
Conversation
Part of #360, one of six per-category rollout PRs toward the #277 structured error codes umbrella. Migrates all 6 bail!/anyhow! call sites in src/wal.rs to bail_coded!/err_coded! with their real WAL-0xx codes from docs/ERROR_REFERENCE.md: - WAL-001 invalid WAL magic number - WAL-002 unsupported WAL version - WAL-003 fact serialised size exceeds the WAL per-entry maximum - WAL-004 fact serialised size exceeds u32 range (practically unreachable — WAL-003's limit fires first) - WAL-005 WAL num_facts exceeds platform usize (unreachable on any 64-bit target) - WAL-006 failed to delete the WAL sidecar file after checkpoint Adds src/error.rs's ErrorCode::Wal001..Wal006 REGISTRY entries and extends the exhaustiveness match test. Rewrites ERROR_REFERENCE.md's WAL-002/003/004/006 "Error text" lines from a concrete example value to the canonical {}-placeholder template form (per the #277 design spec) so the registry<->doc sync test compares them byte-for-byte; the concrete example now lives in each entry's prose instead. Regression tests: tests/error_codes_wal_test.rs exercises WAL-001, WAL-002, and WAL-003 through the public Minigraf API (WAL corruption on reopen, replay failure on reopen, and a live oversized transact). src/wal.rs's own test module adds direct-call-site coverage for all six codes, including WAL-006 via a directory-at-the-WAL-path trick that's portable without needing a permission-denial setup. Closes #360 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P7e4uTBWtM8fMZiPZc4bCw
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
Part of #360, one of six per-category rollout PRs toward the #277 structured error codes umbrella (foundation PR #357 already merged). Migrates all 6
bail!/anyhow!call sites insrc/wal.rstobail_coded!/err_coded!with their realWAL-0xxcodes.WAL-001invalid WAL magic numberWAL-002unsupported WAL versionWAL-003fact serialised size exceeds the WAL per-entry maximum (~4080 bytes)WAL-004fact serialised size exceeds u32 range — practically unreachable, WAL-003's limit fires firstWAL-005WALnum_factsexceeds platformusize— unreachable on any 64-bit target (usize==u64there)WAL-006failed to delete the.walsidecar file after checkpointsrc/error.rsgainsErrorCode::Wal001..Wal006REGISTRY entries (exhaustiveness match test extended accordingly).docs/ERROR_REFERENCE.md's WAL-002/003/004/006 "Error text" lines are rewritten from a concrete example value to the canonical{}-placeholder template form, per the #277 design spec, so the registry↔doc sync test (error::tests::registry_is_a_subset_of_error_reference_doc) can compare them byte-for-byte; the concrete example now lives in each entry's prose instead. WAL-001/005 needed no rewrite (no dynamic content).Scope note
Stayed strictly within
src/wal.rs,src/error.rs(only the WAL registry additions — a merge conflict with the sibling category PRs' own registry additions there is expected and normal),docs/ERROR_REFERENCE.md, andCHANGELOG.md. Did not touchparser.rs,src/storage/, or the query executor modules, which are being migrated concurrently in separate PRs (#358, #359, #361).Test plan
tests/error_codes_wal_test.rs(new): exercises WAL-001, WAL-002, and WAL-003 through the publicMinigrafAPI — WAL corruption and replay failure on reopen, and a live oversizedtransact.src/wal.rs's own test module: direct call-site coverage for all six codes, including WAL-006 via a directory-at-the-WAL-path trick (portable, no permission-denial setup needed). WAL-004/005 have no dedicated trigger test — genuinely unreachable in practice, as noted above — but are covered byerror.rs's registry↔doc sync test and exhaustiveness test.cargo test— full suite green (725 lib tests + all integration suites + doctests).cargo clippy --all-features -- -D warnings— clean.cargo fmt --check— clean.Closes #360
🤖 Generated with Claude Code
https://claude.ai/code/session_01P7e4uTBWtM8fMZiPZc4bCw