Commit Graph
685 Commits
Author SHA1 Message Date
swaitsandDeepSeek V4.1 Flash 4d9c73deef docs: the Lean laws, and their paths, are bookspec's
The laws are proved once in bookspec (D-69), so the documents that said
"put the new theorem in `verify/lean`" or cited
`verify/lean/Wanderbooks/<File>.lean` now say otherwise:

- AGENTS.md's formal-methods bar: a new law is written in bookspec's
  `lean/Bookspec/`; wanderbooks requires it and moves its pin (the lakefile,
  the manifest, and the crates' Cargo.toml together; the pin test fails if
  they drift). `Audit.lean` lists every theorem.
- docs/verification.md: the model and every cited Lean file are
  `bookspec/lean/Bookspec/<File>.lean`; "Running it" says the dependency is
  fetched and that all 151 theorems are audited.
- docs/testing.md and docs/spec/rules.md: the same paths, and the apportion
  row records where its law moved.
- README's repo map and the two test comments that named the Lean peer.

No accounting behavior changes; only where the proofs and their names live.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 11:36:00 -07:00
swaitsandDeepSeek V4.1 Flash e431791bbc build(lean): verify/lean requires bookspec's Lean; the laws live once
D-69 puts the accounting laws in one place: bookspec's Lean, namespace
`Bookspec`. L-F1 landed there every file of `verify/lean/Wanderbooks/`.
Before deleting the copies, each was checked: comments stripped, namespace
normalised, blank lines dropped, and diffed against its bookspec peer --
all ten are identical (Basic, Entry, Statements, Closing, Ledger,
Apportion, Parties, Prorate, Deductible, Documents). There is nothing
wanderbooks-only left to keep.

So `verify/lean/lakefile.toml` now `[[require]]`s bookspec as a git
dependency at 77e046334eea29e082b53bbe907017d9ffef5a0a -- the same rev
`crates/ledger-core/Cargo.toml` pins the Rust checker to -- with
`subDir = "lean"`. The generated `lake-manifest.json` is committed, because
Lake builds from it and it must not float.

`Wanderbooks.lean` is now a thin local target that imports `Bookspec`:
`lake build` builds and checks the whole law set, and the file says where
a law is edited and how wanderbooks picks it up (move the pin). The
duplicated modules and the `Wanderbooks/` directory are gone.

`Audit.lean` imports `Bookspec` and audits all 151 theorems (the 118
headline laws plus the 33 named laws in `Laws.lean` that cite them) --
the whole set bookspec itself audits. `just prove` still checks standard
axioms only; its summary now says "theorems", since the set is more than
headline ones.

The new `tests/bookspec/pin.rs` reads the rev out of the lakefile, the
manifest, and both crates' Cargo.toml, and fails unless all four name the
same repository at the same commit, and bookspec's `lean/` package. Without
it the Lean laws and the Rust checker could silently be different spec
versions.

