FAILURE MAP
← Case archive

FA-58396 / Loan amortization schedules / Open access

Schedule rows from a fixed payment: balloon amount · case 01

The reported balloon includes another month of interest.

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

ROOT CAUSE

The remaining principal is grossed up with next-month interest.

THE FAILURE

The remaining principal is grossed up with next-month interest.

Unsuccessful approach: Folding small remainders to zero hides principal still owed.

Case contract

x = {'principal', 'rate_bp', 'payment', 'max_months'}. For months 1..max_months while the balance is positive: interest = round_half_up(balance*bp/120000); if payment <= interest return {'error': 'negative_amortization', 'month': k}; principal paid = min(payment - interest, balance); append [k, interest, principal, balance after]. Return {'rows', 'balloon': remaining principal}.

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
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    def rnd(n, d):
        q, r = divmod(n, d)
        return q + (1 if 2 * r >= d else 0)
    bal = x['principal']
    rows = []
    for k in range(1, x['max_months'] + 1):
        if bal == 0:
            break
        interest = rnd(bal * x['rate_bp'], 120000)
        pay = x['payment']
        if pay <= interest:
            return {'error': 'negative_amortization', 'month': k}
        princ = min(pay - interest, bal)
        bal -= princ
        rows.append([k, interest, princ, bal])
    return {'rows': rows, 'balloon': bal + rnd(bal * x['rate_bp'], 120000)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: balloon amount', {'principal': 250000, 'rate_bp': 1999, 'payment': 5000, 'max_months': 24}, {'rows': [[1, 4165, 835, 249165], [2, 4151, 849, 248316], [3, 4137, 863, 247453], [4, 4122, 878, 246575], [5, 4108, 892, 245683], [6, 4093, 907, 244776], [7, 4078, 922, 243854], [8, 4062, 938, 242916], [9, 4047, 953, 241963], [10, 4031, 969, 240994], [11, 4015, 985, 240009], [12, 3998, 1002, 239007], [13, 3981, 1019, 237988], [14, 3964, 1036, 236952], [15, 3947, 1053, 235899], [16, 3930, 1070, 234829], [17, 3912, 1088, 233741], [18, 3894, 1106, 232635], [19, 3875, 1125, 231510], [20, 3857, 1143, 230367], [21, 3838, 1162, 229205], [22, 3818, 1182, 228023], [23, 3798, 1202, 226821], [24, 3778, 1222, 225599]], 'balloon': 225599}], ['regression: balloon amount, partial-repair probe', {'principal': 1000, 'rate_bp': 2400, 'payment': 333, 'max_months': 3}, {'rows': [[1, 20, 313, 687], [2, 14, 319, 368], [3, 7, 326, 42]], 'balloon': 42}], ['control 1', {'principal': 250000, 'rate_bp': 0, 'payment': 500, 'max_months': 1}, {'rows': [[1, 0, 500, 249500]], 'balloon': 249500}], ['control 2', {'principal': 250000, 'rate_bp': 1999, 'payment': 500, 'max_months': 24}, {'error': 'negative_amortization', 'month': 1}], ['control 3', {'principal': 100000, 'rate_bp': 2400, 'payment': 20007, 'max_months': 12}, {'rows': [[1, 2000, 18007, 81993], [2, 1640, 18367, 63626], [3, 1273, 18734, 44892], [4, 898, 19109, 25783], [5, 516, 19491, 6292], [6, 126, 6292, 0]], 'balloon': 0}], ['control 4', {'principal': 250000, 'rate_bp': 1200, 'payment': 500, 'max_months': 12}, {'error': 'negative_amortization', 'month': 1}], ['control 5', {'principal': 250000, 'rate_bp': 2400, 'payment': 50007, 'max_months': 6}, {'rows': [[1, 5000, 45007, 204993], [2, 4100, 45907, 159086], [3, 3182, 46825, 112261], [4, 2245, 47762, 64499], [5, 1290, 48717, 15782], [6, 316, 15782, 0]], 'balloon': 0}]], [['regression: balloon amount', {'principal': 100000, 'rate_bp': 600, 'payment': 20007, 'max_months': 1}, {'rows': [[1, 500, 19507, 80493]], 'balloon': 80493}], ['regression: balloon amount, partial-repair probe', {'principal': 50000, 'rate_bp': 1999, 'payment': 50050, 'max_months': 1}, {'rows': [[1, 833, 49217, 783]], 'balloon': 783}], ['control 1', {'principal': 100000, 'rate_bp': 0, 'payment': 20007, 'max_months': 3}, {'rows': [[1, 0, 20007, 79993], [2, 0, 20007, 59986], [3, 0, 20007, 39979]], 'balloon': 39979}], ['control 2', {'principal': 1000, 'rate_bp': 0, 'payment': 1000, 'max_months': 0}, {'rows': [], 'balloon': 1000}], ['control 3', {'principal': 50000, 'rate_bp': 0, 'payment': 1000, 'max_months': 3}, {'rows': [[1, 0, 1000, 49000], [2, 0, 1000, 48000], [3, 0, 1000, 47000]], 'balloon': 47000}], ['control 4', {'principal': 250000, 'rate_bp': 2400, 'payment': 500, 'max_months': 12}, {'error': 'negative_amortization', 'month': 1}], ['control 5', {'principal': 50000, 'rate_bp': 0, 'payment': 16666, 'max_months': 24}, {'rows': [[1, 0, 16666, 33334], [2, 0, 16666, 16668], [3, 0, 16666, 2], [4, 0, 2, 0]], 'balloon': 0}]], [['regression: balloon amount', {'principal': 50000, 'rate_bp': 2400, 'payment': 5000, 'max_months': 3}, {'rows': [[1, 1000, 4000, 46000], [2, 920, 4080, 41920], [3, 838, 4162, 37758]], 'balloon': 37758}], ['regression: balloon amount, partial-repair probe', {'principal': 1000, 'rate_bp': 2400, 'payment': 1050, 'max_months': 0}, {'rows': [], 'balloon': 1000}], ['control 1', {'principal': 12345, 'rate_bp': 0, 'payment': 4115, 'max_months': 24}, {'rows': [[1, 0, 4115, 8230], [2, 0, 4115, 4115], [3, 0, 4115, 0]], 'balloon': 0}], ['control 2', {'principal': 12345, 'rate_bp': 0, 'payment': 4115, 'max_months': 1}, {'rows': [[1, 0, 4115, 8230]], 'balloon': 8230}], ['control 3', {'principal': 50000, 'rate_bp': 1200, 'payment': 5000, 'max_months': 24}, {'rows': [[1, 500, 4500, 45500], [2, 455, 4545, 40955], [3, 410, 4590, 36365], [4, 364, 4636, 31729], [5, 317, 4683, 27046], [6, 270, 4730, 22316], [7, 223, 4777, 17539], [8, 175, 4825, 12714], [9, 127, 4873, 7841], [10, 78, 4922, 2919], [11, 29, 2919, 0]], 'balloon': 0}], ['control 4', {'principal': 250000, 'rate_bp': 600, 'payment': 1000, 'max_months': 3}, {'error': 'negative_amortization', 'month': 1}], ['control 5', {'principal': 50000, 'rate_bp': 1200, 'payment': 16666, 'max_months': 6}, {'rows': [[1, 500, 16166, 33834], [2, 338, 16328, 17506], [3, 175, 16491, 1015], [4, 10, 1015, 0]], 'balloon': 0}]], [['regression: balloon amount', {'principal': 12345, 'rate_bp': 2400, 'payment': 500, 'max_months': 6}, {'rows': [[1, 247, 253, 12092], [2, 242, 258, 11834], [3, 237, 263, 11571], [4, 231, 269, 11302], [5, 226, 274, 11028], [6, 221, 279, 10749]], 'balloon': 10749}], ['regression: balloon amount, partial-repair probe', {'principal': 250000, 'rate_bp': 1200, 'payment': 250050, 'max_months': 1}, {'rows': [[1, 2500, 247550, 2450]], 'balloon': 2450}], ['control 1', {'principal': 12345, 'rate_bp': 1200, 'payment': 5000, 'max_months': 3}, {'rows': [[1, 123, 4877, 7468], [2, 75, 4925, 2543], [3, 25, 2543, 0]], 'balloon': 0}], ['control 2', {'principal': 12345, 'rate_bp': 0, 'payment': 5000, 'max_months': 6}, {'rows': [[1, 0, 5000, 7345], [2, 0, 5000, 2345], [3, 0, 2345, 0]], 'balloon': 0}], ['control 3', {'principal': 100000, 'rate_bp': 0, 'payment': 8333, 'max_months': 24}, {'rows': [[1, 0, 8333, 91667], [2, 0, 8333, 83334], [3, 0, 8333, 75001], [4, 0, 8333, 66668], [5, 0, 8333, 58335], [6, 0, 8333, 50002], [7, 0, 8333, 41669], [8, 0, 8333, 33336], [9, 0, 8333, 25003], [10, 0, 8333, 16670], [11, 0, 8333, 8337], [12, 0, 8333, 4], [13, 0, 4, 0]], 'balloon': 0}], ['control 4', {'principal': 1000, 'rate_bp': 1200, 'payment': 333, 'max_months': 6}, {'rows': [[1, 10, 323, 677], [2, 7, 326, 351], [3, 4, 329, 22], [4, 0, 22, 0]], 'balloon': 0}], ['control 5', {'principal': 1000, 'rate_bp': 1999, 'payment': 5000, 'max_months': 24}, {'rows': [[1, 17, 1000, 0]], 'balloon': 0}]], [['regression: balloon amount', {'principal': 12345, 'rate_bp': 2400, 'payment': 2476, 'max_months': 0}, {'rows': [], 'balloon': 12345}], ['regression: balloon amount, partial-repair probe', {'principal': 250000, 'rate_bp': 600, 'payment': 250050, 'max_months': 1}, {'rows': [[1, 1250, 248800, 1200]], 'balloon': 1200}], ['control 1', {'principal': 1000, 'rate_bp': 2400, 'payment': 500, 'max_months': 3}, {'rows': [[1, 20, 480, 520], [2, 10, 490, 30], [3, 1, 30, 0]], 'balloon': 0}], ['control 2', {'principal': 50000, 'rate_bp': 0, 'payment': 10007, 'max_months': 24}, {'rows': [[1, 0, 10007, 39993], [2, 0, 10007, 29986], [3, 0, 10007, 19979], [4, 0, 10007, 9972], [5, 0, 9972, 0]], 'balloon': 0}], ['control 3', {'principal': 12345, 'rate_bp': 600, 'payment': 1200, 'max_months': 12}, {'rows': [[1, 62, 1138, 11207], [2, 56, 1144, 10063], [3, 50, 1150, 8913], [4, 45, 1155, 7758], [5, 39, 1161, 6597], [6, 33, 1167, 5430], [7, 27, 1173, 4257], [8, 21, 1179, 3078], [9, 15, 1185, 1893], [10, 9, 1191, 702], [11, 4, 702, 0]], 'balloon': 0}], ['control 4', {'principal': 100000, 'rate_bp': 0, 'payment': 500, 'max_months': 1}, {'rows': [[1, 0, 500, 99500]], 'balloon': 99500}], ['control 5', {'principal': 100000, 'rate_bp': 1999, 'payment': 33333, 'max_months': 6}, {'rows': [[1, 1666, 31667, 68333], [2, 1138, 32195, 36138], [3, 602, 32731, 3407], [4, 57, 3407, 0]], 'balloon': 0}]]]
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: balloon amount{'balloon': 229357, 'rows': [[1, 4165, 835, 249165], [2, 4151, 849, 248316], [3, 4137, 863, 247453], [4, 4122, 878, 246575], [5, 4108, 892, 245683], [6, 4093, 907, 244776], [7, 4078, 922, 243854], [8, 4062, 938, 242916], [9, 4047, 953, 241963], [10, 4031, 969, 240994], [11, 4015, 985, 240009], [12, 3998, 1002, 239007], [13, 3981, 1019, 237988], [14, 3964, 1036, 236952], [15, 3947, 1053, 235899], [16, 3930, 1070, 234829], [17, 3912, 1088, 233741], [18, 3894, 1106, 232635], [19, 3875, 1125, 231510], [20, 3857, 1143, 230367], [21, 3838, 1162, 229205], [22, 3818, 1182, 228023], [23, 3798, 1202, 226821], [24, 3778, 1222, 225599]]}{'balloon': 225599, 'rows': [[1, 4165, 835, 249165], [2, 4151, 849, 248316], [3, 4137, 863, 247453], [4, 4122, 878, 246575], [5, 4108, 892, 245683], [6, 4093, 907, 244776], [7, 4078, 922, 243854], [8, 4062, 938, 242916], [9, 4047, 953, 241963], [10, 4031, 969, 240994], [11, 4015, 985, 240009], [12, 3998, 1002, 239007], [13, 3981, 1019, 237988], [14, 3964, 1036, 236952], [15, 3947, 1053, 235899], [16, 3930, 1070, 234829], [17, 3912, 1088, 233741], [18, 3894, 1106, 232635], [19, 3875, 1125, 231510], [20, 3857, 1143, 230367], [21, 3838, 1162, 229205], [22, 3818, 1182, 228023], [23, 3798, 1202, 226821], [24, 3778, 1222, 225599]]}Failed
regression: balloon amount, partial-repair probe{'balloon': 43, 'rows': [[1, 20, 313, 687], [2, 14, 319, 368], [3, 7, 326, 42]]}{'balloon': 42, 'rows': [[1, 20, 313, 687], [2, 14, 319, 368], [3, 7, 326, 42]]}Failed
control 1{'balloon': 249500, 'rows': [[1, 0, 500, 249500]]}{'balloon': 249500, 'rows': [[1, 0, 500, 249500]]}Passed
control 2{'error': 'negative_amortization', 'month': 1}{'error': 'negative_amortization', 'month': 1}Passed
control 3{'balloon': 0, 'rows': [[1, 2000, 18007, 81993], [2, 1640, 18367, 63626], [3, 1273, 18734, 44892], [4, 898, 19109, 25783], [5, 516, 19491, 6292], [6, 126, 6292, 0]]}{'balloon': 0, 'rows': [[1, 2000, 18007, 81993], [2, 1640, 18367, 63626], [3, 1273, 18734, 44892], [4, 898, 19109, 25783], [5, 516, 19491, 6292], [6, 126, 6292, 0]]}Passed
control 4{'error': 'negative_amortization', 'month': 1}{'error': 'negative_amortization', 'month': 1}Passed
control 5{'balloon': 0, 'rows': [[1, 5000, 45007, 204993], [2, 4100, 45907, 159086], [3, 3182, 46825, 112261], [4, 2245, 47762, 64499], [5, 1290, 48717, 15782], [6, 316, 15782, 0]]}{'balloon': 0, 'rows': [[1, 5000, 45007, 204993], [2, 4100, 45907, 159086], [3, 3182, 46825, 112261], [4, 2245, 47762, 64499], [5, 1290, 48717, 15782], [6, 316, 15782, 0]]}Passed

SHA-256 / 802c1732c0cc486bb28d515d23bde6fcdd066c51a48a47baffce20b6f60213ab

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    def rnd(n, d):
        q, r = divmod(n, d)
        return q + (1 if 2 * r >= d else 0)
    bal = x['principal']
    rows = []
    for k in range(1, x['max_months'] + 1):
        if bal == 0:
            break
        interest = rnd(bal * x['rate_bp'], 120000)
        pay = x['payment']
        if pay <= interest:
            return {'error': 'negative_amortization', 'month': k}
        princ = min(pay - interest, bal)
        bal -= princ
        rows.append([k, interest, princ, bal])
    return {'rows': rows, 'balloon': 0 if bal < x['payment'] else bal}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: balloon amount', {'principal': 250000, 'rate_bp': 1999, 'payment': 5000, 'max_months': 24}, {'rows': [[1, 4165, 835, 249165], [2, 4151, 849, 248316], [3, 4137, 863, 247453], [4, 4122, 878, 246575], [5, 4108, 892, 245683], [6, 4093, 907, 244776], [7, 4078, 922, 243854], [8, 4062, 938, 242916], [9, 4047, 953, 241963], [10, 4031, 969, 240994], [11, 4015, 985, 240009], [12, 3998, 1002, 239007], [13, 3981, 1019, 237988], [14, 3964, 1036, 236952], [15, 3947, 1053, 235899], [16, 3930, 1070, 234829], [17, 3912, 1088, 233741], [18, 3894, 1106, 232635], [19, 3875, 1125, 231510], [20, 3857, 1143, 230367], [21, 3838, 1162, 229205], [22, 3818, 1182, 228023], [23, 3798, 1202, 226821], [24, 3778, 1222, 225599]], 'balloon': 225599}], ['regression: balloon amount, partial-repair probe', {'principal': 1000, 'rate_bp': 2400, 'payment': 333, 'max_months': 3}, {'rows': [[1, 20, 313, 687], [2, 14, 319, 368], [3, 7, 326, 42]], 'balloon': 42}], ['control 1', {'principal': 250000, 'rate_bp': 0, 'payment': 500, 'max_months': 1}, {'rows': [[1, 0, 500, 249500]], 'balloon': 249500}], ['control 2', {'principal': 250000, 'rate_bp': 1999, 'payment': 500, 'max_months': 24}, {'error': 'negative_amortization', 'month': 1}], ['control 3', {'principal': 100000, 'rate_bp': 2400, 'payment': 20007, 'max_months': 12}, {'rows': [[1, 2000, 18007, 81993], [2, 1640, 18367, 63626], [3, 1273, 18734, 44892], [4, 898, 19109, 25783], [5, 516, 19491, 6292], [6, 126, 6292, 0]], 'balloon': 0}], ['control 4', {'principal': 250000, 'rate_bp': 1200, 'payment': 500, 'max_months': 12}, {'error': 'negative_amortization', 'month': 1}], ['control 5', {'principal': 250000, 'rate_bp': 2400, 'payment': 50007, 'max_months': 6}, {'rows': [[1, 5000, 45007, 204993], [2, 4100, 45907, 159086], [3, 3182, 46825, 112261], [4, 2245, 47762, 64499], [5, 1290, 48717, 15782], [6, 316, 15782, 0]], 'balloon': 0}]], [['regression: balloon amount', {'principal': 100000, 'rate_bp': 600, 'payment': 20007, 'max_months': 1}, {'rows': [[1, 500, 19507, 80493]], 'balloon': 80493}], ['regression: balloon amount, partial-repair probe', {'principal': 50000, 'rate_bp': 1999, 'payment': 50050, 'max_months': 1}, {'rows': [[1, 833, 49217, 783]], 'balloon': 783}], ['control 1', {'principal': 100000, 'rate_bp': 0, 'payment': 20007, 'max_months': 3}, {'rows': [[1, 0, 20007, 79993], [2, 0, 20007, 59986], [3, 0, 20007, 39979]], 'balloon': 39979}], ['control 2', {'principal': 1000, 'rate_bp': 0, 'payment': 1000, 'max_months': 0}, {'rows': [], 'balloon': 1000}], ['control 3', {'principal': 50000, 'rate_bp': 0, 'payment': 1000, 'max_months': 3}, {'rows': [[1, 0, 1000, 49000], [2, 0, 1000, 48000], [3, 0, 1000, 47000]], 'balloon': 47000}], ['control 4', {'principal': 250000, 'rate_bp': 2400, 'payment': 500, 'max_months': 12}, {'error': 'negative_amortization', 'month': 1}], ['control 5', {'principal': 50000, 'rate_bp': 0, 'payment': 16666, 'max_months': 24}, {'rows': [[1, 0, 16666, 33334], [2, 0, 16666, 16668], [3, 0, 16666, 2], [4, 0, 2, 0]], 'balloon': 0}]], [['regression: balloon amount', {'principal': 50000, 'rate_bp': 2400, 'payment': 5000, 'max_months': 3}, {'rows': [[1, 1000, 4000, 46000], [2, 920, 4080, 41920], [3, 838, 4162, 37758]], 'balloon': 37758}], ['regression: balloon amount, partial-repair probe', {'principal': 1000, 'rate_bp': 2400, 'payment': 1050, 'max_months': 0}, {'rows': [], 'balloon': 1000}], ['control 1', {'principal': 12345, 'rate_bp': 0, 'payment': 4115, 'max_months': 24}, {'rows': [[1, 0, 4115, 8230], [2, 0, 4115, 4115], [3, 0, 4115, 0]], 'balloon': 0}], ['control 2', {'principal': 12345, 'rate_bp': 0, 'payment': 4115, 'max_months': 1}, {'rows': [[1, 0, 4115, 8230]], 'balloon': 8230}], ['control 3', {'principal': 50000, 'rate_bp': 1200, 'payment': 5000, 'max_months': 24}, {'rows': [[1, 500, 4500, 45500], [2, 455, 4545, 40955], [3, 410, 4590, 36365], [4, 364, 4636, 31729], [5, 317, 4683, 27046], [6, 270, 4730, 22316], [7, 223, 4777, 17539], [8, 175, 4825, 12714], [9, 127, 4873, 7841], [10, 78, 4922, 2919], [11, 29, 2919, 0]], 'balloon': 0}], ['control 4', {'principal': 250000, 'rate_bp': 600, 'payment': 1000, 'max_months': 3}, {'error': 'negative_amortization', 'month': 1}], ['control 5', {'principal': 50000, 'rate_bp': 1200, 'payment': 16666, 'max_months': 6}, {'rows': [[1, 500, 16166, 33834], [2, 338, 16328, 17506], [3, 175, 16491, 1015], [4, 10, 1015, 0]], 'balloon': 0}]], [['regression: balloon amount', {'principal': 12345, 'rate_bp': 2400, 'payment': 500, 'max_months': 6}, {'rows': [[1, 247, 253, 12092], [2, 242, 258, 11834], [3, 237, 263, 11571], [4, 231, 269, 11302], [5, 226, 274, 11028], [6, 221, 279, 10749]], 'balloon': 10749}], ['regression: balloon amount, partial-repair probe', {'principal': 250000, 'rate_bp': 1200, 'payment': 250050, 'max_months': 1}, {'rows': [[1, 2500, 247550, 2450]], 'balloon': 2450}], ['control 1', {'principal': 12345, 'rate_bp': 1200, 'payment': 5000, 'max_months': 3}, {'rows': [[1, 123, 4877, 7468], [2, 75, 4925, 2543], [3, 25, 2543, 0]], 'balloon': 0}], ['control 2', {'principal': 12345, 'rate_bp': 0, 'payment': 5000, 'max_months': 6}, {'rows': [[1, 0, 5000, 7345], [2, 0, 5000, 2345], [3, 0, 2345, 0]], 'balloon': 0}], ['control 3', {'principal': 100000, 'rate_bp': 0, 'payment': 8333, 'max_months': 24}, {'rows': [[1, 0, 8333, 91667], [2, 0, 8333, 83334], [3, 0, 8333, 75001], [4, 0, 8333, 66668], [5, 0, 8333, 58335], [6, 0, 8333, 50002], [7, 0, 8333, 41669], [8, 0, 8333, 33336], [9, 0, 8333, 25003], [10, 0, 8333, 16670], [11, 0, 8333, 8337], [12, 0, 8333, 4], [13, 0, 4, 0]], 'balloon': 0}], ['control 4', {'principal': 1000, 'rate_bp': 1200, 'payment': 333, 'max_months': 6}, {'rows': [[1, 10, 323, 677], [2, 7, 326, 351], [3, 4, 329, 22], [4, 0, 22, 0]], 'balloon': 0}], ['control 5', {'principal': 1000, 'rate_bp': 1999, 'payment': 5000, 'max_months': 24}, {'rows': [[1, 17, 1000, 0]], 'balloon': 0}]], [['regression: balloon amount', {'principal': 12345, 'rate_bp': 2400, 'payment': 2476, 'max_months': 0}, {'rows': [], 'balloon': 12345}], ['regression: balloon amount, partial-repair probe', {'principal': 250000, 'rate_bp': 600, 'payment': 250050, 'max_months': 1}, {'rows': [[1, 1250, 248800, 1200]], 'balloon': 1200}], ['control 1', {'principal': 1000, 'rate_bp': 2400, 'payment': 500, 'max_months': 3}, {'rows': [[1, 20, 480, 520], [2, 10, 490, 30], [3, 1, 30, 0]], 'balloon': 0}], ['control 2', {'principal': 50000, 'rate_bp': 0, 'payment': 10007, 'max_months': 24}, {'rows': [[1, 0, 10007, 39993], [2, 0, 10007, 29986], [3, 0, 10007, 19979], [4, 0, 10007, 9972], [5, 0, 9972, 0]], 'balloon': 0}], ['control 3', {'principal': 12345, 'rate_bp': 600, 'payment': 1200, 'max_months': 12}, {'rows': [[1, 62, 1138, 11207], [2, 56, 1144, 10063], [3, 50, 1150, 8913], [4, 45, 1155, 7758], [5, 39, 1161, 6597], [6, 33, 1167, 5430], [7, 27, 1173, 4257], [8, 21, 1179, 3078], [9, 15, 1185, 1893], [10, 9, 1191, 702], [11, 4, 702, 0]], 'balloon': 0}], ['control 4', {'principal': 100000, 'rate_bp': 0, 'payment': 500, 'max_months': 1}, {'rows': [[1, 0, 500, 99500]], 'balloon': 99500}], ['control 5', {'principal': 100000, 'rate_bp': 1999, 'payment': 33333, 'max_months': 6}, {'rows': [[1, 1666, 31667, 68333], [2, 1138, 32195, 36138], [3, 602, 32731, 3407], [4, 57, 3407, 0]], 'balloon': 0}]]]
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: balloon amount{'balloon': 225599, 'rows': [[1, 4165, 835, 249165], [2, 4151, 849, 248316], [3, 4137, 863, 247453], [4, 4122, 878, 246575], [5, 4108, 892, 245683], [6, 4093, 907, 244776], [7, 4078, 922, 243854], [8, 4062, 938, 242916], [9, 4047, 953, 241963], [10, 4031, 969, 240994], [11, 4015, 985, 240009], [12, 3998, 1002, 239007], [13, 3981, 1019, 237988], [14, 3964, 1036, 236952], [15, 3947, 1053, 235899], [16, 3930, 1070, 234829], [17, 3912, 1088, 233741], [18, 3894, 1106, 232635], [19, 3875, 1125, 231510], [20, 3857, 1143, 230367], [21, 3838, 1162, 229205], [22, 3818, 1182, 228023], [23, 3798, 1202, 226821], [24, 3778, 1222, 225599]]}{'balloon': 225599, 'rows': [[1, 4165, 835, 249165], [2, 4151, 849, 248316], [3, 4137, 863, 247453], [4, 4122, 878, 246575], [5, 4108, 892, 245683], [6, 4093, 907, 244776], [7, 4078, 922, 243854], [8, 4062, 938, 242916], [9, 4047, 953, 241963], [10, 4031, 969, 240994], [11, 4015, 985, 240009], [12, 3998, 1002, 239007], [13, 3981, 1019, 237988], [14, 3964, 1036, 236952], [15, 3947, 1053, 235899], [16, 3930, 1070, 234829], [17, 3912, 1088, 233741], [18, 3894, 1106, 232635], [19, 3875, 1125, 231510], [20, 3857, 1143, 230367], [21, 3838, 1162, 229205], [22, 3818, 1182, 228023], [23, 3798, 1202, 226821], [24, 3778, 1222, 225599]]}Passed
regression: balloon amount, partial-repair probe{'balloon': 0, 'rows': [[1, 20, 313, 687], [2, 14, 319, 368], [3, 7, 326, 42]]}{'balloon': 42, 'rows': [[1, 20, 313, 687], [2, 14, 319, 368], [3, 7, 326, 42]]}Failed
control 1{'balloon': 249500, 'rows': [[1, 0, 500, 249500]]}{'balloon': 249500, 'rows': [[1, 0, 500, 249500]]}Passed
control 2{'error': 'negative_amortization', 'month': 1}{'error': 'negative_amortization', 'month': 1}Passed
control 3{'balloon': 0, 'rows': [[1, 2000, 18007, 81993], [2, 1640, 18367, 63626], [3, 1273, 18734, 44892], [4, 898, 19109, 25783], [5, 516, 19491, 6292], [6, 126, 6292, 0]]}{'balloon': 0, 'rows': [[1, 2000, 18007, 81993], [2, 1640, 18367, 63626], [3, 1273, 18734, 44892], [4, 898, 19109, 25783], [5, 516, 19491, 6292], [6, 126, 6292, 0]]}Passed
control 4{'error': 'negative_amortization', 'month': 1}{'error': 'negative_amortization', 'month': 1}Passed
control 5{'balloon': 0, 'rows': [[1, 5000, 45007, 204993], [2, 4100, 45907, 159086], [3, 3182, 46825, 112261], [4, 2245, 47762, 64499], [5, 1290, 48717, 15782], [6, 316, 15782, 0]]}{'balloon': 0, 'rows': [[1, 5000, 45007, 204993], [2, 4100, 45907, 159086], [3, 3182, 46825, 112261], [4, 2245, 47762, 64499], [5, 1290, 48717, 15782], [6, 316, 15782, 0]]}Passed

SHA-256 / f8a1abd7b8130a4dd46d97593be5eb460ebccef03f9266247b5c6b856b8bf3f3

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:26.198258+00:00.

Case digest / fcb7c1c29800a7f0ebef378b50ee5c6c1b7ac6e8cc2517ba50507831e2a83a25