Commit Graph
1210 Commits
Author SHA1 Message Date
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
swaitsandClaude Opus 5.5 baf4c8ae0d merge: golden files for the members' equity statement and the Form 1065 tax summary (branch t3/golden-equity-tax-reports, 545a502d; reviewed and recomputed independently)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 10:04:46 -07:00
swaitsandDeepSeek V4.1 Flash c5824c4fa2 test(core): golden file for the general ledger by account
Add a golden for general_ledger over [2026-01-01, 2026-01-31] on the
shared extended January fixture, with running balances, each posting's
split, per-account totals, and entry ids. The close is a posting like any
other here; the Feb 5 entry is after the period end and is out.

Hand recomputation (plan/golden-worksheets/general-ledger.md): cash has
five postings (begin 0, debits 11,500, credits 4,300, ending 7,200);
receivables 4,000 - 1,500 = 2,500; equipment 2,500 + 1,500 = 4,000;
payable 500; owner's equity 10,000; retained earnings 3,200; service
revenue 4,000 credit then the close's 4,000 debit, ending 0; rent 800
debit then the close's 800 credit, ending 0. Entry 6's equipment debit
has two accounts on the credit side (cash and payable), so its split is
"-Split-"; the same for entry 7's revenue debit (rent and retained
earnings) and for the close's two other lines the split is the single
account 4000 Service Revenue. Every ending balance ties to the as-of
trial balance.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-07 10:00:51 -07:00
swaitsandDeepSeek V4.1 Flash 73e1210248 test(core): golden file for the trial balance as of a date
Add a golden for trial_balance_as_of on 2026-01-31 over the shared
extended January fixture. The as-of applies before the close is read, so
this is the post-closing trial balance: revenue and rent net to zero and
the close's 3,200 sits in retained earnings; the Feb 5 entry is after the
as-of date and is out.

Hand recomputation (plan/golden-worksheets/trial-balance-as-of.md):
cash net debit 10,000 + 1,500 - 2,500 - 800 - 1,000 = 7,200;
receivables 4,000 - 1,500 = 2,500; equipment 2,500 + 1,500 = 4,000;
payable credit 500; owner's equity credit 10,000; retained earnings
credit 3,200. Service revenue and rent expense each have equal debits and
credits after the close, so neither is listed. Totals: debits 13,700,
credits 500 + 10,000 + 3,200 = 13,700. The Feb 5 entry would have added
600 to each column; the golden pins the January figures.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-07 10:00:05 -07:00
swaitsandDeepSeek V4.1 Flash be9bb02e1b test(core): golden file for the balance sheet as of a date
Add a golden for balance_sheet_as_of on 2026-01-31 over the shared
extended January fixture. Closing entries count on a balance sheet, so
the January close's 3,200 to retained earnings is in; the Feb 5 entry is
after the as-of date and is out.

Hand recomputation (plan/golden-worksheets/balance-sheet-as-of.md):
asset balances are debits minus credits -- cash 10,000 + 1,500 - 2,500 -
800 - 1,000 = 7,200, receivables 4,000 - 1,500 = 2,500, equipment 2,500 +
1,500 = 4,000, total assets 13,700. Liabilities: payable 500. Equity:
owner's equity 10,000 plus retained earnings 3,200. Current earnings is
zero because the close zeroed revenue (4,000 credit and 4,000 debit) and
rent (800 debit and 800 credit). Total equity 13,200, and 13,700 = 500 +
13,200. The Feb 5 entry would have shown AR 3,100 and current earnings
600; the golden pins the January figures instead.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-07 09:59:36 -07:00
swaitsandDeepSeek V4.1 Flash 05c4b16385 test(core): golden file for date-range profit and loss
Add a golden for the P&L over [2026-01-01, 2026-01-31] on an extended copy
of the hand-verified January fixture: the original five entries, plus a
multi-leg equipment purchase, a January close, and a February entry. (The
original fixture has no closing entry and no entry after an as-of date, so
a copy was extended; the first five entries are unchanged.)

