diff --git a/crates/ledger-core/tests/bookspec/engine.rs b/crates/ledger-core/tests/bookspec/engine.rs index 4daa9247..609f962f 100644 --- a/crates/ledger-core/tests/bookspec/engine.rs +++ b/crates/ledger-core/tests/bookspec/engine.rs @@ -29,47 +29,78 @@ 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( + let mut claims = 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", - ) + ); + for &(area, n, option) in PICKS { + claims = claims.with_choice(RuleId::new(area, n), option); + } + claims } } + +/// The option wanderbooks picks for each CHOICE record split out of an +/// embedded choice (P14 unit S-C7); each is recorded in +/// `docs/spec/claims/.md` as `**Pick (BS--):**`. +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, 14, "book-in-the-smallest-unit"), + (Area::Ledger, 15, "child-has-its-parents-type"), + (Area::Ledger, 16, "on-or-after-the-original"), + (Area::Ledger, 17, "reversal-evidence-is-originals"), + (Area::Ledger, 18, "assignment-is-a-fact-in-the-books"), + (Area::Ledger, 19, "refuse-rather-than-renumber"), + (Area::Ledger, 20, "warn-by-default"), + (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, 6, "direct"), + (Area::Statement, 7, "constructive"), + (Area::Statement, 8, "year-through-as-of"), + (Area::Statement, 9, "one-project-per-line"), + (Area::Prepaid, 2, "daily"), + (Area::Prepaid, 3, "start-on-the-first"), + (Area::Prepaid, 4, "minor-unit-for-new-schedules"), + (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, 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::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::Asset, 9, "traditional"), + (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::Tax1099, 5, "payees-share-only"), + (Area::Arap, 7, "due-today-is-current"), + (Area::Arap, 8, "as-of-the-day"), + (Area::Arap, 9, "refuse-a-payment-before-its-document"), + (Area::Arap, 10, "ignore-case-and-spaces"), + (Area::Arap, 11, "reverse-then-plain-entry"), + (Area::Arap, 12, "gross-when-taken"), + (Area::Arap, 13, "gross"), + (Area::Arap, 14, "refuse-with-the-remedy"), + (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"), + (Area::Format, 8, "closes-left-out"), + (Area::Format, 9, "no-customer-or-vendor-name"), + (Area::Format, 10, "refuse-the-entry"), +]; diff --git a/crates/ledger-core/tests/bookspec/rules_md.rs b/crates/ledger-core/tests/bookspec/rules_md.rs index 99baedb0..cefb8262 100644 --- a/crates/ledger-core/tests/bookspec/rules_md.rs +++ b/crates/ledger-core/tests/bookspec/rules_md.rs @@ -25,15 +25,33 @@ pub(crate) fn rules_md_carries_every_id() { } for rule in bookspec_checker::rules().iter() { + if rule.is_retired() { + continue; + } 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 - ); + // 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/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