{"abstract":"Early settlements in a long first period are charged for quasi periods not yet elapsed.","category":"Bond day-count conventions","checks":8,"contract":"Inputs issue, first coupon and settlement [y,m,d], annual rate and months per period. Settlement must lie in [issue, first] else return \"settlement outside first period\". Quasi-coupon dates are generated back from the first coupon in steps of months (day clamped to month length) until one is on or before issue. For each quasi period [start, end), accrued days are those in [max(start, issue), min(end, settle)) and are divided by that quasi period length. Accrued = 100*rate/freq*sum, rounded to 6 decimals.","contract_signature":"issue, first, settle, rate, months","evaluation_group":"w2-bond_day_count_conventions-long-first-coupon-quasi","failed_approach":"Clipping the two latest periods still fails when three or more quasi periods exist.","family":"w2-bond_day_count_conventions-long-first-coupon-quasi-settlement-clipping","id":"FA-61061","implementations":{"attempt":{"sha256":"9bc311dee32aa366a6334f04a76ed7cc5bc203c5e9fa29de0ac1f4be2b90bec0","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport datetime\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(issue, first, settle, rate, months):\n    def mlen(y, m):\n        if m == 2:\n            return 29 if (y % 4 == 0 and y % 100 != 0) or y % 400 == 0 else 28\n        return 30 if m in (4, 6, 9, 11) else 31\n    I = datetime.date(*issue)\n    Fc = datetime.date(*first)\n    S = datetime.date(*settle)\n    if not (I <= S <= Fc):\n        return 'settlement outside first period'\n    freq = 12 // months\n    def back(k):\n        t = Fc.year * 12 + Fc.month - 1 - k * months\n        y, m = t // 12, t % 12 + 1\n        return datetime.date(y, m, min(Fc.day, mlen(y, m)))\n    q = [Fc]\n    k = 1\n    while q[-1] > I:\n        q.append(back(k))\n        k += 1\n    frac = Fraction(0)\n    for j in range(len(q) - 1):\n        end, start = q[j], q[j + 1]\n        lo = max(start, I)\n        hi = min(end, S) if j <= 1 else end\n        if hi > lo:\n            frac += Fraction((hi - lo).days, (end - start).days)\n    return round(float(100 * Fraction(str(rate)) / freq * frac), 6)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression settlement clipping 1', [[2037, 12, 17], [2038, 8, 31], [2038, 4, 9], 0.08, 3], 2.491787], ['regression settlement clipping 2', [[2042, 11, 10], [2043, 8, 31], [2042, 12, 3], 0.03, 6], 0.190608], ['partial repair probe 1', [[2039, 3, 14], [2040, 10, 23], [2039, 3, 14], 0.045, 6], 0.0], ['partial repair probe 2', [[2043, 10, 16], [2045, 4, 30], [2043, 11, 25], 0.03, 6], 0.327869], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 5, 1], 0.05, 6], 1.531444], ['boundary control 2', [[2024, 3, 15], [2024, 9, 15], [2024, 6, 15], 0.05, 6], 1.25], ['normal control 1', [[2029, 10, 4], [2031, 3, 15], [2031, 3, 1], 0.0675, 6], 9.509669], ['normal control 2', [[2027, 11, 10], [2029, 9, 29], [2027, 11, 7], 0.045, 12], 'settlement outside first period']], [['regression settlement clipping 1', [[2018, 3, 16], [2018, 5, 5], [2018, 3, 16], 0.045, 1], 0.0], ['regression settlement clipping 2', [[2035, 7, 24], [2035, 10, 5], [2035, 8, 15], 0.0675, 1], 0.399194], ['partial repair probe 1', [[2037, 2, 2], [2038, 3, 25], [2037, 2, 2], 0.045, 6], 0.0], ['partial repair probe 2', [[2014, 11, 11], [2015, 1, 31], [2014, 11, 27], 0.05, 1], 0.222222], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 9, 16], 0.05, 6], 'settlement outside first period'], ['boundary control 2', [[2024, 1, 10], [2024, 9, 15], [2024, 5, 1], 0.05, 6], 1.531444], ['normal control 1', [[2029, 11, 15], [2030, 5, 4], [2030, 5, 4], 0.08, 6], 3.756906], ['normal control 2', [[2027, 7, 20], [2028, 1, 29], [2027, 7, 17], 0.03, 3], 'settlement outside first period']], [['regression settlement clipping 1', [[2038, 6, 26], [2038, 9, 19], [2038, 6, 27], 0.08, 1], 0.022222], ['regression settlement clipping 2', [[2034, 9, 8], [2035, 3, 31], [2034, 9, 8], 0.045, 3], 0.0], ['partial repair probe 1', [[2037, 3, 25], [2037, 11, 1], [2037, 3, 25], 0.08, 3], 0.0], ['partial repair probe 2', [[2010, 1, 19], [2010, 11, 1], [2010, 1, 19], 0.03, 3], 0.0], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 9, 16], 0.05, 6], 'settlement outside first period'], ['boundary control 2', [[2024, 1, 10], [2024, 9, 15], [2024, 5, 1], 0.05, 6], 1.531444], ['normal control 1', [[2043, 11, 1], [2043, 11, 12], [2043, 11, 4], 0.0675, 3], 0.055027], ['normal control 2', [[2031, 2, 12], [2031, 2, 28], [2031, 2, 28], 0.0675, 1], 0.290323]], [['regression settlement clipping 1', [[2039, 4, 11], [2039, 10, 15], [2039, 7, 14], 0.03, 3], 0.775092], ['regression settlement clipping 2', [[2032, 12, 15], [2034, 1, 28], [2033, 1, 8], 0.05, 12], 0.327869], ['partial repair probe 1', [[2028, 1, 11], [2028, 11, 18], [2028, 4, 15], 0.045, 3], 1.177174], ['partial repair probe 2', [[2026, 2, 6], [2028, 10, 12], [2026, 9, 29], 0.03, 12], 1.931507], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 9, 16], 0.05, 6], 'settlement outside first period'], ['boundary control 2', [[2024, 3, 15], [2024, 9, 15], [2024, 6, 15], 0.05, 6], 1.25], ['normal control 1', [[2012, 12, 25], [2013, 2, 15], [2013, 2, 15], 0.02, 1], 0.27957], ['normal control 2', [[2001, 2, 18], [2001, 5, 28], [2001, 2, 18], 0.03, 6], 0.0]], [['regression settlement clipping 1', [[2005, 11, 20], [2007, 1, 31], [2006, 3, 21], 0.05, 6], 1.655056], ['regression settlement clipping 2', [[2016, 10, 4], [2018, 4, 26], [2016, 10, 4], 0.045, 12], 0.0], ['partial repair probe 1', [[2001, 1, 21], [2001, 3, 31], [2001, 1, 23], 0.045, 1], 0.024194], ['partial repair probe 2', [[2028, 8, 30], [2030, 2, 28], [2028, 12, 17], 0.05, 6], 1.480978], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 5, 1], 0.05, 6], 1.531444], ['boundary control 2', [[2024, 3, 15], [2024, 9, 15], [2024, 6, 15], 0.05, 6], 1.25], ['normal control 1', [[2021, 5, 19], [2021, 5, 31], [2021, 5, 16], 0.05, 3], 'settlement outside first period'], ['normal control 2', [[2040, 1, 11], [2040, 5, 31], [2040, 1, 11], 0.02, 12], 0.0]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), 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":"46be8519456aeadf8babda4d86119ffaccf46179e129a17643b206414aa34d1a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport datetime\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(issue, first, settle, rate, months):\n    def mlen(y, m):\n        if m == 2:\n            return 29 if (y % 4 == 0 and y % 100 != 0) or y % 400 == 0 else 28\n        return 30 if m in (4, 6, 9, 11) else 31\n    I = datetime.date(*issue)\n    Fc = datetime.date(*first)\n    S = datetime.date(*settle)\n    if not (I <= S <= Fc):\n        return 'settlement outside first period'\n    freq = 12 // months\n    def back(k):\n        t = Fc.year * 12 + Fc.month - 1 - k * months\n        y, m = t // 12, t % 12 + 1\n        return datetime.date(y, m, min(Fc.day, mlen(y, m)))\n    q = [Fc]\n    k = 1\n    while q[-1] > I:\n        q.append(back(k))\n        k += 1\n    frac = Fraction(0)\n    for j in range(len(q) - 1):\n        end, start = q[j], q[j + 1]\n        lo = max(start, I)\n        hi = min(end, S) if j == 0 else end\n        if hi > lo:\n            frac += Fraction((hi - lo).days, (end - start).days)\n    return round(float(100 * Fraction(str(rate)) / freq * frac), 6)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression settlement clipping 1', [[2037, 12, 17], [2038, 8, 31], [2038, 4, 9], 0.08, 3], 2.491787], ['regression settlement clipping 2', [[2042, 11, 10], [2043, 8, 31], [2042, 12, 3], 0.03, 6], 0.190608], ['partial repair probe 1', [[2039, 3, 14], [2040, 10, 23], [2039, 3, 14], 0.045, 6], 0.0], ['partial repair probe 2', [[2043, 10, 16], [2045, 4, 30], [2043, 11, 25], 0.03, 6], 0.327869], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 5, 1], 0.05, 6], 1.531444], ['boundary control 2', [[2024, 3, 15], [2024, 9, 15], [2024, 6, 15], 0.05, 6], 1.25], ['normal control 1', [[2029, 10, 4], [2031, 3, 15], [2031, 3, 1], 0.0675, 6], 9.509669], ['normal control 2', [[2027, 11, 10], [2029, 9, 29], [2027, 11, 7], 0.045, 12], 'settlement outside first period']], [['regression settlement clipping 1', [[2018, 3, 16], [2018, 5, 5], [2018, 3, 16], 0.045, 1], 0.0], ['regression settlement clipping 2', [[2035, 7, 24], [2035, 10, 5], [2035, 8, 15], 0.0675, 1], 0.399194], ['partial repair probe 1', [[2037, 2, 2], [2038, 3, 25], [2037, 2, 2], 0.045, 6], 0.0], ['partial repair probe 2', [[2014, 11, 11], [2015, 1, 31], [2014, 11, 27], 0.05, 1], 0.222222], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 9, 16], 0.05, 6], 'settlement outside first period'], ['boundary control 2', [[2024, 1, 10], [2024, 9, 15], [2024, 5, 1], 0.05, 6], 1.531444], ['normal control 1', [[2029, 11, 15], [2030, 5, 4], [2030, 5, 4], 0.08, 6], 3.756906], ['normal control 2', [[2027, 7, 20], [2028, 1, 29], [2027, 7, 17], 0.03, 3], 'settlement outside first period']], [['regression settlement clipping 1', [[2038, 6, 26], [2038, 9, 19], [2038, 6, 27], 0.08, 1], 0.022222], ['regression settlement clipping 2', [[2034, 9, 8], [2035, 3, 31], [2034, 9, 8], 0.045, 3], 0.0], ['partial repair probe 1', [[2037, 3, 25], [2037, 11, 1], [2037, 3, 25], 0.08, 3], 0.0], ['partial repair probe 2', [[2010, 1, 19], [2010, 11, 1], [2010, 1, 19], 0.03, 3], 0.0], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 9, 16], 0.05, 6], 'settlement outside first period'], ['boundary control 2', [[2024, 1, 10], [2024, 9, 15], [2024, 5, 1], 0.05, 6], 1.531444], ['normal control 1', [[2043, 11, 1], [2043, 11, 12], [2043, 11, 4], 0.0675, 3], 0.055027], ['normal control 2', [[2031, 2, 12], [2031, 2, 28], [2031, 2, 28], 0.0675, 1], 0.290323]], [['regression settlement clipping 1', [[2039, 4, 11], [2039, 10, 15], [2039, 7, 14], 0.03, 3], 0.775092], ['regression settlement clipping 2', [[2032, 12, 15], [2034, 1, 28], [2033, 1, 8], 0.05, 12], 0.327869], ['partial repair probe 1', [[2028, 1, 11], [2028, 11, 18], [2028, 4, 15], 0.045, 3], 1.177174], ['partial repair probe 2', [[2026, 2, 6], [2028, 10, 12], [2026, 9, 29], 0.03, 12], 1.931507], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 9, 16], 0.05, 6], 'settlement outside first period'], ['boundary control 2', [[2024, 3, 15], [2024, 9, 15], [2024, 6, 15], 0.05, 6], 1.25], ['normal control 1', [[2012, 12, 25], [2013, 2, 15], [2013, 2, 15], 0.02, 1], 0.27957], ['normal control 2', [[2001, 2, 18], [2001, 5, 28], [2001, 2, 18], 0.03, 6], 0.0]], [['regression settlement clipping 1', [[2005, 11, 20], [2007, 1, 31], [2006, 3, 21], 0.05, 6], 1.655056], ['regression settlement clipping 2', [[2016, 10, 4], [2018, 4, 26], [2016, 10, 4], 0.045, 12], 0.0], ['partial repair probe 1', [[2001, 1, 21], [2001, 3, 31], [2001, 1, 23], 0.045, 1], 0.024194], ['partial repair probe 2', [[2028, 8, 30], [2030, 2, 28], [2028, 12, 17], 0.05, 6], 1.480978], ['boundary control 1', [[2024, 1, 10], [2024, 9, 15], [2024, 5, 1], 0.05, 6], 1.531444], ['boundary control 2', [[2024, 3, 15], [2024, 9, 15], [2024, 6, 15], 0.05, 6], 1.25], ['normal control 1', [[2021, 5, 19], [2021, 5, 31], [2021, 5, 16], 0.05, 3], 'settlement outside first period'], ['normal control 2', [[2040, 1, 11], [2040, 5, 31], [2040, 1, 11], 0.02, 12], 0.0]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), 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 toy contract stated explicitly in the contract field; no claim of conformance to any published convention text. 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-bond_day_count_conventions-long-first-coupon-quasi-settlement-clipping","generated_at":"2026-09-29T14:46:51.543723+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Bond accrual and pricing systems depend on exact day-count arithmetic; a single-day error changes settlement cash.","root_cause":"Only the latest quasi period clips its end at the settlement date.","sha256":"efdd9795aa76866e04853674c7f7362c740c4e0753da5d7578fece2aa2accab1","title":"Irregular first coupon accrued by quasi-coupon periods: older quasi periods are accrued in full regardless of settlement · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":48.233,"exit_code":1,"observations":[{"actual":2.491787,"check":"regression settlement clipping 1","expected":2.491787,"passed":true},{"actual":0.190608,"check":"regression settlement clipping 2","expected":0.190608,"passed":true},{"actual":2.744505,"check":"partial repair probe 1","expected":0.0,"passed":false},{"actual":1.614754,"check":"partial repair probe 2","expected":0.327869,"passed":false},{"actual":1.531444,"check":"boundary control 1","expected":1.531444,"passed":true},{"actual":1.25,"check":"boundary control 2","expected":1.25,"passed":true},{"actual":9.509669,"check":"normal control 1","expected":9.509669,"passed":true},{"actual":"settlement outside first period","check":"normal control 2","expected":"settlement outside first period","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression settlement clipping 1\", \"actual\": 2.491787, \"expected\": 2.491787, \"passed\": true}, {\"check\": \"regression settlement clipping 2\", \"actual\": 0.190608, \"expected\": 0.190608, \"passed\": true}, {\"check\": \"partial repair probe 1\", \"actual\": 2.744505, \"expected\": 0.0, \"passed\": false}, {\"check\": \"partial repair probe 2\", \"actual\": 1.614754, \"expected\": 0.327869, \"passed\": false}, {\"check\": \"boundary control 1\", \"actual\": 1.531444, \"expected\": 1.531444, \"passed\": true}, {\"check\": \"boundary control 2\", \"actual\": 1.25, \"expected\": 1.25, \"passed\": true}, {\"check\": \"normal control 1\", \"actual\": 9.509669, \"expected\": 9.509669, \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": \"settlement outside first period\", \"expected\": \"settlement outside first period\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":47.171,"exit_code":1,"observations":[{"actual":3.622222,"check":"regression settlement clipping 1","expected":2.491787,"passed":false},{"actual":0.911602,"check":"regression settlement clipping 2","expected":0.190608,"passed":false},{"actual":4.994505,"check":"partial repair probe 1","expected":0.0,"passed":false},{"actual":3.114754,"check":"partial repair probe 2","expected":0.327869,"passed":false},{"actual":1.531444,"check":"boundary control 1","expected":1.531444,"passed":true},{"actual":1.25,"check":"boundary control 2","expected":1.25,"passed":true},{"actual":9.509669,"check":"normal control 1","expected":9.509669,"passed":true},{"actual":"settlement outside first period","check":"normal control 2","expected":"settlement outside first period","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression settlement clipping 1\", \"actual\": 3.622222, \"expected\": 2.491787, \"passed\": false}, {\"check\": \"regression settlement clipping 2\", \"actual\": 0.911602, \"expected\": 0.190608, \"passed\": false}, {\"check\": \"partial repair probe 1\", \"actual\": 4.994505, \"expected\": 0.0, \"passed\": false}, {\"check\": \"partial repair probe 2\", \"actual\": 3.114754, \"expected\": 0.327869, \"passed\": false}, {\"check\": \"boundary control 1\", \"actual\": 1.531444, \"expected\": 1.531444, \"passed\": true}, {\"check\": \"boundary control 2\", \"actual\": 1.25, \"expected\": 1.25, \"passed\": true}, {\"check\": \"normal control 1\", \"actual\": 9.509669, \"expected\": 9.509669, \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": \"settlement outside first period\", \"expected\": \"settlement outside first period\", \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}