Files
wanderbooks/crates/ledger-core/tests
swaitsandClaude Sonnet 5.5 f2058931d8 test(core): document events replay as journaled
The store rebuilds a payment's entry from its own entry events and then
tells the ledger which line is the payment, the discount, the write-off.
The core's own suite reached none of this (tag_replayed_at,
replay_invoice_payment_at, replay_bill_payment_at, replay_set_draft_state,
replay_add_line_fx); only the store's replay tests did.

- BS-arap-6 INVARIANT 3: an event that names a line tags exactly it; the
  invoice then reads the figures its lines carry (40.00 paid, 460.00
  owed; 490.00 paid + 10.00 discounted of 500.00) and the control
  accounts tie out with nothing untagged.
- BS-entry-4: an event that names a line the entry cannot answer to (the
  wrong account, amount, side or index) is not refused: the line stays
  untagged, the control check lists it, and the control account still
  ties. Only an unknown document is refused, and the ledger is unchanged.
- A bill's payment is the mirror (debit to payables); a write-off tags
  the receivables credit; a draft's state and a foreign line replay as
  journaled and a foreign line in the wrong base currency is refused.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 03:08:03 -07:00
..