FAILURE MAP
← Case archive

FA-58586 / Loan amortization schedules / Open access

Balloon maturity payment: interest total scope · case 01

Total interest excludes the interest in the balloon payment.

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

ROOT CAUSE

Interest of the final month is not accumulated.

VERIFIED REPAIR

Accumulate interest for every month including the balloon month.

Unsuccessful approach: Skipping the first month instead still leaves a month out.

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 else 0
        if k == last_k:
            final = bal + interest
        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: interest total scope', {'principal': 55555, 'rate_bp': 600, 'amort_months': 12, 'term_months': 84}, {'payment': 4781, 'final_payment': 4786, 'balloon_excess': 5, 'total_interest': 1822}], ['control 1', {'principal': 100000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 3}, {'payment': 20000, 'final_payment': 60000, 'balloon_excess': 40000, 'total_interest': 0}], ['control 2', {'principal': 55555, 'rate_bp': 0, 'amort_months': 360, 'term_months': 5}, {'payment': 154, 'final_payment': 54939, 'balloon_excess': 54785, 'total_interest': 0}], ['control 3', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 84}, {'payment': 600000, 'final_payment': 600000, 'balloon_excess': 0, 'total_interest': 0}], ['control 4', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 360, 'term_months': 5}, {'payment': 8333, 'final_payment': 2966668, 'balloon_excess': 2958335, 'total_interest': 0}], ['control 5', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 5}, {'payment': 50000, 'final_payment': 2800000, 'balloon_excess': 2750000, 'total_interest': 0}], ['control 6', {'principal': 55555, 'rate_bp': 0, 'amort_months': 12, 'term_months': 3}, {'payment': 4630, 'final_payment': 46295, 'balloon_excess': 41665, 'total_interest': 0}]], [['regression: interest total scope', {'principal': 100000, 'rate_bp': 725, 'amort_months': 360, 'term_months': 5}, {'payment': 682, 'final_payment': 100288, 'balloon_excess': 99606, 'total_interest': 3016}], ['control 1', {'principal': 100000, 'rate_bp': 0, 'amort_months': 12, 'term_months': 5}, {'payment': 8333, 'final_payment': 66668, 'balloon_excess': 58335, 'total_interest': 0}], ['control 2', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 12}, {'payment': 50000, 'final_payment': 2450000, 'balloon_excess': 2400000, 'total_interest': 0}], ['control 3', {'principal': 55555, 'rate_bp': 0, 'amort_months': 360, 'term_months': 84}, {'payment': 154, 'final_payment': 42773, 'balloon_excess': 42619, 'total_interest': 0}], ['control 4', {'principal': 55555, 'rate_bp': 0, 'amort_months': 360, 'term_months': 3}, {'payment': 154, 'final_payment': 55247, 'balloon_excess': 55093, 'total_interest': 0}], ['control 5', {'principal': 100000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 60}, {'payment': 1667, 'final_payment': 1647, 'balloon_excess': -20, 'total_interest': 0}], ['control 6', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 360, 'term_months': 60}, {'payment': 8333, 'final_payment': 2508353, 'balloon_excess': 2500020, 'total_interest': 0}]], [['regression: interest total scope', {'principal': 55555, 'rate_bp': 600, 'amort_months': 5, 'term_months': 3}, {'payment': 11278, 'final_payment': 33668, 'balloon_excess': 22390, 'total_interest': 669}], ['control 1', {'principal': 100000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 3}, {'payment': 20000, 'final_payment': 60000, 'balloon_excess': 40000, 'total_interest': 0}], ['control 2', {'principal': 100000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 5}, {'payment': 1667, 'final_payment': 93332, 'balloon_excess': 91665, 'total_interest': 0}], ['control 3', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 60}, {'payment': 600000, 'final_payment': 600000, 'balloon_excess': 0, 'total_interest': 0}], ['control 4', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 12, 'term_months': 5}, {'payment': 250000, 'final_payment': 2000000, 'balloon_excess': 1750000, 'total_interest': 0}], ['control 5', {'principal': 100000, 'rate_bp': 0, 'amort_months': 12, 'term_months': 12}, {'payment': 8333, 'final_payment': 8337, 'balloon_excess': 4, 'total_interest': 0}], ['control 6', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 360, 'term_months': 12}, {'payment': 8333, 'final_payment': 2908337, 'balloon_excess': 2900004, 'total_interest': 0}]], [['regression: interest total scope', {'principal': 1000000, 'rate_bp': 725, 'amort_months': 360, 'term_months': 12}, {'payment': 6822, 'final_payment': 997140, 'balloon_excess': 990318, 'total_interest': 72182}], ['control 1', {'principal': 55555, 'rate_bp': 0, 'amort_months': 5, 'term_months': 84}, {'payment': 11111, 'final_payment': 11111, 'balloon_excess': 0, 'total_interest': 0}], ['control 2', {'principal': 1000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 3}, {'payment': 16667, 'final_payment': 966666, 'balloon_excess': 949999, 'total_interest': 0}], ['control 3', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 84}, {'payment': 50000, 'final_payment': 50000, 'balloon_excess': 0, 'total_interest': 0}], ['control 4', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 84}, {'payment': 600000, 'final_payment': 600000, 'balloon_excess': 0, 'total_interest': 0}], ['control 5', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 12}, {'payment': 600000, 'final_payment': 600000, 'balloon_excess': 0, 'total_interest': 0}], ['control 6', {'principal': 100000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 12}, {'payment': 1667, 'final_payment': 81663, 'balloon_excess': 79996, 'total_interest': 0}]], [['regression: interest total scope', {'principal': 3000000, 'rate_bp': 1200, 'amort_months': 60, 'term_months': 12}, {'payment': 66733, 'final_payment': 2600867, 'balloon_excess': 2534134, 'total_interest': 334930}], ['control 1', {'principal': 55555, 'rate_bp': 0, 'amort_months': 60, 'term_months': 60}, {'payment': 926, 'final_payment': 921, 'balloon_excess': -5, 'total_interest': 0}], ['control 2', {'principal': 1000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 3}, {'payment': 200000, 'final_payment': 600000, 'balloon_excess': 400000, 'total_interest': 0}], ['control 3', {'principal': 1000000, 'rate_bp': 0, 'amort_months': 360, 'term_months': 60}, {'payment': 2778, 'final_payment': 836098, 'balloon_excess': 833320, 'total_interest': 0}], ['control 4', {'principal': 100000, 'rate_bp': 0, 'amort_months': 360, 'term_months': 3}, {'payment': 278, 'final_payment': 99444, 'balloon_excess': 99166, 'total_interest': 0}], ['control 5', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 3}, {'payment': 600000, 'final_payment': 1800000, 'balloon_excess': 1200000, 'total_interest': 0}], ['control 6', {'principal': 55555, 'rate_bp': 0, 'amort_months': 60, 'term_months': 84}, {'payment': 926, 'final_payment': 921, 'balloon_excess': -5, 'total_interest': 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: interest total scope{'balloon_excess': 5, 'final_payment': 4786, 'payment': 4781, 'total_interest': 1798}{'balloon_excess': 5, 'final_payment': 4786, 'payment': 4781, 'total_interest': 1822}Failed
