FAILURE MAP
← Case archive

FA-58486 / Loan amortization schedules / Open access

Payment application waterfall: threshold boundary · case 01

A payment exactly equal to the threshold is parked in suspense.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The threshold test is inclusive.

THE FAILURE

The threshold test is inclusive.

Unsuccessful approach: Testing the new payment alone ignores suspense funds that complete the threshold.

Case contract

x = {'due': {'interest', 'principal', 'late_fee', 'fees'}, 'payment', 'suspense', 'threshold', 'balance'}. Available = payment + suspense. If available < threshold, everything goes to suspense and nothing is applied. Otherwise apply in order interest, principal, late_fee, fees, then curtail principal with the remainder up to balance - applied principal; the rest is refunded. Return {'applied', 'curtailment', 'refund', 'suspense', 'new_balance'}.

Why this case matters

Amortization engines drive borrower statements, payoff quotes and investor remittances; a misplaced rounding step, boundary or ordering rule compounds across hundreds of periods.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    avail = x['payment'] + x['suspense']
    applied = {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 0}
    if avail <= x['threshold']:
        return {'applied': applied, 'curtailment': 0, 'refund': 0, 'suspense': avail, 'new_balance': x['balance']}
    for k in ('interest', 'principal', 'late_fee', 'fees'):
        take = min(avail, x['due'][k])
        applied[k] = take
        avail -= take
    room = x['balance'] - applied['principal']
    curt = min(avail, room)
    refund = avail - curt
    return {'applied': applied, 'curtailment': curt, 'refund': refund, 'suspense': 0, 'new_balance': x['balance'] - applied['principal'] - curt}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: threshold boundary', {'due': {'interest': 500, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'payment': 300, 'suspense': 700, 'threshold': 1000, 'balance': 5000}, {'applied': {'interest': 500, 'principal': 500, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 4500}], ['control 1', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'payment': 300, 'suspense': 0, 'threshold': 1250, 'balance': 800}, {'applied': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 300, 'new_balance': 800}], ['control 2', {'due': {'interest': 1250, 'principal': 800, 'late_fee': 150, 'fees': 0}, 'payment': 7200, 'suspense': 200, 'threshold': 1250, 'balance': 2000}, {'applied': {'interest': 1250, 'principal': 800, 'late_fee': 150, 'fees': 0}, 'curtailment': 1200, 'refund': 4000, 'suspense': 0, 'new_balance': 0}], ['control 3', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'payment': 0, 'suspense': 0, 'threshold': 1000, 'balance': 800}, {'applied': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 800}], ['control 4', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'payment': 1250, 'suspense': 700, 'threshold': 1250, 'balance': 100000}, {'applied': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 700, 'refund': 0, 'suspense': 0, 'new_balance': 99300}], ['control 5', {'due': {'interest': 500, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'payment': 300, 'suspense': 0, 'threshold': 1300, 'balance': 800}, {'applied': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 300, 'new_balance': 800}], ['control 6', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'payment': 1285, 'suspense': 0, 'threshold': 1000, 'balance': 2000}, {'applied': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 2000}]], [['regression: threshold boundary', {'due': {'interest': 500, 'principal': 2000, 'late_fee': 0, 'fees': 35}, 'payment': 300, 'suspense': 700, 'threshold': 1000, 'balance': 2000}, {'applied': {'interest': 500, 'principal': 500, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 1500}], ['control 1', {'due': {'interest': 500, 'principal': 2000, 'late_fee': 0, 'fees': 35}, 'payment': 2500, 'suspense': 200, 'threshold': 0, 'balance': 5000}, {'applied': {'interest': 500, 'principal': 2000, 'late_fee': 0, 'fees': 35}, 'curtailment': 165, 'refund': 0, 'suspense': 0, 'new_balance': 2835}], ['control 2', {'due': {'interest': 0, 'principal': 800, 'late_fee': 150, 'fees': 0}, 'payment': 2500, 'suspense': 0, 'threshold': 950, 'balance': 2000}, {'applied': {'interest': 0, 'principal': 800, 'late_fee': 150, 'fees': 0}, 'curtailment': 1200, 'refund': 350, 'suspense': 0, 'new_balance': 0}], ['control 3', {'due': {'interest': 1250, 'principal': 800, 'late_fee': 150, 'fees': 0}, 'payment': 2201, 'suspense': 200, 'threshold': 1250, 'balance': 5000}, {'applied': {'interest': 1250, 'principal': 800, 'late_fee': 150, 'fees': 0}, 'curtailment': 201, 'refund': 0, 'suspense': 0, 'new_balance': 3999}], ['control 4', {'due': {'interest': 500, 'principal': 0, 'late_fee': 150, 'fees': 0}, 'payment': 649, 'suspense': 0, 'threshold': 650, 'balance': 100000}, {'applied': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 649, 'new_balance': 100000}], ['control 5', {'due': {'interest': 0, 'principal': 800, 'late_fee': 150, 'fees': 0}, 'payment': 2500, 'suspense': 0, 'threshold': 0, 'balance': 800}, {'applied': {'interest': 0, 'principal': 800, 'late_fee': 150, 'fees': 0}, 'curtailment': 0, 'refund': 1550, 'suspense': 0, 'new_balance': 0}], ['control 6', {'due': {'interest': 500, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'payment': 1000, 'suspense': 0, 'threshold': 535, 'balance': 2000}, {'applied': {'interest': 500, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'curtailment': 465, 'refund': 0, 'suspense': 0, 'new_balance': 1535}]], [['regression: threshold boundary', {'due': {'interest': 0, 'principal': 2000, 'late_fee': 0, 'fees': 0}, 'payment': 1000, 'suspense': 0, 'threshold': 1000, 'balance': 5000}, {'applied': {'interest': 0, 'principal': 1000, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 4000}], ['regression: threshold boundary, partial-repair probe', {'due': {'interest': 500, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'payment': 499, 'suspense': 200, 'threshold': 500, 'balance': 2000}, {'applied': {'interest': 500, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 199, 'refund': 0, 'suspense': 0, 'new_balance': 1801}], ['control 1', {'due': {'interest': 0, 'principal': 2000, 'late_fee': 150, 'fees': 0}, 'payment': 300, 'suspense': 700, 'threshold': 0, 'balance': 800}, {'applied': {'interest': 0, 'principal': 1000, 'late_fee': 0, 'fees': 0}, 'curtailment': -200, 'refund': 200, 'suspense': 0, 'new_balance': 0}], ['control 2', {'due': {'interest': 0, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'payment': 5800, 'suspense': 0, 'threshold': 800, 'balance': 100000}, {'applied': {'interest': 0, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'curtailment': 5000, 'refund': 0, 'suspense': 0, 'new_balance': 94200}], ['control 3', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'payment': 0, 'suspense': 200, 'threshold': 1000, 'balance': 800}, {'applied': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 200, 'new_balance': 800}], ['control 4', {'due': {'interest': 500, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'payment': 1000, 'suspense': 200, 'threshold': 0, 'balance': 5000}, {'applied': {'interest': 500, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 700, 'refund': 0, 'suspense': 0, 'new_balance': 4300}], ['control 5', {'due': {'interest': 1250, 'principal': 800, 'late_fee': 0, 'fees': 35}, 'payment': 2084, 'suspense': 0, 'threshold': 1000, 'balance': 2000}, {'applied': {'interest': 1250, 'principal': 800, 'late_fee': 0, 'fees': 34}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 1200}]], [['regression: threshold boundary', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 150, 'fees': 0}, 'payment': 1000, 'suspense': 0, 'threshold': 1000, 'balance': 2000}, {'applied': {'interest': 1000, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 2000}], ['regression: threshold boundary, partial-repair probe', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'payment': 1249, 'suspense': 700, 'threshold': 1250, 'balance': 5000}, {'applied': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 699, 'refund': 0, 'suspense': 0, 'new_balance': 4301}], ['control 1', {'due': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'payment': 36, 'suspense': 700, 'threshold': 35, 'balance': 800}, {'applied': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'curtailment': 701, 'refund': 0, 'suspense': 0, 'new_balance': 99}], ['control 2', {'due': {'interest': 0, 'principal': 2000, 'late_fee': 150, 'fees': 0}, 'payment': 1000, 'suspense': 700, 'threshold': 1000, 'balance': 5000}, {'applied': {'interest': 0, 'principal': 1700, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 3300}], ['control 3', {'due': {'interest': 0, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'payment': 5800, 'suspense': 200, 'threshold': 1000, 'balance': 5000}, {'applied': {'interest': 0, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'curtailment': 4200, 'refund': 1000, 'suspense': 0, 'new_balance': 0}], ['control 4', {'due': {'interest': 1250, 'principal': 2000, 'late_fee': 0, 'fees': 0}, 'payment': 8250, 'suspense': 200, 'threshold': 3250, 'balance': 800}, {'applied': {'interest': 1250, 'principal': 2000, 'late_fee': 0, 'fees': 0}, 'curtailment': -1200, 'refund': 6400, 'suspense': 0, 'new_balance': 0}], ['control 5', {'due': {'interest': 500, 'principal': 2000, 'late_fee': 0, 'fees': 0}, 'payment': 1000, 'suspense': 200, 'threshold': 1000, 'balance': 800}, {'applied': {'interest': 500, 'principal': 700, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 100}]], [['regression: threshold boundary', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'payment': 1000, 'suspense': 0, 'threshold': 1000, 'balance': 2000}, {'applied': {'interest': 1000, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 2000}], ['regression: threshold boundary, partial-repair probe', {'due': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'payment': -1, 'suspense': 200, 'threshold': 0, 'balance': 2000}, {'applied': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 199, 'refund': 0, 'suspense': 0, 'new_balance': 1801}], ['control 1', {'due': {'interest': 500, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'payment': 1300, 'suspense': 0, 'threshold': 1000, 'balance': 800}, {'applied': {'interest': 500, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 0}], ['control 2', {'due': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'payment': 300, 'suspense': 700, 'threshold': 0, 'balance': 800}, {'applied': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'curtailment': 800, 'refund': 165, 'suspense': 0, 'new_balance': 0}], ['control 3', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 150, 'fees': 0}, 'payment': 300, 'suspense': 0, 'threshold': 0, 'balance': 100000}, {'applied': {'interest': 300, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 100000}], ['control 4', {'due': {'interest': 1250, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'payment': 2051, 'suspense': 200, 'threshold': 2050, 'balance': 100000}, {'applied': {'interest': 1250, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'curtailment': 201, 'refund': 0, 'suspense': 0, 'new_balance': 98999}], ['control 5', {'due': {'interest': 500, 'principal': 0, 'late_fee': 150, 'fees': 0}, 'payment': 2500, 'suspense': 0, 'threshold': 0, 'balance': 2000}, {'applied': {'interest': 500, 'principal': 0, 'late_fee': 150, 'fees': 0}, 'curtailment': 1850, 'refund': 0, 'suspense': 0, 'new_balance': 150}]]]