Verified: `lake build` from a clean `.lake` (fetches and builds in 7 s);
`just prove` 871 s (Kani 53 harnesses, then 151 theorems, standard axioms
only); `cargo test -p ledger-core --test bookspec pin`; `cargo fmt --check`;
`cargo clippy -p ledger-core --tests -D warnings`.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 11:35:07 -07:00
swaitsandClaude Opus 5.5 7a3860de73 build: pin bookspec at 77e04633, rule records and every law in its Lean
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 now keeps one structured record per rule (rules/, each with a
plain-English description, generated index and per-area pages, link
checks, ids never reused) and proves all 118 headline theorems plus 33
named laws in its own Lean (P14 units S-A and L-F1, reviewed, with the
review fixes). The checker's public API is unchanged: the adapter (52
tests) and the package tests (29) pass on the new rev.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 11:05:28 -07:00
swaitsandClaude Opus 5.5 539ef8a345 merge: the bookspec adapter becomes modules by area (X-H0; branch t3/split-bookspec-adapter-modules, f9cdf4d7; same 52 tests, same functions)
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 10:49:40 -07:00
swaitsandDeepSeek V4.1 Flash f9cdf4d718 refactor(core): the bookspec adapter becomes modules by area
The bookspec adapter was one 4,647-line test file, and every later unit
that adds a query or an event touches it. Split it by its own sections,
with no behaviour change: `main` keeps the crate doc, the shared imports
and the module list; `common` holds the shared vocabulary (dates,
refusals, exact decimals, figure formatting); `books` the example's
books and setup; `events` the application of each event; `queries/` the
answers and checks per query family (statements, parties, tax, assets,
formats, commands, dates); `engine` the `Engine` impl; `check` and `run`
the drivers; and `examples`, `loader_tests`, `sources` and `rules_md`
the tests by area. Every `#[test]` keeps its function name (52 tests,
same names), and Cargo still builds one test target named `bookspec`.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 10:49:03 -07:00
swaitsandClaude Opus 5.5 69cfc81bb4 merge: Money::checked_add and checked_sub return an error on overflow (branch t3/fix-money-checked-overflow, bac0ea22; reviewed)
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 10:14:00 -07:00
swaitsandClaude Opus 5.5 66d9b7ac54 docs(plan): P13 step 6 names bookspec's pin after the history rewrite
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 10:11:47 -07:00
swaitsandClaude Opus 5.5 54c710bc43 build: pin bookspec at 4eb99123, its history purged of build output
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's first push committed 1,979 files of cargo build output
(target/). At the owner's request its history was rewritten to drop
them (git filter-branch, every commit) and force-pushed: the repository
went from 105 MB to under 400 KB. Every commit got a new hash, so the old
pin 74f2853d no longer exists upstream. Its rewritten twin is 6b309306,
with an identical tree apart from target/ (checked against a mirror
backup); the pin moves to the new tip 4eb99123, which only adds a
.gitignore. The bookspec adapter (52 tests) and the package tests (29)
pass on it. Older wanderbooks commits still name 74f2853d and will not
fetch bookspec from scratch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 10:11:32 -07:00
swaitsandClaude Sonnet 5.5 bac0ea22af fix(core): Money::checked_add and checked_sub return an error on overflow, never panic
Both were named checked but only checked the currency; the amounts went
through raw Decimal + and -, which panic past Decimal's range. A sum or
difference too large for exact arithmetic is now refused with
TooLargeToCompute, as everywhere else in the engine: never rounded,
wrapped or crashed. Currency mismatch still reports as a mismatch.

Test: checked_arithmetic_refuses_overflow_instead_of_panicking (MAX+MAX,
MIN+MIN, MIN-MAX, MAX-MIN refused; MAX+MIN and MAX-MAX exact).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 10:09:35 -07:00
swaitsandClaude Opus 5.5 c99a24893c docs(plan): P14, bookspec the definitive spec, the kernel sweep, D-68 to D-72
The owner's decisions of 2026-11-08 and the plan built from the two
audits: bookspec becomes the specification (one structured record per
rule with a plain-English description, the laws proved once in its
Lean, wanderbooks keeping claims and WB-n product rules), every money
computation moves into the proved kernel, the Lean model is run against
the code, and hledger joins GnuCash as an oracle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 10:03:07 -07:00
swaitsandClaude Opus 5.5 c433bc5062 merge: the kernel sweep and hledger audit (commit 9369c1f4; plan input)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 10:02:11 -07:00
swaitsandClaude Opus 5.5 9ea8254161 merge: the bookspec and kernel-sweep audits (branches t3/bookspec-audit 671d2fd6, t3/5250266e 9369c1f4; plan input)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 10:02:07 -07:00
swaitsandClaude Sonnet 5.5 671d2fd6cc docs(plan): bookspec audit
Read-only audit of what it takes to make bookspec the definitive
accounting specification: the 45 rules classed (accounting law,
convention/choice, format, product) with bookspec's completeness for
each, the 27 vendored sources and their licences, the Lean drift and a
verified lake require, the golden files as candidate examples, the
executable reference model (decidability, soundness, TOML in Lean), and
a unit breakdown with dependencies and file ownership.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 09:58:18 -07:00
swaitsandDeepSeek V4.1 Flash 9369c1f45a docs(plan): kernel sweep and hledger audit
Read-only audit of money arithmetic outside kernel.rs: 211 sites
(169 must move, 35 display-only, 7 not money), 76 raw/panic-capable
operators, grouped into nine sweep units with kernel signatures, Kani
harnesses, bridge properties, Lean laws, and a module layout that keeps
parallel units from conflicting. Also assesses hledger as a second
semantic oracle: what it can compare, how to map the journal, the
display-precision trap, a pinned static 1.52.4 image, and an hledger
engine adapter for bookspec.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 09:56:28 -07:00
swaitsandClaude Opus 5.5 a2ad2ed35e merge: Lean proves the deductible share rounds once, at any size (branch t3/deductible-share-lean-proof, aa1331c8)
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 08:19:17 -07:00
swaitsandClaude Sonnet 5.5 aa1331c8bd docs: law 39 names its Lean theorems
Law 39 said no Lean theorem was needed because the Books model has no
tax categories. That reasoning was wrong: the law is pure kernel
arithmetic, like Prorate's roundUnit laws, and needs no Books model.
verify/lean/Wanderbooks/Deductible.lean now proves it at any size.

