test: cover wal.rs's canonical_bytes_of_line and non-NotFound error arms - #595
Merged
Conversation
Issue #587 (#533 persistence audit): canonical_bytes_of_line's three call sites (shippable_records, parse_log's interior loop, tail_record_is_complete) had zero coverage of its None return — issue text confirmed by grep, no test in the repo ever exercised it. Also covers reset/replay/replay_readonly's non-NotFound error arms (previously only the NotFound-tolerant path was tested), strengthens the two existing heal-failure tests to check the outer "could not heal" wrapper message rather than only the injected cause, and adds a characterization test pinning that shippable_records does not dedupe a repeated seq (unlike parse_log's later-wins resolution) — intentional per its own doc comment, not a gap. Refs #587
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughWALのCRC検証、重複sequence処理、末尾修復、およびファイルI/Oエラー伝播を検証するテストを追加しました。 ChangesWAL検証とエラー処理
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
…r loop's The pre-PR mutation gate found one missed mutant: parse_log's tail branch computes its 1-indexed line number as segments.len() + 1 (distinct from the interior loop's index + 1) — replacing + with * was unobserved because the new tail-position marker test never asserted on the reported line number, only the message body. Refs #587
This was referenced Aug 12, 2026
Closed
4 tasks
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
canonical_bytes_of_line'sNonereturn had zero coverage at any of its three call sites (shippable_records,parse_log's interior loop,tail_record_is_complete) — confirmed by grep, no test in the repository ever exercised it. Adds one test per call site, each forcing a distinct way the byte-exact,"crc":marker search can fail to find a field that genuinely parsed.reset/replay/replay_readonlypreviously had only theirNotFound-tolerant arm tested; adds the non-NotFoundpropagation arm for all three (injected forreset, a real directory-in-place-of-file OS error for the twofs::read-based ones, since that call is intentionally outside the fault-injection choke point).a_truncate_heal_failure_is_fatal_not_a_shrug,a_newline_heal_failure_is_fatal_not_a_shrug) to also assert the outer "could not heal ..." wrapper message, not just the injected cause underneath it.shippable_recordsdoes NOT dedupe a repeated seq, unlikeparse_log's later-wins resolution — intentional per its own doc comment ("shipping is a byte transport, not the trust boundary"), not a gap.parse_log's tail branch (segments.len() + 1→* 1, its own line-number computation, distinct from the interior loop'sindex + 1): the new tail-position marker test asserted the error message body but not the reported line number. Fixed by pinning it there too (commit a2773d9).Part of #587 (untested-branches audit from #533). Refs #587.
Test plan
cargo fmtcargo clippy --bin taguru --tests(clean)cargo test(full suite green, 1544 passed)cargo mutants --in-diff): 0 mutants (test-only diff)cargo mutants --file src/wal.rs: 93 tested, 65 caught, 28 unviable, 0 missed (fix verified across two independent runs — unviable count matched both times, ruling out snapshot corruption)https://claude.ai/code/session_013NPb5cDU8ojZAKGJaq8rYy