From de57598df8d631b8e678ac51628a7c5f42715e88 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sun, 8 Nov 2026 15:59:44 -0700 Subject: [PATCH] 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,