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

+15 -1
View File
@@ -27,6 +27,17 @@ Rules: B-18, B-38, B-39, B-40, B-41, B-42.
`a_payment_never_predates_its_document`, `aging_as_of_ignores_a_later_reversal`,
`a_voided_invoice_never_ages`, `status_is_a_function_of_journal_and_date`.
**Bookspec examples:** `arap-aging-buckets` (BS-arap-1);
`arap-a-document-due-today-is-current` (BS-arap-7);
`arap-an-aging-shows-what-stood-on-its-day` (BS-arap-8);
`arap-a-payment-before-its-invoice-is-refused` (BS-arap-9), run by the
adapter through `Ledger::{ar_aging, ap_aging, receive_payment, pay_bill}`
(`tests/bookspec/queries/documents.rs`). The examples for the options
wanderbooks did not pick (`arap-a-document-due-today-is-one-day-past-due`,
`arap-an-aging-shows-what-stands-today`,
`arap-a-payment-before-its-invoice-is-accepted`) name them (`under`) and the
runner skips them for the pick above.
## B-38 A document's figures are its ledger lines that stand; a control account is its documents
**bookspec:** `BS-arap-2`
@@ -137,7 +148,10 @@ check_void_document}`, the control guard). **Checked:**
**Enforced:** `ledger_core::Terms` (`new`, `parse`, `due_date`,
`discount_by`, `describe`), `kernel::discount_max`, `kernel::line_amount`,
`Ledger::check_document_line_account`.
**Checked:** `ledger-core` `tests/spec_documents.rs`
**Checked:** bookspec example `arap-terms-give-due-and-discount-dates`
(the adapter takes each due date from `Terms::due_date`, but for a date
the parties agreed, which that call leaves to its caller, and each discount
date from `Terms::discount_by`); `ledger-core` `tests/spec_documents.rs`
(`terms_derive_due_dates`, `discount_bounds_and_late_reason`,
`terms_describe_and_parse_round_trip`, `qty_times_price_must_equal_amount`,
`document_line_account_refuses_roles_cash_and_placeholders`,