{"abstract":"In months starting on a Saturday or Sunday the expiry lands a week early.","category":"Options payoff and settlement","checks":8,"contract":"Inputs year, month, kind and holidays. Monthly expiry is the third Friday of the month; quarterly expiry is the last calendar day of the quarter-end month (Mar/Jun/Sep/Dec) containing the month. Either date rolls back to the preceding business day (weekday not in holidays) when it is not a business day. Return [y,m,d].","contract_signature":"y, m, kind, holidays","evaluation_group":"w2-options_payoff_and_settlement-expiration-date","failed_approach":"Forcing a full week when the month starts on Friday skips the first Friday.","family":"w2-options_payoff_and_settlement-expiration-date-first-friday-offset","id":"FA-61591","implementations":{"attempt":{"sha256":"4be18ce517374c078594ccf5b6624b4bdda8c1817387e005856f69011d165e7c","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport datetime\nN = 1\nobservations = []\ndef solve(y, m, kind, holidays):\n    H = {datetime.date(*h) for h in holidays}\n    def biz(x):\n        return x.weekday() < 5 and x not in H\n    def mlen(yy, mm):\n        if mm == 2:\n            return 29 if (yy % 4 == 0 and yy % 100 != 0) or yy % 400 == 0 else 28\n        return 30 if mm in (4, 6, 9, 11) else 31\n    if kind == 'quarterly':\n        qm = ((m - 1) // 3 + 1) * 3\n        x = datetime.date(y, qm, mlen(y, qm))\n    else:\n        first = datetime.date(y, m, 1)\n        offset = (4 - first.weekday()) % 7 or 7\n        x = first + datetime.timedelta(days=offset + 14)\n    while not biz(x):\n        x -= datetime.timedelta(days=1)\n    return [x.year, x.month, x.day]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression first friday offset 1', [2032, 2, 'monthly', []], [2032, 2, 20]], ['regression first friday offset 2', [2030, 9, 'monthly', [[2030, 9, 20]]], [2030, 9, 19]], ['partial repair probe 1', [2023, 12, 'monthly', []], [2023, 12, 15]], ['partial repair probe 2', [2029, 6, 'monthly', []], [2029, 6, 15]], ['boundary control 1', [2024, 3, 'quarterly', []], [2024, 3, 29]], ['boundary control 2', [2024, 12, 'quarterly', []], [2024, 12, 31]], ['normal control 1', [2028, 8, 'monthly', []], [2028, 8, 18]], ['normal control 2', [2022, 3, 'quarterly', [[2022, 3, 28]]], [2022, 3, 31]]], [['regression first friday offset 1', [2023, 7, 'monthly', []], [2023, 7, 21]], ['regression first friday offset 2', [2031, 6, 'monthly', [[2031, 6, 20], [2031, 6, 19]]], [2031, 6, 18]], ['partial repair probe 1', [2025, 8, 'monthly', []], [2025, 8, 15]], ['partial repair probe 2', [2019, 2, 'monthly', [[2019, 2, 15], [2019, 2, 14]]], [2019, 2, 13]], ['boundary control 1', [2024, 12, 'quarterly', []], [2024, 12, 31]], ['boundary control 2', [2024, 3, 'quarterly', []], [2024, 3, 29]], ['normal control 1', [2021, 3, 'quarterly', []], [2021, 3, 31]], ['normal control 2', [2030, 11, 'quarterly', [[2030, 11, 15]]], [2030, 12, 31]]], [['regression first friday offset 1', [2023, 7, 'monthly', []], [2023, 7, 21]], ['regression first friday offset 2', [2020, 2, 'monthly', [[2020, 2, 21], [2020, 2, 20]]], [2020, 2, 19]], ['partial repair probe 1', [2029, 6, 'monthly', []], [2029, 6, 15]], ['partial repair probe 2', [2031, 8, 'monthly', []], [2031, 8, 15]], ['boundary control 1', [2024, 12, 'quarterly', []], [2024, 12, 31]], ['boundary control 2', [2024, 3, 'quarterly', []], [2024, 3, 29]], ['normal control 1', [2027, 3, 'monthly', [[2027, 3, 19], [2027, 3, 18]]], [2027, 3, 17]], ['normal control 2', [2022, 5, 'quarterly', [[2022, 6, 29]]], [2022, 6, 30]]], [['regression first friday offset 1', [2020, 2, 'monthly', []], [2020, 2, 21]], ['regression first friday offset 2', [2026, 3, 'monthly', [[2026, 3, 20]]], [2026, 3, 19]], ['partial repair probe 1', [2026, 5, 'monthly', []], [2026, 5, 15]], ['partial repair probe 2', [2019, 11, 'monthly', [[2019, 11, 15], [2019, 11, 14]]], [2019, 11, 13]], ['boundary control 1', [2024, 12, 'quarterly', []], [2024, 12, 31]], ['boundary control 2', [2024, 3, 'quarterly', []], [2024, 3, 29]], ['normal control 1', [2031, 1, 'quarterly', [[2031, 1, 17], [2031, 3, 28]]], [2031, 3, 31]], ['normal control 2', [2021, 4, 'quarterly', [[2021, 4, 16], [2021, 4, 15]]], [2021, 6, 30]]], [['regression first friday offset 1', [2025, 3, 'monthly', [[2025, 3, 21]]], [2025, 3, 20]], ['regression first friday offset 2', [2021, 8, 'monthly', []], [2021, 8, 20]], ['partial repair probe 1', [2022, 7, 'monthly', [[2022, 7, 15]]], [2022, 7, 14]], ['partial repair probe 2', [2025, 8, 'monthly', []], [2025, 8, 15]], ['boundary control 1', [2024, 12, 'quarterly', []], [2024, 12, 31]], ['boundary control 2', [2024, 3, 'quarterly', []], [2024, 3, 29]], ['normal control 1', [2029, 2, 'monthly', []], [2029, 2, 16]], ['normal control 2', [2032, 7, 'quarterly', []], [2032, 9, 30]]]]\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":"307d045a6bba931d7e97721251d14531bfb89d182bec9e61e0c8a2f1e0c21b31","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport datetime\nN = 1\nobservations = []\ndef solve(y, m, kind, holidays):\n    H = {datetime.date(*h) for h in holidays}\n    def biz(x):\n        return x.weekday() < 5 and x not in H\n    def mlen(yy, mm):\n        if mm == 2:\n            return 29 if (yy % 4 == 0 and yy % 100 != 0) or yy % 400 == 0 else 28\n        return 30 if mm in (4, 6, 9, 11) else 31\n    if kind == 'quarterly':\n        qm = ((m - 1) // 3 + 1) * 3\n        x = datetime.date(y, qm, mlen(y, qm))\n    else:\n        first = datetime.date(y, m, 1)\n        offset = 4 - first.weekday()\n        x = first + datetime.timedelta(days=offset + 14)\n    while not biz(x):\n        x -= datetime.timedelta(days=1)\n    return [x.year, x.month, x.day]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression first friday offset 1', [2032, 2, 'monthly', []], [2032, 2, 20]], ['regression first friday offset 2', [2030, 9, 'monthly', [[2030, 9, 20]]], [2030, 9, 19]], ['partial repair probe 1', [2023, 12, 'monthly', []], [2023, 12, 15]], ['partial repair probe 2', [2029, 6, 'monthly', []], [2029, 6, 15]], ['boundary control 1', [2024, 3, 'quarterly', []], [2024, 3, 29]], ['boundary control 2', [2024, 12, 'quarterly', []], [2024, 12, 31]], ['normal control 1', [2028, 8, 'monthly', []], [2028, 8, 18]], ['normal control 2', [2022, 3, 'quarterly', [[2022, 3, 28]]], [2022, 3, 31]]], [['regression first friday offset 1', [2023, 7, 'monthly', []], [2023, 7, 21]], ['regression first friday offset 2', [2031, 6, 'monthly', [[2031, 6, 20], [2031, 6, 19]]], [2031, 6, 18]], ['partial repair probe 1', [2025, 8, 'monthly', []], [2025, 8, 15]], ['partial repair probe 2', [2019, 2, 'monthly', [[2019, 2, 15], [2019, 2, 14]]], [2019, 2, 13]], ['boundary control 1', [2024, 12, 'quarterly', []], [2024, 12, 31]], ['boundary control 2', [2024, 3, 'quarterly', []], [2024, 3, 29]], ['normal control 1', [2021, 3, 'quarterly', []], [2021, 3, 31]], ['normal control 2', [2030, 11, 'quarterly', [[2030, 11, 15]]], [2030, 12, 31]]], [['regression first friday offset 1', [2023, 7, 'monthly', []], [2023, 7, 21]], ['regression first friday offset 2', [2020, 2, 'monthly', [[2020, 2, 21], [2020, 2, 20]]], [2020, 2, 19]], ['partial repair probe 1', [2029, 6, 'monthly', []], [2029, 6, 15]], ['partial repair probe 2', [2031, 8, 'monthly', []], [2031, 8, 15]], ['boundary control 1', [2024, 12, 'quarterly', []], [2024, 12, 31]], ['boundary control 2', [2024, 3, 'quarterly', []], [2024, 3, 29]], ['normal control 1', [2027, 3, 'monthly', [[2027, 3, 19], [2027, 3, 18]]], [2027, 3, 17]], ['normal control 2', [2022, 5, 'quarterly', [[2022, 6, 29]]], [2022, 6, 30]]], [['regression first friday offset 1', [2020, 2, 'monthly', []], [2020, 2, 21]], ['regression first friday offset 2', [2026, 3, 'monthly', [[2026, 3, 20]]], [2026, 3, 19]], ['partial repair probe 1', [2026, 5, 'monthly', []], [2026, 5, 15]], ['partial repair probe 2', [2019, 11, 'monthly', [[2019, 11, 15], [2019, 11, 14]]], [2019, 11, 13]], ['boundary control 1', [2024, 12, 'quarterly', []], [2024, 12, 31]], ['boundary control 2', [2024, 3, 'quarterly', []], [2024, 3, 29]], ['normal control 1', [2031, 1, 'quarterly', [[2031, 1, 17], [2031, 3, 28]]], [2031, 3, 31]], ['normal control 2', [2021, 4, 'quarterly', [[2021, 4, 16], [2021, 4, 15]]], [2021, 6, 30]]], [['regression first friday offset 1', [2025, 3, 'monthly', [[2025, 3, 21]]], [2025, 3, 20]], ['regression first friday offset 2', [2021, 8, 'monthly', []], [2021, 8, 20]], ['partial repair probe 1', [2022, 7, 'monthly', [[2022, 7, 15]]], [2022, 7, 14]], ['partial repair probe 2', [2025, 8, 'monthly', []], [2025, 8, 15]], ['boundary control 1', [2024, 12, 'quarterly', []], [2024, 12, 31]], ['boundary control 2', [2024, 3, 'quarterly', []], [2024, 3, 29]], ['normal control 1', [2029, 2, 'monthly', []], [2029, 2, 16]], ['normal control 2', [2032, 7, 'quarterly', []], [2032, 9, 30]]]]\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 exchange or clearing rulebook. 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-options_payoff_and_settlement-expiration-date-first-friday-offset","generated_at":"2026-09-29T14:46:56.715360+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Option expiry, exercise and settlement engines move cash and shares; a wrong branch misstates obligations.","root_cause":"The offset to the first Friday omits the modulo 7.","sha256":"4391f8224a390b9c18e06b9a1163571930c550a93060d978e33beccfbb9b5153","title":"Listed option expiration date calendar: the first Friday offset can be negative · 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":41.776,"exit_code":1,"observations":[{"actual":[2032,2,20],"check":"regression first friday offset 1","expected":[2032,2,20],"passed":true},{"actual":[2030,9,19],"check":"regression first friday offset 2","expected":[2030,9,19],"passed":true},{"actual":[2023,12,22],"check":"partial repair probe 1","expected":[2023,12,15],"passed":false},{"actual":[2029,6,22],"check":"partial repair probe 2","expected":[2029,6,15],"passed":false},{"actual":[2024,3,29],"check":"boundary control 1","expected":[2024,3,29],"passed":true},{"actual":[2024,12,31],"check":"boundary control 2","expected":[2024,12,31],"passed":true},{"actual":[2028,8,18],"check":"normal control 1","expected":[2028,8,18],"passed":true},{"actual":[2022,3,31],"check":"normal control 2","expected":[2022,3,31],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression first friday offset 1\", \"actual\": [2032, 2, 20], \"expected\": [2032, 2, 20], \"passed\": true}, {\"check\": \"regression first friday offset 2\", \"actual\": [2030, 9, 19], \"expected\": [2030, 9, 19], \"passed\": true}, {\"check\": \"partial repair probe 1\", \"actual\": [2023, 12, 22], \"expected\": [2023, 12, 15], \"passed\": false}, {\"check\": \"partial repair probe 2\", \"actual\": [2029, 6, 22], \"expected\": [2029, 6, 15], \"passed\": false}, {\"check\": \"boundary control 1\", \"actual\": [2024, 3, 29], \"expected\": [2024, 3, 29], \"passed\": true}, {\"check\": \"boundary control 2\", \"actual\": [2024, 12, 31], \"expected\": [2024, 12, 31], \"passed\": true}, {\"check\": \"normal control 1\", \"actual\": [2028, 8, 18], \"expected\": [2028, 8, 18], \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": [2022, 3, 31], \"expected\": [2022, 3, 31], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.236,"exit_code":1,"observations":[{"actual":[2032,2,13],"check":"regression first friday offset 1","expected":[2032,2,20],"passed":false},{"actual":[2030,9,13],"check":"regression first friday offset 2","expected":[2030,9,19],"passed":false},{"actual":[2023,12,15],"check":"partial repair probe 1","expected":[2023,12,15],"passed":true},{"actual":[2029,6,15],"check":"partial repair probe 2","expected":[2029,6,15],"passed":true},{"actual":[2024,3,29],"check":"boundary control 1","expected":[2024,3,29],"passed":true},{"actual":[2024,12,31],"check":"boundary control 2","expected":[2024,12,31],"passed":true},{"actual":[2028,8,18],"check":"normal control 1","expected":[2028,8,18],"passed":true},{"actual":[2022,3,31],"check":"normal control 2","expected":[2022,3,31],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression first friday offset 1\", \"actual\": [2032, 2, 13], \"expected\": [2032, 2, 20], \"passed\": false}, {\"check\": \"regression first friday offset 2\", \"actual\": [2030, 9, 13], \"expected\": [2030, 9, 19], \"passed\": false}, {\"check\": \"partial repair probe 1\", \"actual\": [2023, 12, 15], \"expected\": [2023, 12, 15], \"passed\": true}, {\"check\": \"partial repair probe 2\", \"actual\": [2029, 6, 15], \"expected\": [2029, 6, 15], \"passed\": true}, {\"check\": \"boundary control 1\", \"actual\": [2024, 3, 29], \"expected\": [2024, 3, 29], \"passed\": true}, {\"check\": \"boundary control 2\", \"actual\": [2024, 12, 31], \"expected\": [2024, 12, 31], \"passed\": true}, {\"check\": \"normal control 1\", \"actual\": [2028, 8, 18], \"expected\": [2028, 8, 18], \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": [2022, 3, 31], \"expected\": [2022, 3, 31], \"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."}}