FA-58581 / Loan amortization schedules / Open access
Balloon maturity payment: balloon payment composition · case 01
The balloon payment is inflated by a full regular payment.
ROOT CAUSE
The balloon adds the regular payment to the remaining balance.
THE FAILURE
The balloon adds the regular payment to the remaining balance.
Unsuccessful approach: Taking the larger of balance and payment omits interest.
Case contract
x = {'principal', 'rate_bp', 'amort_months', 'term_months'}. The level payment amortizes over amort_months (exact annuity, half-up). Payments run to the earlier of term and amortization end; the last one pays balance + interest (the balloon). Monthly interest is round_half_up(balance*bp/120000). Return {'payment', 'final_payment', 'balloon_excess': final - payment, 'total_interest'}.
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)
def level(P, n):
if n <= 0 or P <= 0:
return 0
if bp == 0:
exact = Fraction(P, n)
else:
r = Fraction(bp, 120000)
exact = P * r / (1 - (1 + r) ** -n)
return math.floor(exact + Fraction(1, 2))
bp = x['rate_bp']
P = x['principal']
pay = level(P, x['amort_months'])
last_k = min(x['term_months'], x['amort_months'])
bal = P
total = 0
final = 0
for k in range(1, last_k + 1):
interest = rnd(bal * bp, 120000)
total += interest
if k == last_k:
final = bal + pay
else:
bal -= pay - interest
return {'payment': pay, 'final_payment': final, 'balloon_excess': final - pay, 'total_interest': total}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: balloon payment composition', {'principal': 100000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 3}, {'payment': 20000, 'final_payment': 60000, 'balloon_excess': 40000, 'total_interest': 0}], ['regression: balloon payment composition, partial-repair probe', {'principal': 55555, 'rate_bp': 600, 'amort_months': 12, 'term_months': 84}, {'payment': 4781, 'final_payment': 4786, 'balloon_excess': 5, 'total_interest': 1822}], ['sample 1', {'principal': 1000000, 'rate_bp': 600, 'amort_months': 360, 'term_months': 60}, {'payment': 5996, 'final_payment': 936506, 'balloon_excess': 930510, 'total_interest': 290270}], ['sample 2', {'principal': 1000000, 'rate_bp': 600, 'amort_months': 12, 'term_months': 84}, {'payment': 86066, 'final_payment': 86070, 'balloon_excess': 4, 'total_interest': 32796}], ['sample 3', {'principal': 3000000, 'rate_bp': 600, 'amort_months': 5, 'term_months': 84}, {'payment': 609030, 'final_payment': 609030, 'balloon_excess': 0, 'total_interest': 45150}], ['sample 4', {'principal': 55555, 'rate_bp': 725, 'amort_months': 60, 'term_months': 84}, {'payment': 1107, 'final_payment': 1081, 'balloon_excess': -26, 'total_interest': 10839}], ['sample 5', {'principal': 55555, 'rate_bp': 0, 'amort_months': 360, 'term_months': 5}, {'payment': 154, 'final_payment': 54939, 'balloon_excess': 54785, 'total_interest': 0}]], [['regression: balloon payment composition', {'principal': 100000, 'rate_bp': 0, 'amort_months': 12, 'term_months': 5}, {'payment': 8333, 'final_payment': 66668, 'balloon_excess': 58335, 'total_interest': 0}], ['regression: balloon payment composition, partial-repair probe', {'principal': 100000, 'rate_bp': 725, 'amort_months': 360, 'term_months': 5}, {'payment': 682, 'final_payment': 100288, 'balloon_excess': 99606, 'total_interest': 3016}], ['sample 1', {'principal': 100000, 'rate_bp': 600, 'amort_months': 5, 'term_months': 5}, {'payment': 20301, 'final_payment': 20300, 'balloon_excess': -1, 'total_interest': 1504}], ['sample 2', {'principal': 100000, 'rate_bp': 1200, 'amort_months': 60, 'term_months': 60}, {'payment': 2224, 'final_payment': 2262, 'balloon_excess': 38, 'total_interest': 33478}], ['sample 3', {'principal': 3000000, 'rate_bp': 1200, 'amort_months': 360, 'term_months': 84}, {'payment': 30858, 'final_payment': 2918745, 'balloon_excess': 2887887, 'total_interest': 2479959}], ['sample 4', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 12}, {'payment': 50000, 'final_payment': 2450000, 'balloon_excess': 2400000, 'total_interest': 0}], ['sample 5', {'principal': 100000, 'rate_bp': 1200, 'amort_months': 60, 'term_months': 5}, {'payment': 2224, 'final_payment': 95980, 'balloon_excess': 93756, 'total_interest': 4876}]], [['regression: balloon payment composition', {'principal': 100000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 3}, {'payment': 20000, 'final_payment': 60000, 'balloon_excess': 40000, 'total_interest': 0}], ['regression: balloon payment composition, partial-repair probe', {'principal': 55555, 'rate_bp': 600, 'amort_months': 5, 'term_months': 3}, {'payment': 11278, 'final_payment': 33668, 'balloon_excess': 22390, 'total_interest': 669}], ['sample 1', {'principal': 1000000, 'rate_bp': 1200, 'amort_months': 5, 'term_months': 60}, {'payment': 206040, 'final_payment': 206040, 'balloon_excess': 0, 'total_interest': 30200}], ['sample 2', {'principal': 100000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 5}, {'payment': 1667, 'final_payment': 93332, 'balloon_excess': 91665, 'total_interest': 0}], ['sample 3', {'principal': 55555, 'rate_bp': 600, 'amort_months': 60, 'term_months': 84}, {'payment': 1074, 'final_payment': 1074, 'balloon_excess': 0, 'total_interest': 8885}], ['sample 4', {'principal': 100000, 'rate_bp': 600, 'amort_months': 12, 'term_months': 3}, {'payment': 8607, 'final_payment': 84164, 'balloon_excess': 75557, 'total_interest': 1378}], ['sample 5', {'principal': 100000, 'rate_bp': 1200, 'amort_months': 12, 'term_months': 12}, {'payment': 8885, 'final_payment': 8884, 'balloon_excess': -1, 'total_interest': 6619}]], [['regression: balloon payment composition', {'principal': 1000000, 'rate_bp': 725, 'amort_months': 360, 'term_months': 12}, {'payment': 6822, 'final_payment': 997140, 'balloon_excess': 990318, 'total_interest': 72182}], ['sample 1', {'principal': 1000000, 'rate_bp': 1200, 'amort_months': 360, 'term_months': 12}, {'payment': 10286, 'final_payment': 1006656, 'balloon_excess': 996370, 'total_interest': 119802}], ['sample 2', {'principal': 55555, 'rate_bp': 0, 'amort_months': 5, 'term_months': 84}, {'payment': 11111, 'final_payment': 11111, 'balloon_excess': 0, 'total_interest': 0}], ['sample 3', {'principal': 55555, 'rate_bp': 725, 'amort_months': 360, 'term_months': 5}, {'payment': 379, 'final_payment': 55715, 'balloon_excess': 55336, 'total_interest': 1676}], ['sample 4', {'principal': 1000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 3}, {'payment': 16667, 'final_payment': 966666, 'balloon_excess': 949999, 'total_interest': 0}], ['sample 5', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 84}, {'payment': 50000, 'final_payment': 50000, 'balloon_excess': 0, 'total_interest': 0}], ['sample 6', {'principal': 1000000, 'rate_bp': 600, 'amort_months': 5, 'term_months': 5}, {'payment': 203010, 'final_payment': 203010, 'balloon_excess': 0, 'total_interest': 15050}]], [['regression: balloon payment composition', {'principal': 3000000, 'rate_bp': 1200, 'amort_months': 60, 'term_months': 12}, {'payment': 66733, 'final_payment': 2600867, 'balloon_excess': 2534134, 'total_interest': 334930}], ['sample 1', {'principal': 55555, 'rate_bp': 725, 'amort_months': 12, 'term_months': 3}, {'payment': 4813, 'final_payment': 46855, 'balloon_excess': 42042, 'total_interest': 926}], ['sample 2', {'principal': 100000, 'rate_bp': 600, 'amort_months': 60, 'term_months': 60}, {'payment': 1933, 'final_payment': 1952, 'balloon_excess': 19, 'total_interest': 15999}], ['sample 3', {'principal': 55555, 'rate_bp': 1200, 'amort_months': 12, 'term_months': 60}, {'payment': 4936, 'final_payment': 4938, 'balloon_excess': 2, 'total_interest': 3679}], ['sample 4', {'principal': 55555, 'rate_bp': 0, 'amort_months': 60, 'term_months': 60}, {'payment': 926, 'final_payment': 921, 'balloon_excess': -5, 'total_interest': 0}], ['sample 5', {'principal': 1000000, 'rate_bp': 725, 'amort_months': 360, 'term_months': 60}, {'payment': 6822, 'final_payment': 950593, 'balloon_excess': 943771, 'total_interest': 353091}], ['sample 6', {'principal': 100000, 'rate_bp': 1200, 'amort_months': 12, 'term_months': 12}, {'payment': 8885, 'final_payment': 8884, 'balloon_excess': -1, 'total_interest': 6619}]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: balloon payment composition | {'balloon_excess': 60000, 'final_payment': 80000, 'payment': 20000, 'total_interest': 0} | {'balloon_excess': 40000, 'final_payment': 60000, 'payment': 20000, 'total_interest': 0} | Failed |
| regression: balloon payment composition, partial-repair probe | {'balloon_excess': 4762, 'final_payment': 9543, 'payment': 4781, 'total_interest': 1822} | {'balloon_excess': 5, 'final_payment': 4786, 'payment': 4781, 'total_interest': 1822} | Failed |
| sample 1 | {'balloon_excess': 931847, 'final_payment': 937843, 'payment': 5996, 'total_interest': 290270} | {'balloon_excess': 930510, 'final_payment': 936506, 'payment': 5996, 'total_interest': 290270} | Failed |
| sample 2 | {'balloon_excess': 85642, 'final_payment': 171708, 'payment': 86066, 'total_interest': 32796} | {'balloon_excess': 4, 'final_payment': 86070, 'payment': 86066, 'total_interest': 32796} | Failed |
| sample 3 | {'balloon_excess': 606000, 'final_payment': 1215030, 'payment': 609030, 'total_interest': 45150} | {'balloon_excess': 0, 'final_payment': 609030, 'payment': 609030, 'total_interest': 45150} | Failed |
| sample 4 | {'balloon_excess': 1075, 'final_payment': 2182, 'payment': 1107, 'total_interest': 10839} | {'balloon_excess': -26, 'final_payment': 1081, 'payment': 1107, 'total_interest': 10839} | Failed |
| sample 5 | {'balloon_excess': 54939, 'final_payment': 55093, 'payment': 154, 'total_interest': 0} | {'balloon_excess': 54785, 'final_payment': 54939, 'payment': 154, 'total_interest': 0} | Failed |
SHA-256 / 1d1df2b619da1f5d848bbec3344a60c70e09b6673945f8fb5cd5041e055ad7bf
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)
def level(P, n):
if n <= 0 or P <= 0:
return 0
if bp == 0:
exact = Fraction(P, n)
else:
r = Fraction(bp, 120000)
exact = P * r / (1 - (1 + r) ** -n)
return math.floor(exact + Fraction(1, 2))
bp = x['rate_bp']
P = x['principal']
pay = level(P, x['amort_months'])
last_k = min(x['term_months'], x['amort_months'])
bal = P
total = 0
final = 0
for k in range(1, last_k + 1):
interest = rnd(bal * bp, 120000)
total += interest
if k == last_k:
final = max(bal, pay)
else:
bal -= pay - interest
return {'payment': pay, 'final_payment': final, 'balloon_excess': final - pay, 'total_interest': total}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: balloon payment composition', {'principal': 100000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 3}, {'payment': 20000, 'final_payment': 60000, 'balloon_excess': 40000, 'total_interest': 0}], ['regression: balloon payment composition, partial-repair probe', {'principal': 55555, 'rate_bp': 600, 'amort_months': 12, 'term_months': 84}, {'payment': 4781, 'final_payment': 4786, 'balloon_excess': 5, 'total_interest': 1822}], ['sample 1', {'principal': 1000000, 'rate_bp': 600, 'amort_months': 360, 'term_months': 60}, {'payment': 5996, 'final_payment': 936506, 'balloon_excess': 930510, 'total_interest': 290270}], ['sample 2', {'principal': 1000000, 'rate_bp': 600, 'amort_months': 12, 'term_months': 84}, {'payment': 86066, 'final_payment': 86070, 'balloon_excess': 4, 'total_interest': 32796}], ['sample 3', {'principal': 3000000, 'rate_bp': 600, 'amort_months': 5, 'term_months': 84}, {'payment': 609030, 'final_payment': 609030, 'balloon_excess': 0, 'total_interest': 45150}], ['sample 4', {'principal': 55555, 'rate_bp': 725, 'amort_months': 60, 'term_months': 84}, {'payment': 1107, 'final_payment': 1081, 'balloon_excess': -26, 'total_interest': 10839}], ['sample 5', {'principal': 55555, 'rate_bp': 0, 'amort_months': 360, 'term_months': 5}, {'payment': 154, 'final_payment': 54939, 'balloon_excess': 54785, 'total_interest': 0}]], [['regression: balloon payment composition', {'principal': 100000, 'rate_bp': 0, 'amort_months': 12, 'term_months': 5}, {'payment': 8333, 'final_payment': 66668, 'balloon_excess': 58335, 'total_interest': 0}], ['regression: balloon payment composition, partial-repair probe', {'principal': 100000, 'rate_bp': 725, 'amort_months': 360, 'term_months': 5}, {'payment': 682, 'final_payment': 100288, 'balloon_excess': 99606, 'total_interest': 3016}], ['sample 1', {'principal': 100000, 'rate_bp': 600, 'amort_months': 5, 'term_months': 5}, {'payment': 20301, 'final_payment': 20300, 'balloon_excess': -1, 'total_interest': 1504}], ['sample 2', {'principal': 100000, 'rate_bp': 1200, 'amort_months': 60, 'term_months': 60}, {'payment': 2224, 'final_payment': 2262, 'balloon_excess': 38, 'total_interest': 33478}], ['sample 3', {'principal': 3000000, 'rate_bp': 1200, 'amort_months': 360, 'term_months': 84}, {'payment': 30858, 'final_payment': 2918745, 'balloon_excess': 2887887, 'total_interest': 2479959}], ['sample 4', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 12}, {'payment': 50000, 'final_payment': 2450000, 'balloon_excess': 2400000, 'total_interest': 0}], ['sample 5', {'principal': 100000, 'rate_bp': 1200, 'amort_months': 60, 'term_months': 5}, {'payment': 2224, 'final_payment': 95980, 'balloon_excess': 93756, 'total_interest': 4876}]], [['regression: balloon payment composition', {'principal': 100000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 3}, {'payment': 20000, 'final_payment': 60000, 'balloon_excess': 40000, 'total_interest': 0}], ['regression: balloon payment composition, partial-repair probe', {'principal': 55555, 'rate_bp': 600, 'amort_months': 5, 'term_months': 3}, {'payment': 11278, 'final_payment': 33668, 'balloon_excess': 22390, 'total_interest': 669}], ['sample 1', {'principal': 1000000, 'rate_bp': 1200, 'amort_months': 5, 'term_months': 60}, {'payment': 206040, 'final_payment': 206040, 'balloon_excess': 0, 'total_interest': 30200}], ['sample 2', {'principal': 100000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 5}, {'payment': 1667, 'final_payment': 93332, 'balloon_excess': 91665, 'total_interest': 0}], ['sample 3', {'principal': 55555, 'rate_bp': 600, 'amort_months': 60, 'term_months': 84}, {'payment': 1074, 'final_payment': 1074, 'balloon_excess': 0, 'total_interest': 8885}], ['sample 4', {'principal': 100000, 'rate_bp': 600, 'amort_months': 12, 'term_months': 3}, {'payment': 8607, 'final_payment': 84164, 'balloon_excess': 75557, 'total_interest': 1378}], ['sample 5', {'principal': 100000, 'rate_bp': 1200, 'amort_months': 12, 'term_months': 12}, {'payment': 8885, 'final_payment': 8884, 'balloon_excess': -1, 'total_interest': 6619}]], [['regression: balloon payment composition', {'principal': 1000000, 'rate_bp': 725, 'amort_months': 360, 'term_months': 12}, {'payment': 6822, 'final_payment': 997140, 'balloon_excess': 990318, 'total_interest': 72182}], ['sample 1', {'principal': 1000000, 'rate_bp': 1200, 'amort_months': 360, 'term_months': 12}, {'payment': 10286, 'final_payment': 1006656, 'balloon_excess': 996370, 'total_interest': 119802}], ['sample 2', {'principal': 55555, 'rate_bp': 0, 'amort_months': 5, 'term_months': 84}, {'payment': 11111, 'final_payment': 11111, 'balloon_excess': 0, 'total_interest': 0}], ['sample 3', {'principal': 55555, 'rate_bp': 725, 'amort_months': 360, 'term_months': 5}, {'payment': 379, 'final_payment': 55715, 'balloon_excess': 55336, 'total_interest': 1676}], ['sample 4', {'principal': 1000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 3}, {'payment': 16667, 'final_payment': 966666, 'balloon_excess': 949999, 'total_interest': 0}], ['sample 5', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 84}, {'payment': 50000, 'final_payment': 50000, 'balloon_excess': 0, 'total_interest': 0}], ['sample 6', {'principal': 1000000, 'rate_bp': 600, 'amort_months': 5, 'term_months': 5}, {'payment': 203010, 'final_payment': 203010, 'balloon_excess': 0, 'total_interest': 15050}]], [['regression: balloon payment composition', {'principal': 3000000, 'rate_bp': 1200, 'amort_months': 60, 'term_months': 12}, {'payment': 66733, 'final_payment': 2600867, 'balloon_excess': 2534134, 'total_interest': 334930}], ['sample 1', {'principal': 55555, 'rate_bp': 725, 'amort_months': 12, 'term_months': 3}, {'payment': 4813, 'final_payment': 46855, 'balloon_excess': 42042, 'total_interest': 926}], ['sample 2', {'principal': 100000, 'rate_bp': 600, 'amort_months': 60, 'term_months': 60}, {'payment': 1933, 'final_payment': 1952, 'balloon_excess': 19, 'total_interest': 15999}], ['sample 3', {'principal': 55555, 'rate_bp': 1200, 'amort_months': 12, 'term_months': 60}, {'payment': 4936, 'final_payment': 4938, 'balloon_excess': 2, 'total_interest': 3679}], ['sample 4', {'principal': 55555, 'rate_bp': 0, 'amort_months': 60, 'term_months': 60}, {'payment': 926, 'final_payment': 921, 'balloon_excess': -5, 'total_interest': 0}], ['sample 5', {'principal': 1000000, 'rate_bp': 725, 'amort_months': 360, 'term_months': 60}, {'payment': 6822, 'final_payment': 950593, 'balloon_excess': 943771, 'total_interest': 353091}], ['sample 6', {'principal': 100000, 'rate_bp': 1200, 'amort_months': 12, 'term_months': 12}, {'payment': 8885, 'final_payment': 8884, 'balloon_excess': -1, 'total_interest': 6619}]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: balloon payment composition | {'balloon_excess': 40000, 'final_payment': 60000, 'payment': 20000, 'total_interest': 0} | {'balloon_excess': 40000, 'final_payment': 60000, 'payment': 20000, 'total_interest': 0} | Passed |
| regression: balloon payment composition, partial-repair probe | {'balloon_excess': 0, 'final_payment': 4781, 'payment': 4781, 'total_interest': 1822} | {'balloon_excess': 5, 'final_payment': 4786, 'payment': 4781, 'total_interest': 1822} | Failed |
| sample 1 | {'balloon_excess': 925851, 'final_payment': 931847, 'payment': 5996, 'total_interest': 290270} | {'balloon_excess': 930510, 'final_payment': 936506, 'payment': 5996, 'total_interest': 290270} | Failed |
| sample 2 | {'balloon_excess': 0, 'final_payment': 86066, 'payment': 86066, 'total_interest': 32796} | {'balloon_excess': 4, 'final_payment': 86070, 'payment': 86066, 'total_interest': 32796} | Failed |
| sample 3 | {'balloon_excess': 0, 'final_payment': 609030, 'payment': 609030, 'total_interest': 45150} | {'balloon_excess': 0, 'final_payment': 609030, 'payment': 609030, 'total_interest': 45150} | Passed |
| sample 4 | {'balloon_excess': 0, 'final_payment': 1107, 'payment': 1107, 'total_interest': 10839} | {'balloon_excess': -26, 'final_payment': 1081, 'payment': 1107, 'total_interest': 10839} | Failed |
| sample 5 | {'balloon_excess': 54785, 'final_payment': 54939, 'payment': 154, 'total_interest': 0} | {'balloon_excess': 54785, 'final_payment': 54939, 'payment': 154, 'total_interest': 0} | Passed |
SHA-256 / 75b61a74f8953ff4fc4928d9ada18594fa54ea2239ae3fe0df91b3cb4aac35f5
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:28.067429+00:00.
Case digest / 2b5baa7f6c3706c4173dc854bd9547eff4a9c8da3bcc8dababfc2d74880c5933