verification.md law 39 lists the Lean theorems in the usual format and
states the split plainly: Lean proves the law on integers over a common
denominator (one rounding, Prorate.roundUnit on the magnitude, signed
after); Kani proves the code on i64; the bridge and exact-reference
properties carry it to Decimal; overflow stays outside the model.
rules.md B-32's Checked line and plan/STATUS.md name the Lean file.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 08:14:49 -07:00
swaitsandClaude Sonnet 5.5 2d345d02bc feat(lean): the deductible share rounds once, at any size
Law 39 (kernel::deductible_amount, B-32, D-67) was proved by Kani only
for up to three accounts and books to 2^20 cents. Like the proration
kernel, its arithmetic needs no Books model: Deductible.lean states it
on integers, for any number of accounts and any sizes.

Model: a share is a pair of integer numerators over one positive common
denominator D (10^(p+s) for books at p places and percents at s). The
category in cents is N / D, N = sum of book x percent; the /100 of the
percent and the x100 of dollars-to-cents cancel, so there is one
rounding: roundHA N D, the magnitude rounded by Prorate.roundUnit (unit
one, reused, not a second rounding function) and signed after, which is
what checked_div_round_cent does with a_mag, b_mag and `negative`.

Theorems (all on the exact sum, none by cases on the list):
- near: |2(D c - N)| <= D, any size
- tie_away_pos / tie_away_neg: at exactly k + 1/2 cents the result is
  k + 1 (resp. -(k + 1)), the cent farther from zero
- sign: never the opposite sign; zero when the sum is zero
- neg: negating every book negates the result (odd symmetry)
- of_sum, of_perm, append, split_percent: the result depends on the
  shares only through their exact sum
- per_account_differs (+ _mixed, tie_example): the kernel's three
  scenarios by decide: 1.01+1.01 at 50% is 1.01 once, 1.02 by account;
  1.05 at 50% and 30% is 0.84 vs 0.85; 333.33 at 50% is 166.67
- scale_books / scale_percents: a finer common denominator (books or
  percents carrying more decimal places) changes nothing

The Lean proves the law, not the Rust: Kani proves the code on i64, the
bridge and exact-reference properties carry it to Decimal. Overflow
(None) is outside the model. 20 headline theorems added to Audit.lean,
standard axioms only; no sorry.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 08:12:24 -07:00
swaitsandClaude Opus 5.5 5353b5ae58 docs(status): the deductible share is kernel arithmetic, proved (2026-11-08)
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 07:01:23 -07:00
swaitsandClaude Opus 5.5 f2c84d6779 test(core): the deductible rounding step at Decimal's edges
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
Pins the re-check's adversarial rows (each matched exact fractions):
Decimal::MAX over 1 and 10 (two and one trailing-zero reductions), over
2 and 4 (no scale holds .50 or .75, so None), 1 over 1e-28 (the widest
exponent), and a half-cent tie written at scale 28, both signs, with the
value just under it. The 2,000-case property stays in the ordinary band;
these hold the edges it doesn't reach.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 07:01:10 -07:00
swaitsandClaude Opus 5.5 5630b9aff8 merge: the tax summary's deductible share is kernel arithmetic with Kani and bridge proofs (branch t3/move-deductible-share-kernel, 9f5ff9d0; reviewed twice, just prove and the slow harness green)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 07:00:35 -07:00
swaitsandMuse Wonder 1.0 9f5ff9d0bf docs: law 39 names the Decimal coverage and the no-x100 rounding
Say which part of the Decimal path the new exact-reference property covers (decimal percents, sub-cent books, multi-share categories) beside deductible_amount_agrees, note the negative-tie cover, and record that Decimal checked_div_round_cent now rounds from mantissa and scale by exact i128 arithmetic with None left for a product or sum overflow or a quotient Decimal cannot hold. That is the spec change the overflow fix makes in law 39's text.