control 1{'balloon_excess': 40000, 'final_payment': 60000, 'payment': 20000, 'total_interest': 0}{'balloon_excess': 40000, 'final_payment': 60000, 'payment': 20000, 'total_interest': 0}Passed
control 2{'balloon_excess': 54785, 'final_payment': 54939, 'payment': 154, 'total_interest': 0}{'balloon_excess': 54785, 'final_payment': 54939, 'payment': 154, 'total_interest': 0}Passed
control 3{'balloon_excess': 0, 'final_payment': 600000, 'payment': 600000, 'total_interest': 0}{'balloon_excess': 0, 'final_payment': 600000, 'payment': 600000, 'total_interest': 0}Passed
control 4{'balloon_excess': 2958335, 'final_payment': 2966668, 'payment': 8333, 'total_interest': 0}{'balloon_excess': 2958335, 'final_payment': 2966668, 'payment': 8333, 'total_interest': 0}Passed
control 5{'balloon_excess': 2750000, 'final_payment': 2800000, 'payment': 50000, 'total_interest': 0}{'balloon_excess': 2750000, 'final_payment': 2800000, 'payment': 50000, 'total_interest': 0}Passed
control 6{'balloon_excess': 41665, 'final_payment': 46295, 'payment': 4630, 'total_interest': 0}{'balloon_excess': 41665, 'final_payment': 46295, 'payment': 4630, 'total_interest': 0}Passed

