{"abstract":"Periods ending on the 31st lose a day even when the start day is early in the month.","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.","contract_signature":"a, b","evaluation_group":"w2-bond_day_count_conventions-thirty-360-us","failed_approach":"Requiring D1 to be exactly 31 misses starts on the 30th and February-end starts promoted to 30.","family":"w2-bond_day_count_conventions-thirty-360-us-d2-thirty-one-condition","id":"FA-60841","implementations":{"attempt":{"sha256":"682399de404af764cbe5ce54bc10b656f50a133180755fbc73d3388b3610c735","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 == 31:\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 d2 thirty-one condition 1', [[2003, 3, 4], [2004, 7, 31]], 507], ['regression d2 thirty-one condition 2', [[2054, 5, 29], [2055, 7, 31]], 422], ['partial repair probe 1', [[2065, 12, 30], [2067, 5, 31]], 510], ['partial repair probe 2', [[2004, 2, 29], [2004, 1, 31]], -30], ['boundary control 1', [[2023, 1, 31], [2023, 3, 31]], 60], ['boundary control 2', [[2024, 2, 29], [2025, 2, 28]], 360], ['normal control 1', [[2015, 9, 30], [2015, 11, 1]], 31], ['normal control 2', [[2016, 2, 28], [2016, 6, 23]], 115]], [['regression d2 thirty-one condition 1', [[2010, 12, 29], [2011, 12, 31]], 362], ['regression d2 thirty-one condition 2', [[2016, 2, 28], [2017, 3, 31]], 393], ['partial repair probe 1', [[2082, 11, 30], [2084, 3, 31]], 480], ['partial repair probe 2', [[2004, 2, 29], [2005, 5, 31]], 450], ['boundary control 1', [[2024, 3, 15], [2024, 9, 15]], 180], ['boundary control 2', [[2024, 1, 1], [2024, 1, 1]], 0], ['normal control 1', [[2001, 11, 21], [2003, 11, 23]], 722], ['normal control 2', [[2032, 7, 29], [2033, 2, 28]], 209]], [['regression d2 thirty-one condition 1', [[2077, 11, 25], [2077, 12, 31]], 36], ['regression d2 thirty-one condition 2', [[2030, 1, 14], [2033, 7, 31]], 1277], ['partial repair probe 1', [[2074, 1, 30], [2077, 12, 31]], 1410], ['partial repair probe 2', [[2047, 6, 30], [2050, 1, 31]], 930], ['boundary control 1', [[2023, 1, 31], [2023, 3, 31]], 60], ['boundary control 2', [[2024, 3, 15], [2024, 9, 15]], 180], ['normal control 1', [[2007, 3, 31], [2009, 2, 28]], 688], ['normal control 2', [[2065, 5, 31], [2068, 7, 31]], 1140]], [['regression d2 thirty-one condition 1', [[2065, 12, 23], [2069, 1, 31]], 1118], ['regression d2 thirty-one condition 2', [[2058, 1, 18], [2060, 1, 31]], 733], ['partial repair probe 1', [[2016, 2, 29], [2018, 12, 31]], 1020], ['partial repair probe 2', [[2096, 2, 29], [2097, 12, 31]], 660], ['boundary control 1', [[2024, 2, 29], [2025, 2, 28]], 360], ['boundary control 2', [[2024, 3, 15], [2024, 9, 15]], 180], ['normal control 1', [[1999, 12, 31], [1999, 3, 31]], -270], ['normal control 2', [[2066, 7, 31], [2069, 12, 30]], 1230]], [['regression d2 thirty-one condition 1', [[2080, 3, 21], [2080, 10, 31]], 220], ['regression d2 thirty-one condition 2', [[2038, 8, 15], [2039, 10, 31]], 436], ['partial repair probe 1', [[2030, 11, 30], [2033, 8, 31]], 990], ['partial repair probe 2', [[2051, 9, 30], [2053, 5, 31]], 600], ['boundary control 1', [[2023, 1, 31], [2023, 3, 31]], 60], ['boundary control 2', [[2024, 1, 1], [2024, 1, 1]], 0], ['normal control 1', [[2091, 11, 20], [2092, 2, 29]], 99], ['normal control 2', [[2000, 2, 28], [2002, 2, 9]], 701]]]\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":"038c99700188bc86910da21fc772cd7d24fe3ffbe8cf3876ea2bf5f1e605aeac","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:\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 d2 thirty-one condition 1', [[2003, 3, 4], [2004, 7, 31]], 507], ['regression d2 thirty-one condition 2', [[2054, 5, 29], [2055, 7, 31]], 422], ['partial repair probe 1', [[2065, 12, 30], [2067, 5, 31]], 510], ['partial repair probe 2', [[2004, 2, 29], [2004, 1, 31]], -30], ['boundary control 1', [[2023, 1, 31], [2023, 3, 31]], 60], ['boundary control 2', [[2024, 2, 29], [2025, 2, 28]], 360], ['normal control 1', [[2015, 9, 30], [2015, 11, 1]], 31], ['normal control 2', [[2016, 2, 28], [2016, 6, 23]], 115]], [['regression d2 thirty-one condition 1', [[2010, 12, 29], [2011, 12, 31]], 362], ['regression d2 thirty-one condition 2', [[2016, 2, 28], [2017, 3, 31]], 393], ['partial repair probe 1', [[2082, 11, 30], [2084, 3, 31]], 480], ['partial repair probe 2', [[2004, 2, 29], [2005, 5, 31]], 450], ['boundary control 1', [[2024, 3, 15], [2024, 9, 15]], 180], ['boundary control 2', [[2024, 1, 1], [2024, 1, 1]], 0], ['normal control 1', [[2001, 11, 21], [2003, 11, 23]], 722], ['normal control 2', [[2032, 7, 29], [2033, 2, 28]], 209]], [['regression d2 thirty-one condition 1', [[2077, 11, 25], [2077, 12, 31]], 36], ['regression d2 thirty-one condition 2', [[2030, 1, 14], [2033, 7, 31]], 1277], ['partial repair probe 1', [[2074, 1, 30], [2077, 12, 31]], 1410], ['partial repair probe 2', [[2047, 6, 30], [2050, 1, 31]], 930], ['boundary control 1', [[2023, 1, 31], [2023, 3, 31]], 60], ['boundary control 2', [[2024, 3, 15], [2024, 9, 15]], 180], ['normal control 1', [[2007, 3, 31], [2009, 2, 28]], 688], ['normal control 2', [[2065, 5, 31], [2068, 7, 31]], 1140]], [['regression d2 thirty-one condition 1', [[2065, 12, 23], [2069, 1, 31]], 1118], ['regression d2 thirty-one condition 2', [[2058, 1, 18], [2060, 1, 31]], 733], ['partial repair probe 1', [[2016, 2, 29], [2018, 12, 31]], 1020], ['partial repair probe 2', [[2096, 2, 29], [2097, 12, 31]], 660], ['boundary control 1', [[2024, 2, 29], [2025, 2, 28]], 360], ['boundary control 2', [[2024, 3, 15], [2024, 9, 15]], 180], ['normal control 1', [[1999, 12, 31], [1999, 3, 31]], -270], ['normal control 2', [[2066, 7, 31], [2069, 12, 30]], 1230]], [['regression d2 thirty-one condition 1', [[2080, 3, 21], [2080, 10, 31]], 220], ['regression d2 thirty-one condition 2', [[2038, 8, 15], [2039, 10, 31]], 436], ['partial repair probe 1', [[2030, 11, 30], [2033, 8, 31]], 990], ['partial repair probe 2', [[2051, 9, 30], [2053, 5, 31]], 600], ['boundary control 1', [[2023, 1, 31], [2023, 3, 31]], 60], ['boundary control 2', [[2024, 1, 1], [2024, 1, 1]], 0], ['normal control 1', [[2091, 11, 20], [2092, 2, 29]], 99], ['normal control 2', [[2000, 2, 28], [2002, 2, 9]], 701]]]\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-d2-thirty-one-condition","generated_at":"2026-09-29T14:46:49.333181+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":"The D2 adjustment ignores the requirement that the adjusted D1 is already 30 or 31.","sha256":"0a6026de82cf75744215f735fae2627186dbb2e2c35cb4f0bafe9d413f0387ad","title":"30/360 US bond basis: end day 31 is clamped regardless of the start day · 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":42.195,"exit_code":1,"observations":[{"actual":507,"check":"regression d2 thirty-one condition 1","expected":507,"passed":true},{"actual":422,"check":"regression d2 thirty-one condition 2","expected":422,"passed":true},{"actual":511,"check":"partial repair probe 1","expected":510,"passed":false},{"actual":-29,"check":"partial repair probe 2","expected":-30,"passed":false},{"actual":60,"check":"boundary control 1","expected":60,"passed":true},{"actual":360,"check":"boundary control 2","expected":360,"passed":true},{"actual":31,"check":"normal control 1","expected":31,"passed":true},{"actual":115,"check":"normal control 2","expected":115,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression d2 thirty-one condition 1\", \"actual\": 507, \"expected\": 507, \"passed\": true}, {\"check\": \"regression d2 thirty-one condition 2\", \"actual\": 422, \"expected\": 422, \"passed\": true}, {\"check\": \"partial repair probe 1\", \"actual\": 511, \"expected\": 510, \"passed\": false}, {\"check\": \"partial repair probe 2\", \"actual\": -29, \"expected\": -30, \"passed\": false}, {\"check\": \"boundary control 1\", \"actual\": 60, \"expected\": 60, \"passed\": true}, {\"check\": \"boundary control 2\", \"actual\": 360, \"expected\": 360, \"passed\": true}, {\"check\": \"normal control 1\", \"actual\": 31, \"expected\": 31, \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": 115, \"expected\": 115, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":44.292,"exit_code":1,"observations":[{"actual":506,"check":"regression d2 thirty-one condition 1","expected":507,"passed":false},{"actual":421,"check":"regression d2 thirty-one condition 2","expected":422,"passed":false},{"actual":510,"check":"partial repair probe 1","expected":510,"passed":true},{"actual":-30,"check":"partial repair probe 2","expected":-30,"passed":true},{"actual":60,"check":"boundary control 1","expected":60,"passed":true},{"actual":360,"check":"boundary control 2","expected":360,"passed":true},{"actual":31,"check":"normal control 1","expected":31,"passed":true},{"actual":115,"check":"normal control 2","expected":115,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression d2 thirty-one condition 1\", \"actual\": 506, \"expected\": 507, \"passed\": false}, {\"check\": \"regression d2 thirty-one condition 2\", \"actual\": 421, \"expected\": 422, \"passed\": false}, {\"check\": \"partial repair probe 1\", \"actual\": 510, \"expected\": 510, \"passed\": true}, {\"check\": \"partial repair probe 2\", \"actual\": -30, \"expected\": -30, \"passed\": true}, {\"check\": \"boundary control 1\", \"actual\": 60, \"expected\": 60, \"passed\": true}, {\"check\": \"boundary control 2\", \"actual\": 360, \"expected\": 360, \"passed\": true}, {\"check\": \"normal control 1\", \"actual\": 31, \"expected\": 31, \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": 115, \"expected\": 115, \"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."}}