Hand recomputation (plan/golden-worksheets/profit-and-loss-period.md):
revenue account 4000 is credited 4,000 by the Jan 10 invoice; expense
account 6000 is debited 800 by the Jan 15 rent. The Jan 31 closing entry
(Dr revenue 4,000, Cr rent 800, Cr retained earnings 3,200) lies inside
the range but is excluded because a close moves earnings rather than
earning or spending, and the Feb 5 entry after the range is excluded too.
So revenue 4,000.00, expenses 800.00, net income 3,200.00 -- exactly the
3,200 the close moved. The golden pins those numbers.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-07 09:59:01 -07:00
swaitsandClaude Sonnet 5.5 545a502d3d test(core): golden file for the tax summary
Golden for the Form 1065 first-quarter fixture (tax.rs books()), Jan 1 to
Mar 31. Every number was recomputed by hand from the entries
(plan/golden-worksheets/tax_summary_form_1065.md) before the engine's output
was compared:

Income: sales 10,000.00; refunds 250.00 are an expense-type account in an
income category, so a contra: -250.00 (Form 1065 line 1b). Income 9,750.00.
Deductions, book / deductible: fees 1,500 / 1,500; guaranteed payments
2,000 / 2,000; meals 333.33 at 50% = 166.665 = 166.67 (cent, half away from
zero; Schedule C line 24b: "in most cases, the percentage is 50%"); software
600 / 600; penalties 40 at 0% = 0 (Schedule C Part V: no deduction for
fines). Totals 4,473.33 book, 4,266.67 deductible. Misc 75.00 has no
category and is listed apart, in no total (B-32).
Book net 9,750.00 - 4,473.33 = 5,276.67; tax net 9,750.00 - 4,266.67 =
5,483.33; the 206.66 difference is the disallowed meals half (166.66) plus
penalties (40.00).

Decimals compare by value (normalized), as the existing snapshot golden
writes them; no existing golden or assertion changed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 09:54:39 -07:00
swaitsandClaude Sonnet 5.5 5c7055123d test(core): golden file for the statement of changes in members' equity
Golden for the two-member 50/50 fixture (statements.rs partnership()),
January and February, with and without January's close. Every number was
recomputed by hand from the entries (plan/golden-worksheets/
members_equity_two_member.md) before the engine's output was compared:

January: NI 1000.00 - 333.33 = 666.67 = 66667 cents; half is 33333.5, so
largest remainder with the tie to Alice (listed first, B-13 CHOICE) gives
Alice 333.34, Bob 333.33. Alice 0 + 600 + 333.34 = 933.34; Bob 0 + 400 +
333.33 = 733.33; Total 1666.67 = balance-sheet equity.
February: undistributed earnings to date 666.67 + 100.01 = 766.68 split
cumulatively is 383.34 each, so Alice earns 383.34 - 333.34 = 50.00 and Bob
383.34 - 333.33 = 50.01 (sum 100.01). Alice 933.34 + 50.00 = 983.34; Bob
733.33 + 50.01 - 100.00 = 683.34; Total 1666.68 = equity (1000 + 766.68 -
100). Ending of January = beginning of February (B-13 3a). "Other" is 0 in
both. Same numbers whether or not January is closed (B-13 3c).

