Commit Graph
4 Commits
Author SHA1 Message Date
swaitsandClaude Sonnet 5.5 ea4d8bc86e test(core): the adapter runs settlements, recoveries, numbers and vendor references
bookspec's X-H1b examples state BS-arap-4, -6 and -10 to -14 through new
events and queries; the adapter runs each through the real API, none
reimplemented.

- settlement: `Store::settle` with the applications, the fee and the
  deposit account; the party is the first document's customer or vendor, so
  the engine itself finds an invoice mixed with a bill, two customers, a
  document twice, more than a document owes, a discount that needs a reason,
  a discount on an asset bill and a fee above the cash. Each engine error is
  read as the examples' word (the fee case from the one InvalidSettlement
  error that can arise from exact inputs).
- recovery (BS-arap-11, reverse-then-plain-entry): in the write-off's fiscal
  year `Store::reverse_entry` of the write-off then `Store::receive_payment`;
  in a later year a plain entry, deposit debited and the recoveries account
  credited, naming the invoice. The engine has no recovery command; the two
  calls are the pick's own procedure.
- a bill's vendor reference and duplicate reason go to `BillFields`, so
  `Ledger::check_vendor_ref` is what refuses a second bill; each invoice is
  numbered with `Ledger::next_invoice_number`; a line's own account goes to
  `DocumentLine`.
- queries `document` (`Ledger::invoice_state`/`bill_state`) and
  `invoice_numbers` (the number the engine stored, read as its place in the
  order of issue).

Wanderbooks passes all 80 examples it runs. The runner skips eleven for the
options it did not pick (six new: documents-kept-apart, compare-exactly,
recovery-movement, net-of-expected-discount, net-against-the-deposit,
apportion-across-the-lines), so the pinned count is 11. No engine disagreed
with an example.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 00:16:28 -07:00
swaitsandClaude Sonnet 5.5 08733c6fa2 test(core): five examples are for options wanderbooks did not pick
The bookspec adapter's test pinned the examples for an unpicked option at
three (the other option of BS-arap-7, -8 and -9). The bookspec fixes give
BS-prepaid-2's equal-months and BS-ledger-20's refuse each an example of
their own, so no option-example allow-list grows; wanderbooks picks daily and
warn-by-default, so it skips both, and the count is five. The runner and the
loader tests still agree on exactly which.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 21:56:37 -07:00
swaitsandClaude Sonnet 5.5 23e52de969 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>
2026-11-08 20:47:46 -07:00
swaitsandDeepSeek V4.1 Flash f9cdf4d718 refactor(core): the bookspec adapter becomes modules by area
The bookspec adapter was one 4,647-line test file, and every later unit
that adds a query or an event touches it. Split it by its own sections,
with no behaviour change: `main` keeps the crate doc, the shared imports
and the module list; `common` holds the shared vocabulary (dates,
refusals, exact decimals, figure formatting); `books` the example's
books and setup; `events` the application of each event; `queries/` the
answers and checks per query family (statements, parties, tax, assets,
formats, commands, dates); `engine` the `Engine` impl; `check` and `run`
the drivers; and `examples`, `loader_tests`, `sources` and `rules_md`
the tests by area. Every `#[test]` keeps its function name (52 tests,
same names), and Cargo still builds one test target named `bookspec`.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
2026-11-08 10:49:03 -07:00