Commit Graph
1156 Commits
Author SHA1 Message Date
swaitsandDeepSeek V4.1 Flash 4d3444c0af fix(core): the gate walks a whole path and pins its skips
Three holes in the traceability gate let a name pass that should not:

- an imported uppercase type excused any associated item, so
  NaiveDate::NoSuchThing resolved. External types' items are now an
  explicit list of what the claims cite (NaiveDate::MAX only);
- only the last two segments of a qualified path were checked, so
  bogus::Ledger::post_entry and bogus::form1099::untagged_payments
  resolved. The whole path is walked: an optional crate name, then every
  module segment against the real module tree (file modules, inline mods,
  glob re-exports), then the item the module or type defines;
- a bare-name call counted in any module, so other::take( looked like
  take. Only kernel::name( or an imported name( counts now.

The right-law check was skippable by omission: a function with no rule or
no harness law was silently counted as skipped. Every ordinary function
must now be applied, and the skipped set is pinned to the excepted
wrappers that lack a law or a rule (SKIPPED), compared exactly.

source_ids reads only the spec block's source clause and is keyed by the
function's signature, so the free flip and Direction::flip no longer share
one id set and fx_booked stops picking BS-ledger-14 from prose.

The index also read root.rs badly: strip_code treated the backslash in a
raw Windows path (r"\\?\UNC\") as an escape and blanked the rest of
the file, so Root (and its adopt) were invisible. Raw strings are parsed
as raw strings now; Root::adopt resolves through its own impl, not through
the imported-type excuse that used to hide the bug.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 22:34:28 -07:00
swaitsandDeepSeek V4.1 Flash e98b9a63de docs(core): every kernel function cites its rule
Twenty-six kernel entry points had a harness, a bridge or a law, but no
SOURCE line of their own: their doc comments stopped at a sentence, so the
traceability gate could not check that the harness's law serves the rule
the function claims. Each now carries the house spec block, its source
clause naming the rule of the law its harness proves (take is law 10, so
BS-statement-3; flip is law 5, so BS-ledger-5).

Where a wrapper's law is its inner function's (round_places, round_minor,
fx_booked_minor), the source clause says so; part_weight and catch_up had
their rule id on a continuation line, so the SOURCE line now names it.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 22:33:25 -07:00
swaitsandClaude Opus 5.5 e435df0e81 merge: custom terms are due on the date they give; the adapter runs payments, the aging and due dates (X-H1a's wanderbooks half; reviewed twice)
The bookspec examples for A/R and A/P reading run through the real
Ledger: payments, the aging as of a day, a document's due and discount
dates. Writing them exposed an engine bug: custom terms ("Due
2026-11-15") came back due on the document's own date through the MCP
tools, so an invoice read past due two weeks early. Terms now keep the
agreed date and due_date returns it (BS-arap-3). The journal records each
document's due date and replay reads it, so books already written keep
what they recorded; the live books hold no invoices or bills. Five
examples are for options wanderbooks did not pick and are skipped,
pinned at five.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 22:10:01 -07:00
swaitsandClaude Sonnet 5.5 08733c6fa2 test(core): five examples are for options wanderbooks did not pick
The bookspec adapter's test pinned the examples for an unpicked option at
three (the other option of BS-arap-7, -8 and -9). The bookspec fixes give
BS-prepaid-2's equal-months and BS-ledger-20's refuse each an example of
their own, so no option-example allow-list grows; wanderbooks picks daily and
warn-by-default, so it skips both, and the count is five. The runner and the
loader tests still agree on exactly which.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 21:56:37 -07:00
swaitsandDeepSeek V4.1 Flash 36d1954e59 docs(proofs): the harness-to-law table format
The gate reads every proof note for a machine-readable table pairing a
harness with its bookspec law, but the format was undocumented. State it:
the first cell is the harness name in backticks, the second a bare integer,
extra columns allowed; name the three failures it drives (a kernel
function with no row, one harness with two different laws, a law sharing
no `BS-` id with the function's `SOURCE:` line).

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 21:54:24 -07:00
swaitsandDeepSeek V4.1 Flash 10fdab668d fix(core): the gate resolves names strictly
Three resolver weaknesses let a wrong name pass as backed, which is
exactly what the gate exists to catch:

- Kani harnesses resolved as Rust items: every `fn` under
  `src/proofs/` was in the item set, so 79 of ~82 harness citations
  never reached the harness class. Proof functions are excluded from
  items and harnesses are checked before items, so deleting a
  `#[kani::proof]` attribute now leaves the claim unbacked.
- A kernel function was "called" by a word mention or any `.name(`.
  A call is now a bare `name(` that is not a method call, or
  `Type::name(` for a kernel type's method. The two proof and bridge
  call sites that only used method syntax are written as the qualified
  call they mean.
- A `Type::item` token matched if its last segment existed anywhere,
  and every `fn` under `tests/` counted as a test. `Type::item` must
  now be an impl function, a variant, a field or an associated const of
  that type; `module::item` must be defined in that module's file; and
  only `#[test]`/`#[tokio::test]`/`proptest!` functions are tests.
- Product surfaces are the exact tool registrations (or exact declared
  names); the dotted-string fallback is gone; crate names come from
  `[package] name`, not directory names.
- `Audit.lean` is parsed once and matched exactly, with or without the
  `Bookspec.` prefix.

The law-table check is stricter too: duplicate rows with different law
numbers fail, and where a kernel function's `SOURCE:` line and its
harness's law row both cite rule ids, they must intersect. Of the 55
kernel functions, 29 have both and are checked; 26 are skipped (no
`SOURCE:` ids or a law with no rules).

Self-tests cover a harness name, a proof helper that is not a harness, a
made-up method, a real item under the wrong type, a test helper, an
unregistered `books.` name, a directory as a crate, and an unaudited
Lean name.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 21:54:19 -07:00
swaitsandDeepSeek V4.1 Flash 080a3ffbf5 test(core): Kani for Direction::of and part_weight
Both were exceptions for lacking all three backing kinds; neither is a
wrapper or an enum map. `Direction::of` is the sign classification the
party direction law is stated over (law 23), and `part_weight` is the
weight the proration charges are computed from (laws 26-28).

- `direction_of_is_the_sign` explores any `i64` and covers paid,
  received and neither (`kani::cover!`).
- `part_weight_is_days_of_the_month` explores `days` and `month_days`
  up to 40 and covers a partial month, a whole month and an invalid
  part.
- each spec block now carries its `SOURCE:` line, so the gate's
  right-law check applies to them.
- `docs/proofs/entries.md` records each harness's law in the
  machine-readable table; the exception list drops from 16 to 14
  (`Direction::key` and `MonthPart::is_valid` stay, with their reasons).

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 21:54:10 -07:00
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
swaitsandClaude Sonnet 5.5 e6c0d0d51b test(core): the adapter reads due dates from the engine
The bookspec adapter took a custom terms' due date by parsing the example's
terms text, which sidestepped the engine bug that custom terms were due on
the document's own date, so no example could catch it. It now takes every
due date, custom included, from Terms::due_date; an example on "Due
2026-11-15" passes only if the engine computes 2026-11-15 (BS-arap-3).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 21:25:16 -07:00
swaitsandClaude Sonnet 5.5 71a4e7e59d fix(core): custom terms are due on the date they give
BS-arap-3 statement 1: custom terms ("Due 2026-11-15") are due on the date
they give. Terms::due_date returned the document's own date for them, so
the MCP path (create_invoice / create_bill, from the terms given or a
party's default) stored an invoice dated 2026-11-01 on "Due 2026-11-15" as
due 2026-11-01: a document that read past due two weeks early in the aging.

Terms now keeps the agreed date (a new `agreed` field, Some exactly for
custom terms, with Terms::agreed_date), and due_date returns it, refusing
an agreed date before the document's like any due date before its document.
TermsKind keeps its shape, so stored kinds read as before. Terms read back
from storage fill `agreed` from their canonical text when it is missing, and
a custom terms with no readable date is refused rather than invented.

Stored books: the journal records each document's due_date itself
(invoice.created / bill.created payloads) and replay reads it, never
recomputing it from the terms, so a document already written keeps the due
date it recorded (posted is forever). New journal entries with custom terms
carry the extra "agreed" key; older ones read as before. No golden under
crates/*/tests/golden holds custom terms, so none changes; the live books
have no invoices or bills.

Through the tool, an invoice dated 2026-11-01 on "Due 2026-11-15": due
2026-11-01 before, 2026-11-15 after. Tests: ledger-core
custom_terms_are_due_on_the_date_they_give (Terms, the stored document, the
storage round trip incl. the older form, and the refusals) and the same
through books.create_invoice / create_bill / a party's default terms and the
refusal of a document dated after the agreed day (ledger-cli documents.rs).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 21:25:16 -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 Sonnet 5.5 23e52de969 test(core): the adapter runs payments, aging and due dates
The bookspec adapter learns the three things X-H1a's examples ask: a
`payment` event (Store::receive_payment for an invoice, pay_bill for a bill,
a payment dated before its document refused as `payment_before_document`
from LedgerError::PaymentBeforeDocument, BS-arap-9); `terms` on a bill or
invoice (the document is created with the engine's own Terms, its due date
from Terms::due_date, and the engine must print the example's spelling back
as written, BS-arap-3); and the `aging` and `document_dates` queries, read
from Ledger::{ar_aging, ap_aging} and the stored document's due date and
Terms::discount_by. Nothing of aging or terms is recomputed in the test.

An example for an option wanderbooks did not pick (`under`, checked against
PICKS) is read and not run, in the loader tests as in the runner, which
reports it skipped; the 71 others pass: wanderbooks agrees with every example
for the options it picks (BS-arap-7 due-today-is-current, BS-arap-8
as-of-the-day, BS-arap-9 refuse-a-payment-before-its-document). Run against
bookspec branch x-h1a by patching the dependency; the pin does not move
here. Claims for B-18 and B-39 name the new examples.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 20:47:46 -07:00
swaitsandClaude Opus 5.5 71df823080 docs(plan): X-H1 in five slices, one after another
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
Every slice adds to the same four files (the schema, its derivation, the
Lean runner and the adapter), so they cannot run in parallel; split by
what the schema must learn, A/R and A/P reading first (the most rules
for one new event and two queries).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:15:30 -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