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/<area>.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 <noreply@anthropic.com>
This commit is contained in:
1 parent
8ecf177cb2
commit
422a956ffc
6 files changed
+107
-2
No files matched your search
@@ -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/<area>.md` as `**Pick (BS-<area>-<n>):**`.
|
||||
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"),
|
||||
];
|
||||
@@ -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 {}",
|
||||
|
||||
Reference in new issue
Block a user