Co-Authored-By: Muse Wonder 1.0
2026-11-08 06:41:05 -07:00
swaitsandMuse Wonder 1.0 d3837a3a0a test(core): the deductible share's Decimal path against an exact reference
No committed test exercised decimal percents or sub-cent books: Kani proves the integer shape, the bridge used 2-decimal books and integer percents, and the tax tests use integer percents. Add deductible_amount_matches_exact_reference_on_decimal_shares, over books at 0-6 decimal places and percents in hundredths 0.00-100.00 (half at 4 places), several shares per category, against an independent reference computed as an exact i128 scaled numerator over a power of ten, rounded half away from zero by integer arithmetic. Pin the review's unit table (ties, sub-cent and FX-precision books, a 6-decimal percent, the Finding 1 regression, and a genuinely unrepresentable quotient) in kernel_bridge, and cover the negative half-cent tie (exact % 100 == -50) in the slow deductible_amount_rounds_once harness, whose Rust % only fired the existing cover for a positive tie.

Co-Authored-By: Muse Wonder 1.0
2026-11-08 06:41:01 -07:00
swaitsandMuse Wonder 1.0 17b37d3e76 fix(core): the kernel's deductible share never overflows on a representable result
The Decimal checked_div_round_cent formed self * 100 before dividing, so a book of 10^25 - 1 at 100% -- whose exact deductible 9999999999999999999999999.00 is representable, and which the code before the kernel move returned -- overflowed that intermediate and came back None, making tax_summary report TooLargeToCompute. That breaks the function's own spec: None only for a product or sum that overflows, or a quotient Decimal cannot hold.

Round from the two mantissas and scales by exact i128 arithmetic instead: cents are round(a / b * 10^(sb - sa + 2)), half away from zero, with no x100 intermediate ever formed. Scale 28 is settled by the integer remainder, so digits a Decimal division by 100 would have to round away to fit still decide the half-cent tie. A trailing zero may let a past-mantissa quotient fit at scale 1 or 0; anything else past the mantissa is genuinely unrepresentable and stays None, and a zero result is never a negative zero.

Co-Authored-By: Muse Wonder 1.0
2026-11-08 06:40:58 -07:00
swaitsandDeepSeek V4.1 Flash 96a4c4a3b4 docs: the deductible share's percent may carry decimals; measured times
The kernel function's doc now says a percent is a deductible percentage
in 0..=100 and that an override may carry decimals (33.33 is exact), the
fact the tax API allows. docs/verification.md's harness table records the
new harness at 992 s alone and 1,207 s inside the 2026-11-08 prove-slow
run, both under the 1,800 s cap.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 06:13:26 -07:00
swaitsandDeepSeek V4.1 Flash be98b99abb docs: B-32 and verification name the kernel's deductible rounding
B-32's CHOICE now says the category rounding is
`kernel::deductible_amount`, and its Enforced/Checked lines name the two
Kani harnesses and the bridge property. docs/verification.md adds law 39
(the exact sum, rounded once to the cent, never share by share), its
harnesses, the bridge, and the harness table row and the new prove /
prove-slow counts. It records why this law has no Lean model: it is a
report figure's arithmetic, like `discount_max` and `unrecovered_cost`,
not a `Ledger` command or a law about posted entries; the model's Books
has no tax categories, and the arithmetic it would restate is the kernel
function's own definition.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 05:44:59 -07:00
swaitsandDeepSeek V4.1 Flash 9603eadfde test(core): Kani harness and bridge property for the deductible share
`deductible_amount_rounds_once` model-checks up to three accounts at i64
cents: the result is exactly the reference round-half-away-from-zero of
the exact numerator, within half a cent of the sum, never the opposite
sign, and (a cover) not the sum of per-account roundings; it also covers
a half-cent tie and a negative numerator (a refund). It is slow (992 s
alone on 2026-11-08), so it joins the justfile's kani_slow.
`deductible_amount_refuses_overflow` proves the two overflow paths give
None, not a wrapped figure.

