From 1a25e66f230d5a93a92a60719f6432f8ab26acff Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Mon, 9 Nov 2026 04:05:17 -0700 Subject: [PATCH] docs(coverage): the floor rises to 95.45% core and 92.58% store V-D2's tests (94 of them: 85 in ledger-core, 9 in ledger-store) take the core from 89.79% to 95.45% of lines (17,299 -> 18,391 of 19,267) and the store from 92.09% to 92.58% (14,301 -> 14,379 of 15,531), from the full `just coverage` run before and after on the same code and tools. The recorded floors, 90.01% and 91.71%, rise to the new totals; coverage-check reads them from the floor line of docs/coverage-floor.md and passes at exactly the new numbers. Per file: evidence.rs 33.85% -> 100%, conventions.rs 77.76% -> 97.24%, audit.rs 80.33% -> 94.14%, settings.rs 91.05% -> 98.16%, ledger.rs 86.00% -> 96.87%, reconcilable.rs 0% -> 100%. What is left is mostly arms no posted book reaches (a sum past Decimal's range; a line is capped at 1e15) and replay-only refusals. docs/testing.md gets V-D2's record: the tests by area and rule, the finding, what was not reached and the P12 mutation targets. Co-Authored-By: Claude Sonnet 5.5 --- docs/coverage-floor.md | 36 +++++++++++++++++++++++++++---- docs/testing.md | 48 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 4 deletions(-) diff --git a/docs/coverage-floor.md b/docs/coverage-floor.md index de882316..dbd2f82c 100644 --- a/docs/coverage-floor.md +++ b/docs/coverage-floor.md @@ -31,14 +31,42 @@ report drift down unnoticed. measurement movement; more means a test stopped reaching what it used to. -**Floor: `ledger-core` 90.01% lines, `ledger-store` 91.71% lines** (2026-11-08: the first measurement, from the full `just coverage` run; `ledger-core` 16,839 of 18,708 lines, `ledger-store` 14,255 of 15,543; 256-case properties everywhere, no special shard settings. The store measured 91.98% on an earlier run the same day; properties choose random cases, so a few tenths move between runs, which the 0.5 pp tolerance absorbs. The floor records the lower run.) +**Floor: `ledger-core` 95.45% lines, `ledger-store` 92.58% lines** (2026-11-09: V-D2's tests, from the full `just coverage` run after them; `ledger-core` 18,391 of 19,267 lines, `ledger-store` 14,379 of 15,531; 256-case properties everywhere, no special shard settings. Properties choose random cases, so a few tenths move between runs, which the 0.5 pp tolerance absorbs. The floor records the run as measured; it only rises: the first floors, 90.01% and 91.71% (2026-11-08), are in the history below.) | Crate | Lines | Regions | Branches | Lines (covered / total) | Measured | |---|---|---|---|---|---| -| `ledger-core` | 90.01% | 88.86% | 82.65% | 16,839 / 18,708 | 2026-11-08 | -| `ledger-store` | 91.71% | 85.27% | 80.73% | 14,255 / 15,543 | 2026-11-08 | +| `ledger-core` | 95.45% | 93.06% | 88.90% | 18,391 / 19,267 | 2026-11-09 (V-D2) | +| `ledger-store` | 92.58% | 85.98% | 81.72% | 14,379 / 15,531 | 2026-11-09 (V-D2) | +| `ledger-core` | 90.01% | 88.86% | 82.65% | 16,839 / 18,708 | 2026-11-08 (first) | +| `ledger-store` | 91.71% | 85.27% | 80.73% | 14,255 / 15,543 | 2026-11-08 (first) | -## First measurement: the fifteen files with the most uncovered lines +## Second measurement: V-D2, tests where coverage was thinnest (2026-11-09) + +The first measurement named its holes; V-D2 wrote the tests that reach +them, each encoding the rule the code serves (the rule ids are in the +commits and in `docs/testing.md`, "V-D2"). The run at the start of the +unit, on the same code and tools, is the "before": the core had drifted to +89.79% (the code had grown since 2026-11-08), the store to 92.09%. + +| File | Lines before | Lines after | Branches before | Branches after | +|---|---|---|---|---| +| `ledger-core/src/evidence.rs` | 33.85% (129 of 195 missed) | 100.00% (0 missed) | 8.93% | 96.43% | +| `ledger-core/src/conventions.rs` | 77.76% (145 of 652 missed) | 97.24% (18 missed) | 78.21% | 96.15% | +| `ledger-core/src/audit.rs` | 80.33% (94 of 478 missed) | 94.14% (28 missed) | 61.36% | 84.09% | +| `ledger-core/src/settings.rs` | 91.05% (117 of 1,307 missed) | 98.16% (24 missed) | 81.25% | 89.84% | +| `ledger-core/src/ledger.rs` | 86.00% (862 of 6,158 missed) | 96.87% (193 missed) | 80.38% | 91.32% | +| `ledger-store/src/reconcilable.rs` | 0.00% (76 of 76 missed) | 100.00% (0 of 78 missed) | 0.00% | 100.00% | +| `ledger-core` total | 89.79% (17,299 of 19,267) | 95.45% (18,391 of 19,267) | 82.26% | 88.90% | +| `ledger-store` total | 92.09% (14,301 of 15,529) | 92.58% (14,379 of 15,531) | 80.92% | 81.72% | + +What is left in the core is mostly arms no posted book reaches: a sum past +exact arithmetic in the audit's equation, control and register checks (a +journal line is capped at 1e15, so no realistic sum overflows `Decimal`), +and the defensive arms of `ledger.rs` (about 190 lines of scattered +replay-only and overflow refusals). `reconcilable.rs` gained two lines +because the fix to the digest's account order (its own commit) added them. + +## First measurement: the fifteen files with the most uncovered lines (2026-11-08) | File | Lines | Regions | Branches | Uncovered lines | |---|---|---|---|---| diff --git a/docs/testing.md b/docs/testing.md index 4915a52c..b7b0252b 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -4207,6 +4207,54 @@ open/closed ids (a remembered size must not leak between them); equality gates, the `agent_later` flag. *(Consolidated, with the other units' targets, in "P12: the checklists" at the end of this file.)* +## V-D2: tests where coverage was thinnest (2026-11-09) + +The V-D report (`docs/coverage-floor.md`) named the holes; V-D2 wrote 94 +tests that reach them. Each goes through the public API, names the rule it +encodes in its doc comment (a `BS-` id, or a `WB-` product rule), and where +it drives a command shows that a refusal changes nothing (the whole `Ledger` +equals its clone; `Ledger: PartialEq`) and a success moves the numbers its +rule says. + +| Area | File (tests) | Rules it encodes | +|---|---|---| +| `ledger-store` `reconcilable.rs` (0% -> 100%) | `ledger-store/tests/reconcilable.rs` (9) | the module's own INVARIANTS 1 and 2 and its SOURCE (`docs/parties-and-attachments.md` "Reconciliations"; no `BS-`/`WB-` id covers it yet, see the finding below): which accounts are reconciled (cash by name or by configured code, cards by the recorded method else the name, liabilities with a statement), and when one is due (a posted line through last month's end, no standing reconciliation reaching it; a voided one reaches nothing) | +| `evidence.rs` (34% -> 100%, branches 9% -> 96%) | `ledger-core/tests/evidence_gate.rs` (19) | BS-entry-5, WB-entry-5, WB-entry-6 (strictly above the threshold, required and exempt accounts, the split-group rule, each exempt origin with its source, debits past exact arithmetic never a panic); WB-ledger-15 (an annotation's closed list of fields, trimmed, a positive number, a non-negative amount, a date in the calendar) | +| `conventions.rs` (78% -> 97%) | `ledger-core/tests/conventions_refusals.rs` (18) | WB-ledger-5, -6, -9, -10 and the module's INVARIANTS 1 to 6: slug ids and no TIN, revisions and retirement, template shares summing to exactly 1, approval rules and the fingerprint, decisions and open items in order, source corrections, drafting from a template | +| `settings.rs` (91% -> 98%) | `ledger-core/tests/settings_refusals.rs` (10) | WB-ledger-5, -6, -8, BS-entry-4 and the module's INVARIANTS 1 to 8: members, payment methods, replay's shapes, a change all or nothing, defaults | +| `audit.rs` (80% -> 94%, branches 61% -> 84%) | `ledger-core/tests/audit_branches.rs` (14) | BS-ledger-13 / WB-ledger-16, BS-partner-1, BS-entry-5, D-9: severities and subjects, the cash flow and control checks, a split drifts only past a minor unit, evidence only through the date, the bar's parse and edges | +| `ledger.rs` command steps (86% -> 97%) | `ledger-core/tests/document_commands.rs` (10), `ledger_edits.rs` (8), `replay_documents.rs` (6) | BS-arap-2, -5, -6 (send, settle, write-off, aging), BS-entry-4 (replay never refuses a line it cannot match), BS-ledger-19 / WB-ledger-10 (renumbering), BS-partner-8 / WB-partner-4 (party text), BS-asset-1 (disposal), the fiscal-year rule (Form 1128), WB-ledger-15 (annotations, `entry.settles`) | + +Coverage, from `just coverage` before and after (`docs/coverage-floor.md` +has the per-file table): `ledger-core` 89.79% -> 95.45% lines, 82.26% -> +88.90% branches; `ledger-store` 92.09% -> 92.58% lines. The floors rose to +those numbers. + +**Finding (fixed in its own commit).** `reconcilable::cash_accounts` returned +the name-matched cash accounts in `HashMap` order (`ChartOfAccounts::all` is +"order unspecified"), so `books.digest`'s `unreconciled_accounts` could list +the same books' accounts in a different order from run to run; `card_accounts` +beside it sorts by account id. The test that found it +(`cash_accounts_come_in_chart_order`) was committed `#[ignore]`d with the +finding in its reason; the fix sorts the list and is the commit after the +tests, so it can be dropped without touching them. + +**Not reached, by design.** The "cannot be made" arms of the audit's +equation, control and register checks need a sum past `Decimal`'s range; a +journal line is capped at 1e15 (`kernel::MAX_LINE_AMOUNT`), so no posted +book reaches them, and a draft is not read by those statements. The same +holds for most of the roughly 190 lines left in `ledger.rs`: replay-only and +overflow refusals. + +**For P12 (mutation targets).** `evidence::Policy::reason_for` (the strict +`<=` and the exempt-all test), `Policy::split_group` (the three equalities +that make a group, the reversal skip, the `total > threshold` end), +`conventions::check_template` (the share bounds and the sum), `check_rule` +(the amount bound), `Ledger::settlement_lines` (each refusal's order), +`Ledger::mark_sent_steps` (the day of the send against a later void), +`audit::check_split` (`> unit`, not `>=`), `AttestationBar::parse`'s range +(1..=64), `reconcilable::reconciliation_due` (`<=` through, `<` reconciled). + ## P12: the checklists The **For P12** paragraphs above (kept where they were written, with their