test(core): the adapter runs payments, aging and due dates

The bookspec adapter learns the three things X-H1a's examples ask: a
`payment` event (Store::receive_payment for an invoice, pay_bill for a bill,
a payment dated before its document refused as `payment_before_document`
from LedgerError::PaymentBeforeDocument, BS-arap-9); `terms` on a bill or
invoice (the document is created with the engine's own Terms, its due date
from Terms::due_date, and the engine must print the example's spelling back
as written, BS-arap-3); and the `aging` and `document_dates` queries, read
from Ledger::{ar_aging, ap_aging} and the stored document's due date and
Terms::discount_by. Nothing of aging or terms is recomputed in the test.

An example for an option wanderbooks did not pick (`under`, checked against
PICKS) is read and not run, in the loader tests as in the runner, which
reports it skipped; the 71 others pass: wanderbooks agrees with every example
for the options it picks (BS-arap-7 due-today-is-current, BS-arap-8
as-of-the-day, BS-arap-9 refuse-a-payment-before-its-document). Run against
bookspec branch x-h1a by patching the dependency; the pin does not move
here. Claims for B-18 and B-39 name the new examples.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-08 20:47:46 -07:00
1 parent 8dec2900eb
commit 23e52de969
9 files changed
+299 -13

No files matched your search

@@ -41,6 +41,25 @@ impl Engine for Books<'_> {
}
}
/// Why wanderbooks does not run `ex`: it is an example for an option of a
/// CHOICE rule (`under`) that wanderbooks did not pick (`PICKS`). The
/// runner skips such an example for the same reason; the loader tests do
/// it with this.
pub(crate) fn unpicked_option(ex: &Example) -> Option<String> {
ex.under.iter().find_map(|u| {
let rule = RuleId::parse(&u.rule).ok()?;
let &(_, _, pick) = PICKS
.iter()
.find(|&&(area, n, _)| RuleId::new(area, n) == rule)?;
(pick != u.option).then(|| {
format!(
"for {} under {}; wanderbooks picks {pick}",
u.rule, u.option
)
})
})
}
/// 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/<area>.md` as `**Pick (BS-<area>-<n>):**`.