{"abstract":"Stub interest drifts by several cents on long first periods.","category":"Loan amortization schedules","checks":7,"contract":"x = {'principal', 'rate_bp', 'convention': '30/360'|'act/365'|'act/360', 'start': [y,m,d], 'first_due': [y,m,d]}. 30/360: a start day of 31 becomes 30; then a due day of 31 becomes 30 when the (adjusted) start day is 30; days = 360*dy + 30*dm + dd. Actual conventions count calendar days, basis 365 or 360 (365 even in leap years). If days <= 0 return {'error': 'due_not_after_start'}. Interest = round_half_up(P*bp*days/(10000*basis)). Return {'days', 'basis', 'interest'}.","evaluation_group":"w2-loan-amortization-schedules-odd-first-period-day-count","failed_approach":"Rounding before dividing by the basis truncates the final result.","family":"w2-loan-amortization-schedules-odd-first-period-day-count-interest-rounding-stage","id":"FA-58471","implementations":{"attempt":{"sha256":"a419d244c2e4841e6b9426d055e7ba940d5dc820950ae077ad81e0cfe2c51485","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport datetime\nN = 1\nobservations = []\ndef solve(x):\n    def rnd(n, d):\n        q, r = divmod(n, d)\n        return q + (1 if 2 * r >= d else 0)\n    y1, m1, d1 = x['start']\n    y2, m2, d2 = x['first_due']\n    conv = x['convention']\n    if conv == '30/360':\n        if d1 == 31:\n            d1 = 30\n        if d2 == 31 and d1 == 30:\n            d2 = 30\n        days = 360 * (y2 - y1) + 30 * (m2 - m1) + (d2 - d1)\n        basis = 360\n    else:\n        days = (datetime.date(y2, m2, d2) - datetime.date(y1, m1, d1)).days\n        basis = 365 if conv == 'act/365' else 360\n    if days <= 0:\n        return {'error': 'due_not_after_start'}\n    interest = rnd(x['principal'] * x['rate_bp'] * days, 10000) // basis\n    return {'days': days, 'basis': basis, 'interest': interest}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: interest rounding stage', {'principal': 12345, 'rate_bp': 365, 'convention': 'act/360', 'start': [2023, 3, 15], 'first_due': [2024, 3, 1]}, {'days': 352, 'basis': 360, 'interest': 441}], ['control 1', {'principal': 100000, 'rate_bp': 365, 'convention': 'act/360', 'start': [2024, 11, 30], 'first_due': [2024, 12, 1]}, {'days': 1, 'basis': 360, 'interest': 10}], ['control 2', {'principal': 36500, 'rate_bp': 1200, 'convention': '30/360', 'start': [2023, 3, 29], 'first_due': [2023, 3, 31]}, {'days': 2, 'basis': 360, 'interest': 24}], ['control 3', {'principal': 1000000, 'rate_bp': 365, 'convention': 'act/365', 'start': [2023, 8, 30], 'first_due': [2023, 8, 30]}, {'error': 'due_not_after_start'}], ['control 4', {'principal': 100000, 'rate_bp': 500, 'convention': 'act/365', 'start': [2024, 12, 31], 'first_due': [2024, 12, 31]}, {'error': 'due_not_after_start'}], ['control 5', {'principal': 1000000, 'rate_bp': 1200, 'convention': 'act/360', 'start': [2024, 9, 30], 'first_due': [2024, 9, 30]}, {'error': 'due_not_after_start'}], ['control 6', {'principal': 1000000, 'rate_bp': 500, 'convention': 'act/365', 'start': [2023, 12, 31], 'first_due': [2024, 1, 30]}, {'days': 30, 'basis': 365, 'interest': 4110}]], [['regression: interest rounding stage', {'principal': 12345, 'rate_bp': 600, 'convention': '30/360', 'start': [2023, 7, 28], 'first_due': [2023, 8, 28]}, {'days': 30, 'basis': 360, 'interest': 62}], ['control 1', {'principal': 12345, 'rate_bp': 600, 'convention': '30/360', 'start': [2024, 8, 29], 'first_due': [2024, 8, 29]}, {'error': 'due_not_after_start'}], ['control 2', {'principal': 36500, 'rate_bp': 1200, 'convention': 'act/365', 'start': [2024, 10, 29], 'first_due': [2025, 9, 30]}, {'days': 336, 'basis': 365, 'interest': 4032}], ['control 3', {'principal': 36500, 'rate_bp': 600, 'convention': 'act/365', 'start': [2023, 5, 15], 'first_due': [2023, 6, 30]}, {'days': 46, 'basis': 365, 'interest': 276}], ['control 4', {'principal': 1000000, 'rate_bp': 365, 'convention': 'act/365', 'start': [2023, 10, 31], 'first_due': [2023, 10, 30]}, {'error': 'due_not_after_start'}], ['control 5', {'principal': 36500, 'rate_bp': 600, 'convention': 'act/365', 'start': [2024, 11, 30], 'first_due': [2024, 12, 15]}, {'days': 15, 'basis': 365, 'interest': 90}], ['control 6', {'principal': 100000, 'rate_bp': 500, 'convention': 'act/365', 'start': [2023, 11, 30], 'first_due': [2023, 11, 30]}, {'error': 'due_not_after_start'}]], [['regression: interest rounding stage', {'principal': 12345, 'rate_bp': 500, 'convention': 'act/360', 'start': [2023, 11, 28], 'first_due': [2024, 10, 31]}, {'days': 338, 'basis': 360, 'interest': 580}], ['control 1', {'principal': 12345, 'rate_bp': 500, 'convention': '30/360', 'start': [2024, 1, 31], 'first_due': [2024, 1, 28]}, {'error': 'due_not_after_start'}], ['control 2', {'principal': 1000000, 'rate_bp': 365, 'convention': 'act/365', 'start': [2023, 12, 1], 'first_due': [2023, 12, 15]}, {'days': 14, 'basis': 365, 'interest': 1400}], ['control 3', {'principal': 1000000, 'rate_bp': 600, 'convention': 'act/360', 'start': [2023, 10, 30], 'first_due': [2023, 10, 31]}, {'days': 1, 'basis': 360, 'interest': 167}], ['control 4', {'principal': 36500, 'rate_bp': 1200, 'convention': 'act/365', 'start': [2024, 3, 29], 'first_due': [2025, 3, 31]}, {'days': 367, 'basis': 365, 'interest': 4404}], ['control 5', {'principal': 1000000, 'rate_bp': 600, 'convention': 'act/365', 'start': [2023, 4, 29], 'first_due': [2023, 4, 15]}, {'error': 'due_not_after_start'}], ['control 6', {'principal': 36500, 'rate_bp': 1200, 'convention': 'act/360', 'start': [2023, 6, 29], 'first_due': [2023, 7, 1]}, {'days': 2, 'basis': 360, 'interest': 24}]], [['regression: interest rounding stage', {'principal': 100000, 'rate_bp': 1200, 'convention': '30/360', 'start': [2023, 4, 1], 'first_due': [2024, 3, 1]}, {'days': 330, 'basis': 360, 'interest': 11000}], ['regression: interest rounding stage, partial-repair probe', {'principal': 12345, 'rate_bp': 1200, 'convention': 'act/365', 'start': [2024, 2, 29], 'first_due': [2024, 4, 29]}, {'days': 60, 'basis': 365, 'interest': 244}], ['control 1', {'principal': 36500, 'rate_bp': 500, 'convention': 'act/365', 'start': [2023, 4, 28], 'first_due': [2023, 6, 28]}, {'days': 61, 'basis': 365, 'interest': 305}], ['control 2', {'principal': 12345, 'rate_bp': 365, 'convention': 'act/360', 'start': [2024, 4, 30], 'first_due': [2024, 5, 1]}, {'days': 1, 'basis': 360, 'interest': 1}], ['control 3', {'principal': 36500, 'rate_bp': 1200, 'convention': 'act/365', 'start': [2023, 4, 30], 'first_due': [2023, 4, 30]}, {'error': 'due_not_after_start'}], ['control 4', {'principal': 36500, 'rate_bp': 600, 'convention': 'act/365', 'start': [2023, 12, 31], 'first_due': [2024, 1, 28]}, {'days': 28, 'basis': 365, 'interest': 168}], ['control 5', {'principal': 36500, 'rate_bp': 1200, 'convention': 'act/365', 'start': [2024, 11, 1], 'first_due': [2025, 11, 1]}, {'days': 365, 'basis': 365, 'interest': 4380}]], [['regression: interest rounding stage', {'principal': 1000000, 'rate_bp': 600, 'convention': 'act/360', 'start': [2024, 6, 28], 'first_due': [2024, 7, 30]}, {'days': 32, 'basis': 360, 'interest': 5333}], ['regression: interest rounding stage, partial-repair probe', {'principal': 1000000, 'rate_bp': 500, 'convention': 'act/360', 'start': [2024, 1, 29], 'first_due': [2024, 1, 30]}, {'days': 1, 'basis': 360, 'interest': 139}], ['control 1', {'principal': 36500, 'rate_bp': 500, 'convention': 'act/365', 'start': [2024, 2, 29], 'first_due': [2024, 3, 29]}, {'days': 29, 'basis': 365, 'interest': 145}], ['control 2', {'principal': 100000, 'rate_bp': 365, 'convention': 'act/365', 'start': [2024, 6, 28], 'first_due': [2025, 5, 15]}, {'days': 321, 'basis': 365, 'interest': 3210}], ['control 3', {'principal': 12345, 'rate_bp': 365, 'convention': 'act/360', 'start': [2024, 7, 30], 'first_due': [2024, 7, 30]}, {'error': 'due_not_after_start'}], ['control 4', {'principal': 100000, 'rate_bp': 365, 'convention': 'act/365', 'start': [2024, 9, 28], 'first_due': [2025, 9, 30]}, {'days': 367, 'basis': 365, 'interest': 3670}], ['control 5', {'principal': 36500, 'rate_bp': 365, 'convention': '30/360', 'start': [2024, 6, 30], 'first_due': [2024, 6, 15]}, {'error': 'due_not_after_start'}]]]\nfor label, args, expected in fixtures[N-1]:\n    try:\n        actual = solve(args)\n    except Exception as exc:\n        actual = 'raised ' + type(exc).__name__\n    check(label, actual, expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"3b3051e6630323e1b19b69665fb6ef91a8885c718ba91184f080370020118da1","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport datetime\nN = 1\nobservations = []\ndef solve(x):\n    def rnd(n, d):\n        q, r = divmod(n, d)\n        return q + (1 if 2 * r >= d else 0)\n    y1, m1, d1 = x['start']\n    y2, m2, d2 = x['first_due']\n    conv = x['convention']\n    if conv == '30/360':\n        if d1 == 31:\n            d1 = 30\n        if d2 == 31 and d1 == 30:\n            d2 = 30\n        days = 360 * (y2 - y1) + 30 * (m2 - m1) + (d2 - d1)\n        basis = 360\n    else:\n        days = (datetime.date(y2, m2, d2) - datetime.date(y1, m1, d1)).days\n        basis = 365 if conv == 'act/365' else 360\n    if days <= 0:\n        return {'error': 'due_not_after_start'}\n    interest = rnd(x['principal'] * x['rate_bp'], 10000 * basis) * days\n    return {'days': days, 'basis': basis, 'interest': interest}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: interest rounding stage', {'principal': 12345, 'rate_bp': 365, 'convention': 'act/360', 'start': [2023, 3, 15], 'first_due': [2024, 3, 1]}, {'days': 352, 'basis': 360, 'interest': 441}], ['control 1', {'principal': 100000, 'rate_bp': 365, 'convention': 'act/360', 'start': [2024, 11, 30], 'first_due': [2024, 12, 1]}, {'days': 1, 'basis': 360, 'interest': 10}], ['control 2', {'principal': 36500, 'rate_bp': 1200, 'convention': '30/360', 'start': [2023, 3, 29], 'first_due': [2023, 3, 31]}, {'days': 2, 'basis': 360, 'interest': 24}], ['control 3', {'principal': 1000000, 'rate_bp': 365, 'convention': 'act/365', 'start': [2023, 8, 30], 'first_due': [2023, 8, 30]}, {'error': 'due_not_after_start'}], ['control 4', {'principal': 100000, 'rate_bp': 500, 'convention': 'act/365', 'start': [2024, 12, 31], 'first_due': [2024, 12, 31]}, {'error': 'due_not_after_start'}], ['control 5', {'principal': 1000000, 'rate_bp': 1200, 'convention': 'act/360', 'start': [2024, 9, 30], 'first_due': [2024, 9, 30]}, {'error': 'due_not_after_start'}], ['control 6', {'principal': 1000000, 'rate_bp': 500, 'convention': 'act/365', 'start': [2023, 12, 31], 'first_due': [2024, 1, 30]}, {'days': 30, 'basis': 365, 'interest': 4110}]], [['regression: interest rounding stage', {'principal': 12345, 'rate_bp': 600, 'convention': '30/360', 'start': [2023, 7, 28], 'first_due': [2023, 8, 28]}, {'days': 30, 'basis': 360, 'interest': 62}], ['control 1', {'principal': 12345, 'rate_bp': 600, 'convention': '30/360', 'start': [2024, 8, 29], 'first_due': [2024, 8, 29]}, {'error': 'due_not_after_start'}], ['control 2', {'principal': 36500, 'rate_bp': 1200, 'convention': 'act/365', 'start': [2024, 10, 29], 'first_due': [2025, 9, 30]}, {'days': 336, 'basis': 365, 'interest': 4032}], ['control 3', {'principal': 36500, 'rate_bp': 600, 'convention': 'act/365', 'start': [2023, 5, 15], 'first_due': [2023, 6, 30]}, {'days': 46, 'basis': 365, 'interest': 276}], ['control 4', {'principal': 1000000, 'rate_bp': 365, 'convention': 'act/365', 'start': [2023, 10, 31], 'first_due': [2023, 10, 30]}, {'error': 'due_not_after_start'}], ['control 5', {'principal': 36500, 'rate_bp': 600, 'convention': 'act/365', 'start': [2024, 11, 30], 'first_due': [2024, 12, 15]}, {'days': 15, 'basis': 365, 'interest': 90}], ['control 6', {'principal': 100000, 'rate_bp': 500, 'convention': 'act/365', 'start': [2023, 11, 30], 'first_due': [2023, 11, 30]}, {'error': 'due_not_after_start'}]], [['regression: interest rounding stage', {'principal': 12345, 'rate_bp': 500, 'convention': 'act/360', 'start': [2023, 11, 28], 'first_due': [2024, 10, 31]}, {'days': 338, 'basis': 360, 'interest': 580}], ['control 1', {'principal': 12345, 'rate_bp': 500, 'convention': '30/360', 'start': [2024, 1, 31], 'first_due': [2024, 1, 28]}, {'error': 'due_not_after_start'}], ['control 2', {'principal': 1000000, 'rate_bp': 365, 'convention': 'act/365', 'start': [2023, 12, 1], 'first_due': [2023, 12, 15]}, {'days': 14, 'basis': 365, 'interest': 1400}], ['control 3', {'principal': 1000000, 'rate_bp': 600, 'convention': 'act/360', 'start': [2023, 10, 30], 'first_due': [2023, 10, 31]}, {'days': 1, 'basis': 360, 'interest': 167}], ['control 4', {'principal': 36500, 'rate_bp': 1200, 'convention': 'act/365', 'start': [2024, 3, 29], 'first_due': [2025, 3, 31]}, {'days': 367, 'basis': 365, 'interest': 4404}], ['control 5', {'principal': 1000000, 'rate_bp': 600, 'convention': 'act/365', 'start': [2023, 4, 29], 'first_due': [2023, 4, 15]}, {'error': 'due_not_after_start'}], ['control 6', {'principal': 36500, 'rate_bp': 1200, 'convention': 'act/360', 'start': [2023, 6, 29], 'first_due': [2023, 7, 1]}, {'days': 2, 'basis': 360, 'interest': 24}]], [['regression: interest rounding stage', {'principal': 100000, 'rate_bp': 1200, 'convention': '30/360', 'start': [2023, 4, 1], 'first_due': [2024, 3, 1]}, {'days': 330, 'basis': 360, 'interest': 11000}], ['regression: interest rounding stage, partial-repair probe', {'principal': 12345, 'rate_bp': 1200, 'convention': 'act/365', 'start': [2024, 2, 29], 'first_due': [2024, 4, 29]}, {'days': 60, 'basis': 365, 'interest': 244}], ['control 1', {'principal': 36500, 'rate_bp': 500, 'convention': 'act/365', 'start': [2023, 4, 28], 'first_due': [2023, 6, 28]}, {'days': 61, 'basis': 365, 'interest': 305}], ['control 2', {'principal': 12345, 'rate_bp': 365, 'convention': 'act/360', 'start': [2024, 4, 30], 'first_due': [2024, 5, 1]}, {'days': 1, 'basis': 360, 'interest': 1}], ['control 3', {'principal': 36500, 'rate_bp': 1200, 'convention': 'act/365', 'start': [2023, 4, 30], 'first_due': [2023, 4, 30]}, {'error': 'due_not_after_start'}], ['control 4', {'principal': 36500, 'rate_bp': 600, 'convention': 'act/365', 'start': [2023, 12, 31], 'first_due': [2024, 1, 28]}, {'days': 28, 'basis': 365, 'interest': 168}], ['control 5', {'principal': 36500, 'rate_bp': 1200, 'convention': 'act/365', 'start': [2024, 11, 1], 'first_due': [2025, 11, 1]}, {'days': 365, 'basis': 365, 'interest': 4380}]], [['regression: interest rounding stage', {'principal': 1000000, 'rate_bp': 600, 'convention': 'act/360', 'start': [2024, 6, 28], 'first_due': [2024, 7, 30]}, {'days': 32, 'basis': 360, 'interest': 5333}], ['regression: interest rounding stage, partial-repair probe', {'principal': 1000000, 'rate_bp': 500, 'convention': 'act/360', 'start': [2024, 1, 29], 'first_due': [2024, 1, 30]}, {'days': 1, 'basis': 360, 'interest': 139}], ['control 1', {'principal': 36500, 'rate_bp': 500, 'convention': 'act/365', 'start': [2024, 2, 29], 'first_due': [2024, 3, 29]}, {'days': 29, 'basis': 365, 'interest': 145}], ['control 2', {'principal': 100000, 'rate_bp': 365, 'convention': 'act/365', 'start': [2024, 6, 28], 'first_due': [2025, 5, 15]}, {'days': 321, 'basis': 365, 'interest': 3210}], ['control 3', {'principal': 12345, 'rate_bp': 365, 'convention': 'act/360', 'start': [2024, 7, 30], 'first_due': [2024, 7, 30]}, {'error': 'due_not_after_start'}], ['control 4', {'principal': 100000, 'rate_bp': 365, 'convention': 'act/365', 'start': [2024, 9, 28], 'first_due': [2025, 9, 30]}, {'days': 367, 'basis': 365, 'interest': 3670}], ['control 5', {'principal': 36500, 'rate_bp': 365, 'convention': '30/360', 'start': [2024, 6, 30], 'first_due': [2024, 6, 15]}, {'error': 'due_not_after_start'}]]]\nfor label, args, expected in fixtures[N-1]:\n    try:\n        actual = solve(args)\n    except Exception as exc:\n        actual = 'raised ' + type(exc).__name__\n    check(label, actual, expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"03195d691f18b93b3e66b7e7267f80e7faf6aa175ce9b6ce79ee3b57fea9e8e8","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport datetime\nN = 1\nobservations = []\ndef solve(x):\n    def rnd(n, d):\n        q, r = divmod(n, d)\n        return q + (1 if 2 * r >= d else 0)\n    y1, m1, d1 = x['start']\n    y2, m2, d2 = x['first_due']\n    conv = x['convention']\n    if conv == '30/360':\n        if d1 == 31:\n            d1 = 30\n        if d2 == 31 and d1 == 30:\n            d2 = 30\n        days = 360 * (y2 - y1) + 30 * (m2 - m1) + (d2 - d1)\n        basis = 360\n    else:\n        days = (datetime.date(y2, m2, d2) - datetime.date(y1, m1, d1)).days\n        basis = 365 if conv == 'act/365' else 360\n    if days <= 0:\n        return {'error': 'due_not_after_start'}\n    interest = rnd(x['principal'] * x['rate_bp'] * days, 10000 * basis)\n    return {'days': days, 'basis': basis, 'interest': interest}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: interest rounding stage', {'principal': 12345, 'rate_bp': 365, 'convention': 'act/360', 'start': [2023, 3, 15], 'first_due': [2024, 3, 1]}, {'days': 352, 'basis': 360, 'interest': 441}], ['control 1', {'principal': 100000, 'rate_bp': 365, 'convention': 'act/360', 'start': [2024, 11, 30], 'first_due': [2024, 12, 1]}, {'days': 1, 'basis': 360, 'interest': 10}], ['control 2', {'principal': 36500, 'rate_bp': 1200, 'convention': '30/360', 'start': [2023, 3, 29], 'first_due': [2023, 3, 31]}, {'days': 2, 'basis': 360, 'interest': 24}], ['control 3', {'principal': 1000000, 'rate_bp': 365, 'convention': 'act/365', 'start': [2023, 8, 30], 'first_due': [2023, 8, 30]}, {'error': 'due_not_after_start'}], ['control 4', {'principal': 100000, 'rate_bp': 500, 'convention': 'act/365', 'start': [2024, 12, 31], 'first_due': [2024, 12, 31]}, {'error': 'due_not_after_start'}], ['control 5', {'principal': 1000000, 'rate_bp': 1200, 'convention': 'act/360', 'start': [2024, 9, 30], 'first_due': [2024, 9, 30]}, {'error': 'due_not_after_start'}], ['control 6', {'principal': 1000000, 'rate_bp': 500, 'convention': 'act/365', 'start': [2023, 12, 31], 'first_due': [2024, 1, 30]}, {'days': 30, 'basis': 365, 'interest': 4110}]], [['regression: interest rounding stage', {'principal': 12345, 'rate_bp': 600, 'convention': '30/360', 'start': [2023, 7, 28], 'first_due': [2023, 8, 28]}, {'days': 30, 'basis': 360, 'interest': 62}], ['control 1', {'principal': 12345, 'rate_bp': 600, 'convention': '30/360', 'start': [2024, 8, 29], 'first_due': [2024, 8, 29]}, {'error': 'due_not_after_start'}], ['control 2', {'principal': 36500, 'rate_bp': 1200, 'convention': 'act/365', 'start': [2024, 10, 29], 'first_due': [2025, 9, 30]}, {'days': 336, 'basis': 365, 'interest': 4032}], ['control 3', {'principal': 36500, 'rate_bp': 600, 'convention': 'act/365', 'start': [2023, 5, 15], 'first_due': [2023, 6, 30]}, {'days': 46, 'basis': 365, 'interest': 276}], ['control 4', {'principal': 1000000, 'rate_bp': 365, 'convention': 'act/365', 'start': [2023, 10, 31], 'first_due': [2023, 10, 30]}, {'error': 'due_not_after_start'}], ['control 5', {'principal': 36500, 'rate_bp': 600, 'convention': 'act/365', 'start': [2024, 11, 30], 'first_due': [2024, 12, 15]}, {'days': 15, 'basis': 365, 'interest': 90}], ['control 6', {'principal': 100000, 'rate_bp': 500, 'convention': 'act/365', 'start': [2023, 11, 30], 'first_due': [2023, 11, 30]}, {'error': 'due_not_after_start'}]], [['regression: interest rounding stage', {'principal': 12345, 'rate_bp': 500, 'convention': 'act/360', 'start': [2023, 11, 28], 'first_due': [2024, 10, 31]}, {'days': 338, 'basis': 360, 'interest': 580}], ['control 1', {'principal': 12345, 'rate_bp': 500, 'convention': '30/360', 'start': [2024, 1, 31], 'first_due': [2024, 1, 28]}, {'error': 'due_not_after_start'}], ['control 2', {'principal': 1000000, 'rate_bp': 365, 'convention': 'act/365', 'start': [2023, 12, 1], 'first_due': [2023, 12, 15]}, {'days': 14, 'basis': 365, 'interest': 1400}], ['control 3', {'principal': 1000000, 'rate_bp': 600, 'convention': 'act/360', 'start': [2023, 10, 30], 'first_due': [2023, 10, 31]}, {'days': 1, 'basis': 360, 'interest': 167}], ['control 4', {'principal': 36500, 'rate_bp': 1200, 'convention': 'act/365', 'start': [2024, 3, 29], 'first_due': [2025, 3, 31]}, {'days': 367, 'basis': 365, 'interest': 4404}], ['control 5', {'principal': 1000000, 'rate_bp': 600, 'convention': 'act/365', 'start': [2023, 4, 29], 'first_due': [2023, 4, 15]}, {'error': 'due_not_after_start'}], ['control 6', {'principal': 36500, 'rate_bp': 1200, 'convention': 'act/360', 'start': [2023, 6, 29], 'first_due': [2023, 7, 1]}, {'days': 2, 'basis': 360, 'interest': 24}]], [['regression: interest rounding stage', {'principal': 100000, 'rate_bp': 1200, 'convention': '30/360', 'start': [2023, 4, 1], 'first_due': [2024, 3, 1]}, {'days': 330, 'basis': 360, 'interest': 11000}], ['regression: interest rounding stage, partial-repair probe', {'principal': 12345, 'rate_bp': 1200, 'convention': 'act/365', 'start': [2024, 2, 29], 'first_due': [2024, 4, 29]}, {'days': 60, 'basis': 365, 'interest': 244}], ['control 1', {'principal': 36500, 'rate_bp': 500, 'convention': 'act/365', 'start': [2023, 4, 28], 'first_due': [2023, 6, 28]}, {'days': 61, 'basis': 365, 'interest': 305}], ['control 2', {'principal': 12345, 'rate_bp': 365, 'convention': 'act/360', 'start': [2024, 4, 30], 'first_due': [2024, 5, 1]}, {'days': 1, 'basis': 360, 'interest': 1}], ['control 3', {'principal': 36500, 'rate_bp': 1200, 'convention': 'act/365', 'start': [2023, 4, 30], 'first_due': [2023, 4, 30]}, {'error': 'due_not_after_start'}], ['control 4', {'principal': 36500, 'rate_bp': 600, 'convention': 'act/365', 'start': [2023, 12, 31], 'first_due': [2024, 1, 28]}, {'days': 28, 'basis': 365, 'interest': 168}], ['control 5', {'principal': 36500, 'rate_bp': 1200, 'convention': 'act/365', 'start': [2024, 11, 1], 'first_due': [2025, 11, 1]}, {'days': 365, 'basis': 365, 'interest': 4380}]], [['regression: interest rounding stage', {'principal': 1000000, 'rate_bp': 600, 'convention': 'act/360', 'start': [2024, 6, 28], 'first_due': [2024, 7, 30]}, {'days': 32, 'basis': 360, 'interest': 5333}], ['regression: interest rounding stage, partial-repair probe', {'principal': 1000000, 'rate_bp': 500, 'convention': 'act/360', 'start': [2024, 1, 29], 'first_due': [2024, 1, 30]}, {'days': 1, 'basis': 360, 'interest': 139}], ['control 1', {'principal': 36500, 'rate_bp': 500, 'convention': 'act/365', 'start': [2024, 2, 29], 'first_due': [2024, 3, 29]}, {'days': 29, 'basis': 365, 'interest': 145}], ['control 2', {'principal': 100000, 'rate_bp': 365, 'convention': 'act/365', 'start': [2024, 6, 28], 'first_due': [2025, 5, 15]}, {'days': 321, 'basis': 365, 'interest': 3210}], ['control 3', {'principal': 12345, 'rate_bp': 365, 'convention': 'act/360', 'start': [2024, 7, 30], 'first_due': [2024, 7, 30]}, {'error': 'due_not_after_start'}], ['control 4', {'principal': 100000, 'rate_bp': 365, 'convention': 'act/365', 'start': [2024, 9, 28], 'first_due': [2025, 9, 30]}, {'days': 367, 'basis': 365, 'interest': 3670}], ['control 5', {'principal': 36500, 'rate_bp': 365, 'convention': '30/360', 'start': [2024, 6, 30], 'first_due': [2024, 6, 15]}, {'error': 'due_not_after_start'}]]]\nfor label, args, expected in fixtures[N-1]:\n    try:\n        actual = solve(args)\n    except Exception as exc:\n        actual = 'raised ' + type(exc).__name__\n    check(label, actual, expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-loan-amortization-schedules-odd-first-period-day-count-interest-rounding-stage","generated_at":"2026-09-29T14:46:26.978081+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Amortization engines drive borrower statements, payoff quotes and investor remittances; a misplaced rounding step, boundary or ordering rule compounds across hundreds of periods.","repair":"Round once, after multiplying by the days.","root_cause":"The per-diem amount is rounded before being multiplied by the day count.","sha256":"743cd74da70433038b04e6545c6ee47e58725a0b5ff9472aa9e3115e68448211","title":"Odd first period day count: interest rounding stage · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":39.0,"exit_code":1,"observations":[{"actual":{"basis":360,"days":352,"interest":440},"check":"regression: interest rounding stage","expected":{"basis":360,"days":352,"interest":441},"passed":false},{"actual":{"basis":360,"days":1,"interest":10},"check":"control 1","expected":{"basis":360,"days":1,"interest":10},"passed":true},{"actual":{"basis":360,"days":2,"interest":24},"check":"control 2","expected":{"basis":360,"days":2,"interest":24},"passed":true},{"actual":{"error":"due_not_after_start"},"check":"control 3","expected":{"error":"due_not_after_start"},"passed":true},{"actual":{"error":"due_not_after_start"},"check":"control 4","expected":{"error":"due_not_after_start"},"passed":true},{"actual":{"error":"due_not_after_start"},"check":"control 5","expected":{"error":"due_not_after_start"},"passed":true},{"actual":{"basis":365,"days":30,"interest":4109},"check":"control 6","expected":{"basis":365,"days":30,"interest":4110},"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: interest rounding stage\", \"actual\": {\"days\": 352, \"basis\": 360, \"interest\": 440}, \"expected\": {\"days\": 352, \"basis\": 360, \"interest\": 441}, \"passed\": false}, {\"check\": \"control 1\", \"actual\": {\"days\": 1, \"basis\": 360, \"interest\": 10}, \"expected\": {\"days\": 1, \"basis\": 360, \"interest\": 10}, \"passed\": true}, {\"check\": \"control 2\", \"actual\": {\"days\": 2, \"basis\": 360, \"interest\": 24}, \"expected\": {\"days\": 2, \"basis\": 360, \"interest\": 24}, \"passed\": true}, {\"check\": \"control 3\", \"actual\": {\"error\": \"due_not_after_start\"}, \"expected\": {\"error\": \"due_not_after_start\"}, \"passed\": true}, {\"check\": \"control 4\", \"actual\": {\"error\": \"due_not_after_start\"}, \"expected\": {\"error\": \"due_not_after_start\"}, \"passed\": true}, {\"check\": \"control 5\", \"actual\": {\"error\": \"due_not_after_start\"}, \"expected\": {\"error\": \"due_not_after_start\"}, \"passed\": true}, {\"check\": \"control 6\", \"actual\": {\"days\": 30, \"basis\": 365, \"interest\": 4109}, \"expected\": {\"days\": 30, \"basis\": 365, \"interest\": 4110}, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.512,"exit_code":1,"observations":[{"actual":{"basis":360,"days":352,"interest":352},"check":"regression: interest rounding stage","expected":{"basis":360,"days":352,"interest":441},"passed":false},{"actual":{"basis":360,"days":1,"interest":10},"check":"control 1","expected":{"basis":360,"days":1,"interest":10},"passed":true},{"actual":{"basis":360,"days":2,"interest":24},"check":"control 2","expected":{"basis":360,"days":2,"interest":24},"passed":true},{"actual":{"error":"due_not_after_start"},"check":"control 3","expected":{"error":"due_not_after_start"},"passed":true},{"actual":{"error":"due_not_after_start"},"check":"control 4","expected":{"error":"due_not_after_start"},"passed":true},{"actual":{"error":"due_not_after_start"},"check":"control 5","expected":{"error":"due_not_after_start"},"passed":true},{"actual":{"basis":365,"days":30,"interest":4110},"check":"control 6","expected":{"basis":365,"days":30,"interest":4110},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: interest rounding stage\", \"actual\": {\"days\": 352, \"basis\": 360, \"interest\": 352}, \"expected\": {\"days\": 352, \"basis\": 360, \"interest\": 441}, \"passed\": false}, {\"check\": \"control 1\", \"actual\": {\"days\": 1, \"basis\": 360, \"interest\": 10}, \"expected\": {\"days\": 1, \"basis\": 360, \"interest\": 10}, \"passed\": true}, {\"check\": \"control 2\", \"actual\": {\"days\": 2, \"basis\": 360, \"interest\": 24}, \"expected\": {\"days\": 2, \"basis\": 360, \"interest\": 24}, \"passed\": true}, {\"check\": \"control 3\", \"actual\": {\"error\": \"due_not_after_start\"}, \"expected\": {\"error\": \"due_not_after_start\"}, \"passed\": true}, {\"check\": \"control 4\", \"actual\": {\"error\": \"due_not_after_start\"}, \"expected\": {\"error\": \"due_not_after_start\"}, \"passed\": true}, {\"check\": \"control 5\", \"actual\": {\"error\": \"due_not_after_start\"}, \"expected\": {\"error\": \"due_not_after_start\"}, \"passed\": true}, {\"check\": \"control 6\", \"actual\": {\"days\": 30, \"basis\": 365, \"interest\": 4110}, \"expected\": {\"days\": 30, \"basis\": 365, \"interest\": 4110}, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":39.458,"exit_code":0,"observations":[{"actual":{"basis":360,"days":352,"interest":441},"check":"regression: interest rounding stage","expected":{"basis":360,"days":352,"interest":441},"passed":true},{"actual":{"basis":360,"days":1,"interest":10},"check":"control 1","expected":{"basis":360,"days":1,"interest":10},"passed":true},{"actual":{"basis":360,"days":2,"interest":24},"check":"control 2","expected":{"basis":360,"days":2,"interest":24},"passed":true},{"actual":{"error":"due_not_after_start"},"check":"control 3","expected":{"error":"due_not_after_start"},"passed":true},{"actual":{"error":"due_not_after_start"},"check":"control 4","expected":{"error":"due_not_after_start"},"passed":true},{"actual":{"error":"due_not_after_start"},"check":"control 5","expected":{"error":"due_not_after_start"},"passed":true},{"actual":{"basis":365,"days":30,"interest":4110},"check":"control 6","expected":{"basis":365,"days":30,"interest":4110},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: interest rounding stage\", \"actual\": {\"days\": 352, \"basis\": 360, \"interest\": 441}, \"expected\": {\"days\": 352, \"basis\": 360, \"interest\": 441}, \"passed\": true}, {\"check\": \"control 1\", \"actual\": {\"days\": 1, \"basis\": 360, \"interest\": 10}, \"expected\": {\"days\": 1, \"basis\": 360, \"interest\": 10}, \"passed\": true}, {\"check\": \"control 2\", \"actual\": {\"days\": 2, \"basis\": 360, \"interest\": 24}, \"expected\": {\"days\": 2, \"basis\": 360, \"interest\": 24}, \"passed\": true}, {\"check\": \"control 3\", \"actual\": {\"error\": \"due_not_after_start\"}, \"expected\": {\"error\": \"due_not_after_start\"}, \"passed\": true}, {\"check\": \"control 4\", \"actual\": {\"error\": \"due_not_after_start\"}, \"expected\": {\"error\": \"due_not_after_start\"}, \"passed\": true}, {\"check\": \"control 5\", \"actual\": {\"error\": \"due_not_after_start\"}, \"expected\": {\"error\": \"due_not_after_start\"}, \"passed\": true}, {\"check\": \"control 6\", \"actual\": {\"days\": 30, \"basis\": 365, \"interest\": 4110}, \"expected\": {\"days\": 30, \"basis\": 365, \"interest\": 4110}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}