SHA-256 / 0047f2b993078f4cb007955a04512c084f1402fab83c38c620ae961e79965e6d

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 > 1 else 0
        if k == last_k:
            final = bal + interest
        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: interest total scope', {'principal': 55555, 'rate_bp': 600, 'amort_months': 12, 'term_months': 84}, {'payment': 4781, 'final_payment': 4786, 'balloon_excess': 5, 'total_interest': 1822}], ['control 1', {'principal': 100000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 3}, {'payment': 20000, 'final_payment': 60000, 'balloon_excess': 40000, 'total_interest': 0}], ['control 2', {'principal': 55555, 'rate_bp': 0, 'amort_months': 360, 'term_months': 5}, {'payment': 154, 'final_payment': 54939, 'balloon_excess': 54785, 'total_interest': 0}], ['control 3', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 84}, {'payment': 600000, 'final_payment': 600000, 'balloon_excess': 0, 'total_interest': 0}], ['control 4', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 360, 'term_months': 5}, {'payment': 8333, 'final_payment': 2966668, 'balloon_excess': 2958335, 'total_interest': 0}], ['control 5', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 5}, {'payment': 50000, 'final_payment': 2800000, 'balloon_excess': 2750000, 'total_interest': 0}], ['control 6', {'principal': 55555, 'rate_bp': 0, 'amort_months': 12, 'term_months': 3}, {'payment': 4630, 'final_payment': 46295, 'balloon_excess': 41665, 'total_interest': 0}]], [['regression: interest total scope', {'principal': 100000, 'rate_bp': 725, 'amort_months': 360, 'term_months': 5}, {'payment': 682, 'final_payment': 100288, 'balloon_excess': 99606, 'total_interest': 3016}], ['control 1', {'principal': 100000, 'rate_bp': 0, 'amort_months': 12, 'term_months': 5}, {'payment': 8333, 'final_payment': 66668, 'balloon_excess': 58335, 'total_interest': 0}], ['control 2', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 12}, {'payment': 50000, 'final_payment': 2450000, 'balloon_excess': 2400000, 'total_interest': 0}], ['control 3', {'principal': 55555, 'rate_bp': 0, 'amort_months': 360, 'term_months': 84}, {'payment': 154, 'final_payment': 42773, 'balloon_excess': 42619, 'total_interest': 0}], ['control 4', {'principal': 55555, 'rate_bp': 0, 'amort_months': 360, 'term_months': 3}, {'payment': 154, 'final_payment': 55247, 'balloon_excess': 55093, 'total_interest': 0}], ['control 5', {'principal': 100000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 60}, {'payment': 1667, 'final_payment': 1647, 'balloon_excess': -20, 'total_interest': 0}], ['control 6', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 360, 'term_months': 60}, {'payment': 8333, 'final_payment': 2508353, 'balloon_excess': 2500020, 'total_interest': 0}]], [['regression: interest total scope', {'principal': 55555, 'rate_bp': 600, 'amort_months': 5, 'term_months': 3}, {'payment': 11278, 'final_payment': 33668, 'balloon_excess': 22390, 'total_interest': 669}], ['control 1', {'principal': 100000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 3}, {'payment': 20000, 'final_payment': 60000, 'balloon_excess': 40000, 'total_interest': 0}], ['control 2', {'principal': 100000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 5}, {'payment': 1667, 'final_payment': 93332, 'balloon_excess': 91665, 'total_interest': 0}], ['control 3', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 60}, {'payment': 600000, 'final_payment': 600000, 'balloon_excess': 0, 'total_interest': 0}], ['control 4', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 12, 'term_months': 5}, {'payment': 250000, 'final_payment': 2000000, 'balloon_excess': 1750000, 'total_interest': 0}], ['control 5', {'principal': 100000, 'rate_bp': 0, 'amort_months': 12, 'term_months': 12}, {'payment': 8333, 'final_payment': 8337, 'balloon_excess': 4, 'total_interest': 0}], ['control 6', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 360, 'term_months': 12}, {'payment': 8333, 'final_payment': 2908337, 'balloon_excess': 2900004, 'total_interest': 0}]], [['regression: interest total scope', {'principal': 1000000, 'rate_bp': 725, 'amort_months': 360, 'term_months': 12}, {'payment': 6822, 'final_payment': 997140, 'balloon_excess': 990318, 'total_interest': 72182}], ['control 1', {'principal': 55555, 'rate_bp': 0, 'amort_months': 5, 'term_months': 84}, {'payment': 11111, 'final_payment': 11111, 'balloon_excess': 0, 'total_interest': 0}], ['control 2', {'principal': 1000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 3}, {'payment': 16667, 'final_payment': 966666, 'balloon_excess': 949999, 'total_interest': 0}], ['control 3', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 84}, {'payment': 50000, 'final_payment': 50000, 'balloon_excess': 0, 'total_interest': 0}], ['control 4', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 84}, {'payment': 600000, 'final_payment': 600000, 'balloon_excess': 0, 'total_interest': 0}], ['control 5', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 12}, {'payment': 600000, 'final_payment': 600000, 'balloon_excess': 0, 'total_interest': 0}], ['control 6', {'principal': 100000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 12}, {'payment': 1667, 'final_payment': 81663, 'balloon_excess': 79996, 'total_interest': 0}]], [['regression: interest total scope', {'principal': 3000000, 'rate_bp': 1200, 'amort_months': 60, 'term_months': 12}, {'payment': 66733, 'final_payment': 2600867, 'balloon_excess': 2534134, 'total_interest': 334930}], ['control 1', {'principal': 55555, 'rate_bp': 0, 'amort_months': 60, 'term_months': 60}, {'payment': 926, 'final_payment': 921, 'balloon_excess': -5, 'total_interest': 0}], ['control 2', {'principal': 1000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 3}, {'payment': 200000, 'final_payment': 600000, 'balloon_excess': 400000, 'total_interest': 0}], ['control 3', {'principal': 1000000, 'rate_bp': 0, 'amort_months': 360, 'term_months': 60}, {'payment': 2778, 'final_payment': 836098, 'balloon_excess': 833320, 'total_interest': 0}], ['control 4', {'principal': 100000, 'rate_bp': 0, 'amort_months': 360, 'term_months': 3}, {'payment': 278, 'final_payment': 99444, 'balloon_excess': 99166, 'total_interest': 0}], ['control 5', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 3}, {'payment': 600000, 'final_payment': 1800000, 'balloon_excess': 1200000, 'total_interest': 0}], ['control 6', {'principal': 55555, 'rate_bp': 0, 'amort_months': 60, 'term_months': 84}, {'payment': 926, 'final_payment': 921, 'balloon_excess': -5, 'total_interest': 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: interest total scope{'balloon_excess': 5, 'final_payment': 4786, 'payment': 4781, 'total_interest': 1544}{'balloon_excess': 5, 'final_payment': 4786, 'payment': 4781, 'total_interest': 1822}Failed
