FAILURE MAP
← Case archive

FA-58134 / Double-entry ledger accounting / Member archive

Aging-based allowance adjustment: write-off exclusion · case 04

Written-off invoices are still aged and reserved.

Member previewVariant 4 · 3 implementations · 7 checks per implementation

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 fixture

This sample comes from the broken implementation of a controlled reproducer.

Boundary fixtureActualExpectedOutcome
regression: write-off exclusion{"adjustment": 1040, "buckets": [2650, 1150, 483, 1000, 0], "net_ar": 4726, "required": 557}{"adjustment": 968, "buckets": [2650, 1150, 0, 1000, 0], "net_ar": 4315, "required": 485}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 ↗