Skip to content

test(coverage): bring btree, persistent_facts and index.rs to 90% branches (#396) - #584

Merged
adityamukho merged 1 commit into
v3from
test/396-branch-coverage
Oct 14, 2026
Merged

adityamukho merged 1 commit into
v3from
test/396-branch-coverage

Conversation

@adityamukho

Copy link
Copy Markdown
Collaborator

Follow-up to #522: brings the storage files #396 names to its 90% branch target. Closes #396.

File Branches before After New floor (lines/branches)
src/storage/btree.rs 85.5% 95.7% 96 / 94
src/storage/persistent_facts.rs 87.9% 91.7% 96 / 90
src/storage/index.rs 75% 100% 100 / 100

wal.rs (95%) and packed_pages.rs (100%) were already above it.

Tests

  • pack_leaves retried around one large last entry (an empty group and an overfull leaf on the first cut), and an entry larger than a page (INT-049).
  • build_btree with separators over PAGE_FILL_BYTES (internal nodes of two children).
  • cow_insert into a root whose rightmost child is itself: INT-049 from the depth check. The existing cycle test now asserts INT-049 too.
  • An empty tree through assert_tree_exact.
  • Dropping a dirty PersistentFactStorage saves it.
  • A torn first meta with a blank page 1 is initialized again.
  • An unreadable page past the meta's page_count (a sparse store's hole) is not taken as evidence of a later generation.

Code changes

  • write_internal_pieces splits in one pass. The retry loop could not run: a cut goes before the first element whose running size passes the group's share, so the separators each node keeps add up to at most total / parts, and parts keeps that within PAGE_FILL_BYTES - body. An INT-049 check remains for the invariant.
  • check_sorted zips adjacent entries instead of matching windows(2), which removes a pattern branch that could not fail.
  • Test-only changes: test asserts no longer use && (the never-taken failure side counted as uncovered), and helpers drop guards that read_chain(0, …) already handles.

CI

coverage-gates.yml pins cargo-llvm-cov@0.9.1. It used @latest, and 0.8.5 under the pinned nightly reports far lower numbers (persistent_facts.rs 59% branches) because it misses the lib test binary in the new build-dir layout. coverage-thresholds.toml now lists the branches left uncovered on purpose: the INT-049 invariant checks, let … else on groups that are never empty, and the depth check in the test-only collect_leaf_pages.

Measured locally with nightly-2026-10-01 and cargo-llvm-cov 0.9.1, matching CI's numbers on v3 before the change. 1,463 passing and 10 ignored tests (+6).

🤖 Generated with Claude Code

https://claude.ai/code/session_01U611mBGbkSqJeSwNz2xd7s

…nches (#396)

New tests: leaf packing retried around one large entry, an entry larger
than a page (INT-049), separators over the fill target, cow_insert into
a root that points to itself (INT-049), auto-save on drop, a torn first
meta with a blank page 1, and an unreadable page past the meta's page
count. write_internal_pieces splits in one pass: its retry loop could
not run, since the balanced cut keeps each node's separators within
total / parts <= PAGE_FILL_BYTES - body. check_sorted zips instead of
matching windows; test asserts no longer short-circuit.

Floors: btree.rs 96/94, persistent_facts.rs 96/90, index.rs 100/100.
The workflow pins cargo-llvm-cov 0.9.1: 0.8.x misses the lib test binary
under the pinned nightly's build-dir layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U611mBGbkSqJeSwNz2xd7s
@codecov

codecov Bot commented Oct 14, 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 73e8cc5 into v3 Oct 14, 2026
24 of 25 checks passed
@adityamukho
adityamukho deleted the test/396-branch-coverage branch October 14, 2026 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant