From 422a956ffc1f7bf482a52a82c8fabd0258de2dc6 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sun, 8 Nov 2026 13:46:41 -0700 Subject: [PATCH 01/10] docs(spec): wanderbooks declares its picks for the new CHOICE records (partner, asset, 1099, format) bookspec split the CHOICEs embedded in BS-partner-1..4, BS-asset-1, BS-asset-4, BS-1099-1 and BS-format-2 into records of their own (S-C7b). Wanderbooks' decisions are unchanged; each is now recorded against the id an engine declares it by: - partner: BS-partner-5 largest-remainder-first-listed (owner, 2026-10-13), -6 cumulative-from-first-close (D-10, 2026-10-16), -7 running-split (D-38, 2026-10-20), -8 outside-the-books and -9 tin-facts-then-w9 (2026-10-15), -10..-13 money, entry flow, books' carrying amount, labelled basis (2026-10-15, 2026-10-20), -14 tax-basis-beside-book (D-41), -15 running-cumulative (D-38's rule, 2026-10-22) - asset: BS-asset-5 straight-line-by-days, -6 lesser-of-value-and-basis, -7 books-recorded-amounts, -8 register-carries-tax-figures - 1099: BS-1099-2 refuse-an-unknown-year, -3 presumed-a-check-ach-or-transfer, -4 dated-by-the-payments-date - format: BS-format-3..7 (D-36, 2026-10-20) Each is a `**Pick (BS-..):**` line in docs/spec/claims/.md and a `with_choice` in the adapter's claims(). The rules_md test no longer expects a B-n row for a rule born without one (a split-out CHOICE has none): it requires the pick line, that the pick is one of the record's options, and that the adapter declares the same option. The pin is not moved here: this needs bookspec's s-c7b to be merged and the pin moved to it. Verified with ledger-core's bookspec test patched to the s-c7b checker and runner (53 passed). Co-Authored-By: Claude Sonnet 5.5 --- crates/ledger-core/tests/bookspec/engine.rs | 37 ++++++++++++++++++- crates/ledger-core/tests/bookspec/rules_md.rs | 26 +++++++++++++ docs/spec/claims/1099.md | 6 +++ docs/spec/claims/asset.md | 8 ++++ docs/spec/claims/format.md | 10 +++++ docs/spec/claims/partner.md | 22 +++++++++++ 6 files changed, 107 insertions(+), 2 deletions(-) diff --git a/crates/ledger-core/tests/bookspec/engine.rs b/crates/ledger-core/tests/bookspec/engine.rs index d83d769f..30503056 100644 --- a/crates/ledger-core/tests/bookspec/engine.rs +++ b/crates/ledger-core/tests/bookspec/engine.rs @@ -29,10 +29,43 @@ impl Engine for Books<'_> { } fn claims(&self) -> Claims { - Claims::new( + let mut claims = Claims::new( bookspec_checker::covered_rules() .into_iter() .map(|r| r.id.clone()), - ) + ); + for &(area, n, option) in PICKS_S_C7B { + claims = claims.with_choice(RuleId::new(area, n), option); + } + claims } } + +/// The option wanderbooks picks for each CHOICE record split out of the +/// partner, asset, 1099 and format rules (P14 unit S-C7b); each is recorded +/// in `docs/spec/claims/.md` as `**Pick (BS--):**`. +pub(crate) const PICKS_S_C7B: &[(Area, u32, &str)] = &[ + (Area::Partner, 5, "largest-remainder-first-listed"), + (Area::Partner, 6, "cumulative-from-first-close"), + (Area::Partner, 7, "running-split"), + (Area::Partner, 8, "outside-the-books"), + (Area::Partner, 9, "tin-facts-then-w9"), + (Area::Partner, 10, "cash-cards-and-financing"), + (Area::Partner, 11, "capital-movement-counted-once"), + (Area::Partner, 12, "books-carrying-amount"), + (Area::Partner, 13, "labelled-cash-default-or-all"), + (Area::Partner, 14, "tax-basis-beside-book"), + (Area::Partner, 15, "running-cumulative"), + (Area::Asset, 5, "straight-line-by-days"), + (Area::Asset, 6, "lesser-of-value-and-basis"), + (Area::Asset, 7, "books-recorded-amounts"), + (Area::Asset, 8, "register-carries-tax-figures"), + (Area::Tax1099, 2, "refuse-an-unknown-year"), + (Area::Tax1099, 3, "presumed-a-check-ach-or-transfer"), + (Area::Tax1099, 4, "dated-by-the-payments-date"), + (Area::Format, 3, "plain-ascii-transliterated-and-listed"), + (Area::Format, 4, "cr-lf"), + (Area::Format, 5, "docnum-is-the-entry-id"), + (Area::Format, 6, "everything-through-as-of"), + (Area::Format, 7, "journal-sample-columns"), +]; diff --git a/crates/ledger-core/tests/bookspec/rules_md.rs b/crates/ledger-core/tests/bookspec/rules_md.rs index 91daa5e3..c6f9b142 100644 --- a/crates/ledger-core/tests/bookspec/rules_md.rs +++ b/crates/ledger-core/tests/bookspec/rules_md.rs @@ -25,6 +25,32 @@ pub(crate) fn rules_md_carries_every_id() { } for rule in bookspec_checker::rules().iter() { + if rule.b == 0 { + // A rule born after the B numbering has no row in the index. + // A CHOICE record split out of another rule (P14 unit S-C7) + // has its pick recorded in its claims file, and the engine's + // adapter declares the same option, which the record names. + if rule.status == Some(bookspec_checker::Status::Choice) { + let marker = format!("**Pick ({}):** `", rule.id); + let at = all + .find(&marker) + .unwrap_or_else(|| panic!("{} carries its pick in its claims file", rule.id)); + let option = all[at + marker.len()..].split('`').next().unwrap(); + assert!( + rule.record().options.iter().any(|o| o.name == option), + "{}'s pick {option:?} is one of its options", + rule.id + ); + assert!( + engine::PICKS_S_C7B + .iter() + .any(|&(area, n, o)| RuleId::new(area, n) == rule.id && o == option), + "{}'s pick {option:?} is declared in the adapter's claims()", + rule.id + ); + } + continue; + } assert!( index.contains(&format!("| B-{} | `{}` |", rule.b, rule.id)), "rules.md indexes B-{} to {}", diff --git a/docs/spec/claims/1099.md b/docs/spec/claims/1099.md index 2442d792..c7ef5f0d 100644 --- a/docs/spec/claims/1099.md +++ b/docs/spec/claims/1099.md @@ -14,6 +14,12 @@ Rules: B-19. **Pick:** `refuse-an-unknown-year` and the D-40 options: a threshold the engine does not know is refused, never guessed (CHOICE, the owner, 2026-10-13); a payment from a cash account with no recorded method is presumed a check, ACH or transfer and counts (CHOICE D-40, the owner, 2026-10-20); a shared entry counts only the payee's share (CHOICE, the owner, 2026-10-15); decisions are dated, and each payment takes the decision in force on its reversal chain's first entry's date (CHOICE D-40, the owner, 2026-10-20: "legally this has to be 2 dated statuses"). +**Pick (BS-1099-2):** `refuse-an-unknown-year`, the owner, 2026-10-13. + +**Pick (BS-1099-3):** `presumed-a-check-ach-or-transfer`, the owner, D-40, 2026-10-20. + +**Pick (BS-1099-4):** `dated-by-the-payments-date`, the owner, D-40, 2026-10-20. + **Enforced:** the bucket table is `kernel::payment_bucket` and `kernel::net_buckets`; `kernel::apportion` splits a payee's part across the buckets; `form1099::vendor_1099_report` applies the threshold and the diff --git a/docs/spec/claims/asset.md b/docs/spec/claims/asset.md index e7f242c8..27be8981 100644 --- a/docs/spec/claims/asset.md +++ b/docs/spec/claims/asset.md @@ -14,6 +14,8 @@ Rules: B-15, B-22, B-24, B-25. **Pick:** `straight-line-by-days`: CHOICE (the owner, 2026-10-13; the engineer settled the arithmetic from ASC 360-10-35-4, 2026-10-20): straight line, partial months prorated by days, including a schedule through a mid-month date, with each cumulative figure rounded half away from zero to the currency's minor unit. The tax conventions (half-year, mid-month, mid-quarter) are not applied: they are the CPA's, per IRS Publication 946. +**Pick (BS-asset-5):** `straight-line-by-days`, the owner, 2026-10-13; the engineer settled the arithmetic from ASC 360-10-35-4, 2026-10-20. + **Enforced:** `assets::depreciation_schedule`, `assets::run_amount`, `assets::catch_up_room`, `assets::depreciation_effects`, `kernel::prorated_through`, `kernel::catch_up`, `kernel::true_up`, @@ -147,6 +149,12 @@ printer makes an Avery 5160 label sheet from the register's tags. **Pick:** `register-carries-tax-figures` and the D-41 options: the register carries the tax figures beside book value (CHOICE, the owner, 2026-10-15); for property a member contributed from personal use, the depreciable basis is the lesser of its fair market value and the member's adjusted basis (the MAY of `BS-asset-4`, taken by analogy to Treas. Reg. §1.168(i)-4(b)(1), which governs a taxpayer converting its own property; the choice is wanderbooks', the CPA to confirm at year end); the §704(c) method is `traditional`, recorded as a choice the CPA confirms; the contributed property's values on the contribution date are the books' recorded amounts (CHOICE D-41, the owner, 2026-10-20). +**Pick (BS-asset-6):** `lesser-of-value-and-basis`, the owner, D-41, 2026-10-20. + +**Pick (BS-asset-7):** `books-recorded-amounts`, the owner, D-41, 2026-10-20. + +**Pick (BS-asset-8):** `register-carries-tax-figures`, the owner, 2026-10-15; D-41, 2026-10-20. + **Enforced:** `kernel::basis_figures` (Kani `basis_figures_laws`), `AssetBasis::check` (a purchase takes no contribution facts; a contribution needs the adjusted basis and the fair market value, each diff --git a/docs/spec/claims/format.md b/docs/spec/claims/format.md index 04f99712..70304bc2 100644 --- a/docs/spec/claims/format.md +++ b/docs/spec/claims/format.md @@ -239,6 +239,16 @@ unless another class's own name is the same ignoring case (the P4 follow-ups' review, finding 4, 2026-10-22: before, all the classes whose names matched were renamed). +**Pick (BS-format-3):** `plain-ascii-transliterated-and-listed`, the owner, 2026-10-20, D-36. + +**Pick (BS-format-4):** `cr-lf`, the owner, 2026-10-20, D-36. + +**Pick (BS-format-5):** `docnum-is-the-entry-id`, the owner, 2026-10-20, D-36. + +**Pick (BS-format-6):** `everything-through-as-of`, the owner, 2026-10-20, D-36. + +**Pick (BS-format-7):** `journal-sample-columns`, the owner, 2026-10-20, D-36 (CHOICE). + **Pick:** `no-customer-or-vendor-name`: CHOICE (open risk). The IIF writes no NAME on a line to accounts receivable or payable, though Intuit's staff say such a line requires one: no Intuit source says what an IIF journal import diff --git a/docs/spec/claims/partner.md b/docs/spec/claims/partner.md index 36b90a81..64ff140c 100644 --- a/docs/spec/claims/partner.md +++ b/docs/spec/claims/partner.md @@ -14,6 +14,12 @@ Rules: B-13, B-26, B-35, B-36. **Pick:** a share is rounded to the base currency's minor unit by largest remainder, a tied odd unit to the member the count's first close listed first (the owner, 2026-10-13; closes made before then replay with the last member absorbing it); members closes are counted cumulatively from the company's first close (D-10, 2026-10-16); the statement of members' equity splits unclosed earnings the same running way (D-38, 2026-10-20); a prepaid service contract credited straight to capital is contributed property, while a prepaid service a member paid a vendor for on the company's behalf, booked through Due to Shareholders, is cash (the owner, 2026-10-15); a period closes at the shares in force at the close. +**Pick (BS-partner-5):** `largest-remainder-first-listed`, the owner, 2026-10-13. + +**Pick (BS-partner-6):** `cumulative-from-first-close`, the owner, D-10, 2026-10-16. + +**Pick (BS-partner-7):** `running-split`, the owner, D-38, 2026-10-20. + **Enforced:** `CloseTo::Members`, `CloseTo::MembersCumulative`, `Ledger::members_regime`, `Regime::allocate`, `periods::allocate_cumulative`, `kernel::apportion_cumulative`, @@ -99,6 +105,10 @@ journal (the owner, 2026-10-15); any party may have its TIN in the vault, whatever its roles (the owner, 2026-10-15); a party's last four is its TIN facts', else its W-9 facts'. +**Pick (BS-partner-8):** `outside-the-books`, the owner, 2026-10-15. + +**Pick (BS-partner-9):** `tin-facts-then-w9`, the owner, 2026-10-15. + **Enforced:** `crate::parties` (has_full_tin, check_text, W9Facts::check, W4Facts::check), `Ledger::add_party`, `update_party`, `set_party_role`, `set_party_w9`, `set_party_w4`, `set_party_tin` (TinFacts::check; TIN and @@ -292,6 +302,14 @@ owner, 2026-10-20); property distributed counts at the books' carrying amount; party totals take basis cash by default, or all, always labelled. +**Pick (BS-partner-10):** `cash-cards-and-financing`, the owner, 2026-10-20. + +**Pick (BS-partner-11):** `capital-movement-counted-once`, the owner, 2026-10-15 and 2026-10-20. + +**Pick (BS-partner-12):** `books-carrying-amount`, the owner, 2026-10-20. + +**Pick (BS-partner-13):** `labelled-cash-default-or-all`, the owner, 2026-10-20. + **Enforced:** `kernel::party_target`, `kernel::reverse_target`, `shares::{target, split, resolve}`, `parties::{flow, money_accounts, card_accounts, MoneyAccounts::for_parties, activity_with, Activity::totals, @@ -376,6 +394,10 @@ contributed to a prepaid account with no fixed asset for it enters at its book amount, with a note (P3 review, 2026-10-21; the CPA to confirm). +**Pick (BS-partner-14):** `tax-basis-beside-book`, the owner, D-41, 2026-10-20. + +**Pick (BS-partner-15):** `running-cumulative`, the owner, D-38's rule applied 2026-10-22. + **Enforced:** `ledger_core::tax_capital::tax_basis_capital`; `ledger-package` `k1_tax` (`k1-tax-basis-capital.csv` in the CPA package); the odd cents, `ledger_core::tax_capital::RunningSplit` on From cb5578785290907e8eae0e7163affbf3beb64aff Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sun, 8 Nov 2026 13:49:15 -0700 Subject: [PATCH 02/10] docs(spec): wanderbooks declares its picks for the new CHOICE records (entry, ledger, period, statement, prepaid) Bookspect S-C7 split the CHOICEs embedded in these areas' AUTHORITY and CONVENTION rules into their own records, so an engine declares its pick by rule id. Each parent B-n section in docs/spec/claims/.md now carries a **Pick (BS--):** line naming wanderbooks' option with who decided it and when (the parents' **bookspec:** lines stand), and the bookspec adapter's claims() declares the same twenty picks with Claims::with_choice. The rules_md test now reads a born-after-B-n rule (b = 0 in the catalogue) by its **Pick (BS-...):** line instead of a B-n index row it cannot have. No engine behaviour changes: every pick is the decision the claims already recorded in prose (for example check-when-line-added, D-73's on-or-after-the-original, D-67's round-once-on-the-total, D-72's minor-unit-for-new-schedules). Verified against the s-c7a bookspec branch with the documented patch override (not committed): cargo test -p ledger-core --test bookspec, 53 passed. Co-Authored-By: Muse Wonder 1.0 --- crates/ledger-core/tests/bookspec/engine.rs | 37 +++++++++++++++++++ crates/ledger-core/tests/bookspec/rules_md.rs | 11 ++++++ docs/spec/claims/entry.md | 8 ++++ docs/spec/claims/ledger.md | 16 ++++++++ docs/spec/claims/period.md | 4 ++ docs/spec/claims/prepaid.md | 6 +++ docs/spec/claims/statement.md | 8 ++++ 7 files changed, 90 insertions(+) diff --git a/crates/ledger-core/tests/bookspec/engine.rs b/crates/ledger-core/tests/bookspec/engine.rs index d83d769f..4daa9247 100644 --- a/crates/ledger-core/tests/bookspec/engine.rs +++ b/crates/ledger-core/tests/bookspec/engine.rs @@ -29,10 +29,47 @@ impl Engine for Books<'_> { } fn claims(&self) -> Claims { + // The picks for the CHOICE records split out of embedded choices + // (P14 unit S-C7a: entry, ledger, period, statement, prepaid). Claims::new( bookspec_checker::covered_rules() .into_iter() .map(|r| r.id.clone()), ) + .with_choice(RuleId::new(Area::Entry, 6), "check-when-line-added") + .with_choice(RuleId::new(Area::Entry, 7), "refuse-rather-than-crash") + .with_choice( + RuleId::new(Area::Entry, 8), + "bounds-bind-commands-never-replay", + ) + .with_choice(RuleId::new(Area::Ledger, 14), "book-in-the-smallest-unit") + .with_choice(RuleId::new(Area::Ledger, 15), "child-has-its-parents-type") + .with_choice(RuleId::new(Area::Ledger, 16), "on-or-after-the-original") + .with_choice( + RuleId::new(Area::Ledger, 17), + "reversal-evidence-is-originals", + ) + .with_choice( + RuleId::new(Area::Ledger, 18), + "assignment-is-a-fact-in-the-books", + ) + .with_choice(RuleId::new(Area::Ledger, 19), "refuse-rather-than-renumber") + .with_choice(RuleId::new(Area::Ledger, 20), "warn-by-default") + .with_choice(RuleId::new(Area::Ledger, 21), "round-once-on-the-total") + .with_choice(RuleId::new(Area::Period, 4), "nest-never-partially-overlap") + .with_choice( + RuleId::new(Area::Period, 5), + "fiscal-year-to-date-by-default", + ) + .with_choice(RuleId::new(Area::Statement, 6), "direct") + .with_choice(RuleId::new(Area::Statement, 7), "constructive") + .with_choice(RuleId::new(Area::Statement, 8), "year-through-as-of") + .with_choice(RuleId::new(Area::Statement, 9), "one-project-per-line") + .with_choice(RuleId::new(Area::Prepaid, 2), "daily") + .with_choice(RuleId::new(Area::Prepaid, 3), "start-on-the-first") + .with_choice( + RuleId::new(Area::Prepaid, 4), + "minor-unit-for-new-schedules", + ) } } diff --git a/crates/ledger-core/tests/bookspec/rules_md.rs b/crates/ledger-core/tests/bookspec/rules_md.rs index 91daa5e3..99baedb0 100644 --- a/crates/ledger-core/tests/bookspec/rules_md.rs +++ b/crates/ledger-core/tests/bookspec/rules_md.rs @@ -25,6 +25,17 @@ pub(crate) fn rules_md_carries_every_id() { } for rule in bookspec_checker::rules().iter() { + if rule.b == 0 { + // Born after the B-n numbering ended (P14 unit S-C7): no index + // row and no B-n section; its pick is recorded in the claims + // file of its parent. + assert!( + all.contains(&format!("**Pick ({}):**", rule.id)), + "{} carries its pick in its claims file", + rule.id + ); + continue; + } assert!( index.contains(&format!("| B-{} | `{}` |", rule.b, rule.id)), "rules.md indexes B-{} to {}", diff --git a/docs/spec/claims/entry.md b/docs/spec/claims/entry.md index fde6a60f..54c41888 100644 --- a/docs/spec/claims/entry.md +++ b/docs/spec/claims/entry.md @@ -10,6 +10,8 @@ Rules: B-1, B-2, B-21, B-28, B-43. **bookspec:** `BS-entry-1` +**Pick (BS-entry-6):** check-when-line-added, the owner, 2026-10-13 + **Claims:** yes **Pick:** a line's account must exist and take postings when the line is added to a draft, not only when the entry posts: CHOICE (the owner, 2026-10-13). @@ -60,6 +62,10 @@ None. **bookspec:** `BS-entry-4` +**Pick (BS-entry-7):** refuse-rather-than-crash, the owner, 2026-10-16 + +**Pick (BS-entry-8):** bounds-bind-commands-never-replay, the owner, 2026-10-17 + **Claims:** yes **Pick:** the bounds are bookspec's (dates 0001-01-01 through 9999-12-31, an amount at most `kernel::MAX_LINE_AMOUNT` = 1,000,000,000,000,000, scale at most `MAX_LINE_SCALE` = 10), and one run of the recurring entries creates at most 1,000 drafts (`MAX_RECURRING_RUN`). Provenance: CHOICE (P0 review round 3, 2026-10-16, finding S1: the @@ -178,6 +184,8 @@ pinned; every tool over every old book). **bookspec:** `BS-entry-5` +**Pick (BS-ledger-17):** reversal-evidence-is-originals, D-47, the owner, 2026-10-26 + **Claims:** partly (bookspec's record states the evidence gate's principle, the draft state as a note and the discard; the gate's function, the policy settings, the states' names and the surfaces are wanderbooks product, below) **Pick:** reversals stay posted and need no evidence of their own, their evidence being their original's: CHOICE D-47 (owner-adopted recommendation, 2026-10-26; stated in `BS-ledger-7`'s status note, and in B-20's claims). A draft's state as a note that moves no figure, and discarding a draft rather than posting and reversing it, are the CONVENTIONs of the record. diff --git a/docs/spec/claims/ledger.md b/docs/spec/claims/ledger.md index b1d30aed..dc41b90f 100644 --- a/docs/spec/claims/ledger.md +++ b/docs/spec/claims/ledger.md @@ -10,6 +10,8 @@ Rules: B-3, B-4, B-5, B-8, B-9, B-10, B-20, B-23, B-29, B-31, B-32, B-44, B-45. **bookspec:** `BS-ledger-1` +**Pick (BS-ledger-14):** book-in-the-smallest-unit, the owner, 2026-10-13 + **Claims:** yes **Pick:** a foreign line is booked in the base currency's smallest unit (ISO 4217 minor units, `sources/iso-4217.md`), half away from zero: CHOICE (the owner, 2026-10-13), after the GnuCash cross-check found wanderbooks kept $108.34567 where GnuCash booked $108.35. Lines booked before then replay as booked (WB-entry-1). @@ -38,6 +40,8 @@ None. **bookspec:** `BS-ledger-2` +**Pick (BS-ledger-15):** child-has-its-parents-type, the owner, 2026-10-13 + **Claims:** yes **Pick:** a child account has its parent's type: CHOICE (the owner, 2026-10-13). @@ -92,6 +96,8 @@ and never called corrupt (statement 4). **Checked:** Lean `Step.extends`, **bookspec:** `BS-ledger-5` +**Pick (BS-ledger-16):** on-or-after-the-original, the owner, 2026-11-08, wanderbooks D-73 + **Claims:** yes **Pick:** none (AUTHORITY). @@ -123,6 +129,8 @@ None. **bookspec:** `BS-ledger-7` +**Pick (BS-ledger-17):** reversal-evidence-is-originals, D-47, the owner, 2026-10-26 + **Claims:** partly (the engine does not enforce it; the receipt policy of the tool layer does) **Pick:** a reversal's evidence is its original's (a reversal needs no evidence of its own): CHOICE D-47 (the owner, 2026-10-26; options: a reversal's evidence is its original's / a reversal needs its own). The rest is AUTHORITY; a procedural rule. @@ -137,6 +145,10 @@ None. **bookspec:** `BS-ledger-8` +**Pick (BS-ledger-18):** assignment-is-a-fact-in-the-books, the owner, 2026-10-15 + +**Pick (BS-ledger-19):** refuse-rather-than-renumber, the owner, 2026-10-13 + **Claims:** yes **Pick:** the assignment of a role to an account is journaled, so replay never depends on a setting outside the journal: CHOICE (the owner, 2026-10-15); the engine refuses a role account that is not postable or of the role's type rather than renumber the chart: CHOICE (the owner, 2026-10-13). Receivables and payables are different (B-38, 2026-10-23): their documents read their figures from their lines. @@ -245,6 +257,10 @@ bookspec `examples/rename-changes-no-amount.toml`. **bookspec:** `BS-ledger-11` +**Pick (BS-ledger-20):** warn-by-default, the owner, 2026-10-20 + +**Pick (BS-ledger-21):** round-once-on-the-total, the owner, 2026-11-07, D-67 + **Claims:** yes **Pick:** warn versus refuse: CHOICE (Pub. 583: "the law does not require any specific kind of records"; the owner, 2026-10-20: warn by default, header accounts exempt, the first company set to refuse at the P3 cutover). A category's deductible amount rounds once, on the category total: CHOICE (the owner, 2026-11-07, D-67). The arithmetic is `kernel::deductible_amount`, so Kani proves the one rounding and the bridge carries it to `Decimal`. diff --git a/docs/spec/claims/period.md b/docs/spec/claims/period.md index 682e81f4..b862c884 100644 --- a/docs/spec/claims/period.md +++ b/docs/spec/claims/period.md @@ -25,6 +25,8 @@ decision, D-73, 2026-11-08). **Checked:** Kani **bookspec:** `BS-period-2` +**Pick (BS-period-4):** nest-never-partially-overlap, the owner, 2026-10-13 + **Claims:** yes **Pick:** periods nest and never partially overlap (the owner, 2026-10-13). @@ -51,6 +53,8 @@ untouched. **bookspec:** `BS-period-3` +**Pick (BS-period-5):** fiscal-year-to-date-by-default, the owner, 2026-10-20 + **Claims:** partly (the bookspec record states the one default rule; the surfaces it binds are wanderbooks product, below) **Pick:** a report asked for without dates covers this fiscal year so far, everywhere (the owner, 2026-10-20, `plan/served.md` P3 "Settled in design": "a report asked for without dates covers this fiscal year so far, everywhere, and an account's register opens on it with 'Show all dates' one click away"). diff --git a/docs/spec/claims/prepaid.md b/docs/spec/claims/prepaid.md index 36c8f83c..5b0cdd09 100644 --- a/docs/spec/claims/prepaid.md +++ b/docs/spec/claims/prepaid.md @@ -10,6 +10,12 @@ Rules: B-16. **bookspec:** `BS-prepaid-1` +**Pick (BS-prepaid-2):** daily, the owner, 2026-10-20, D-11 and D-37 + +**Pick (BS-prepaid-3):** start-on-the-first, the owner, 2026-10-20, D-37 + +**Pick (BS-prepaid-4):** minor-unit-for-new-schedules, the owner, 2026-11-08, D-72 + **Claims:** yes **Pick:** new schedules spread by the day (`daily`), the owner, D-11 confirmed in D-37, 2026-10-20; an equal-months schedule starts on the 1st of a month for prepaid expenses and deferred revenue alike (the owner, D-37, 2026-10-20); new monthly-even schedules round to the currency's minor unit (the owner, D-72, 2026-11-08). diff --git a/docs/spec/claims/statement.md b/docs/spec/claims/statement.md index f3ffaa28..73ed65ac 100644 --- a/docs/spec/claims/statement.md +++ b/docs/spec/claims/statement.md @@ -30,6 +30,10 @@ Lean `trial_balance_iff`, `Reachable.trial_balance`, **bookspec:** `BS-statement-3` +**Pick (BS-statement-6):** direct, the owner, 2026-10-20 + +**Pick (BS-statement-7):** constructive, the owner, 2026-10-20, D-42 + **Claims:** partly (bookspec's record states rules 1-12; the picks and the product surface are below) **Pick:** the direct method; an entry's cash allocated to its sections in the order operating, investing, financing (CONVENTION, the ASC silent, disclosed); within a section, the cash split among its kinds in the order the rest of the section's kinds, interest received, interest paid (CONVENTION, as the engine splits it); what a member or a lender pays or receives for the company presented as constructive cash, borrowed (or contributed) and spent (the owner, D-42, 2026-10-20, revising D-35's first point); a payment shared between a government and others split by their resolved shares, the government's part rounded half to even to the base currency's places and the rest exact (CONVENTION); payroll entries keep their (d) class whoever they name (CONVENTION). @@ -152,6 +156,8 @@ with `books.close_period`, whose entries are never in the statement. **bookspec:** `BS-statement-4` +**Pick (BS-statement-8):** year-through-as-of, the owner, 2026-10-20, D-36 + **Claims:** partly (bookspec's record states the as-of principle and the calendar-year counting; the CPA package itself is wanderbooks product, below) **Pick:** the 1099 worksheet stops at as_of too (the owner, 2026-10-20, plan D-36). @@ -207,6 +213,8 @@ given no accounts, uses the settings', as a package given none does. **bookspec:** `BS-statement-5` +**Pick (BS-statement-9):** one-project-per-line, the owner, 2026-10-22, D-43 + **Claims:** partly (bookspec's record states the class, the figures, on-spec and document-line rules; the project facts and the snapshot presentation are wanderbooks product, below) **Pick:** a project is a class (the owner, 2026-10-21: "a Projects page that treats a class as a project ... Projects are entities too and can have name, description, whatever other metadata you think they should have"; the convention `link-to-projects` in the books: "whenever applicable, we link things to [projects]"); an invoice's or bill's lines take a project, each line one or none (the owner, 2026-10-22, plan D-43). From 3877a49a81d5eca340bbd780ebd5c76077170043 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sun, 8 Nov 2026 14:40:14 -0700 Subject: [PATCH 03/10] docs(spec): one picks list; picks for every CHOICE record The two S-C7 halves declared their picks two ways; there is now one shared PICKS list in the bookspec adapter's engine.rs, declared via Claims::with_choice, and rules_md.rs keeps S-C7b's check (the backticked option in the claims file must be one of the record's options and the adapter must declare the same), skipping retired rules. S-C7a's Pick lines are rewritten with backticks. Picks are added, in the claims files and the adapter, for the 16 records of s-c7b-noexample (BS-partner-16..18, BS-asset-9, BS-1099-5, BS-arap-7..14, BS-format-8..10), taken from each parent's old status_note and the claims' existing Pick lines. BS-partner-9's pick is gone with its record (folded into BS-partner-2), and BS-ledger-17's pick now appears once, under B-20. Co-Authored-By: Muse Wonder 1.0 --- docs/spec/claims/1099.md | 1 + docs/spec/claims/arap.md | 12 ++++++++++++ docs/spec/claims/asset.md | 1 + docs/spec/claims/entry.md | 7 +++---- docs/spec/claims/format.md | 5 +++++ docs/spec/claims/ledger.md | 16 ++++++++-------- docs/spec/claims/partner.md | 5 ++++- docs/spec/claims/period.md | 4 ++-- docs/spec/claims/prepaid.md | 6 +++--- docs/spec/claims/statement.md | 8 ++++---- 10 files changed, 43 insertions(+), 22 deletions(-) diff --git a/docs/spec/claims/1099.md b/docs/spec/claims/1099.md index c7ef5f0d..e7ea2c5a 100644 --- a/docs/spec/claims/1099.md +++ b/docs/spec/claims/1099.md @@ -19,6 +19,7 @@ Rules: B-19. **Pick (BS-1099-3):** `presumed-a-check-ach-or-transfer`, the owner, D-40, 2026-10-20. **Pick (BS-1099-4):** `dated-by-the-payments-date`, the owner, D-40, 2026-10-20. +**Pick (BS-1099-5):** `payees-share-only`, the owner, 2026-10-15. **Enforced:** the bucket table is `kernel::payment_bucket` and `kernel::net_buckets`; `kernel::apportion` splits a payee's part across diff --git a/docs/spec/claims/arap.md b/docs/spec/claims/arap.md index 0b7656ff..c6e4ff01 100644 --- a/docs/spec/claims/arap.md +++ b/docs/spec/claims/arap.md @@ -13,6 +13,11 @@ Rules: B-18, B-38, B-39, B-40, B-41, B-42. **Claims:** yes **Pick:** a document due today is Current, not 1 day past due: CHOICE (the owner, 2026-10-13); an aging as of a day shows only the documents issued by then, less only the payments made by then: CHOICE (the owner, 2026-10-13); a payment never predates its invoice or bill, a real prepayment being a deposit: CHOICE (the owner, 2026-10-13). The bucket edges are the record's. +**Pick (BS-arap-7):** `due-today-is-current`, the owner, 2026-10-13. + +**Pick (BS-arap-8):** `as-of-the-day`, the owner, 2026-10-13. + +**Pick (BS-arap-9):** `refuse-a-payment-before-its-document`, the owner, 2026-10-13. **Enforced:** `arap::aging_bucket`, `Ledger::ar_aging`/`ap_aging` (through `Ledger::doc_state`), `receive_payment`/`pay_bill` @@ -159,6 +164,7 @@ behind the feature `documents_v2`. **Checked:** **Claims:** yes **Pick:** a vendor's invoice reference is compared after the normalization that drops case and spaces (`Ledger::check_vendor_ref`); the old text names no separate decision for it. +**Pick (BS-arap-10):** `ignore-case-and-spaces`; a vendor's invoice reference is compared after the normalization that drops case and spaces. **Enforced:** `Ledger::next_invoice_number`, `Ledger::check_vendor_ref`, `PartySnapshot::from_party` (the snapshots at issue, D-55); @@ -218,6 +224,7 @@ the viewer `a_numbered_invoice_shows_its_number_terms_bill_to_and_po`. **Claims:** yes **Pick:** `direct-write-off`: CHOICE (the owner, 2026-10-23, plan 8.3.1 A-5: bad debts by the direct write-off method; and 8.3.2: for a small company's receivables a CPA accepts the direct method and notes it, where GAAP prefers an allowance under ASC 326-20). A recovery is not a new movement (plan D-49): the same year, the write-off is reversed; a later year, a plain entry to a bad-debt-recoveries revenue account. +**Pick (BS-arap-11):** `reverse-then-plain-entry`, plan D-49. **Enforced:** `ledger_core::Ledger::write_off` (and its replay `replay_invoice_write_off`), `LedgerError::{WriteOffOnCashBasis, @@ -280,6 +287,11 @@ leaves the books and the journal unchanged and never panics. **Claims:** yes **Pick:** the gross method for an early-payment discount (the owner, A-8); the processor's fee posted gross (the owner, A-4); D-49's refusal to apportion a discount across a bill's asset lines. ASC 606-10-32-5 to 32-9 are the strict treatment of an expected discount; this company's size makes the gross method immaterial (A-8). The sources are cited and not yet vendored (the Open list in `README.md`). +**Pick (BS-arap-12):** `gross-when-taken`, the owner, A-8. + +**Pick (BS-arap-13):** `gross`, the owner, A-4. + +**Pick (BS-arap-14):** `refuse-with-the-remedy`, plan D-49. **Enforced:** `kernel::settle`, `Ledger::{settle, settlement_lines, check_discount}`, `arap::{Application, Fee, SettleParams, SettlementRow}`, diff --git a/docs/spec/claims/asset.md b/docs/spec/claims/asset.md index 27be8981..51f10615 100644 --- a/docs/spec/claims/asset.md +++ b/docs/spec/claims/asset.md @@ -154,6 +154,7 @@ printer makes an Avery 5160 label sheet from the register's tags. **Pick (BS-asset-7):** `books-recorded-amounts`, the owner, D-41, 2026-10-20. **Pick (BS-asset-8):** `register-carries-tax-figures`, the owner, 2026-10-15; D-41, 2026-10-20. +**Pick (BS-asset-9):** `traditional`, the owner, D-41, 2026-10-20; recorded as a choice the CPA confirms. **Enforced:** `kernel::basis_figures` (Kani `basis_figures_laws`), `AssetBasis::check` (a purchase takes no contribution facts; a diff --git a/docs/spec/claims/entry.md b/docs/spec/claims/entry.md index 54c41888..c5aa77df 100644 --- a/docs/spec/claims/entry.md +++ b/docs/spec/claims/entry.md @@ -10,7 +10,7 @@ Rules: B-1, B-2, B-21, B-28, B-43. **bookspec:** `BS-entry-1` -**Pick (BS-entry-6):** check-when-line-added, the owner, 2026-10-13 +**Pick (BS-entry-6):** `check-when-line-added`, the owner, 2026-10-13 **Claims:** yes @@ -62,9 +62,9 @@ None. **bookspec:** `BS-entry-4` -**Pick (BS-entry-7):** refuse-rather-than-crash, the owner, 2026-10-16 +**Pick (BS-entry-7):** `refuse-rather-than-crash`, the owner, 2026-10-16 -**Pick (BS-entry-8):** bounds-bind-commands-never-replay, the owner, 2026-10-17 +**Pick (BS-entry-8):** `bounds-bind-commands-never-replay`, the owner, 2026-10-17 **Claims:** yes @@ -184,7 +184,6 @@ pinned; every tool over every old book). **bookspec:** `BS-entry-5` -**Pick (BS-ledger-17):** reversal-evidence-is-originals, D-47, the owner, 2026-10-26 **Claims:** partly (bookspec's record states the evidence gate's principle, the draft state as a note and the discard; the gate's function, the policy settings, the states' names and the surfaces are wanderbooks product, below) diff --git a/docs/spec/claims/format.md b/docs/spec/claims/format.md index 70304bc2..be63e590 100644 --- a/docs/spec/claims/format.md +++ b/docs/spec/claims/format.md @@ -248,6 +248,11 @@ were renamed). **Pick (BS-format-6):** `everything-through-as-of`, the owner, 2026-10-20, D-36. **Pick (BS-format-7):** `journal-sample-columns`, the owner, 2026-10-20, D-36 (CHOICE). +**Pick (BS-format-8):** `closes-left-out`, the owner, 2026-10-20, D-36. + +**Pick (BS-format-9):** `no-customer-or-vendor-name`, the owner, 2026-10-20, D-36. + +**Pick (BS-format-10):** `refuse-the-entry`, the owner, 2026-10-20, D-36. **Pick:** `no-customer-or-vendor-name`: CHOICE (open risk). The IIF writes no NAME on a line to accounts receivable or payable, though Intuit's staff say diff --git a/docs/spec/claims/ledger.md b/docs/spec/claims/ledger.md index dc41b90f..fa3ded97 100644 --- a/docs/spec/claims/ledger.md +++ b/docs/spec/claims/ledger.md @@ -10,7 +10,7 @@ Rules: B-3, B-4, B-5, B-8, B-9, B-10, B-20, B-23, B-29, B-31, B-32, B-44, B-45. **bookspec:** `BS-ledger-1` -**Pick (BS-ledger-14):** book-in-the-smallest-unit, the owner, 2026-10-13 +**Pick (BS-ledger-14):** `book-in-the-smallest-unit`, the owner, 2026-10-13 **Claims:** yes @@ -40,7 +40,7 @@ None. **bookspec:** `BS-ledger-2` -**Pick (BS-ledger-15):** child-has-its-parents-type, the owner, 2026-10-13 +**Pick (BS-ledger-15):** `child-has-its-parents-type`, the owner, 2026-10-13 **Claims:** yes @@ -96,7 +96,7 @@ and never called corrupt (statement 4). **Checked:** Lean `Step.extends`, **bookspec:** `BS-ledger-5` -**Pick (BS-ledger-16):** on-or-after-the-original, the owner, 2026-11-08, wanderbooks D-73 +**Pick (BS-ledger-16):** `on-or-after-the-original`, the owner, 2026-11-08, wanderbooks D-73 **Claims:** yes @@ -129,7 +129,7 @@ None. **bookspec:** `BS-ledger-7` -**Pick (BS-ledger-17):** reversal-evidence-is-originals, D-47, the owner, 2026-10-26 +**Pick (BS-ledger-17):** `reversal-evidence-is-originals`, D-47, the owner, 2026-10-26 **Claims:** partly (the engine does not enforce it; the receipt policy of the tool layer does) @@ -145,9 +145,9 @@ None. **bookspec:** `BS-ledger-8` -**Pick (BS-ledger-18):** assignment-is-a-fact-in-the-books, the owner, 2026-10-15 +**Pick (BS-ledger-18):** `assignment-is-a-fact-in-the-books`, the owner, 2026-10-15 -**Pick (BS-ledger-19):** refuse-rather-than-renumber, the owner, 2026-10-13 +**Pick (BS-ledger-19):** `refuse-rather-than-renumber`, the owner, 2026-10-13 **Claims:** yes @@ -257,9 +257,9 @@ bookspec `examples/rename-changes-no-amount.toml`. **bookspec:** `BS-ledger-11` -**Pick (BS-ledger-20):** warn-by-default, the owner, 2026-10-20 +**Pick (BS-ledger-20):** `warn-by-default`, the owner, 2026-10-20 -**Pick (BS-ledger-21):** round-once-on-the-total, the owner, 2026-11-07, D-67 +**Pick (BS-ledger-21):** `round-once-on-the-total`, the owner, 2026-11-07, D-67 **Claims:** yes diff --git a/docs/spec/claims/partner.md b/docs/spec/claims/partner.md index 64ff140c..8a47e519 100644 --- a/docs/spec/claims/partner.md +++ b/docs/spec/claims/partner.md @@ -19,6 +19,9 @@ Rules: B-13, B-26, B-35, B-36. **Pick (BS-partner-6):** `cumulative-from-first-close`, the owner, D-10, 2026-10-16. **Pick (BS-partner-7):** `running-split`, the owner, D-38, 2026-10-20. +**Pick (BS-partner-16):** `contract-is-property-vendor-paid-is-cash`, the owner, 2026-10-15. + +**Pick (BS-partner-17):** `close-at-the-change`, the owner, 2026-10-16. **Enforced:** `CloseTo::Members`, `CloseTo::MembersCumulative`, `Ledger::members_regime`, `Regime::allocate`, @@ -107,7 +110,6 @@ is its TIN facts', else its W-9 facts'. **Pick (BS-partner-8):** `outside-the-books`, the owner, 2026-10-15. -**Pick (BS-partner-9):** `tin-facts-then-w9`, the owner, 2026-10-15. **Enforced:** `crate::parties` (has_full_tin, check_text, W9Facts::check, W4Facts::check), `Ledger::add_party`, `update_party`, `set_party_role`, @@ -397,6 +399,7 @@ confirm). **Pick (BS-partner-14):** `tax-basis-beside-book`, the owner, D-41, 2026-10-20. **Pick (BS-partner-15):** `running-cumulative`, the owner, D-38's rule applied 2026-10-22. +**Pick (BS-partner-18):** `book-amount-with-note`, the owner, P3 review, 2026-10-21. **Enforced:** `ledger_core::tax_capital::tax_basis_capital`; `ledger-package` `k1_tax` (`k1-tax-basis-capital.csv` in the CPA diff --git a/docs/spec/claims/period.md b/docs/spec/claims/period.md index b862c884..386ac05d 100644 --- a/docs/spec/claims/period.md +++ b/docs/spec/claims/period.md @@ -25,7 +25,7 @@ decision, D-73, 2026-11-08). **Checked:** Kani **bookspec:** `BS-period-2` -**Pick (BS-period-4):** nest-never-partially-overlap, the owner, 2026-10-13 +**Pick (BS-period-4):** `nest-never-partially-overlap`, the owner, 2026-10-13 **Claims:** yes @@ -53,7 +53,7 @@ untouched. **bookspec:** `BS-period-3` -**Pick (BS-period-5):** fiscal-year-to-date-by-default, the owner, 2026-10-20 +**Pick (BS-period-5):** `fiscal-year-to-date-by-default`, the owner, 2026-10-20 **Claims:** partly (the bookspec record states the one default rule; the surfaces it binds are wanderbooks product, below) diff --git a/docs/spec/claims/prepaid.md b/docs/spec/claims/prepaid.md index 5b0cdd09..c41c9010 100644 --- a/docs/spec/claims/prepaid.md +++ b/docs/spec/claims/prepaid.md @@ -10,11 +10,11 @@ Rules: B-16. **bookspec:** `BS-prepaid-1` -**Pick (BS-prepaid-2):** daily, the owner, 2026-10-20, D-11 and D-37 +**Pick (BS-prepaid-2):** `daily`, the owner, 2026-10-20, D-11 and D-37 -**Pick (BS-prepaid-3):** start-on-the-first, the owner, 2026-10-20, D-37 +**Pick (BS-prepaid-3):** `start-on-the-first`, the owner, 2026-10-20, D-37 -**Pick (BS-prepaid-4):** minor-unit-for-new-schedules, the owner, 2026-11-08, D-72 +**Pick (BS-prepaid-4):** `minor-unit-for-new-schedules`, the owner, 2026-11-08, D-72 **Claims:** yes diff --git a/docs/spec/claims/statement.md b/docs/spec/claims/statement.md index 73ed65ac..c0764e39 100644 --- a/docs/spec/claims/statement.md +++ b/docs/spec/claims/statement.md @@ -30,9 +30,9 @@ Lean `trial_balance_iff`, `Reachable.trial_balance`, **bookspec:** `BS-statement-3` -**Pick (BS-statement-6):** direct, the owner, 2026-10-20 +**Pick (BS-statement-6):** `direct`, the owner, 2026-10-20 -**Pick (BS-statement-7):** constructive, the owner, 2026-10-20, D-42 +**Pick (BS-statement-7):** `constructive`, the owner, 2026-10-20, D-42 **Claims:** partly (bookspec's record states rules 1-12; the picks and the product surface are below) @@ -156,7 +156,7 @@ with `books.close_period`, whose entries are never in the statement. **bookspec:** `BS-statement-4` -**Pick (BS-statement-8):** year-through-as-of, the owner, 2026-10-20, D-36 +**Pick (BS-statement-8):** `year-through-as-of`, the owner, 2026-10-20, D-36 **Claims:** partly (bookspec's record states the as-of principle and the calendar-year counting; the CPA package itself is wanderbooks product, below) @@ -213,7 +213,7 @@ given no accounts, uses the settings', as a package given none does. **bookspec:** `BS-statement-5` -**Pick (BS-statement-9):** one-project-per-line, the owner, 2026-10-22, D-43 +**Pick (BS-statement-9):** `one-project-per-line`, the owner, 2026-10-22, D-43 **Claims:** partly (bookspec's record states the class, the figures, on-spec and document-line rules; the project facts and the snapshot presentation are wanderbooks product, below) From 9d58502a09b908bd484888fd491a583f0b5440ed Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sun, 8 Nov 2026 14:45:02 -0700 Subject: [PATCH 04/10] docs(plan): X-I checks ids-issued only grows against the base commit Co-Authored-By: Claude Opus 5.5 --- plan/p14-bookspec.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plan/p14-bookspec.md b/plan/p14-bookspec.md index eb12bd05..acd1e0b3 100644 --- a/plan/p14-bookspec.md +++ b/plan/p14-bookspec.md @@ -75,7 +75,7 @@ workers have been faster). | **X-H0** | Split the 4,647-line adapter `crates/ledger-core/tests/bookspec.rs` into modules, no behaviour change | none | `crates/ledger-core/tests/bookspec/**` | S-M | | **X-H1** | Schema additions for the missing examples (balance sheet, general ledger, tax summary, 1099 worksheet, aging, payments, drafts and evidence, refused input); and examples for every CHOICE record on `rules/allow-no-example.txt` (the EM, 2026-11-08, revised: every embedded CHOICE becomes its own record now so an engine can declare a pick for it; a record's examples must genuinely exercise it, an example is never linked to a choice it doesn't depend on, so the CHOICEs no example can show yet go on the allow-list, whose cap is raised once for them, from 9, and only shrinks after; X-H1/X-H2 work it down. Among them, from S-C7b's `s-c7b-noexample`: partner prepaid-contract, shares-in-force, prepaid basis; asset §704(c) method; 1099 payee's share; arap due-today, as-of reading, payment before its document, vendor reference compare, recovery form, gross discount, gross fee, discount apportioning; format closing entries, the customer/vendor NAME, the two-A/R refusal; and from S-C7a the records no example exercises: BS-entry-6..8, BS-ledger-14, -17, -18, -19, -21, BS-period-4, BS-prepaid-4, subject to its review) | S-A, X-H0 | bookspec `checker/src/schema.rs`; the adapter | L | | **X-H2** | Examples from the 2026-11-07 goldens, each from its worksheet | X-H1 (4 need nothing) | bookspec `examples/*.toml` | M | -| **X-I** | Per-rule coverage in the runner with a floor (stated rules with an example never decrease) | S-A, X-H2 | bookspec `runner/`, `checker/tests/coverage.rs` | S-M | +| **X-I** | Per-rule coverage in the runner with a floor (stated rules with an example never decrease); a CI step, like `scripts/parity-floor.sh`, that fails when `rules/ids-issued.txt` loses a line or the allow-list grows against the base commit (the in-tree checks can't see a record and its ids-issued line deleted together) | S-A, X-H2 | bookspec `runner/`, `checker/tests/coverage.rs` | S-M | | **X-J** | wanderbooks traceability gate: every claimed BS id has an enforcement site and a test, every law a Lean theorem, every CHOICE a declared pick, every kernel function a Kani harness, a bridge property and a law | S-D, S-E, L-F2 | `crates/ledger-core/tests/traceability.rs`, `docs/spec/claims/**` | M | | **X-K2** | Profiles (core, documents, partners, us-tax, formats) and an engine builder's guide; the hard-coded accounts become setup keys | S-A, X-H1 | bookspec `checker/src/{engine,schema}.rs`, `spec/00-model.md` | M | | **X-O** | hledger as a second oracle: a pinned container (official static 1.52.4, sha256 in the Dockerfile), a bookspec engine adapter, and wanderbooks' random-book differential beside GnuCash's (task C; `plan/kernel-sweep-audit.md` section 4) | S-K1 | bookspec `hledger/**`; wanderbooks `tests/oracle_hledger.rs`, `justfile` | M | From 03f667585d0582cd4ab64aac3b38b8f3bc2eacd4 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sun, 8 Nov 2026 14:53:25 -0700 Subject: [PATCH 05/10] docs(spec): partner picks follow the renumbering Co-Authored-By: Muse Wonder 1.0 --- crates/ledger-core/tests/bookspec/engine.rs | 18 +++++++++--------- docs/spec/claims/partner.md | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/crates/ledger-core/tests/bookspec/engine.rs b/crates/ledger-core/tests/bookspec/engine.rs index 609f962f..1fd4d4f0 100644 --- a/crates/ledger-core/tests/bookspec/engine.rs +++ b/crates/ledger-core/tests/bookspec/engine.rs @@ -69,15 +69,15 @@ pub(crate) const PICKS: &[(Area, u32, &str)] = &[ (Area::Partner, 6, "cumulative-from-first-close"), (Area::Partner, 7, "running-split"), (Area::Partner, 8, "outside-the-books"), - (Area::Partner, 10, "cash-cards-and-financing"), - (Area::Partner, 11, "capital-movement-counted-once"), - (Area::Partner, 12, "books-carrying-amount"), - (Area::Partner, 13, "labelled-cash-default-or-all"), - (Area::Partner, 14, "tax-basis-beside-book"), - (Area::Partner, 15, "running-cumulative"), - (Area::Partner, 16, "contract-is-property-vendor-paid-is-cash"), - (Area::Partner, 17, "close-at-the-change"), - (Area::Partner, 18, "book-amount-with-note"), + (Area::Partner, 9, "cash-cards-and-financing"), + (Area::Partner, 10, "capital-movement-counted-once"), + (Area::Partner, 11, "books-carrying-amount"), + (Area::Partner, 12, "labelled-cash-default-or-all"), + (Area::Partner, 13, "tax-basis-beside-book"), + (Area::Partner, 14, "running-cumulative"), + (Area::Partner, 15, "contract-is-property-vendor-paid-is-cash"), + (Area::Partner, 16, "close-at-the-change"), + (Area::Partner, 17, "book-amount-with-note"), (Area::Asset, 5, "straight-line-by-days"), (Area::Asset, 6, "lesser-of-value-and-basis"), (Area::Asset, 7, "books-recorded-amounts"), diff --git a/docs/spec/claims/partner.md b/docs/spec/claims/partner.md index 8a47e519..3318e8b4 100644 --- a/docs/spec/claims/partner.md +++ b/docs/spec/claims/partner.md @@ -19,9 +19,9 @@ Rules: B-13, B-26, B-35, B-36. **Pick (BS-partner-6):** `cumulative-from-first-close`, the owner, D-10, 2026-10-16. **Pick (BS-partner-7):** `running-split`, the owner, D-38, 2026-10-20. -**Pick (BS-partner-16):** `contract-is-property-vendor-paid-is-cash`, the owner, 2026-10-15. +**Pick (BS-partner-15):** `contract-is-property-vendor-paid-is-cash`, the owner, 2026-10-15. -**Pick (BS-partner-17):** `close-at-the-change`, the owner, 2026-10-16. +**Pick (BS-partner-16):** `close-at-the-change`, the owner, 2026-10-16. **Enforced:** `CloseTo::Members`, `CloseTo::MembersCumulative`, `Ledger::members_regime`, `Regime::allocate`, @@ -304,13 +304,13 @@ owner, 2026-10-20); property distributed counts at the books' carrying amount; party totals take basis cash by default, or all, always labelled. -**Pick (BS-partner-10):** `cash-cards-and-financing`, the owner, 2026-10-20. +**Pick (BS-partner-9):** `cash-cards-and-financing`, the owner, 2026-10-20. -**Pick (BS-partner-11):** `capital-movement-counted-once`, the owner, 2026-10-15 and 2026-10-20. +**Pick (BS-partner-10):** `capital-movement-counted-once`, the owner, 2026-10-15 and 2026-10-20. -**Pick (BS-partner-12):** `books-carrying-amount`, the owner, 2026-10-20. +**Pick (BS-partner-11):** `books-carrying-amount`, the owner, 2026-10-20. -**Pick (BS-partner-13):** `labelled-cash-default-or-all`, the owner, 2026-10-20. +**Pick (BS-partner-12):** `labelled-cash-default-or-all`, the owner, 2026-10-20. **Enforced:** `kernel::party_target`, `kernel::reverse_target`, `shares::{target, split, resolve}`, `parties::{flow, money_accounts, @@ -396,10 +396,10 @@ contributed to a prepaid account with no fixed asset for it enters at its book amount, with a note (P3 review, 2026-10-21; the CPA to confirm). -**Pick (BS-partner-14):** `tax-basis-beside-book`, the owner, D-41, 2026-10-20. +**Pick (BS-partner-13):** `tax-basis-beside-book`, the owner, D-41, 2026-10-20. -**Pick (BS-partner-15):** `running-cumulative`, the owner, D-38's rule applied 2026-10-22. -**Pick (BS-partner-18):** `book-amount-with-note`, the owner, P3 review, 2026-10-21. +**Pick (BS-partner-14):** `running-cumulative`, the owner, D-38's rule applied 2026-10-22. +**Pick (BS-partner-17):** `book-amount-with-note`, the owner, P3 review, 2026-10-21. **Enforced:** `ledger_core::tax_capital::tax_basis_capital`; `ledger-package` `k1_tax` (`k1-tax-basis-capital.csv` in the CPA From 27e47a2b51ee158633810901813cdc5cb64d836a Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sun, 8 Nov 2026 15:48:58 -0700 Subject: [PATCH 06/10] docs(plan): D-74, any rule a command breaks is a conformant refusal Co-Authored-By: Claude Opus 5.5 --- plan/served.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plan/served.md b/plan/served.md index fff9056a..fce35aea 100644 --- a/plan/served.md +++ b/plan/served.md @@ -2196,6 +2196,7 @@ The owner decisions of 2026-10-16 (at the top of this document) replace the form | D-71 | Product rules and licence (owner, 2026-11-08, the question tool: "Generic in bookspec, rest WB-n"; "Yes, CC BY 4.0") | **bookspec keeps only the general principle of a product rule, inside an engine-independent rule; wholly product ids (`BS-format-1`, `BS-ledger-12`, `BS-ledger-13`) are retired, never reused; wanderbooks keeps its product rules as WB-n. Rule text moved from rules.md is CC BY 4.0 in bookspec.** | | D-72 | Amortization rounding by currency (owner, 2026-11-08, the question tool: "Version the rule") | **New monthly-even schedules round to the currency's minor unit (was 2 places for every currency, wrong for JPY and KWD); schedules written before the format feature replay the cent rule, so nothing journaled moves.** | | D-73 | A reversal's date (owner, 2026-11-08, the question tool: "Every reversal on or after") | **Every reversal MUST be dated on or after the entry it reverses, for every kind of entry (was enforced only for document reversals and schedule runs): a correction comes after what it corrects. bookspec BS-ledger-5 states it; the engine's `check_reversal` refuses an earlier date; the Lean model's `reverse` step requires it (unit L-G1).** Found when the Lean model was made executable. In the same pass, a close with nothing to close was confirmed to post no entry and still close the period (the engine's INVARIANT 5; an entry needs two lines), and BS-period-1 is worded to say so. | +| D-74 | A refusal when several rules are broken (owner, 2026-11-08, the question tool: "Any broken rule counts") | **When one command breaks several rules, an engine may refuse it with any rule it actually breaks; bookspec's examples test one broken rule at a time, and the Lean-model differential test (L-G5) checks that the engine's reason is one of the rules the command breaks.** Found by L-G5: the engine checks each line as it is added, the model checks the date and the whole entry first, so a command with two faults was refused with different words. | ### 10.2 Deferred From b24062e8fa02883f314e0692158dfadc5413e38e Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sun, 8 Nov 2026 15:50:14 -0700 Subject: [PATCH 07/10] docs(plan): K-U10, the Decimal sum exact at the edge (found by K-U4) Co-Authored-By: Claude Opus 5.5 --- plan/p14-bookspec.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plan/p14-bookspec.md b/plan/p14-bookspec.md index acd1e0b3..25a2de7d 100644 --- a/plan/p14-bookspec.md +++ b/plan/p14-bookspec.md @@ -81,6 +81,7 @@ workers have been faster). | **X-O** | hledger as a second oracle: a pinned container (official static 1.52.4, sha256 in the Dockerfile), a bookspec engine adapter, and wanderbooks' random-book differential beside GnuCash's (task C; `plan/kernel-sweep-audit.md` section 4) | S-K1 | bookspec `hledger/**`; wanderbooks `tests/oracle_hledger.rs`, `justfile` | M | | **K-U0** | Kernel and proofs into modules (`kernel/`, `proofs/`, `tests/kernel_bridge/`), `_kani` updated, `just prove` unchanged | none | `crates/ledger-core/src/{kernel,proofs}/**`, `tests/kernel_bridge/**`, `justfile` | S | | **K-U1..U9** | The sweep (`plan/kernel-sweep-audit.md` section 3), in value order: U1 FX, U3 shares (six copies to one; legacy replay policies only named, never changed), U2 rounding, U5 schedules (D-72), U4 totals (the raw-operator panic class), U6 ratios, U7 payroll, U8 control and aging, U9 display rounding. Each: kernel functions, Kani, bridge, its law in bookspec's Lean, its rule cited by BS id | K-U0; Lean laws after L-F2 | its own `kernel/.rs`, `proofs/.rs`, bridge module, call sites | S-M each | +| **K-U10** | `impl Amount for Decimal`'s `checked_add` (and its siblings) exact at the edge: `rust_decimal` rounds dust away within one unit of `Decimal::MAX` (`MAX + 0.4` gives `Some(MAX)`), breaking the kernel's exact-or-None contract (found by K-U4, 2026-11-08; pinned by the canary `finding_decimal_add_rounds_dust_at_the_edge`): refuse a sum whose result scale fell below the operands'; after the sweep units merge (the file is shared) | K-U4 merged | `kernel/entries.rs`, the canary, the bridge | S | | **V-D** | Coverage report and floor; `rust_decimal` checked against exact rationals (task D) | none | in flight 2026-11-08 | S | ## Order From de57598df8d631b8e678ac51628a7c5f42715e88 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sun, 8 Nov 2026 15:59:44 -0700 Subject: [PATCH 08/10] docs(spec): every CHOICE wanderbooks claims has a declared pick Add the seven older CHOICE records (with a B number) that carried no declared pick in the adapter, taking each option from its record's options and the claims file's existing Pick line for its B section: - BS-arap-2 lines-that-stand, BS-arap-5 direct-write-off, BS-asset-3 tag-and-never-reuse, BS-ledger-6 reversible-once, BS-ledger-9 facts-in-the-books, BS-ledger-10 label-only, BS-statement-5 project-is-a-class - PICKS in crates/ledger-core/tests/bookspec/engine.rs gains all seven; each claims file gains a '**Pick (BS-...):**' line beside its B section's Pick - Widen rules_md.rs's pick check from b == 0 records to every non-retired CHOICE record wanderbooks claims, so no CHOICE can go undeclared again Co-Authored-By: Muse Wonder 1.0 --- crates/ledger-core/tests/bookspec/engine.rs | 7 +++ crates/ledger-core/tests/bookspec/rules_md.rs | 46 ++++++++++--------- docs/spec/claims/arap.md | 4 ++ docs/spec/claims/asset.md | 2 + docs/spec/claims/ledger.md | 6 +++ docs/spec/claims/statement.md | 2 + 6 files changed, 45 insertions(+), 22 deletions(-) diff --git a/crates/ledger-core/tests/bookspec/engine.rs b/crates/ledger-core/tests/bookspec/engine.rs index 1fd4d4f0..03e22ff3 100644 --- a/crates/ledger-core/tests/bookspec/engine.rs +++ b/crates/ledger-core/tests/bookspec/engine.rs @@ -48,6 +48,9 @@ pub(crate) const PICKS: &[(Area, u32, &str)] = &[ (Area::Entry, 6, "check-when-line-added"), (Area::Entry, 7, "refuse-rather-than-crash"), (Area::Entry, 8, "bounds-bind-commands-never-replay"), + (Area::Ledger, 6, "reversible-once"), + (Area::Ledger, 9, "facts-in-the-books"), + (Area::Ledger, 10, "label-only"), (Area::Ledger, 14, "book-in-the-smallest-unit"), (Area::Ledger, 15, "child-has-its-parents-type"), (Area::Ledger, 16, "on-or-after-the-original"), @@ -58,6 +61,7 @@ pub(crate) const PICKS: &[(Area, u32, &str)] = &[ (Area::Ledger, 21, "round-once-on-the-total"), (Area::Period, 4, "nest-never-partially-overlap"), (Area::Period, 5, "fiscal-year-to-date-by-default"), + (Area::Statement, 5, "project-is-a-class"), (Area::Statement, 6, "direct"), (Area::Statement, 7, "constructive"), (Area::Statement, 8, "year-through-as-of"), @@ -78,6 +82,7 @@ pub(crate) const PICKS: &[(Area, u32, &str)] = &[ (Area::Partner, 15, "contract-is-property-vendor-paid-is-cash"), (Area::Partner, 16, "close-at-the-change"), (Area::Partner, 17, "book-amount-with-note"), + (Area::Asset, 3, "tag-and-never-reuse"), (Area::Asset, 5, "straight-line-by-days"), (Area::Asset, 6, "lesser-of-value-and-basis"), (Area::Asset, 7, "books-recorded-amounts"), @@ -87,6 +92,8 @@ pub(crate) const PICKS: &[(Area, u32, &str)] = &[ (Area::Tax1099, 3, "presumed-a-check-ach-or-transfer"), (Area::Tax1099, 4, "dated-by-the-payments-date"), (Area::Tax1099, 5, "payees-share-only"), + (Area::Arap, 2, "lines-that-stand"), + (Area::Arap, 5, "direct-write-off"), (Area::Arap, 7, "due-today-is-current"), (Area::Arap, 8, "as-of-the-day"), (Area::Arap, 9, "refuse-a-payment-before-its-document"), diff --git a/crates/ledger-core/tests/bookspec/rules_md.rs b/crates/ledger-core/tests/bookspec/rules_md.rs index cefb8262..5487609c 100644 --- a/crates/ledger-core/tests/bookspec/rules_md.rs +++ b/crates/ledger-core/tests/bookspec/rules_md.rs @@ -28,30 +28,32 @@ pub(crate) fn rules_md_carries_every_id() { if rule.is_retired() { continue; } + // Every non-retired CHOICE record wanderbooks claims -- whether + // it carries a B number or was split out of another rule (P14 + // unit S-C7) -- has its pick recorded in its claims file, and + // the engine's adapter declares the same option, which the + // record names, so no CHOICE can go undeclared. + if rule.status == Some(bookspec_checker::Status::Choice) { + let marker = format!("**Pick ({}):** `", rule.id); + let at = all + .find(&marker) + .unwrap_or_else(|| panic!("{} carries its pick in its claims file", rule.id)); + let option = all[at + marker.len()..].split('`').next().unwrap(); + assert!( + rule.record().options.iter().any(|o| o.name == option), + "{}'s pick {option:?} is one of its options", + rule.id + ); + assert!( + engine::PICKS + .iter() + .any(|&(area, n, o)| RuleId::new(area, n) == rule.id && o == option), + "{}'s pick {option:?} is declared in the adapter's claims()", + rule.id + ); + } if rule.b == 0 { // A rule born after the B numbering has no row in the index. - // A CHOICE record split out of another rule (P14 unit S-C7) - // has its pick recorded in its claims file, and the engine's - // adapter declares the same option, which the record names. - if rule.status == Some(bookspec_checker::Status::Choice) { - let marker = format!("**Pick ({}):** `", rule.id); - let at = all - .find(&marker) - .unwrap_or_else(|| panic!("{} carries its pick in its claims file", rule.id)); - let option = all[at + marker.len()..].split('`').next().unwrap(); - assert!( - rule.record().options.iter().any(|o| o.name == option), - "{}'s pick {option:?} is one of its options", - rule.id - ); - assert!( - engine::PICKS - .iter() - .any(|&(area, n, o)| RuleId::new(area, n) == rule.id && o == option), - "{}'s pick {option:?} is declared in the adapter's claims()", - rule.id - ); - } continue; } assert!( diff --git a/docs/spec/claims/arap.md b/docs/spec/claims/arap.md index c6e4ff01..11ec2997 100644 --- a/docs/spec/claims/arap.md +++ b/docs/spec/claims/arap.md @@ -33,6 +33,8 @@ Rules: B-18, B-38, B-39, B-40, B-41, B-42. **Claims:** yes +**Pick (BS-arap-2):** `lines-that-stand`, the owner, 2026-10-23. + **Pick:** `lines-that-stand`: CHOICE (the owner, 2026-10-23, plan D-45: "we kinda need stronger invoice support. Like make it a first class citizen"; hand entries to receivables and payables refused, the owner's answer 5). A control account agreeing with its subledger is the CONVENTION beside it (as B-23, `BS-ledger-8`). The sources are cited and not yet vendored (the Open list in `README.md`). **Enforced:** `ledger_core::arap::{DocRef, DocTag, Movement, DocState, @@ -224,6 +226,8 @@ the viewer `a_numbered_invoice_shows_its_number_terms_bill_to_and_po`. **Claims:** yes **Pick:** `direct-write-off`: CHOICE (the owner, 2026-10-23, plan 8.3.1 A-5: bad debts by the direct write-off method; and 8.3.2: for a small company's receivables a CPA accepts the direct method and notes it, where GAAP prefers an allowance under ASC 326-20). A recovery is not a new movement (plan D-49): the same year, the write-off is reversed; a later year, a plain entry to a bad-debt-recoveries revenue account. +**Pick (BS-arap-5):** `direct-write-off`, the owner, 2026-10-23. + **Pick (BS-arap-11):** `reverse-then-plain-entry`, plan D-49. **Enforced:** `ledger_core::Ledger::write_off` (and its replay diff --git a/docs/spec/claims/asset.md b/docs/spec/claims/asset.md index 51f10615..73f6ee4c 100644 --- a/docs/spec/claims/asset.md +++ b/docs/spec/claims/asset.md @@ -119,6 +119,8 @@ None. **Claims:** yes +**Pick (BS-asset-3):** `tag-and-never-reuse`, the owner, 2026-10-15. + **Pick:** `tag-and-never-reuse`: CHOICE (the owner, 2026-10-15): each asset may carry one tag, generated `PREFIX-0001` or the human's own, unique ignoring case and never reused, and the register reconciles to the cost and accumulated depreciation accounts. **Enforced:** `Ledger::set_asset_tag` / `check_asset_tag_for` / diff --git a/docs/spec/claims/ledger.md b/docs/spec/claims/ledger.md index fa3ded97..e5dc5053 100644 --- a/docs/spec/claims/ledger.md +++ b/docs/spec/claims/ledger.md @@ -116,6 +116,8 @@ None. **Claims:** yes +**Pick (BS-ledger-6):** `reversible-once`, the owner, 2026-10-13. + **Pick:** `reversible-once`: CHOICE (the owner, 2026-10-13). **Enforced:** `Ledger::check_reversal`. **Checked:** @@ -176,6 +178,8 @@ frees its code); the control guard and `Ledger::control_check` (B-38). **Claims:** yes +**Pick (BS-ledger-9):** `facts-in-the-books`, the owner, 2026-10-16. + **Pick:** `facts-in-the-books`: CHOICE (plan/served.md I-3, owner decisions of 2026-10-16: "the journal holds all books state"; light governance: decisions are recorded with who made them and when, not as paperwork). IRS Pub. 538 and the rules of B-1 to B-28 say what each setting means. **Enforced:** `ledger_core::settings` (`check`, `Settings::check_changes`, @@ -222,6 +226,8 @@ checked to change no figure or entry; **Claims:** yes +**Pick (BS-ledger-10):** `label-only`, the owner, 2026-10-20. + **Pick:** `label-only`: CHOICE (the owner, `plan/served.md` 4.9 and P3 "Settled in design", 2026-10-20: "a new account named like a sibling (ignoring capitals), or holding a nine-digit number, is refused"). Posted is forever (B-8) stands behind it, and Rev. Proc. 98-25 §5.01 (`sources/irs-records.md`) for keeping the old name. The nine-digit refusal is B-26's: every report prints a name. The 200-character bound is `account::MAX_ACCOUNT_NAME`, the bound of the company's own name. **Enforced:** `Ledger::rename_account` / `check_rename_account`, diff --git a/docs/spec/claims/statement.md b/docs/spec/claims/statement.md index c0764e39..85000e1e 100644 --- a/docs/spec/claims/statement.md +++ b/docs/spec/claims/statement.md @@ -217,6 +217,8 @@ given no accounts, uses the settings', as a package given none does. **Claims:** partly (bookspec's record states the class, the figures, on-spec and document-line rules; the project facts and the snapshot presentation are wanderbooks product, below) +**Pick (BS-statement-5):** `project-is-a-class`, the owner, 2026-10-21. + **Pick:** a project is a class (the owner, 2026-10-21: "a Projects page that treats a class as a project ... Projects are entities too and can have name, description, whatever other metadata you think they should have"; the convention `link-to-projects` in the books: "whenever applicable, we link things to [projects]"); an invoice's or bill's lines take a project, each line one or none (the owner, 2026-10-22, plan D-43). **Enforced:** `ledger_core::classes::{ProjectFacts, ProjectStatus, From 72de6efec0aa837b99b9c88c8bb40e50e65a36b1 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sun, 8 Nov 2026 17:06:14 -0700 Subject: [PATCH 09/10] 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 --- Cargo.lock | 4 ++-- crates/ledger-core/Cargo.toml | 4 ++-- crates/ledger-package/Cargo.toml | 2 +- verify/lean/lake-manifest.json | 4 ++-- verify/lean/lakefile.toml | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0480f8df..355d6be1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -788,7 +788,7 @@ dependencies = [ [[package]] name = "bookspec-checker" version = "0.1.0" -source = "git+https://git.swaits.com/swaits/bookspec?rev=c46709379781593139f5a23e8198f027bffaa44b#c46709379781593139f5a23e8198f027bffaa44b" +source = "git+https://git.swaits.com/swaits/bookspec?rev=218b5c89799f6b9df80607e711c29bb559a485ac#218b5c89799f6b9df80607e711c29bb559a485ac" dependencies = [ "chrono", "include_dir", @@ -801,7 +801,7 @@ dependencies = [ [[package]] name = "bookspec-runner" version = "0.1.0" -source = "git+https://git.swaits.com/swaits/bookspec?rev=c46709379781593139f5a23e8198f027bffaa44b#c46709379781593139f5a23e8198f027bffaa44b" +source = "git+https://git.swaits.com/swaits/bookspec?rev=218b5c89799f6b9df80607e711c29bb559a485ac#218b5c89799f6b9df80607e711c29bb559a485ac" dependencies = [ "bookspec-checker", "serde_json", diff --git a/crates/ledger-core/Cargo.toml b/crates/ledger-core/Cargo.toml index c83b1811..a339cbcf 100644 --- a/crates/ledger-core/Cargo.toml +++ b/crates/ledger-core/Cargo.toml @@ -28,8 +28,8 @@ proptest = "1" toml = "1" # The specification lives in its own repository (P13 step 6, D-34, D-65), # pinned to a commit. -bookspec-checker = { git = "https://git.swaits.com/swaits/bookspec", rev = "c46709379781593139f5a23e8198f027bffaa44b" } -bookspec-runner = { git = "https://git.swaits.com/swaits/bookspec", rev = "c46709379781593139f5a23e8198f027bffaa44b" } +bookspec-checker = { git = "https://git.swaits.com/swaits/bookspec", rev = "218b5c89799f6b9df80607e711c29bb559a485ac" } +bookspec-runner = { git = "https://git.swaits.com/swaits/bookspec", rev = "218b5c89799f6b9df80607e711c29bb559a485ac" } ledger-package = { path = "../ledger-package" } ledger-import = { path = "../ledger-import" } ledger-store = { path = "../ledger-store" } diff --git a/crates/ledger-package/Cargo.toml b/crates/ledger-package/Cargo.toml index 4bfcb695..3e31c659 100644 --- a/crates/ledger-package/Cargo.toml +++ b/crates/ledger-package/Cargo.toml @@ -21,7 +21,7 @@ zip = "9.0.1" workspace = true [dev-dependencies] -bookspec-checker = { git = "https://git.swaits.com/swaits/bookspec", rev = "c46709379781593139f5a23e8198f027bffaa44b" } +bookspec-checker = { git = "https://git.swaits.com/swaits/bookspec", rev = "218b5c89799f6b9df80607e711c29bb559a485ac" } proptest = "1" tempfile = "3" toml = "1" diff --git a/verify/lean/lake-manifest.json b/verify/lean/lake-manifest.json index 797d8506..20c272cd 100644 --- a/verify/lean/lake-manifest.json +++ b/verify/lean/lake-manifest.json @@ -5,10 +5,10 @@ "type": "git", "subDir": "lean", "scope": "", - "rev": "c46709379781593139f5a23e8198f027bffaa44b", + "rev": "218b5c89799f6b9df80607e711c29bb559a485ac", "name": "bookspec", "manifestFile": "lake-manifest.json", - "inputRev": "c46709379781593139f5a23e8198f027bffaa44b", + "inputRev": "218b5c89799f6b9df80607e711c29bb559a485ac", "inherited": false, "configFile": "lakefile.toml"}], "name": "wanderbooks", diff --git a/verify/lean/lakefile.toml b/verify/lean/lakefile.toml index 0fb79715..b1b98eb2 100644 --- a/verify/lean/lakefile.toml +++ b/verify/lean/lakefile.toml @@ -9,7 +9,7 @@ packagesDir = ".lake/packages" [[require]] name = "bookspec" git = "https://git.swaits.com/swaits/bookspec" -rev = "c46709379781593139f5a23e8198f027bffaa44b" +rev = "218b5c89799f6b9df80607e711c29bb559a485ac" subDir = "lean" [[lean_lib]] From ed9adaeec54ecb9f13d50004cead1bd0ed5e46e8 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sun, 8 Nov 2026 17:06:14 -0700 Subject: [PATCH 10/10] docs(plan): D-75, foreign amounts and rates take at most 10 places Co-Authored-By: Claude Opus 5.5 --- plan/served.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plan/served.md b/plan/served.md index fce35aea..3895d011 100644 --- a/plan/served.md +++ b/plan/served.md @@ -2197,6 +2197,7 @@ The owner decisions of 2026-10-16 (at the top of this document) replace the form | D-72 | Amortization rounding by currency (owner, 2026-11-08, the question tool: "Version the rule") | **New monthly-even schedules round to the currency's minor unit (was 2 places for every currency, wrong for JPY and KWD); schedules written before the format feature replay the cent rule, so nothing journaled moves.** | | D-73 | A reversal's date (owner, 2026-11-08, the question tool: "Every reversal on or after") | **Every reversal MUST be dated on or after the entry it reverses, for every kind of entry (was enforced only for document reversals and schedule runs): a correction comes after what it corrects. bookspec BS-ledger-5 states it; the engine's `check_reversal` refuses an earlier date; the Lean model's `reverse` step requires it (unit L-G1).** Found when the Lean model was made executable. In the same pass, a close with nothing to close was confirmed to post no entry and still close the period (the engine's INVARIANT 5; an entry needs two lines), and BS-period-1 is worded to say so. | | D-74 | A refusal when several rules are broken (owner, 2026-11-08, the question tool: "Any broken rule counts") | **When one command breaks several rules, an engine may refuse it with any rule it actually breaks; bookspec's examples test one broken rule at a time, and the Lean-model differential test (L-G5) checks that the engine's reason is one of the rules the command breaks.** Found by L-G5: the engine checks each line as it is added, the model checks the date and the whole entry first, so a command with two faults was refused with different words. | +| D-75 | Foreign amounts and FX rates are bounded (owner, 2026-11-08, the question tool: "Cap them at 10 places") | **A new line's foreign amount and its FX rate take at most 10 decimal places each, as a base amount already does (B-28's bounds; never on replay), so foreign × rate always fits a Decimal exactly and the booked base amount is rounded once.** Found by the K-U1 review: with a 26-place foreign amount, rust_decimal rounded the product to 28 places before the engine rounded it to the cent, booking a cent the exact product doesn't reach. | ### 10.2 Deferred