for label, args, expected in fixtures[N-1]:
    try:
        actual = solve(args)
    except Exception as exc:
        actual = 'raised ' + type(exc).__name__
    check(label, actual, expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: threshold boundary{'applied': {'fees': 0, 'interest': 0, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 5000, 'refund': 0, 'suspense': 1000}{'applied': {'fees': 0, 'interest': 500, 'late_fee': 0, 'principal': 500}, 'curtailment': 0, 'new_balance': 4500, 'refund': 0, 'suspense': 0}Failed
control 1{'applied': {'fees': 0, 'interest': 0, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 800, 'refund': 0, 'suspense': 300}{'applied': {'fees': 0, 'interest': 0, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 800, 'refund': 0, 'suspense': 300}Passed
control 2{'applied': {'fees': 0, 'interest': 1250, 'late_fee': 150, 'principal': 800}, 'curtailment': 1200, 'new_balance': 0, 'refund': 4000, 'suspense': 0}{'applied': {'fees': 0, 'interest': 1250, 'late_fee': 150, 'principal': 800}, 'curtailment': 1200, 'new_balance': 0, 'refund': 4000, 'suspense': 0}Passed
control 3{'applied': {'fees': 0, 'interest': 0, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 800, 'refund': 0, 'suspense': 0}{'applied': {'fees': 0, 'interest': 0, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 800, 'refund': 0, 'suspense': 0}Passed
control 4{'applied': {'fees': 0, 'interest': 1250, 'late_fee': 0, 'principal': 0}, 'curtailment': 700, 'new_balance': 99300, 'refund': 0, 'suspense': 0}{'applied': {'fees': 0, 'interest': 1250, 'late_fee': 0, 'principal': 0}, 'curtailment': 700, 'new_balance': 99300, 'refund': 0, 'suspense': 0}Passed
control 5{'applied': {'fees': 0, 'interest': 0, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 800, 'refund': 0, 'suspense': 300}{'applied': {'fees': 0, 'interest': 0, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 800, 'refund': 0, 'suspense': 300}Passed
control 6{'applied': {'fees': 35, 'interest': 1250, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 2000, 'refund': 0, 'suspense': 0}{'applied': {'fees': 35, 'interest': 1250, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 2000, 'refund': 0, 'suspense': 0}Passed

SHA-256 / fdae9846548b3a6a5acfe98482523da188dfb86dca08c0f0d328008dacde6550

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    avail = x['payment'] + x['suspense']
    applied = {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 0}
    if x['payment'] < x['threshold']:
        return {'applied': applied, 'curtailment': 0, 'refund': 0, 'suspense': avail, 'new_balance': x['balance']}
    for k in ('interest', 'principal', 'late_fee', 'fees'):
        take = min(avail, x['due'][k])
        applied[k] = take
        avail -= take
    room = x['balance'] - applied['principal']
    curt = min(avail, room)
    refund = avail - curt
    return {'applied': applied, 'curtailment': curt, 'refund': refund, 'suspense': 0, 'new_balance': x['balance'] - applied['principal'] - curt}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: threshold boundary', {'due': {'interest': 500, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'payment': 300, 'suspense': 700, 'threshold': 1000, 'balance': 5000}, {'applied': {'interest': 500, 'principal': 500, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 4500}], ['control 1', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'payment': 300, 'suspense': 0, 'threshold': 1250, 'balance': 800}, {'applied': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 300, 'new_balance': 800}], ['control 2', {'due': {'interest': 1250, 'principal': 800, 'late_fee': 150, 'fees': 0}, 'payment': 7200, 'suspense': 200, 'threshold': 1250, 'balance': 2000}, {'applied': {'interest': 1250, 'principal': 800, 'late_fee': 150, 'fees': 0}, 'curtailment': 1200, 'refund': 4000, 'suspense': 0, 'new_balance': 0}], ['control 3', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'payment': 0, 'suspense': 0, 'threshold': 1000, 'balance': 800}, {'applied': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 800}], ['control 4', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'payment': 1250, 'suspense': 700, 'threshold': 1250, 'balance': 100000}, {'applied': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 700, 'refund': 0, 'suspense': 0, 'new_balance': 99300}], ['control 5', {'due': {'interest': 500, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'payment': 300, 'suspense': 0, 'threshold': 1300, 'balance': 800}, {'applied': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 300, 'new_balance': 800}], ['control 6', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'payment': 1285, 'suspense': 0, 'threshold': 1000, 'balance': 2000}, {'applied': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 2000}]], [['regression: threshold boundary', {'due': {'interest': 500, 'principal': 2000, 'late_fee': 0, 'fees': 35}, 'payment': 300, 'suspense': 700, 'threshold': 1000, 'balance': 2000}, {'applied': {'interest': 500, 'principal': 500, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 1500}], ['control 1', {'due': {'interest': 500, 'principal': 2000, 'late_fee': 0, 'fees': 35}, 'payment': 2500, 'suspense': 200, 'threshold': 0, 'balance': 5000}, {'applied': {'interest': 500, 'principal': 2000, 'late_fee': 0, 'fees': 35}, 'curtailment': 165, 'refund': 0, 'suspense': 0, 'new_balance': 2835}], ['control 2', {'due': {'interest': 0, 'principal': 800, 'late_fee': 150, 'fees': 0}, 'payment': 2500, 'suspense': 0, 'threshold': 950, 'balance': 2000}, {'applied': {'interest': 0, 'principal': 800, 'late_fee': 150, 'fees': 0}, 'curtailment': 1200, 'refund': 350, 'suspense': 0, 'new_balance': 0}], ['control 3', {'due': {'interest': 1250, 'principal': 800, 'late_fee': 150, 'fees': 0}, 'payment': 2201, 'suspense': 200, 'threshold': 1250, 'balance': 5000}, {'applied': {'interest': 1250, 'principal': 800, 'late_fee': 150, 'fees': 0}, 'curtailment': 201, 'refund': 0, 'suspense': 0, 'new_balance': 3999}], ['control 4', {'due': {'interest': 500, 'principal': 0, 'late_fee': 150, 'fees': 0}, 'payment': 649, 'suspense': 0, 'threshold': 650, 'balance': 100000}, {'applied': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 649, 'new_balance': 100000}], ['control 5', {'due': {'interest': 0, 'principal': 800, 'late_fee': 150, 'fees': 0}, 'payment': 2500, 'suspense': 0, 'threshold': 0, 'balance': 800}, {'applied': {'interest': 0, 'principal': 800, 'late_fee': 150, 'fees': 0}, 'curtailment': 0, 'refund': 1550, 'suspense': 0, 'new_balance': 0}], ['control 6', {'due': {'interest': 500, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'payment': 1000, 'suspense': 0, 'threshold': 535, 'balance': 2000}, {'applied': {'interest': 500, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'curtailment': 465, 'refund': 0, 'suspense': 0, 'new_balance': 1535}]], [['regression: threshold boundary', {'due': {'interest': 0, 'principal': 2000, 'late_fee': 0, 'fees': 0}, 'payment': 1000, 'suspense': 0, 'threshold': 1000, 'balance': 5000}, {'applied': {'interest': 0, 'principal': 1000, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 4000}], ['regression: threshold boundary, partial-repair probe', {'due': {'interest': 500, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'payment': 499, 'suspense': 200, 'threshold': 500, 'balance': 2000}, {'applied': {'interest': 500, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 199, 'refund': 0, 'suspense': 0, 'new_balance': 1801}], ['control 1', {'due': {'interest': 0, 'principal': 2000, 'late_fee': 150, 'fees': 0}, 'payment': 300, 'suspense': 700, 'threshold': 0, 'balance': 800}, {'applied': {'interest': 0, 'principal': 1000, 'late_fee': 0, 'fees': 0}, 'curtailment': -200, 'refund': 200, 'suspense': 0, 'new_balance': 0}], ['control 2', {'due': {'interest': 0, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'payment': 5800, 'suspense': 0, 'threshold': 800, 'balance': 100000}, {'applied': {'interest': 0, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'curtailment': 5000, 'refund': 0, 'suspense': 0, 'new_balance': 94200}], ['control 3', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'payment': 0, 'suspense': 200, 'threshold': 1000, 'balance': 800}, {'applied': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 200, 'new_balance': 800}], ['control 4', {'due': {'interest': 500, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'payment': 1000, 'suspense': 200, 'threshold': 0, 'balance': 5000}, {'applied': {'interest': 500, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 700, 'refund': 0, 'suspense': 0, 'new_balance': 4300}], ['control 5', {'due': {'interest': 1250, 'principal': 800, 'late_fee': 0, 'fees': 35}, 'payment': 2084, 'suspense': 0, 'threshold': 1000, 'balance': 2000}, {'applied': {'interest': 1250, 'principal': 800, 'late_fee': 0, 'fees': 34}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 1200}]], [['regression: threshold boundary', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 150, 'fees': 0}, 'payment': 1000, 'suspense': 0, 'threshold': 1000, 'balance': 2000}, {'applied': {'interest': 1000, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 2000}], ['regression: threshold boundary, partial-repair probe', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'payment': 1249, 'suspense': 700, 'threshold': 1250, 'balance': 5000}, {'applied': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 699, 'refund': 0, 'suspense': 0, 'new_balance': 4301}], ['control 1', {'due': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'payment': 36, 'suspense': 700, 'threshold': 35, 'balance': 800}, {'applied': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'curtailment': 701, 'refund': 0, 'suspense': 0, 'new_balance': 99}], ['control 2', {'due': {'interest': 0, 'principal': 2000, 'late_fee': 150, 'fees': 0}, 'payment': 1000, 'suspense': 700, 'threshold': 1000, 'balance': 5000}, {'applied': {'interest': 0, 'principal': 1700, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 3300}], ['control 3', {'due': {'interest': 0, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'payment': 5800, 'suspense': 200, 'threshold': 1000, 'balance': 5000}, {'applied': {'interest': 0, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'curtailment': 4200, 'refund': 1000, 'suspense': 0, 'new_balance': 0}], ['control 4', {'due': {'interest': 1250, 'principal': 2000, 'late_fee': 0, 'fees': 0}, 'payment': 8250, 'suspense': 200, 'threshold': 3250, 'balance': 800}, {'applied': {'interest': 1250, 'principal': 2000, 'late_fee': 0, 'fees': 0}, 'curtailment': -1200, 'refund': 6400, 'suspense': 0, 'new_balance': 0}], ['control 5', {'due': {'interest': 500, 'principal': 2000, 'late_fee': 0, 'fees': 0}, 'payment': 1000, 'suspense': 200, 'threshold': 1000, 'balance': 800}, {'applied': {'interest': 500, 'principal': 700, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 100}]], [['regression: threshold boundary', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'payment': 1000, 'suspense': 0, 'threshold': 1000, 'balance': 2000}, {'applied': {'interest': 1000, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 2000}], ['regression: threshold boundary, partial-repair probe', {'due': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'payment': -1, 'suspense': 200, 'threshold': 0, 'balance': 2000}, {'applied': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 199, 'refund': 0, 'suspense': 0, 'new_balance': 1801}], ['control 1', {'due': {'interest': 500, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'payment': 1300, 'suspense': 0, 'threshold': 1000, 'balance': 800}, {'applied': {'interest': 500, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 0}], ['control 2', {'due': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'payment': 300, 'suspense': 700, 'threshold': 0, 'balance': 800}, {'applied': {'interest': 0, 'principal': 0, 'late_fee': 0, 'fees': 35}, 'curtailment': 800, 'refund': 165, 'suspense': 0, 'new_balance': 0}], ['control 3', {'due': {'interest': 1250, 'principal': 0, 'late_fee': 150, 'fees': 0}, 'payment': 300, 'suspense': 0, 'threshold': 0, 'balance': 100000}, {'applied': {'interest': 300, 'principal': 0, 'late_fee': 0, 'fees': 0}, 'curtailment': 0, 'refund': 0, 'suspense': 0, 'new_balance': 100000}], ['control 4', {'due': {'interest': 1250, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'payment': 2051, 'suspense': 200, 'threshold': 2050, 'balance': 100000}, {'applied': {'interest': 1250, 'principal': 800, 'late_fee': 0, 'fees': 0}, 'curtailment': 201, 'refund': 0, 'suspense': 0, 'new_balance': 98999}], ['control 5', {'due': {'interest': 500, 'principal': 0, 'late_fee': 150, 'fees': 0}, 'payment': 2500, 'suspense': 0, 'threshold': 0, 'balance': 2000}, {'applied': {'interest': 500, 'principal': 0, 'late_fee': 150, 'fees': 0}, 'curtailment': 1850, 'refund': 0, 'suspense': 0, 'new_balance': 150}]]]
for label, args, expected in fixtures[N-1]:
    try:
        actual = solve(args)
    except Exception as exc:
        actual = 'raised ' + type(exc).__name__
    check(label, actual, expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: threshold boundary{'applied': {'fees': 0, 'interest': 0, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 5000, 'refund': 0, 'suspense': 1000}{'applied': {'fees': 0, 'interest': 500, 'late_fee': 0, 'principal': 500}, 'curtailment': 0, 'new_balance': 4500, 'refund': 0, 'suspense': 0}Failed
control 1{'applied': {'fees': 0, 'interest': 0, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 800, 'refund': 0, 'suspense': 300}{'applied': {'fees': 0, 'interest': 0, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 800, 'refund': 0, 'suspense': 300}Passed
control 2{'applied': {'fees': 0, 'interest': 1250, 'late_fee': 150, 'principal': 800}, 'curtailment': 1200, 'new_balance': 0, 'refund': 4000, 'suspense': 0}{'applied': {'fees': 0, 'interest': 1250, 'late_fee': 150, 'principal': 800}, 'curtailment': 1200, 'new_balance': 0, 'refund': 4000, 'suspense': 0}Passed
control 3{'applied': {'fees': 0, 'interest': 0, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 800, 'refund': 0, 'suspense': 0}{'applied': {'fees': 0, 'interest': 0, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 800, 'refund': 0, 'suspense': 0}Passed
control 4{'applied': {'fees': 0, 'interest': 1250, 'late_fee': 0, 'principal': 0}, 'curtailment': 700, 'new_balance': 99300, 'refund': 0, 'suspense': 0}{'applied': {'fees': 0, 'interest': 1250, 'late_fee': 0, 'principal': 0}, 'curtailment': 700, 'new_balance': 99300, 'refund': 0, 'suspense': 0}Passed
control 5{'applied': {'fees': 0, 'interest': 0, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 800, 'refund': 0, 'suspense': 300}{'applied': {'fees': 0, 'interest': 0, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 800, 'refund': 0, 'suspense': 300}Passed
control 6{'applied': {'fees': 35, 'interest': 1250, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 2000, 'refund': 0, 'suspense': 0}{'applied': {'fees': 35, 'interest': 1250, 'late_fee': 0, 'principal': 0}, 'curtailment': 0, 'new_balance': 2000, 'refund': 0, 'suspense': 0}Passed

SHA-256 / 243798f645db57aa3b51ffef39fc2a43391625211b9c20c875130798748c01d8

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

A deterministic bounded teaching model with stipulated toy lending rules stated in the contract; money is integer cents and rates are basis points; it makes no claim of conformance to any regulation, servicing standard or product. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:46:27.219644+00:00.

Case digest / 648a88d2be311dd93def4d00d80b78490581bfc1f546c490726781a3fcb84aa5