The bridge property `deductible_amount_agrees` checks the i64 cents
result against the Decimal dollars result on the same accounts, and the
Decimal result against the exact sum within half a cent, with the sign
law and no negative zero: what Kani proved on i64 holds on Decimal, the
type the engine runs.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 05:44:56 -07:00
swaitsandDeepSeek V4.1 Flash 3cc9965a04 refactor(core): the tax summary's deductible share moves into the kernel
A category's deductible amount is the exact sum of its accounts' shares
(book × deductible percent ÷ 100), rounded once to the cent, half away
from zero (rules.md B-32's CHOICE, owner 2026-11-07, D-67; B-21's "round
off only the total"). That rounding was the last money arithmetic outside
kernel.rs: tax.rs accumulated Decimal shares and called
round_dp_with_strategy itself, so nothing proved the round-once law.

`kernel::deductible_amount` now takes the (book, percent) pairs and sums
their products exactly, then `Amount::checked_div_round_cent` divides by
100 and rounds once to the cent. The trait method is the explicit step:
exact quotient and remainder on a machine integer, cents-then-remainder
on Decimal (no double rounding through Decimal's 28-place division),
halves away from zero, no negative zero, None on overflow. The amount is
the nearest cent of the exact sum, never the sum of per-account
roundings, and its sign follows the sum.

tax.rs keeps the same output and the same TooLargeToCompute error; it
now gathers the shares and asks the kernel for the category total. The
18 tax tests, the golden Form 1065 summary and the two round-once tests
pass unchanged.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 05:44:53 -07:00
swaitsandClaude Opus 5.5 4551566767 fix(just): p12-night counts a mutation run with survivors as finished, not failed
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
cargo-mutants exits 2 when mutants were missed and 3 when some timed out.
The runner treated every non-zero exit as a failure, and a failed step
starts fresh, so a crate with even one equivalent mutant would have been
mutated from scratch every night and never marked done. Exits 2 and 3 now
record the counts as findings to triage and mark the step done; any other
exit (a usage error, a failing baseline) still fails. A resumed run's
failure note now says its counts are this run's (cargo-mutants rotates
earlier catches into previously_caught.txt). Review of 3b989916 (Muse),
F1 and F2; checked with a stand-in just exiting 2 and 4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 12:26:01 -07:00
swaitsandClaude Opus 5.5 fea90f4054 merge: p12-night resumes a cut-off mutation step with cargo-mutants --iterate (branch t3/p12-night-resume-mutants, 3b989916; reviewed)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 12:25:02 -07:00
swaitsandDeepSeek V4.1 Flash 3b9899167c feat(just): p12-night resumes a cut-off mutation step with --iterate
A mutation step stopped at P12_STOP (or by `just p12-stop`) is marked
partial and used to restart from scratch the next night: run_mutants
rm -rf'd the crate's output directory and the recipes did not pass
cargo-mutants' --iterate. A crate whose run takes longer than one night
could never finish.

cargo-mutants 27.1.0 writes caught.txt, unviable.txt, timeout.txt and
missed.txt incrementally, and --iterate reads caught.txt, unviable.txt
and previously_caught.txt before rotating the output directory. A killed
run therefore resumes: mutants already caught or found unviable are
skipped, while missed, timed-out and never-reached mutants are retested.
Verified on a scratch crate: a run killed after 19 of 42 mutants; the
--iterate rerun found 23 to test, excluded the 19, retested the mutant
killed mid-test and the unreached ones; a third run excluded 38 and
retested only the 4 missed.

A partial mutation step now keeps its output directory and the runner
sets P12_MUTANTS_ITERATE=--iterate; every mutation recipe forwards that
variable to cargo-mutants. Fresh and failed steps still rm -rf and start
over, and the empty-name guard stays before the rm. The step result
records that it resumed and how many mutants were already tested.

Also resolve cargo-mutants' output layout while here: -o NAME puts the
files in NAME/mutants.out, so the state copy, the counts and the resume
skip count now use that inner directory instead of counting zero. The
core recipe's default output is already the repo's mutants.out.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-07 12:18:52 -07:00
swaitsandClaude Opus 5.5 7aa1297840 docs(status): 2026-11-07, eleven golden files, the floor to 36, D-67
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-07 12:11:45 -07:00
swaitsandClaude Opus 5.5 30bbf9a1ba docs: B-32 names D-67 and its tests; the tax worksheet notes the rounding is decided
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
Review notes on the round-once change: B-32's Status line now lists the
owner's 2026-11-07 CHOICE and its Checked line the two tests that pin
it; the Form 1065 worksheet's two remarks that no rule stated the
rounding now say D-67 settled it (the golden, one account per
category, is unchanged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 12:10:52 -07:00
swaitsandClaude Opus 5.5 107571fd5e merge: the tax summary rounds a category's deductible amount once (D-67; branch t3/tax-summary-round-once, 5b1f9d02; reviewed)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 12:10:39 -07:00
swaitsandMuse Wonder 1.0 5b1f9d0232 docs: D-67, the tax summary rounds once per category
Record the owner's 2026-11-07 decision in rules.md B-32 and as D-67 in plan/served.md 10.1: a category's deductible amount is the exact sum of its accounts' shares, rounded once to the cent, following B-21's 'round off only the total'.

Co-Authored-By: Muse Wonder 1.0
2026-11-07 12:03:43 -07:00
swaitsandMuse Wonder 1.0 531fe671dc fix(core): the tax summary rounds a category's deductible amount once
Per-account rounding could put a category a cent per account away from the return's figure. The IRS adds with cents and rounds only the total (rules.md B-21), so each account's share now accumulates exactly (checked arithmetic, TooLargeToCompute on overflow) and the category rounds once, half away from zero. The golden is unchanged: one account per category there.

Co-Authored-By: Muse Wonder 1.0
2026-11-07 12:03:40 -07:00
swaitsandClaude Opus 5.5 8934bef8a2 docs(parity): the audit run is done, floor 36
It waited on a hand-verified golden covering a workpaper. One small book
seeds five findings in five check areas (a missing receipt, an open
draft, a schedule three months behind, an uncategorized account, an
undecided 1099 vendor paid 900.00), with the 1099 and cash-flow inputs
derived from the books as the MCP tool derives them. A second model
(Sonnet) recomputed every finding; its review moved the 1099 input from
a hand-fed string to a posted payment and corrected the worksheet: B-45
fixes a deterministic, ordered list, and the severities are the code's
own CODES table, a CONVENTION the golden pins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 11:59:44 -07:00
swaitsandClaude Opus 5.5 341ef2eb6e merge: golden file for the audit workpaper (branch t3/audit-workpaper-golden, 5e526d1c; reviewed and recomputed independently, review fixes applied)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 11:59:42 -07:00
swaitsandClaude Sonnet 5.5 5e526d1cd9 test(core): the audit golden derives its 1099 finding from a posted payment
The audit golden used to hand the vendor and amount to the audit; the
ledger held no payment to that vendor. Now the fixture adds the vendor
(Ledger::add_vendor, which makes its party) and posts entry 5, 900.00 of
supplies paid from the bank on 2026-03-10 with a receipt, 1099 decision
left undecided. The audit's 1099 input is built as ledger-mcp's
audit_findings builds it: ledger_package::vendor_1099_report(year 2026,
as of 2026-03-31), keeping the vendors with decision_needed. Because the
books name the bank as their cash account, the cash-flow footing is tried
the same way instead of handed in as None.

Recomputed by hand (worksheet): opening raised to 3,000.00 so the bank
stays positive (860.00 = 3,000 - 40 - 1,200 - 900); trial balance 3,000.00
= 3,000.00; assets 2,060.00 = equity 3,000 - 940; net income -940.00 =
current earnings; cash flow operating -2,140.00 + financing 3,000.00 =
+860.00 = change in cash. The vendor's 900.00 is under the 2026 threshold
of 2,000.00 (B-19, status under_threshold), yet decision_needed is
has_undecided && hi(U) > 0, so the code flags it; the worksheet records
that this is the code's rule, which B-19 does not state separately. The
payment debits Supplies (already categorized) and is entry 5 so the draft
stays entry 4: no other finding changes, and the golden JSON is unchanged.

The worksheet no longer says B-45 gives the severities or the checks'
list: B-45 asks for a deterministic, fixed-order list; the severities are
the CODES table's, the code's own CONVENTION, which this golden pins. It
also lists which checks the golden leaves silent and that tests/audit.rs
seeds each one.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 11:59:13 -07:00
swaitsandClaude Opus 5.5 0162ee436e docs(parity): draft states and discard, and the one evidence gate, are done, floor 35
Both rows waited on a hand-verified golden covering a discard. One store
fixture now pins every draft's state, each entry's evidence requirement
(a reversal exempt by origin above the threshold, D-47), the gate's two
refusals, a discard that moves no balance and spends no id, and a close
refused while a draft holds the period and accepted after its discard.
A second model (Muse) recomputed every value independently from B-43
and D-47 and showed a wrong balance, a flipped exemption and a bypassed
gate each fail the test. Worksheet: the closing entry is pinned under
close_after_discard, not posted_entries (review note).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 11:57:14 -07:00
swaitsandClaude Opus 5.5 cb82403247 merge: golden file for draft states, discard and the one evidence gate (branch t3/golden-draft-states-discard-evidence, 2593931c; reviewed and recomputed independently)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 11:56:25 -07:00
swaitsandClaude Sonnet 5.5 2593931c47 test(store): golden file for draft states, discard and the evidence gate
One fixture serves both parity rows (draft states and discard; the one
evidence gate). A Store fixture, because the gate's receipt-on-file half
lives in the store. New fixture, built like books_for_drafts and extended.

Hand-computed in plan/golden-worksheets/draft-states-and-evidence-gate.md,
before serializing anything:
- Requirement (B-43 inv. 2, threshold strictly > 25.00): drafts of 40.00,
  60.00 and 100.00 are Required; 12.50 is Exempt (policy); the reversal
  (debits 100.00) is Exempt by origin (D-47, D-12); the closing entry
  (52.50) is Exempt by origin. Receipt counts are pinned beside them: the
  gate refuses the 40.00 and 60.00 drafts (no receipt) with the journal
  head unchanged, then lets the rest post; the reversal has no receipt.
- Trial balance 2026-01-31 before and after the discard of the 60.00
  draft: Cash 447.50 Dr, Equity 500.00 Cr, Software 52.50 Dr, totals
  500.00; identical after the discard, next entry id 7 both times.
- The close is refused while the draft is open (B-12), accepted after the
  discard: Dr Retained Earnings 52.50 / Cr Software 52.50 (a loss), id 7;
  trial balance then 447.50 Dr, 500.00 Cr, 52.50 Dr.
Code and hand values agreed on the first run. Strength: four scratch edits
of the golden (a balance, a decision, a discard reason, the next id) each
fail the test.

Adds serde::Serialize to evidence::Requirement (tagged, snake_case) so the
gate's result can be pinned.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 10:39:36 -07:00
swaitsandDeepSeek V4.1 Flash 3fa0bddfda test(core): golden file for the audit workpaper
The audit's statements programme (rules.md B-45) now has a golden for one
small book, hand-worked from B-45 in plan/golden-worksheets/audit-workpaper.md:
2,000.00 of capital, a 40.00 purchase with no receipt, a year of prepaid
insurance never posted, a 5.00 draft, and one Revenue account with no tax
category. Through 2026-03-31 that gives one failure (evidence_missing,
entry 2, debits 40.00 over the 25.00 threshold) and four warnings: draft 4
on 2026-02-10, schedule 1 with 3 months / 300.00 due from 2026-01-31,
account 4100, and vendor Tobin Harlow Supply at 900.00. Trial balance,
equation, P&L articulation, control accounts, closes, assets, settings and
the receipted entries are all silent.

The golden holds the workpaper's statements data (scope, through, summary,
findings). Hashes, the figure head and the programme version are not
hand-verifiable, and the static check catalogue is not a finding, so they
stay out; the worksheet says so. The first draft mis-marked evidence_missing
a warning: the table and CODES say failure, the prose was wrong, and both
the worksheet and the golden were corrected to the books.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-07 10:38:59 -07:00
swaitsandClaude Opus 5.5 3ac3e8b1b4 docs(parity): the 1099 worksheet and prepaid/deferred amortization are done, floor 33
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
Both rows lacked only a golden file. Each now has one computed by hand
before the engine's output was read; a second model (Sonnet) recomputed
both independently. The review found the 1099 golden pinned no card
exclusion (the fixture never records its card, so by B-19 the charge
counted for no one); the golden test now records the card as a business
card, so Sam's 5,000 is excluded and listed, and the unrecorded case is
asserted in cash_paid_per_vendor_and_who_is_reportable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 10:31:21 -07:00
swaitsandClaude Opus 5.5 de584309fc merge: golden files for the 1099 worksheet (with a recorded business card's exclusion) and prepaid and deferred amortization (branch t3/golden-1099-prepaid-amortization, 06b571c1; reviewed and recomputed independently)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 10:30:49 -07:00
swaitsandClaude Sonnet 5.5 06b571c109 test(core): the 1099 golden covers a recorded business card's exclusion
The golden's fixture charged Sam's 5,000 to 2100 Credit Card with no
business-card payment method recorded, so by B-19 ("anything else" row)
the charge landed in no bucket and the golden pinned no excluded_card
figure at all, though the parity row claims card exclusion.

The golden test now records 2100 as a business-card method (books() is
untouched; other tests rely on its unrecorded card). Worked by hand from
B-19's table before running: #8's Cr 2100 is a company card's account, so
the line is card (excluded) 5,000; Dr 6000 is an expense, no payment
line; the entry nets to card 5,000 alone. So in 2026 Sam gets
excluded_card 5,000, paid 0, undetermined 0, still under_threshold
(F = U = 0; a card is never the vendor's reason), and
excluded_card_payments lists entry 8, 2026-04-01, vendor 3, 5,000,
instrument null (untagged). Every bank payment, the untagged note and all
of 2025 are unchanged. The code agreed with every hand figure; the golden
differs from its predecessor in exactly those two fields.

cash_paid_per_vendor_and_who_is_reportable now also asserts that on the
unrecorded books() Sam's card charge is in no exclusion bucket and the
card list is empty, keeping the unrecorded case covered.

Vendor1099Report, Vendor1099Line and Payment1099 drop the unused
Deserialize derive (Serialize stays for the golden).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 10:30:31 -07:00
swaitsandDeepSeek V4.1 Flash 72f7bcece9 test(core): golden file for prepaid and deferred amortization
The two hand-verified amortization fixtures in schedules.rs now have one
golden covering both plans, their rounding, their remaining balance and
the statements they move. Recomputing them by hand from rules.md B-16
(monthly_even: each period total/months to the cent, the last period
taking the remainder) before serializing:

- Prepaid: 1,200.00 of insurance from 2026-03-01 over 12 months is
  100.00 a month exactly. March-May are posted, so 300.00 is expensed and
  900.00 remains; the balance sheet carries 900.00 of prepaid.
- Deferred: 1,000.00 from 2026-01-01 over 3 months is 333.33, 333.33 and
  333.34 (the last period absorbs the 0.01 remainder), summing to
  1,000.00 exactly. All three are posted, so 1,000.00 is revenue and
  nothing remains a liability.

Every period, cumulative and remaining figure agrees with the hand
worksheet in plan/golden-worksheets/amortization-plans.md. No existing
golden or assertion changes.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-07 10:24:53 -07:00
swaitsandDeepSeek V4.1 Flash 025c0942ee test(core): golden file for the 1099 vendor worksheet
The `books()` fixture's worksheet is now a golden: 2025 and 2026, so the
year boundary and both thresholds (600 and 2,000) are pinned. Recomputing
it by hand from rules.md B-19 before serializing the report:

- Dana: 1,500 bill payment + 700 direct = 2,200 in 2026 (reportable at
  2,000); the 300 dated 2025-12-30 counts only in 2025 (under 600).
- Ace Rentals: 1,200 in January; the February 1,200 and its reversal net
  to zero, so 1,200, under 2,000.
- Sam: 5,000 charged to 2100, which no cash, financing or business-card
  method names, so no payment line: paid 0, under. The card exclusion is
  the fixture's documented "nothing counts" case.
- Bigco: 9,000 from the bank while never decided: undetermined, a decision
  needed, never reportable until one is made.
- The untagged 50.00 contract-labor payment is the quieter note.

Every field agrees with the hand worksheet in
plan/golden-worksheets/1099-worksheet.md. `Vendor1099Report`,
`Vendor1099Line` and `Payment1099` gain serde derives so the report can be
serialized; no existing golden or assertion changes.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-07 10:24:15 -07:00
swaitsandClaude Opus 5.5 671ccac733 docs(parity): date-range P&L, as-of balance sheet and trial balance, general ledger are done, floor 31
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
The four rows lacked only a golden file. One fixture (the fixture
company plus a three-leg purchase, the engine's own January close and a
February entry) now backs four goldens computed by hand before the
engine's output was read; a second model (Sonnet) recomputed all four
independently, confirmed the P&L drops the close by its closing-entry
id and not by date, and showed a cent, a missing line or a reordered
posting fails each test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 10:05:25 -07:00
swaitsandClaude Opus 5.5 805633ef7b merge: golden files for the date-range P&L, the balance sheet and trial balance as of a date, and the general ledger (branch t3/golden-pl-balance-trial-gl, c5824c4f; reviewed and recomputed independently)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 10:05:13 -07:00
swaitsandClaude Opus 5.5 e2c16f01ed docs(parity): members' equity and tax summary are done, floor 27
Both rows lacked only a golden file. Each now has one whose every
number was computed by hand from the fixture before the engine's output
was read, and a second model recomputed both independently (Muse) and
showed a 0.01 change to the golden fails the test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 10:04:55 -07:00