control 1{'balloon_excess': 40000, 'final_payment': 60000, 'payment': 20000, 'total_interest': 0}{'balloon_excess': 40000, 'final_payment': 60000, 'payment': 20000, 'total_interest': 0}Passed
control 2{'balloon_excess': 54785, 'final_payment': 54939, 'payment': 154, 'total_interest': 0}{'balloon_excess': 54785, 'final_payment': 54939, 'payment': 154, 'total_interest': 0}Passed
control 3{'balloon_excess': 0, 'final_payment': 600000, 'payment': 600000, 'total_interest': 0}{'balloon_excess': 0, 'final_payment': 600000, 'payment': 600000, 'total_interest': 0}Passed
control 4{'balloon_excess': 2958335, 'final_payment': 2966668, 'payment': 8333, 'total_interest': 0}{'balloon_excess': 2958335, 'final_payment': 2966668, 'payment': 8333, 'total_interest': 0}Passed
control 5{'balloon_excess': 2750000, 'final_payment': 2800000, 'payment': 50000, 'total_interest': 0}{'balloon_excess': 2750000, 'final_payment': 2800000, 'payment': 50000, 'total_interest': 0}Passed
control 6{'balloon_excess': 41665, 'final_payment': 46295, 'payment': 4630, 'total_interest': 0}{'balloon_excess': 41665, 'final_payment': 46295, 'payment': 4630, 'total_interest': 0}Passed

SHA-256 / 681157b35f88e816c0525f7b9acabed3f48e1beef44bdb7bb99b04c2da304cab

3 / The verified repair

Exit 0
"""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 + interest
        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: interest total scope', {'principal': 55555, 'rate_bp': 600, 'amort_months': 12, 'term_months': 84}, {'payment': 4781, 'final_payment': 4786, 'balloon_excess': 5, 'total_interest': 1822}], ['control 1', {'principal': 100000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 3}, {'payment': 20000, 'final_payment': 60000, 'balloon_excess': 40000, 'total_interest': 0}], ['control 2', {'principal': 55555, 'rate_bp': 0, 'amort_months': 360, 'term_months': 5}, {'payment': 154, 'final_payment': 54939, 'balloon_excess': 54785, 'total_interest': 0}], ['control 3', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 84}, {'payment': 600000, 'final_payment': 600000, 'balloon_excess': 0, 'total_interest': 0}], ['control 4', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 360, 'term_months': 5}, {'payment': 8333, 'final_payment': 2966668, 'balloon_excess': 2958335, 'total_interest': 0}], ['control 5', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 5}, {'payment': 50000, 'final_payment': 2800000, 'balloon_excess': 2750000, 'total_interest': 0}], ['control 6', {'principal': 55555, 'rate_bp': 0, 'amort_months': 12, 'term_months': 3}, {'payment': 4630, 'final_payment': 46295, 'balloon_excess': 41665, 'total_interest': 0}]], [['regression: interest total scope', {'principal': 100000, 'rate_bp': 725, 'amort_months': 360, 'term_months': 5}, {'payment': 682, 'final_payment': 100288, 'balloon_excess': 99606, 'total_interest': 3016}], ['control 1', {'principal': 100000, 'rate_bp': 0, 'amort_months': 12, 'term_months': 5}, {'payment': 8333, 'final_payment': 66668, 'balloon_excess': 58335, 'total_interest': 0}], ['control 2', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 12}, {'payment': 50000, 'final_payment': 2450000, 'balloon_excess': 2400000, 'total_interest': 0}], ['control 3', {'principal': 55555, 'rate_bp': 0, 'amort_months': 360, 'term_months': 84}, {'payment': 154, 'final_payment': 42773, 'balloon_excess': 42619, 'total_interest': 0}], ['control 4', {'principal': 55555, 'rate_bp': 0, 'amort_months': 360, 'term_months': 3}, {'payment': 154, 'final_payment': 55247, 'balloon_excess': 55093, 'total_interest': 0}], ['control 5', {'principal': 100000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 60}, {'payment': 1667, 'final_payment': 1647, 'balloon_excess': -20, 'total_interest': 0}], ['control 6', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 360, 'term_months': 60}, {'payment': 8333, 'final_payment': 2508353, 'balloon_excess': 2500020, 'total_interest': 0}]], [['regression: interest total scope', {'principal': 55555, 'rate_bp': 600, 'amort_months': 5, 'term_months': 3}, {'payment': 11278, 'final_payment': 33668, 'balloon_excess': 22390, 'total_interest': 669}], ['control 1', {'principal': 100000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 3}, {'payment': 20000, 'final_payment': 60000, 'balloon_excess': 40000, 'total_interest': 0}], ['control 2', {'principal': 100000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 5}, {'payment': 1667, 'final_payment': 93332, 'balloon_excess': 91665, 'total_interest': 0}], ['control 3', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 60}, {'payment': 600000, 'final_payment': 600000, 'balloon_excess': 0, 'total_interest': 0}], ['control 4', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 12, 'term_months': 5}, {'payment': 250000, 'final_payment': 2000000, 'balloon_excess': 1750000, 'total_interest': 0}], ['control 5', {'principal': 100000, 'rate_bp': 0, 'amort_months': 12, 'term_months': 12}, {'payment': 8333, 'final_payment': 8337, 'balloon_excess': 4, 'total_interest': 0}], ['control 6', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 360, 'term_months': 12}, {'payment': 8333, 'final_payment': 2908337, 'balloon_excess': 2900004, 'total_interest': 0}]], [['regression: interest total scope', {'principal': 1000000, 'rate_bp': 725, 'amort_months': 360, 'term_months': 12}, {'payment': 6822, 'final_payment': 997140, 'balloon_excess': 990318, 'total_interest': 72182}], ['control 1', {'principal': 55555, 'rate_bp': 0, 'amort_months': 5, 'term_months': 84}, {'payment': 11111, 'final_payment': 11111, 'balloon_excess': 0, 'total_interest': 0}], ['control 2', {'principal': 1000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 3}, {'payment': 16667, 'final_payment': 966666, 'balloon_excess': 949999, 'total_interest': 0}], ['control 3', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 84}, {'payment': 50000, 'final_payment': 50000, 'balloon_excess': 0, 'total_interest': 0}], ['control 4', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 84}, {'payment': 600000, 'final_payment': 600000, 'balloon_excess': 0, 'total_interest': 0}], ['control 5', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 12}, {'payment': 600000, 'final_payment': 600000, 'balloon_excess': 0, 'total_interest': 0}], ['control 6', {'principal': 100000, 'rate_bp': 0, 'amort_months': 60, 'term_months': 12}, {'payment': 1667, 'final_payment': 81663, 'balloon_excess': 79996, 'total_interest': 0}]], [['regression: interest total scope', {'principal': 3000000, 'rate_bp': 1200, 'amort_months': 60, 'term_months': 12}, {'payment': 66733, 'final_payment': 2600867, 'balloon_excess': 2534134, 'total_interest': 334930}], ['control 1', {'principal': 55555, 'rate_bp': 0, 'amort_months': 60, 'term_months': 60}, {'payment': 926, 'final_payment': 921, 'balloon_excess': -5, 'total_interest': 0}], ['control 2', {'principal': 1000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 3}, {'payment': 200000, 'final_payment': 600000, 'balloon_excess': 400000, 'total_interest': 0}], ['control 3', {'principal': 1000000, 'rate_bp': 0, 'amort_months': 360, 'term_months': 60}, {'payment': 2778, 'final_payment': 836098, 'balloon_excess': 833320, 'total_interest': 0}], ['control 4', {'principal': 100000, 'rate_bp': 0, 'amort_months': 360, 'term_months': 3}, {'payment': 278, 'final_payment': 99444, 'balloon_excess': 99166, 'total_interest': 0}], ['control 5', {'principal': 3000000, 'rate_bp': 0, 'amort_months': 5, 'term_months': 3}, {'payment': 600000, 'final_payment': 1800000, 'balloon_excess': 1200000, 'total_interest': 0}], ['control 6', {'principal': 55555, 'rate_bp': 0, 'amort_months': 60, 'term_months': 84}, {'payment': 926, 'final_payment': 921, 'balloon_excess': -5, 'total_interest': 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: interest total scope{'balloon_excess': 5, 'final_payment': 4786, 'payment': 4781, 'total_interest': 1822}{'balloon_excess': 5, 'final_payment': 4786, 'payment': 4781, 'total_interest': 1822}Passed
control 1{'balloon_excess': 40000, 'final_payment': 60000, 'payment': 20000, 'total_interest': 0}{'balloon_excess': 40000, 'final_payment': 60000, 'payment': 20000, 'total_interest': 0}Passed
control 2{'balloon_excess': 54785, 'final_payment': 54939, 'payment': 154, 'total_interest': 0}{'balloon_excess': 54785, 'final_payment': 54939, 'payment': 154, 'total_interest': 0}Passed
control 3{'balloon_excess': 0, 'final_payment': 600000, 'payment': 600000, 'total_interest': 0}{'balloon_excess': 0, 'final_payment': 600000, 'payment': 600000, 'total_interest': 0}Passed
control 4{'balloon_excess': 2958335, 'final_payment': 2966668, 'payment': 8333, 'total_interest': 0}{'balloon_excess': 2958335, 'final_payment': 2966668, 'payment': 8333, 'total_interest': 0}Passed
control 5{'balloon_excess': 2750000, 'final_payment': 2800000, 'payment': 50000, 'total_interest': 0}{'balloon_excess': 2750000, 'final_payment': 2800000, 'payment': 50000, 'total_interest': 0}Passed
control 6{'balloon_excess': 41665, 'final_payment': 46295, 'payment': 4630, 'total_interest': 0}{'balloon_excess': 41665, 'final_payment': 46295, 'payment': 4630, 'total_interest': 0}Passed

SHA-256 / eb57fc06431b85ca01ef1271c76dbc3937832f8045544269338bc196c85292ef

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

Case digest / e8a6dd36e558f4c05d0ef15d4faec3bad734e5a70a7c9c2b9f5dc62c86278e5e