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
This commit is contained in:
1 parent
03f667585d
commit
de57598df8
6 files changed
+45
-22
No files matched your search
@@ -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"),
|
||||
|
||||
@@ -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!(
|
||||
|
||||
Reference in new issue
Block a user