Commit Graph
795 Commits
Author SHA1 Message Date
swaitsandDeepSeek V4.1 Flash 6f2e2cf1eb test(core): bridge the party direction, part weight and reverse_target
Three properties the traceability gate can see as calls, not mentions:

- `reverse_target_agrees`: the earlier party bridge only passed
  `reverse_target` to `and_then`, which proves nothing about the `i64`
  and `Decimal` instantiations agreeing; the property now calls both.
- `direction_of_agrees`: `Direction::of` classifies the same sign at
  both types, each case keeping its meaning.
- `part_weight_agrees`: `part_weight` is the same weight at `i32`,
  `i64` and `i128`, and `None` exactly for a part no month has.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 21:54:01 -07:00
swaitsandDeepSeek V4.1 Flash 087ddaf094 docs(claims): one Enforced/Checked pair for WB-prepaid-2
The rule carried two pairs, the first naming only `amortization_plan`
and the replay entry point and the second naming `schedule_month_hold`
too. One pair says both: the schedule's plan, replay, and the month
hold, with the three tests that check them.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 21:53:56 -07:00
swaitsandDeepSeek V4.1 Flash 6b20946ae7 docs(claims): name the real items the stricter gate caught
The traceability gate now resolves a name exactly, so five citations that
were only approximately right are corrected to the code they mean:

- `form1099::Vendor1099Report::untagged_payments` is the free
  `form1099::untagged_payments`, not a method.
- `JournalFormat::declared` is the free `format::declared`, not an
  associated function.
- the Deductible and Apportion Lean theorems were cited bare; they live in
  those namespaces (`Deductible.tie_away_pos`, `Apportion.allocW_sum`, ...).
- `control_agrees` is `Documents.control_agrees`.
- `Step.discard` is a Step constructor, not an audited theorem; the claim
  keeps the two audited theorems that prove it.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 21:53:53 -07:00
swaitsandDeepSeek V4.1 Flash 0a90290160 test(core): the traceability gate
A claim is worth what backs it. The new bookspec test module reads every
claimed rule's Enforced and Checked paragraphs and follows each backticked
name to a real Rust item, test, Kani harness, Lean theorem (checked
against bookspec's embedded Audit.lean), path, rule id, or an explicitly
classified value; it requires a live record behind every bookspec id and
a unique WB id. It then walks every pub fn in the kernel and requires a
harness that calls it, a bridge property that calls it, and a harness
whose numbered law is a row of spec/laws.md; the wrappers and enum maps
with no independent proof are named in a pinned exceptions list with why.
Finally it checks every law row that cites a claimed rule names audited
theorems or says why not. Floors on sections, tokens and kernel functions,
and a made-up name that must fail, keep the gate from passing vacuously.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 21:20:45 -07:00
swaitsandDeepSeek V4.1 Flash 5703657957 docs(proofs): number each kernel-sweep harness's law
The kernel sweep's proof notes described each harness's law in prose. The
traceability gate needs the number to check it against a row of
bookspec's spec/laws.md, so each note now carries a machine-readable
Harness | Law table: fx_booked's harnesses law 41, round_step's law 40,
and total's law 4 (the engine-bound law whose Lean row says why it has no
theorem). The prose tables and times stay as they were.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 21:20:45 -07:00
swaitsandDeepSeek V4.1 Flash 2ef945ae3f docs(claims): name only live records and real items
The traceability gate follows every backticked name a claimed rule's
Enforced and Checked paragraphs carry, so the claims now name what exists:

- B-22 claimed `partly` while stating the engine enforces nothing; it is
  `no` now, with the reason (the policy is the books' own AGENTS.md).
- WB-prepaid-2 is `partly`: replay of old schedules is implemented and
  tested, while moving new monthly-even schedules to the currency's minor
  unit is K-U5 and not landed.
- The stale names: Vendor1099Report::untagged is untagged_payments,
  Asset::set_entry is Ledger::set_asset_acquisition, shares::share_target
  is shares::target, tag_in_use is check_asset_tag's refusal,
  Step.extends and Step.record are the audited Steps.extends and
  Step.record_changes_no_figure, and two asset tests are named as they
  exist (a_journaled_tag_taken_by_another_asset_is_refused_on_open,
  legacy_tax_basis_set_lines_replay_to_todays_figures).
- BS-format-1, BS-ledger-12 and BS-ledger-13 are retired; they are marked
  `retired bookspec:` so a live `bookspec:` id means a live record.
- B-44 and B-45 are wholly product rules: their enforcement and checks are
  the WB rules they point at.
- WB-ledger-3, -4 and -6 had one `Enforced and checked` marker; each now
  carries `Enforced` and `Checked` separately.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 21:20:45 -07:00
swaitsandDeepSeek V4.1 Flash 67bf2280a8 test(core): bridge the small cash-flow and bounds helpers
The traceability gate asks every public kernel function for a bridge
property. Three amount-generic helpers had none: take, entry_movements
and flows_of (the statement of cash flows' split) and running_bounds and
bounds_kept (a document's position against its total). The properties
compare the i64 instantiation Kani proves with the Decimal one the engine
runs, on random inputs, so law 10 and law 34 hold at both types.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 21:20:45 -07:00
swaitsandClaude Opus 5.5 8dec2900eb fix(prove): audit bookspec's own theorem list, not a copy
just prove audited verify/lean/Audit.lean, a copy of bookspec's list
made when the laws moved there (L-F2). The laws then grew in bookspec
(the FX law, the rounding primitive, the executable model's soundness
and completeness, the empty close) and the copy did not: it audited 151
theorems of the 177 bookspec states, so 26 were proved but never
checked for axioms on this side. Bookspec's CI audits them, so no
theorem is known to rest on more than Lean's three; but the laws live
once (D-69), and so must their list. just prove now runs bookspec's
lean/Audit.lean from the pinned package, and the copy is gone: 177
theorems, standard axioms only. A unit's #print axioms line now goes in
its bookspec branch with its theorem.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:13:40 -07:00
swaitsandClaude Opus 5.5 127d33fb0b build: pin bookspec at 51375ec, the spec floors and L-G2
check / check (push) Canceled after 0s
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
bookspec main now carries L-G2 (documents run as a Lean step; the
example runner posts them) and X-I (per-rule coverage, and the floors
against the base commit: an issued id is never lost, an allow-list never
grows, no rule or option loses its example). The checker and the Lean
move together (tests/bookspec/pin.rs). Option names are now plain words
in bookspec; every pick named in docs/spec/claims/ already is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:09:12 -07:00
swaitsandClaude Opus 5.5 ec10ef3b77 merge: rule references cite bookspec ids (S-E; reviewed, fixes applied)
Every citation of the retired B-1..B-45 numbering in code, docs and
tests now names the rule's bookspec id, the one stable name for it
(D-68). docs/spec/rules.md is the index from the old numbers, and
docs/spec/claims/ holds what wanderbooks claims for each rule. Thirteen
citations in program output and one golden stay as they were: output is
a contract and a golden changes only when recomputed by hand, so S-E2
moves them together.

A test now holds it: no retired number anywhere outside the index and
an exact-count list of the kept ones, and every SOURCE clause in the
sources, tests and fuzz targets names a bookspec rule the pinned checker
has, a product rule the claims hold, a file that exists, or a declared
outside source (pinned in number, so the free-text set cannot grow
unseen). The review found unrewritten citations, a mangled range or
two, and a user-visible note changed by accident; all fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:03:59 -07:00
swaitsandClaude Opus 5.5 b131bdded8 docs: rules.md is an index; the rules are in bookspec
Pointers that said the rule text lives in docs/spec/rules.md now point at bookspec's rules and/or wanderbooks' claims in docs/spec/claims/: the dated-rule catalog doc, the kernel module header, a payout doc, the spec-derived and model and GnuCash tests (including its panic message), the MCP interface crate table and the spec README. Same treatment for the other stale mentions the grep found in attention, the P3 seams test and the store schema. AGENTS.md gains a Docs index row for docs/spec/claims/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:02:13 -07:00
swaitsandClaude Opus 5.5 b63fbf8847 chore: remove the one-time rewrite script
The script was one-time, is not idempotent, and treats --help as a live run. Method, for the record: the map was parsed from docs/spec/rules.md's index table, a word-boundary retired number (1 to 45) was replaced outside plan/, docs/spec/rules.md and docs/spec/claims/, and the kept strings were restored by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:02:13 -07:00
swaitsandClaude Opus 5.5 8d3cc5056f test(core): no retired rule number anywhere, SOURCE clauses checked whole
The retired-reference test now scans the whole text of every tracked file (git ls-files, skipping plan/, docs/spec/rules.md and docs/spec/claims/) for any word-boundary retired number from 1 to 45, wrapped references included, with an exact-count allow-list for the deliberately kept user-visible and golden strings; a count rising or falling fails. The SOURCE test now reads each whole clause with its continuations (crates/*/src, crates/*/tests and fuzz/), checks every bookspec and product-rule id in it, requires every path-like token to exist and every crate code reference to name a real item, counts clauses passing only through the free-text branch against a constant (56; 353 clauses checked), and keeps a floor on the total. The repo_root doc comment became the module header.

Lines the tightened check made fail, fixed in the lines not the test: relative sources/ and claims/ paths in form1099, instruments, kernel entries, money, kernel round and the 1099 tests now give full docs/spec paths; wrapped docs/spec/sources/ and docs/parties-and-attachments.md paths in ledger, store, reconciliation, tins and the GUI books module are joined; settings.rs names the real parser path instead of a runtime filename; the bounds tests name the real kernel and calendar files, and spec_bounds no longer cites rules.md for the line bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:02:08 -07:00
swaitsandClaude Opus 5.5 9aeee94fd2 fix: rule references the rewrite missed and ranges it mangled
common.rs (two doc comments and a test-helper panic message) and the fuzz target still cited the retired numbering outside the script's roots; they now cite BS-period-3 and BS-arap-2. A repo-wide sweep of tracked files found no other real citations beyond the deliberately kept strings.

Bookspec ids are not ordered across areas, so ranges the script produced are nonsense: the three 'all rules' ranges now say all 45 rules in docs/spec/rules.md's index, the seven allocated ids and the nine statement-era ids are listed explicitly, taken from that index table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:02:08 -07:00
swaitsandClaude Opus 5.5 d45cb8687b fix: keep user-visible rule citations as they were
CONTRIBUTION_NOTE is shown on screen; the rewrite dropped 'rules.md ' from its '(rules.md B-37 item 7)' citation. Restore main's exact text. User-visible output does not change in this unit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:02:03 -07:00
swaitsandClaude Opus 5.5 9ac8f4f768 docs(plan): S-E2 moves the kept output citations to bookspec ids
S-E rewrote every rule citation in comments, docs and tests, but kept
13 in program output and one golden unchanged: output is a contract,
and a golden only changes when recomputed by hand. S-E2 changes them
together, after checking none is stored in the books.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 19:44:59 -07:00
swaitsandMuse Wonder 1.0 ec366e7e14 test(core): every SOURCE line names a rule or source that exists
source_refs in the bookspec suite: every SOURCE: line in crates/*/src cites a BS id the pinned bookspec has (bookspec_checker::rules()), a WB id in docs/spec/claims/, an existing repo path, or an external/declared source; unknown BS/WB ids fail. A second test fails if a retired rules.md B-n reference remains outside plan/ and the map files.

Co-Authored-By: Muse Wonder 1.0
2026-11-08 19:40:28 -07:00
swaitsandMuse Wonder 1.0 7928531c47 docs: AGENTS.md points at bookspec for the rules
Specs come from authorities now states that the rules live in bookspec (its rules/ records, spec/rules/ pages, rules-index), that docs/spec/claims/ holds wanderbooks' picks, enforcement and WB- product rules, that docs/spec/rules.md is only the retired B-n index, and that SOURCE lines cite BS-/WB- ids. The docs index says the same.

Co-Authored-By: Muse Wonder 1.0
2026-11-08 19:40:28 -07:00
swaitsandMuse Wonder 1.0 489360f598 refactor: rule references cite bookspec ids
Every B-n citation in crates/, docs/, deploy/, scripts/ and .github/ now names its bookspec id BS-<area>-<n> (D-68), via scripts/rewrite-rule-refs.py: the map is parsed from docs/spec/rules.md's index, rules.md-prefixed and bare forms are rewritten, sub-references (rule 11, item 7, INVARIANT 2) survive, and plan/, docs/spec/rules.md and docs/spec/claims/ are untouched. Program-output string literals that cited a rule were reverted by hand so user-visible output and its goldens are unchanged; DatedRule.catalog, metadata no output prints, now holds BS-1099-1. One SOURCE line that cited only 'R-?' now also cites BS-statement-5.

Co-Authored-By: Muse Wonder 1.0
2026-11-08 19:40:22 -07:00
swaitsandClaude Opus 5.5 7a177a3cfc docs(status): 2026-11-08, P14 under way
check / check (push) Canceled after 0s
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 19:14:44 -07:00
swaitsandClaude Opus 5.5 a27bdafde1 build: pin bookspec at aaa02ca, the FX law and D-75's bound
check / check (push) Canceled after 0s
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
bookspec proves the FX law (law 41: whole unit, within half a unit,
positive from half a unit, the tie included), links BS-ledger-14's FX
invariants, and states D-75's ten-place bound in BS-entry-4. With the
K-U1 merge above: 1,198 core and package tests pass, just prove is
green (Lean 151 audited here, 174 in bookspec), the Lean-model test
agrees on 64 sequences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 19:14:24 -07:00
swaitsandClaude Opus 5.5 3da9d97929 merge: foreign-currency conversion in the kernel, fx_booked, and D-75's ten-place bound (K-U1; branch t3/kernel-fx-booked-conversion; reviewed, fixes applied)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:51:53 -07:00
swaitsandClaude Opus 5.5 61a381b921 docs(plan): K-U10 makes Decimal's multiply exact-or-None too (found by K-U1's fix)
check / check (push) Canceled after 0s
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:51:50 -07:00
swaitsandClaude Sonnet 5.5 c400624310 docs(proofs): K-U1 notes after review and D-75
The overflow harness proves two concrete cases (and non-positive rate for
every symbolic rate), not every overflow; step <= 0 -> None rests on K-U2's
round_step_refuses_nonpositive_step and the bridge; the D-75 precondition,
the open 96-bit edge, the bridge's new properties, Fx.booked_pos now proved
at the tie, and the BS-ledger-14 link landed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 18:08:12 -07:00
swaitsandClaude Sonnet 5.5 c5a4894985 fix(core): foreign amounts and rates take at most 10 places (D-75)
The K-U1 review: foreign 0.99999999999999999999999999 (26 places) x rate
0.005 into USD booked 0.01, though the exact product
0.00499999999999999999999999995 is under half a cent. Decimal::checked_mul
rounds a product finer than 28 places to 28 before fx_booked rounds it to
the cent: two roundings, one cent off. A ledger in one money books the
exact product rounded once (BS-ledger-1, BS-ledger-14).

Owner decision D-75 (2026-11-08): a new line's foreign amount and its rate
take at most MAX_LINE_SCALE (10) decimal places each, as a base amount does
(B-28), so their product has at most 20 places, under Decimal's 28.
Ledger::add_line_fx refuses past it with ValueOutOfRange ("foreign amount
..." / "FX rate ..."; the variant for an amount that is not a journal
line's), trailing zeros not counted, before computing, and never on replay
(is_replaying; replay_add_line_fx books a journal's older line verbatim).

Tests: 11-place foreign amount and rate refused; ten and ten accepted with
hand-checked books; the review's input refused, not mis-booked; trailing
zeros are not places; replay keeps a 26-place foreign line in core, and a
store journal holding one opens with its figures.

fx_booked's spec block states the precondition (scales within 10 each, and
the mantissas' product within Decimal's 96 bits) and that the result is
exact under it, and documents Decimal::checked_mul's behaviours outside it
(rounding past scale 28 and past 96 bits; 1e-28 x 1e-28 underflowing to
zero); invariant 1 now says None when T's checked_mul cannot hold the
product. The bridge covers every D-75 scale (0..=10 each, products to 20
places) against an independent exact reference, shows 26 places is where the
reference and Decimal part (and the engine refuses), and pins an open edge
this bridge found: ten places each still allow a 20-place product past
~7.9e8 that outgrows 96 bits (1050000010.0000000001 x 9.9999999999 books
10500000099.90, exact 10500000099.89). B-28 and B-3 claims record the
enforcement and checks.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 18:08:12 -07:00
swaitsandClaude Sonnet 5.5 bf2fe200c2 style: rustfmt engine.rs (main's S-C7 merge left it unformatted)
No accounting change; `cargo fmt --check` was red on main.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 18:08:12 -07:00
swaitsandClaude Opus 5.5 3b59f7fec9 test(core): the Lean-model test requires D-73 to have landed; cargo fmt
The engine now refuses a reversal dated before its original (D-73), so
the gap the Lean-model test counted (the engine accepting a backdated
plain reversal the model refuses) is zero: the recipe sets
WANDERBOOKS_D73_LANDED, making any return of it a failure, and the
test's error mapping follows the variant's new name
(ReversalBeforeOriginal). 256 sequences, 2,204 commands: 0 mismatched,
0 gaps. Also formats the adapter's PICKS list, left unformatted by the
S-C7 renumbering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:16:20 -07:00
swaitsandClaude Opus 5.5 5de13d480b merge: the Rust ledger and the Lean model agree on random command sequences, refusals checked under D-74 (L-G5; branch t3/lean-model-differential-test; reviewed, fixes applied)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:14:33 -07:00
swaitsandClaude Opus 5.5 e080f761a0 merge: every reversal is dated on or after its original (D-73; branch t3/reversal-dating-d73, bb5008ed; reviewed)
claims/ledger.md conflicted with the reduced B-9 section: the D-73 pick,
Enforced and Checked lines sit above its product rules; the check's
place corrected (after the schedule double-post check, not ahead of it)
and the citation completed (BS-ledger-16, the Lean model since L-G1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:14:13 -07:00
swaitsandClaude Opus 5.5 4de03c1eaa merge: a coverage report and floor; rust_decimal checked against exact rationals (V-D; branch t3/decimal-exact-coverage-floor, e6fe6e29; reviewed, fix applied)
Cargo.toml: both the dev-dependencies for decimal_exact and the bookspec
comment's new path kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:11:27 -07:00
swaitsandClaude Opus 5.5 e6fe6e2949 test(core): decimal_exact pins the add's rounding next to Decimal::MAX
Review: the file's checked_add property stays at the books' sums, so it
couldn't see K-U4's finding that MAX + 0.4 gives Some(MAX); the header
now says where the checks are exact and a test pins the edge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:10:16 -07:00
swaitsandClaude Opus 5.5 57d86b1920 merge: every report and book total goes through the kernel's checked sum (K-U4; branch t3/kernel-checked-totals, bc81b849; reviewed)
periods.rs conflicted with K-U2: the frozen replay rules delegate to
K-U4's checked twins, whose rounding now goes through K-U2's
round_places (so every rounding stays in the kernel); no figure changes.
The K-U4 note gains the review's list of bounded raw sums left, and the
caveat that the twin test checks delegation (the review's independent
20,000-case comparison found the twins identical).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:09:27 -07:00
swaitsandClaude Opus 5.5 7ed3f431de docs(plan): V-D2, tests where coverage is thinnest
check / check (push) Canceled after 0s
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:07:05 -07:00
swaits 38b843cfe9 Merge branch 'main' into t3/kernel-fx-booked-conversion 2026-11-08 17:06:45 -07:00
swaitsandClaude Opus 5.5 ed9adaeec5 docs(plan): D-75, foreign amounts and rates take at most 10 places
check / check (push) Canceled after 0s
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:06:14 -07:00
swaitsandClaude Opus 5.5 72de6efec0 build: pin bookspec at 218b5c8, every CHOICE its own record
bookspec splits every CHOICE embedded in another rule into its own
record (S-C7), so an engine declares its pick for each by id; wanderbooks
declares its 65 picks (one list in the adapter, checked against each
record's options and the claims files). Lean builds and audits; adapter
and package tests pass on the new rev.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:06:14 -07:00
swaitsandDeepSeek V4.1 Flash 986c75b31e feat(just): coverage report and floor
Coverage is a tripwire, not a correctness oracle: the proofs, the
property tests, the GnuCash cross-check and mutation testing answer
whether the books are right; a line/branch report answers whether a test
still reaches the code it used to. This adds that measurement, pinned in
mise.toml like every other tool: cargo-llvm-cov 0.9.1, and the
llvm-tools component on the pinned nightly because branch coverage is
nightly-only (-Zcoverage-options=branch).

`just coverage` runs each crate's own suite instrumented (core and
store separately, so one crate's dev-dependency code does not enter the
other's totals), writes HTML, the JSON and the plain per-file table under
target/coverage/<crate>/, and excludes src/proofs.rs (Kani-only,
cfg(kani)) plus test and bench files: it measures the library.
`just coverage-check` reads docs/coverage-floor.md and fails when a
crate's total line coverage is more than 0.5 pp below its floor; regions
and branches are recorded for context but not gated, since branch
coverage is the noisier number across compiler versions.

First measurement from the full run: ledger-core 90.01% lines (88.86%
regions, 82.65% branches), ledger-store 91.71% lines (85.27%, 80.73%).
The store measured 91.98% on an earlier run the same day; properties pick
random cases, so a few tenths move between runs and the 0.5 pp tolerance
absorbs it (the floor records the lower run). The largest holes are
findings, not fixes here: ledger-store/reconcilable.rs is 0% (the server
and viewer are its readers; the store suite never calls it), and
ledger.rs is mostly the document/payroll replay steps the store's replay
tests exercise rather than the core's own.

It is not a push gate (the instrumented suites are slow: the store alone
runs about a hundred minutes of tests once built); the weekly scheduled
workflow runs it beside the proofs. The store's tests start and kill
helper processes that inherit LLVM_PROFILE_FILE, so a killed child can
leave a truncated profraw; the run passes --failure-mode all, which
merges the test binaries' profiles and ignores such a file (it holds no
test coverage).

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 16:05:43 -07:00
swaitsandMuse Wonder 1.0 720a93f0e0 ci: the Lean-model test runs weekly
Co-Authored-By: Muse Wonder 1.0
2026-11-08 16:01:28 -07:00
swaitsandMuse Wonder 1.0 22a9cc79a3 test(core): the Lean-model test checks D-74: each refusal names a rule the command breaks
Co-Authored-By: Muse Wonder 1.0
2026-11-08 16:01:13 -07:00
swaitsandClaude Opus 5.5 ee3ac6e6fc merge: wanderbooks declares its pick for every CHOICE it claims (S-C7; branch t3/s-c7-split-embedded-choices, de57598d; reviewed, fixes applied)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 16:00:45 -07:00
swaitsandClaude Sonnet 5.5 bb5008edb5 fix(core): every reversal is dated on or after its original (D-73)
A correction comes after what it corrects (Pacioli ch. 31; B-9). Until now
only document reversals and depreciation/schedule runs were held to it; a
plain posted entry could be reversed with an earlier date, leaving the
books carrying the opposite of an entry that doesn't exist yet at the
reversal's date. The owner's decision D-73 (2026-11-08) makes it one rule
for every kind of entry; bookspec BS-ledger-5 states it.

- Ledger::check_reversal refuses date < original.date() with one error,
  ReversalBeforeOriginal (it replaces DocumentReversalBeforeOriginal,
  which was the document-only wording). Same-day reversals are allowed.
- Not on replay (B-28): the check sits behind is_replaying(), so a journal
  an earlier version wrote, holding a reversal dated before its original,
  reopens with the same figures.
- The store's own date check for depreciation runs and schedule months
  (InvalidSchedule / AssetEntryIrreversible wording) was the same rule
  for a narrower case; it is removed so there is one variant for all.
  Store::check_reverse_entry, books.reverse_entry (preview and post), and
  the document voids all reach the refusal through check_reversal; the
  only construction path for a reversal is reverse_entry_steps, which
  calls it first.

Tests: store reversal_dates.rs (plain entry refused before it, nothing
journaled, same day and later taken; a journal with an earlier-dated
reversal written the old way opens with the same figures); ledger-cli
spec_mcp (preview, unconfirmed and confirmed post all refuse alike).
Existing tests changed: store assets.rs (three expectations move to the
new variant); core spec_asset_basis.rs (it backdated a reversal on
purpose to check the trial balance carries -100.00 between the dates; it
now replays one, as an old journal would); model.rs (the model oracle's
`reverse` requires the date, as the Lean/bookspec rule does); bookspec
common.rs (the pinned depreciation example words this refusal
"entry_irreversible"); spec_documents.rs (variant rename).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 16:00:23 -07:00
swaitsandMuse Wonder 1.0 de57598df8 docs(spec): every CHOICE wanderbooks claims has a declared pick
Add the seven older CHOICE records (with a B number) that carried no declared pick in the adapter, taking each option from its record's options and the claims file's existing Pick line for its B section:

- BS-arap-2 lines-that-stand, BS-arap-5 direct-write-off, BS-asset-3 tag-and-never-reuse, BS-ledger-6 reversible-once, BS-ledger-9 facts-in-the-books, BS-ledger-10 label-only, BS-statement-5 project-is-a-class
- PICKS in crates/ledger-core/tests/bookspec/engine.rs gains all seven; each claims file gains a '**Pick (BS-...):**' line beside its B section's Pick
- Widen rules_md.rs's pick check from b == 0 records to every non-retired CHOICE record wanderbooks claims, so no CHOICE can go undeclared again

Co-Authored-By: Muse Wonder 1.0
2026-11-08 15:59:44 -07:00
swaitsandClaude Opus 5.5 b24062e8fa docs(plan): K-U10, the Decimal sum exact at the edge (found by K-U4)
check / check (push) Canceled after 0s
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:50:14 -07:00
swaitsandClaude Opus 5.5 27e47a2b51 docs(plan): D-74, any rule a command breaks is a conformant refusal
check / check (push) Canceled after 0s
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:48:58 -07:00
swaitsandClaude Sonnet 5.5 bc81b84932 docs(proofs): K-U4 note, and a clippy fix in the bridge
docs/proofs/k-u4.md: the six harnesses with bounds and times, the Lean
counterparts (Basic.net_append is total_append for the signed sum; no new
law), the bridge, the sites replaced with file:line, the sites left raw
because their signatures are infallible, the regression tests, and two
findings: Decimal's checked_add rounds dust within a unit of Decimal::MAX,
and the audit's reachability claims for section 2.1 were overstated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 15:30:41 -07:00
swaitsandMuse Wonder 1.0 abad8d892b test(core): Kani and bridge for fx_booked
Four Kani harnesses on i64 with fixed steps (a symbolic step is
intractable for CBMC's division, as K-U2 found; written down in
docs/proofs/k-u1.md): whole unit, within half a unit with tie covers,
positive for positive, and overflow/non-positive rate refused. The
bridge checks i64 against Decimal and Decimal against an independent
i128 exact-product reference at 0, 2 and 3 minor units (JPY, USD,
KWD), with Decimal::MAX, scale 28, and both-sign tie edges. The law
itself is proved in bookspec's Lean (Fx.booked_whole/near/pos, law
41) on the k-u1 branch there.

Co-Authored-By: Muse Wonder 1.0
2026-11-08 15:12:51 -07:00
swaitsandMuse Wonder 1.0 f9affd0e1f refactor(core): foreign currency conversion, fx_booked, in the kernel
The one FX conversion that books money (add_line_fx: foreign x rate,
rounded once to the base currency's minor unit, half away from zero,
B-3 / BS-ledger-1 and its CHOICE BS-ledger-14) was inline in ledger.rs.
It now lives in kernel/fx.rs as fx_booked<T: Amount> (exact checked
product, one round_step; None on a non-positive rate or overflow) with
fx_booked_minor as its Decimal/currency spelling, which also keeps the
pre-kernel scale and books the exact product for a currency with no
minor unit. add_line_fx keeps its own error variants and refusals, so
behaviour is identical for every input; every test and golden passes
unchanged. Grep found no other FX conversion site: set/get_fx_rate
only record a rate, the store delegates to the core, and replay books
a recorded amount verbatim.

Co-Authored-By: Muse Wonder 1.0
2026-11-08 15:11:36 -07:00
swaitsandClaude Sonnet 5.5 8775d38d0d test(core): the Rust ledger and the Lean model agree on random command sequences
docs/verification.md proves the accounting laws of a model of the
ledger (bookspec's Bookspec.Step, run by Bookspec.Exec.step); that the
model is the engine was checked by review. This makes it a machine check.
tests/bookspec/lean_model.rs generates random command sequences (entries
balanced or not, with zero, negative, finer-than-a-cent and unknown-account
lines; invoices; reversals of anything posted, twice, of a closing entry,
backdated; closes to retained earnings over nested, disjoint, partly
overlapping, inverted, empty and out-of-order periods), runs each through
the Rust Ledger, writes it as a bookspec example whose expected values are
the engine's own answers, and has `lake exe bookspec-check` (the pinned
bookspec, built in a copy under target/) check every refusal, the trial
balance after each event, and at the end the trial balance, balances, P&L
and each posted entry's lines. All cases of a run go to one directory and
one lake call; a failure is shrunk (rounds of single-event removal, one
lake call each) and printed with both answers. `just lean-model [cases]`
runs it with WANDERBOOKS_REQUIRE_LEAN=1; without lake it skips unless that
is set.

Refusal words the checker does not list are compared through a probe (the
model's own word is read from its mismatch), so every refusal is checked,
not skipped; the one word the model does not have (the control guard) is
an explicit allow-listed skip. The D-73 gap (a backdated plain reversal the
engine still accepts and the model refuses) is rolled back and counted.

Findings, all of word only (both sides refuse, the books agree): the order
of checks when a command fails two. Allow-listed in KNOWN_WORD_DIFFERENCES,
pinned by a test that fails when one side changes, and by #[ignore]d d_*
tests that assert agreement: reversing a closing entry or an already
reversed entry on a closed day, an unknown account beside another fault, a
zero line beside a negative one, a close inside a closed period (the
model's own word closed_period_contains_end), a finer amount on a closed
day (the example reader's order). Nothing in the engine or the model is
changed. docs/verification.md's "Be precise about the claims" says what is
now checked and what stays by review.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 15:10:22 -07:00
swaitsandMuse Wonder 1.0 03f667585d docs(spec): partner picks follow the renumbering
Co-Authored-By: Muse Wonder 1.0
2026-11-08 14:53:25 -07:00
swaitsandClaude Opus 5.5 9d58502a09 docs(plan): X-I checks ids-issued only grows against the base commit
check / check (push) Canceled after 0s
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:45:02 -07:00