FA-58123 / Double-entry ledger accounting / Member archive
Aging-based allowance adjustment: not-yet-due aging · case 03
Invoices due next month are reserved as if already delinquent.
Case contract
x = {'as_of': day, 'invoices': [[id, due_day, open cents]], 'rates': [[max_days_past_due or None, basis points]] ascending, 'allowance': existing credit balance (negative = debit balance), 'writeoffs': ids}. Written-off invoices leave receivables and reduce the allowance by their amount. Days past due = max(0, as_of - due); an invoice goes in the first bucket whose limit is None or >= days. Required allowance = sum over buckets of bucket total * bp / 10000 rounded half-up per bucket. Return {'buckets', 'required', 'adjustment': required - allowance after write-offs, 'net_ar'}.
Why this case matters
Ledger software must keep debits equal to credits and apply normal-balance, period and cutoff rules exactly; small sign or boundary slips silently misstate financial statements.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: not-yet-due aging | {"adjustment": 1759, "buckets": [0, 150, 5, 4000, 0], "net_ar": 2546, "required": 1609} | {"adjustment": 1753, "buckets": [150, 0, 5, 4000, 0], "net_ar": 2552, "required": 1603} | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