Decimals compare by value (normalized), as the existing snapshot golden
writes them; no existing golden or assertion changed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 09:53:59 -07:00
swaitsandClaude Opus 5.5 d075235559 fix(just): p12-night runs the 1099 party-totals property at its documented 2,000
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 earlier note said the property hard-codes 256 cases. It does not:
its proptest! block sets no config, so proptest's default reads
PROPTEST_CASES (proptest's contextualize_config), and docs/testing.md
was right all along. The props-max step now runs it at 2,000 like the
other documented maxima, and the wrong note is gone. (Worker branch
t3/party-totals-proptest-cases, 3f66b373, also added an explicit config
to a different proptest block; that part is redundant and is dropped.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 09:45:18 -07:00
swaitsandClaude Opus 5.5 771000a464 fix(just): p12-night refuses an empty mutation output name before its rm -rf
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-06 16:51:59 -07:00
swaitsandClaude Opus 5.5 f030157c87 merge: just p12-night, the resumable overnight run (P12 step 2, D-66; branch t3/placeholder, 78ef6006)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 16:51:59 -07:00
swaitsandClaude Opus 5.5 78ef6006d2 test(just): p12-night, the resumable overnight run (P12 step 2, D-66)
One detached command walks fuzzing, the proofs, the GnuCash oracle, the property maxima and the nine mutation recipes. Each step's status, timing, log and key result live under ${XDG_CACHE_HOME:-$HOME/.cache}/wanderbooks/p12; done markers make the next night resume, and P12_STOP stops the running process group at the deadline so the machine is free in the morning.

The property maxima are the env-controlled ones docs/testing.md names: STORE_CASES=5000, WB_ORDERS_DEPTH=6 (plan 8.2/STATUS), CF_CASES=5000, PROPTEST_CASES=5000 for spec_party_totals and 2000 for settings_replay_is_pure. The form1099 property's documented 2,000 has no env knob (it hard-codes 256) and is recorded as a gap rather than guessed at. Mutation runs do not use --iterate because the recipes as written do not pass it, so a cut-off crate restarts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 16:51:02 -07:00
swaitsandClaude Opus 5.5 9ed94347ae ci: the parity floor compares a push against the branch's tip before it
HEAD^1 is only the new tip's parent: a push of several commits could lower
the floor in an earlier one and pass. github.event.before is what main was
before the push; a new branch (all zeros) falls back to HEAD^1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 16:46:56 -07:00
swaitsandClaude Opus 5.5 38faba92de merge: the parity floor, machine-checked (branch t3/parity-floor-ci, faf38770)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 16:46:42 -07:00
swaitsandClaude Opus 5.5 faf3877012 docs: say what enforces the parity floor
AGENTS.md still promised CI enforcement "once the catalog is
machine-readable". It is now machine-readable: the test in
`crates/ledger-cli/tests/parity_floor.rs` checks the statuses and the
exact done-count inside `cargo test` (hence `just check`), and the CI step
`scripts/parity-floor.sh` checks the floor against the base commit and
refuses a drop between commits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 16:45:33 -07:00
swaitsandClaude Opus 5.5 6c6ffa9d46 ci: fail when the parity floor falls below the base commit
A test sees one tree; it cannot see that the floor used to be higher.
`scripts/parity-floor.sh <base-ref>` reads the floor from
`git show <base-ref>:docs/parity.md` and from the working tree and fails
if the working tree's number is lower, printing both. A base without a
floor line passes and says so, so older refs are not punished.

check.yml fetches one extra commit (fetch-depth: 2) and, on a PR, the
base branch; the step before `just check` compares against HEAD^1 on a
push and origin/<base> on a pull request. The Rust test still runs inside
`just check` as part of the workspace's tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 16:45:28 -07:00
swaitsandClaude Opus 5.5 76b64f99c2 test(parity): machine-check the catalog's statuses and floor
docs/parity.md was only review-checked. `parity_floor.rs` now parses every
table with a `Status` column and fails unless each status is exactly
`done`, `partial` or `todo`, and unless the count of `done` rows equals
the floor line exactly. Equal, not at least: adding a done row raises the
line in the same commit, so a later drop cannot pass unnoticed. The
parser's own cases (a bad status, an empty status, a missing floor line)
are unit-tested inline.

The catalog said 21 done but held 25. The floor line was stale, not the
rows: P4b S5 added one done row (invoice sent tracking) and S6 added three
(multi-document settlements, the processor's fee, bills due and aging),
all four named in the notes with their tests. Raising the line to 25
fixes the discrepancy without demoting anything; the history sentence is
kept and the reason is added to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 16:45:18 -07:00
swaitsandClaude Opus 5.5 6d5bab5cbf docs(plan): D-66, P12 step 2 as one resumable nightly command, fuzzing 1 hour a target
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 16:26:05 -07:00
swaitsandClaude Opus 5.5 320bf4d690 docs(plan): P11a's last steps and P12 step 1 landed; the Windows gate fix; what is left
The 2026-11-05 resume: the two checkpoints merged (758c175f, 3aa1206a),
the Windows server-only build fixed (a92eda21), all four gates green.
8.0.1 and P12's status line record it; STATUS gains the resume entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 16:21:54 -07:00
swaits a92eda210e fix(host): gate the update module's callers for non-unix builds
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 update module is `#[cfg(unix)]` (self-update replaces the running
program's file, which Windows forbids), but three commands in
`ledger-host` used `crate::update` unconditionally, so the server-only
Windows build could not resolve the module. GitHub's portable-windows
job failed on main 3aa1206a with nine E0433 errors in `ledger-host`.

Gate `update_waiting`, `check_for_updates` and `apply_update` with
`#[cfg(unix)]`, leaving their Unix bodies unchanged, and give non-unix
builds a stub of each: nothing is waiting, and checking for or accepting
an update is refused with "self-update isn't available on this platform"
(the same `Err` path a refused update takes). `UPDATE_WAIT` is gated with
the Unix `apply_update` it serves.
2026-11-05 10:17:50 -07:00
swaits 3aa1206afc merge: P12 step 1, the fuzz targets, the op-sequence extension and the mutation recipes (branch P12, 48062b89)
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
2026-11-05 08:49:36 -07:00
swaits 758c175ff2 merge: P11a, the in-app update accept, the update notice and translocation (branch P11a, 7b177451) 2026-11-05 08:49:36 -07:00
swaits 48062b89f0 test(fuzz): the operation sequence gains documents, settlements and drafts (P12)
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 sequence only knew accounts, lines, periods and closes, but that is no
longer where money moves: invoices, bills, their payments, write-offs and
voids are now first class, and the draft-state commands decide whether an
entry exists at all. Op gains each of them, on the same Ledger the store
wraps, with random parties, dates and amounts (including the raw-decimal
extremes).

The invariant after every sequence gains B-38: each control account equals
its documents as of three dates, and a control check too large to compute is
a refusal, never a difference. That is the identity that would catch a
payment tagged to the wrong document, or one that went unmatched, which the
trial balance alone cannot see.
2026-11-05 08:36:15 -07:00
swaits 7002e89efd test(fuzz): arbitrary bytes into the HTTP door and the upload path (P12)
P2 promised these two targets and never added them. `fuzz_http_mcp_request`
feeds a method, a path, headers (token present, absent, wrong, raw) and a
JSON-RPC body drawn from the real method and tool names into the in-process
router. Whatever arrives, the door answers: no token live for the book is
refused 4xx, never run (INVARIANT 8), and a live token never makes the door
fail (no 5xx on the MCP route). Whether a token is live is asked of the door
itself (`FuzzDoor::carries_a_token`), so a token smuggled in an extra header
is judged by the real rule rather than by the target's guess.

`fuzz_upload_put` declares a size and a hash and sends bytes: taken only
when both are exactly what was declared, from the token the grant names,
and only once (INVARIANT 9); a 200 for anything else is the bug.

Both join the weekly matrix in scheduled.yml; fuzz/Cargo.lock gains
ledger-mcp's dependency closure because the targets drive its router.
2026-11-05 08:36:15 -07:00
swaits 5e474cd1ac feat(mcp): the books door served in-process for fuzzing (P12)
The local socket and the tunnel already mount the same four routes; naming
that table `router` gives the fuzz targets the very door a client reaches,
not a copy of it. `local/fuzz_door` (behind the `fuzzing` feature, off in
every shipped build) builds a book, two live tokens and that router, and
answers one request through `tower::oneshot`: no socket, no port, no clock.

The target's oracle is then the code that enforces it: INVARIANT 8 (a book
only behind a live bearer token) is checked by asking `Books::bearer`, not
by a second model of the rule that could drift from it.
2026-11-05 08:36:15 -07:00
swaitsandClaude Fable 5.1 4b0196e416 docs(testing): P12 checklists, one per crate (P12 step 1)
The For P12 paragraphs, each left where its unit wrote it with a pointer,
consolidated into one mutation checklist per crate, each item keeping its
origin unit in brackets, so the run walks a crate at a time.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp
2026-11-05 08:36:15 -07:00