{"abstract":"Weekday offsets are measured from Monday rather than the month first day.","category":"Calendar arithmetic","checks":4,"contract":"Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. n>=1; return None if the requested nth zero-based weekday does not occur in that month. Exact operational definition: (date(year,month,1)+timedelta(days=(weekday-date(year,month,1).weekday())%7+7*(n-1))).isoformat() if (weekday-date(year,month,1).weekday())%7+7*(n-1)<calendar.monthrange(year,month)[1] else None","contract_signature":"year, month, weekday, n","evaluation_group":"model-96465977b8f37ec3","failed_approach":"The occurrence count starts at one full week too late and spills into the next month.","family":"xn-nth-weekday-of-month","id":"FA-6556","implementations":{"attempt":{"sha256":"c15483e16945bc45edf07dbf645fd52147d96ff6ae7f7547bcb4e5ee56e82bf9","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport calendar\nimport statistics\nimport itertools\nfrom fractions import Fraction\nfrom datetime import date, datetime, timedelta, timezone\nfrom decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR\n\nN = 1\nobservations = []\ndef solve(year, month, weekday, n):\n    return (date(year,month,1)+timedelta(days=(weekday-date(year,month,1).weekday())%7+7*n)).isoformat()\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('fixture 1: (2024, 1, 0, 1)', solve(*(2024, 1, 0, 1)), '2024-01-01')\ncheck('fixture 2: (2024, 2, 0, 1)', solve(*(2024, 2, 0, 1)), '2024-02-05')\ncheck('fixture 3: (2024, 2, 3, 5)', solve(*(2024, 2, 3, 5)), '2024-02-29')\ncheck('fixture 4: (2023, 2, 0, 5)', solve(*(2023, 2, 0, 5)), None)\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":"26b50932cad81876de8c1041f8d63c3f1ad62fe1f5f8e28943a2dfd708e30757","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport calendar\nimport statistics\nimport itertools\nfrom fractions import Fraction\nfrom datetime import date, datetime, timedelta, timezone\nfrom decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR\n\nN = 1\nobservations = []\ndef solve(year, month, weekday, n):\n    return (date(year,month,1)+timedelta(days=weekday+7*(n-1))).isoformat()\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('fixture 1: (2024, 1, 0, 1)', solve(*(2024, 1, 0, 1)), '2024-01-01')\ncheck('fixture 2: (2024, 2, 0, 1)', solve(*(2024, 2, 0, 1)), '2024-02-05')\ncheck('fixture 3: (2024, 2, 3, 5)', solve(*(2024, 2, 3, 5)), '2024-02-29')\ncheck('fixture 4: (2023, 2, 0, 5)', solve(*(2023, 2, 0, 5)), None)\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":" 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":"xn-nth-weekday-of-month","generated_at":"2026-09-29T14:38:03.121463+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Calendar conventions results depend on the stated convention.","root_cause":"Weekday offsets are measured from Monday rather than the month first day.","sha256":"72ed16e412918bd0e5307daa524f0ad3fc8d3c9b0e16809adc1e02a7d5e345a7","title":"Nth weekday of month · 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":44.353,"exit_code":1,"observations":[{"actual":"2024-01-08","check":"fixture 1: (2024, 1, 0, 1)","expected":"2024-01-01","passed":false},{"actual":"2024-02-12","check":"fixture 2: (2024, 2, 0, 1)","expected":"2024-02-05","passed":false},{"actual":"2024-03-07","check":"fixture 3: (2024, 2, 3, 5)","expected":"2024-02-29","passed":false},{"actual":"2023-03-13","check":"fixture 4: (2023, 2, 0, 5)","expected":null,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fixture 1: (2024, 1, 0, 1)\", \"actual\": \"2024-01-08\", \"expected\": \"2024-01-01\", \"passed\": false}, {\"check\": \"fixture 2: (2024, 2, 0, 1)\", \"actual\": \"2024-02-12\", \"expected\": \"2024-02-05\", \"passed\": false}, {\"check\": \"fixture 3: (2024, 2, 3, 5)\", \"actual\": \"2024-03-07\", \"expected\": \"2024-02-29\", \"passed\": false}, {\"check\": \"fixture 4: (2023, 2, 0, 5)\", \"actual\": \"2023-03-13\", \"expected\": null, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.668,"exit_code":1,"observations":[{"actual":"2024-01-01","check":"fixture 1: (2024, 1, 0, 1)","expected":"2024-01-01","passed":true},{"actual":"2024-02-01","check":"fixture 2: (2024, 2, 0, 1)","expected":"2024-02-05","passed":false},{"actual":"2024-03-03","check":"fixture 3: (2024, 2, 3, 5)","expected":"2024-02-29","passed":false},{"actual":"2023-03-01","check":"fixture 4: (2023, 2, 0, 5)","expected":null,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fixture 1: (2024, 1, 0, 1)\", \"actual\": \"2024-01-01\", \"expected\": \"2024-01-01\", \"passed\": true}, {\"check\": \"fixture 2: (2024, 2, 0, 1)\", \"actual\": \"2024-02-01\", \"expected\": \"2024-02-05\", \"passed\": false}, {\"check\": \"fixture 3: (2024, 2, 3, 5)\", \"actual\": \"2024-03-03\", \"expected\": \"2024-02-29\", \"passed\": false}, {\"check\": \"fixture 4: (2023, 2, 0, 5)\", \"actual\": \"2023-03-01\", \"expected\": null, \"passed\": false}], \"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."}}