{"abstract":"A start on the 31st with an end mid-month produces a count one day short.","category":"Bond day-count conventions","checks":8,"contract":"Inputs are two [year, month, day] dates. Apply, in order: if both dates are the last day of February, D2 becomes 30; if D1 is the last day of February, D1 becomes 30; if D2 is 31 and (adjusted) D1 is 30 or 31, D2 becomes 30; if D1 is 31, D1 becomes 30. Return 360*(Y2-Y1)+30*(M2-M1)+(D2-D1) as an integer day count.","evaluation_group":"w2-bond_day_count_conventions-thirty-360-us","failed_approach":"Gating the clamp on D2 not being the 1st still leaves most mid-month end dates unadjusted.","family":"w2-bond_day_count_conventions-thirty-360-us-start-day-clamp","id":"FA-60861","implementations":{"attempt":{"sha256":"513cfbe24c150cd72b8f1d631f74615bc7597bfff7b3f8d5222ee16e4ececcae","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(a, b):\n    y1, m1, d1 = a\n    y2, m2, d2 = b\n    def feb_end(y, m, d):\n        leap = (y % 4 == 0 and y % 100 != 0) or y % 400 == 0\n        return m == 2 and d == (29 if leap else 28)\n    e1 = feb_end(y1, m1, d1)\n    e2 = feb_end(y2, m2, d2)\n    if e1 and e2:\n        d2 = 30\n    if e1:\n        d1 = 30\n    if d2 == 31 and d1 >= 30:\n        d2 = 30\n    if d1 == 31 and d2 == 1:\n        d1 = 30\n    return 360 * (y2 - y1) + 30 * (m2 - m1) + (d2 - d1)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression start day clamp 1', [[2050, 12, 31], [2052, 2, 29]], 419], ['regression start day clamp 2', [[2041, 10, 31], [2044, 2, 29]], 839], ['partial repair probe 1', [[2025, 7, 31], [2025, 1, 31]], -180], ['partial repair probe 2', [[2015, 1, 31], [2017, 3, 31]], 780], ['boundary control 1', [[2024, 3, 15], [2024, 9, 15]], 180], ['boundary control 2', [[2023, 2, 28], [2023, 8, 31]], 180], ['normal control 1', [[2014, 11, 24], [2015, 5, 10]], 166], ['normal control 2', [[2050, 7, 15], [2051, 2, 28]], 223]], [['regression start day clamp 1', [[2038, 1, 31], [2038, 5, 24]], 114], ['regression start day clamp 2', [[2054, 10, 31], [2056, 1, 14]], 434], ['partial repair probe 1', [[2035, 1, 31], [2035, 12, 31]], 330], ['partial repair probe 2', [[2009, 10, 31], [2012, 3, 31]], 870], ['boundary control 1', [[2024, 1, 1], [2024, 1, 1]], 0], ['boundary control 2', [[2023, 2, 28], [2023, 8, 31]], 180], ['normal control 1', [[2000, 2, 29], [2000, 4, 19]], 49], ['normal control 2', [[2074, 6, 28], [2075, 11, 30]], 512]], [['regression start day clamp 1', [[2018, 10, 31], [2019, 6, 6]], 216], ['regression start day clamp 2', [[2094, 5, 31], [2095, 2, 28]], 268], ['partial repair probe 1', [[2053, 7, 31], [2056, 1, 31]], 900], ['partial repair probe 2', [[2090, 1, 31], [2090, 7, 31]], 180], ['boundary control 1', [[2024, 3, 15], [2024, 9, 15]], 180], ['boundary control 2', [[2023, 5, 30], [2023, 7, 31]], 60], ['normal control 1', [[2058, 4, 28], [2059, 11, 11]], 553], ['normal control 2', [[2014, 6, 11], [2017, 9, 7]], 1166]], [['regression start day clamp 1', [[2096, 5, 31], [2097, 5, 1]], 331], ['regression start day clamp 2', [[2075, 1, 31], [2076, 5, 13]], 463], ['partial repair probe 1', [[2047, 8, 31], [2050, 6, 30]], 1020], ['partial repair probe 2', [[2023, 1, 31], [2023, 3, 31]], 60], ['boundary control 1', [[2024, 1, 1], [2024, 1, 1]], 0], ['boundary control 2', [[2023, 2, 28], [2023, 8, 31]], 180], ['normal control 1', [[2071, 11, 18], [2074, 12, 31]], 1123], ['normal control 2', [[2089, 4, 29], [2090, 3, 31]], 332]], [['regression start day clamp 1', [[2017, 10, 31], [2018, 3, 2]], 122], ['regression start day clamp 2', [[2086, 5, 31], [2088, 2, 29]], 629], ['partial repair probe 1', [[2029, 1, 31], [2032, 1, 31]], 1080], ['partial repair probe 2', [[2042, 1, 31], [2043, 12, 31]], 690], ['boundary control 1', [[2024, 3, 15], [2024, 9, 15]], 180], ['boundary control 2', [[2024, 2, 29], [2025, 2, 28]], 360], ['normal control 1', [[2004, 4, 30], [2005, 7, 30]], 450], ['normal control 2', [[2020, 2, 29], [2022, 2, 28]], 720]]]\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":"c0e605cc9aa6e4a3b4e52b0917934882bba96a6b1f6b3b3347985fe1bb867451","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(a, b):\n    y1, m1, d1 = a\n    y2, m2, d2 = b\n    def feb_end(y, m, d):\n        leap = (y % 4 == 0 and y % 100 != 0) or y % 400 == 0\n        return m == 2 and d == (29 if leap else 28)\n    e1 = feb_end(y1, m1, d1)\n    e2 = feb_end(y2, m2, d2)\n    if e1 and e2:\n        d2 = 30\n    if e1:\n        d1 = 30\n    if d2 == 31 and d1 >= 30:\n        d2 = 30\n    if d1 == 31 and d2 >= 30:\n        d1 = 30\n    return 360 * (y2 - y1) + 30 * (m2 - m1) + (d2 - d1)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression start day clamp 1', [[2050, 12, 31], [2052, 2, 29]], 419], ['regression start day clamp 2', [[2041, 10, 31], [2044, 2, 29]], 839], ['partial repair probe 1', [[2025, 7, 31], [2025, 1, 31]], -180], ['partial repair probe 2', [[2015, 1, 31], [2017, 3, 31]], 780], ['boundary control 1', [[2024, 3, 15], [2024, 9, 15]], 180], ['boundary control 2', [[2023, 2, 28], [2023, 8, 31]], 180], ['normal control 1', [[2014, 11, 24], [2015, 5, 10]], 166], ['normal control 2', [[2050, 7, 15], [2051, 2, 28]], 223]], [['regression start day clamp 1', [[2038, 1, 31], [2038, 5, 24]], 114], ['regression start day clamp 2', [[2054, 10, 31], [2056, 1, 14]], 434], ['partial repair probe 1', [[2035, 1, 31], [2035, 12, 31]], 330], ['partial repair probe 2', [[2009, 10, 31], [2012, 3, 31]], 870], ['boundary control 1', [[2024, 1, 1], [2024, 1, 1]], 0], ['boundary control 2', [[2023, 2, 28], [2023, 8, 31]], 180], ['normal control 1', [[2000, 2, 29], [2000, 4, 19]], 49], ['normal control 2', [[2074, 6, 28], [2075, 11, 30]], 512]], [['regression start day clamp 1', [[2018, 10, 31], [2019, 6, 6]], 216], ['regression start day clamp 2', [[2094, 5, 31], [2095, 2, 28]], 268], ['partial repair probe 1', [[2053, 7, 31], [2056, 1, 31]], 900], ['partial repair probe 2', [[2090, 1, 31], [2090, 7, 31]], 180], ['boundary control 1', [[2024, 3, 15], [2024, 9, 15]], 180], ['boundary control 2', [[2023, 5, 30], [2023, 7, 31]], 60], ['normal control 1', [[2058, 4, 28], [2059, 11, 11]], 553], ['normal control 2', [[2014, 6, 11], [2017, 9, 7]], 1166]], [['regression start day clamp 1', [[2096, 5, 31], [2097, 5, 1]], 331], ['regression start day clamp 2', [[2075, 1, 31], [2076, 5, 13]], 463], ['partial repair probe 1', [[2047, 8, 31], [2050, 6, 30]], 1020], ['partial repair probe 2', [[2023, 1, 31], [2023, 3, 31]], 60], ['boundary control 1', [[2024, 1, 1], [2024, 1, 1]], 0], ['boundary control 2', [[2023, 2, 28], [2023, 8, 31]], 180], ['normal control 1', [[2071, 11, 18], [2074, 12, 31]], 1123], ['normal control 2', [[2089, 4, 29], [2090, 3, 31]], 332]], [['regression start day clamp 1', [[2017, 10, 31], [2018, 3, 2]], 122], ['regression start day clamp 2', [[2086, 5, 31], [2088, 2, 29]], 629], ['partial repair probe 1', [[2029, 1, 31], [2032, 1, 31]], 1080], ['partial repair probe 2', [[2042, 1, 31], [2043, 12, 31]], 690], ['boundary control 1', [[2024, 3, 15], [2024, 9, 15]], 180], ['boundary control 2', [[2024, 2, 29], [2025, 2, 28]], 360], ['normal control 1', [[2004, 4, 30], [2005, 7, 30]], 450], ['normal control 2', [[2020, 2, 29], [2022, 2, 28]], 720]]]\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"},"fixed":{"sha256":"155e5b46df8336ba1abcc2ce7e0559665c94c2aaf1f1c5e4f70a91428526180a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(a, b):\n    y1, m1, d1 = a\n    y2, m2, d2 = b\n    def feb_end(y, m, d):\n        leap = (y % 4 == 0 and y % 100 != 0) or y % 400 == 0\n        return m == 2 and d == (29 if leap else 28)\n    e1 = feb_end(y1, m1, d1)\n    e2 = feb_end(y2, m2, d2)\n    if e1 and e2:\n        d2 = 30\n    if e1:\n        d1 = 30\n    if d2 == 31 and d1 >= 30:\n        d2 = 30\n    if d1 == 31:\n        d1 = 30\n    return 360 * (y2 - y1) + 30 * (m2 - m1) + (d2 - d1)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression start day clamp 1', [[2050, 12, 31], [2052, 2, 29]], 419], ['regression start day clamp 2', [[2041, 10, 31], [2044, 2, 29]], 839], ['partial repair probe 1', [[2025, 7, 31], [2025, 1, 31]], -180], ['partial repair probe 2', [[2015, 1, 31], [2017, 3, 31]], 780], ['boundary control 1', [[2024, 3, 15], [2024, 9, 15]], 180], ['boundary control 2', [[2023, 2, 28], [2023, 8, 31]], 180], ['normal control 1', [[2014, 11, 24], [2015, 5, 10]], 166], ['normal control 2', [[2050, 7, 15], [2051, 2, 28]], 223]], [['regression start day clamp 1', [[2038, 1, 31], [2038, 5, 24]], 114], ['regression start day clamp 2', [[2054, 10, 31], [2056, 1, 14]], 434], ['partial repair probe 1', [[2035, 1, 31], [2035, 12, 31]], 330], ['partial repair probe 2', [[2009, 10, 31], [2012, 3, 31]], 870], ['boundary control 1', [[2024, 1, 1], [2024, 1, 1]], 0], ['boundary control 2', [[2023, 2, 28], [2023, 8, 31]], 180], ['normal control 1', [[2000, 2, 29], [2000, 4, 19]], 49], ['normal control 2', [[2074, 6, 28], [2075, 11, 30]], 512]], [['regression start day clamp 1', [[2018, 10, 31], [2019, 6, 6]], 216], ['regression start day clamp 2', [[2094, 5, 31], [2095, 2, 28]], 268], ['partial repair probe 1', [[2053, 7, 31], [2056, 1, 31]], 900], ['partial repair probe 2', [[2090, 1, 31], [2090, 7, 31]], 180], ['boundary control 1', [[2024, 3, 15], [2024, 9, 15]], 180], ['boundary control 2', [[2023, 5, 30], [2023, 7, 31]], 60], ['normal control 1', [[2058, 4, 28], [2059, 11, 11]], 553], ['normal control 2', [[2014, 6, 11], [2017, 9, 7]], 1166]], [['regression start day clamp 1', [[2096, 5, 31], [2097, 5, 1]], 331], ['regression start day clamp 2', [[2075, 1, 31], [2076, 5, 13]], 463], ['partial repair probe 1', [[2047, 8, 31], [2050, 6, 30]], 1020], ['partial repair probe 2', [[2023, 1, 31], [2023, 3, 31]], 60], ['boundary control 1', [[2024, 1, 1], [2024, 1, 1]], 0], ['boundary control 2', [[2023, 2, 28], [2023, 8, 31]], 180], ['normal control 1', [[2071, 11, 18], [2074, 12, 31]], 1123], ['normal control 2', [[2089, 4, 29], [2090, 3, 31]], 332]], [['regression start day clamp 1', [[2017, 10, 31], [2018, 3, 2]], 122], ['regression start day clamp 2', [[2086, 5, 31], [2088, 2, 29]], 629], ['partial repair probe 1', [[2029, 1, 31], [2032, 1, 31]], 1080], ['partial repair probe 2', [[2042, 1, 31], [2043, 12, 31]], 690], ['boundary control 1', [[2024, 3, 15], [2024, 9, 15]], 180], ['boundary control 2', [[2024, 2, 29], [2025, 2, 28]], 360], ['normal control 1', [[2004, 4, 30], [2005, 7, 30]], 450], ['normal control 2', [[2020, 2, 29], [2022, 2, 28]], 720]]]\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-thirty-360-us-start-day-clamp","generated_at":"2026-09-29T14:46:49.602973+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.","repair":"Clamp D1=31 to 30 unconditionally after the other rules.","root_cause":"The D1 clamp was written as a mirror of the D2 rule and only fires when D2 is also 30 or later.","sha256":"fe9107cdb16760ab399ecd326d37956099837398e7d1338b73f38eb1def42429","title":"30/360 US bond basis: the D1=31 clamp is made conditional on the end date · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.122,"exit_code":1,"observations":[{"actual":418,"check":"regression start day clamp 1","expected":419,"passed":false},{"actual":838,"check":"regression start day clamp 2","expected":839,"passed":false},{"actual":-181,"check":"partial repair probe 1","expected":-180,"passed":false},{"actual":779,"check":"partial repair probe 2","expected":780,"passed":false},{"actual":180,"check":"boundary control 1","expected":180,"passed":true},{"actual":180,"check":"boundary control 2","expected":180,"passed":true},{"actual":166,"check":"normal control 1","expected":166,"passed":true},{"actual":223,"check":"normal control 2","expected":223,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression start day clamp 1\", \"actual\": 418, \"expected\": 419, \"passed\": false}, {\"check\": \"regression start day clamp 2\", \"actual\": 838, \"expected\": 839, \"passed\": false}, {\"check\": \"partial repair probe 1\", \"actual\": -181, \"expected\": -180, \"passed\": false}, {\"check\": \"partial repair probe 2\", \"actual\": 779, \"expected\": 780, \"passed\": false}, {\"check\": \"boundary control 1\", \"actual\": 180, \"expected\": 180, \"passed\": true}, {\"check\": \"boundary control 2\", \"actual\": 180, \"expected\": 180, \"passed\": true}, {\"check\": \"normal control 1\", \"actual\": 166, \"expected\": 166, \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": 223, \"expected\": 223, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.926,"exit_code":1,"observations":[{"actual":418,"check":"regression start day clamp 1","expected":419,"passed":false},{"actual":838,"check":"regression start day clamp 2","expected":839,"passed":false},{"actual":-180,"check":"partial repair probe 1","expected":-180,"passed":true},{"actual":780,"check":"partial repair probe 2","expected":780,"passed":true},{"actual":180,"check":"boundary control 1","expected":180,"passed":true},{"actual":180,"check":"boundary control 2","expected":180,"passed":true},{"actual":166,"check":"normal control 1","expected":166,"passed":true},{"actual":223,"check":"normal control 2","expected":223,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression start day clamp 1\", \"actual\": 418, \"expected\": 419, \"passed\": false}, {\"check\": \"regression start day clamp 2\", \"actual\": 838, \"expected\": 839, \"passed\": false}, {\"check\": \"partial repair probe 1\", \"actual\": -180, \"expected\": -180, \"passed\": true}, {\"check\": \"partial repair probe 2\", \"actual\": 780, \"expected\": 780, \"passed\": true}, {\"check\": \"boundary control 1\", \"actual\": 180, \"expected\": 180, \"passed\": true}, {\"check\": \"boundary control 2\", \"actual\": 180, \"expected\": 180, \"passed\": true}, {\"check\": \"normal control 1\", \"actual\": 166, \"expected\": 166, \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": 223, \"expected\": 223, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":42.157,"exit_code":0,"observations":[{"actual":419,"check":"regression start day clamp 1","expected":419,"passed":true},{"actual":839,"check":"regression start day clamp 2","expected":839,"passed":true},{"actual":-180,"check":"partial repair probe 1","expected":-180,"passed":true},{"actual":780,"check":"partial repair probe 2","expected":780,"passed":true},{"actual":180,"check":"boundary control 1","expected":180,"passed":true},{"actual":180,"check":"boundary control 2","expected":180,"passed":true},{"actual":166,"check":"normal control 1","expected":166,"passed":true},{"actual":223,"check":"normal control 2","expected":223,"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression start day clamp 1\", \"actual\": 419, \"expected\": 419, \"passed\": true}, {\"check\": \"regression start day clamp 2\", \"actual\": 839, \"expected\": 839, \"passed\": true}, {\"check\": \"partial repair probe 1\", \"actual\": -180, \"expected\": -180, \"passed\": true}, {\"check\": \"partial repair probe 2\", \"actual\": 780, \"expected\": 780, \"passed\": true}, {\"check\": \"boundary control 1\", \"actual\": 180, \"expected\": 180, \"passed\": true}, {\"check\": \"boundary control 2\", \"actual\": 180, \"expected\": 180, \"passed\": true}, {\"check\": \"normal control 1\", \"actual\": 166, \"expected\": 166, \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": 223, \"expected\": 223, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}