fix(core): payments never predate their documents; aging as of a date; refusals leave no draft
Three spec decisions from Stephen (2026-10-13), raised by the spec-blind test writers, each test-first: - A payment dated before its invoice or bill is refused (PaymentBeforeDocument); a real prepayment is a deposit. Test: a_payment_never_predates_its_document. Replay is unaffected (it goes through replay_invoice_payment / replay_bill_payment). - Aging as of a date shows only documents issued by then, less only the payments made by then. The ledger now records each document's payment entries (live and on replay), and aging counts those dated by as_of. Test: aging_as_of_a_date_sees_only_what_existed_then; the A/R and A/P conservation properties' aging oracles updated to the confirmed rule (they had assumed aging ignored dates). - A schedule through a mid-month date prorates that month by days; the code was right and its doc wrong. The spec-blind test that disagreed is rewritten to the confirmed spec and no longer ignored. Also found while wiring payments: a payment to an unknown cash account created the payment's draft and then failed, leaving it behind; the cash account is now checked before anything is created. The unreviewed golden van_schedule.json is gone: every row was first checked against an independent hand computation (all 61 matched), then replaced by van_schedule_is_the_hand_computed_one, which asserts that computation directly (548.39, 59 x 1,000.00, 451.61; total 60,000.00). Tests: 452. No spec-disagreements left ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GWVo7x3UHw5kwCUaWxiejX
This commit is contained in:
1 parent
cece4c4554
commit
c9810ea0a3
8 files changed
+211
-393
No files matched your search
@@ -285,16 +285,17 @@ fn full_months_each_take_one_twelfth_b15() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Oracle: interface doc "through the month containing `through`": through
|
||||
/// 2026-06-15 covers Jan..Jun.
|
||||
/// Oracle: depreciation_schedule SCENARIO 1 (DECISION, Stephen 2026-10-13,
|
||||
/// resolving this test's original disagreement in favor of the code): a
|
||||
/// schedule through 2026-06-15 prorates June by days: 15/30 of 1,000.
|
||||
#[test]
|
||||
#[ignore = "SPEC-DISAGREEMENT: schedule through 2026-06-15 prorates June to 500.00 (acc 5500.00), doc says through the month containing it (acc 6000.00)"]
|
||||
fn schedule_runs_through_month_containing_through_date() {
|
||||
fn schedule_through_a_mid_month_date_prorates_that_month_by_days() {
|
||||
let a = asset("12000.00", "0.00", 12, date(2026, 1, 1));
|
||||
let s = depreciation_schedule(&a, date(2026, 6, 15));
|
||||
assert_eq!(s.len(), 6);
|
||||
assert_eq!(s.last().unwrap().period, "2026-06");
|
||||
assert_eq!(s.last().unwrap().accumulated, d("6000.00"));
|
||||
assert_eq!(s.last().unwrap().amount, d("500.00"));
|
||||
assert_eq!(s.last().unwrap().accumulated, d("5500.00"));
|
||||
}
|
||||
|
||||
/// Oracle: interface doc "clamped to the depreciation end": a schedule asked
|
||||
|
||||
Reference in new issue
Block a user