FA-58148 / Double-entry ledger accounting / Member archive
Aging-based allowance adjustment: net receivable base · case 03
Net receivables use the pre-adjustment allowance.
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: net receivable base | {"adjustment": -2, "buckets": [0, 6505, 150, 0, 0], "net_ar": 6305, "required": 348} | {"adjustment": -2, "buckets": [0, 6505, 150, 0, 0], "net_ar": 6307, "required": 348} | 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 ↗