FA-6541 / Calendar arithmetic / Open access
Next or same weekday · case 01
A full week is unnecessarily added when today matches.
ROOT CAUSE
A full week is unnecessarily added when today matches.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return (date.fromisoformat(text)+timedelta(days=(weekday-date.fromisoformat(text).weekday())%7)).isoformat()
Unsuccessful approach: Signed subtraction can move backward rather than forward.
Case 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. Next or same weekday. Exact operational definition: (date.fromisoformat(text)+timedelta(days=(weekday-date.fromisoformat(text).weekday())%7)).isoformat()
Why this case matters
Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Calendar conventions results depend on the stated convention.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR
N = 1
observations = []
def solve(text, weekday):
return (date.fromisoformat(text)+timedelta(days=(weekday-date.fromisoformat(text).weekday())%7 or 7)).isoformat()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01', 0)", solve(*('2024-01-01', 0)), '2024-01-01')
check("fixture 2: ('2024-01-05', 0)", solve(*('2024-01-05', 0)), '2024-01-08')
check("fixture 3: ('2024-01-01', 4)", solve(*('2024-01-01', 4)), '2024-01-05')
check("fixture 4: ('2024-12-31', 2)", solve(*('2024-12-31', 2)), '2025-01-01')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: ('2024-01-01', 0) | 2024-01-08 | 2024-01-01 | Failed |
| fixture 2: ('2024-01-05', 0) | 2024-01-08 | 2024-01-08 | Passed |
| fixture 3: ('2024-01-01', 4) | 2024-01-05 | 2024-01-05 | Passed |
| fixture 4: ('2024-12-31', 2) | 2025-01-01 | 2025-01-01 | Passed |
SHA-256 / b154003b3cba6106ec466769995ae8a1a08212fd33cecd67c6a1d3504d271807
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR
N = 1
observations = []
def solve(text, weekday):
return (date.fromisoformat(text)+timedelta(days=weekday-date.fromisoformat(text).weekday())).isoformat()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01', 0)", solve(*('2024-01-01', 0)), '2024-01-01')
check("fixture 2: ('2024-01-05', 0)", solve(*('2024-01-05', 0)), '2024-01-08')
check("fixture 3: ('2024-01-01', 4)", solve(*('2024-01-01', 4)), '2024-01-05')
check("fixture 4: ('2024-12-31', 2)", solve(*('2024-12-31', 2)), '2025-01-01')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: ('2024-01-01', 0) | 2024-01-01 | 2024-01-01 | Passed |
| fixture 2: ('2024-01-05', 0) | 2024-01-01 | 2024-01-08 | Failed |
| fixture 3: ('2024-01-01', 4) | 2024-01-05 | 2024-01-05 | Passed |
| fixture 4: ('2024-12-31', 2) | 2025-01-01 | 2025-01-01 | Passed |
SHA-256 / c6187a4cfdad73a96eea5addbfe2b80dd1753e8cdd5ed5faf97f4c3bddcd5f0c
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR
N = 1
observations = []
def solve(text, weekday):
return (date.fromisoformat(text)+timedelta(days=(weekday-date.fromisoformat(text).weekday())%7)).isoformat()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01', 0)", solve(*('2024-01-01', 0)), '2024-01-01')
check("fixture 2: ('2024-01-05', 0)", solve(*('2024-01-05', 0)), '2024-01-08')
check("fixture 3: ('2024-01-01', 4)", solve(*('2024-01-01', 4)), '2024-01-05')
check("fixture 4: ('2024-12-31', 2)", solve(*('2024-12-31', 2)), '2025-01-01')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: ('2024-01-01', 0) | 2024-01-01 | 2024-01-01 | Passed |
| fixture 2: ('2024-01-05', 0) | 2024-01-08 | 2024-01-08 | Passed |
| fixture 3: ('2024-01-01', 4) | 2024-01-05 | 2024-01-05 | Passed |
| fixture 4: ('2024-12-31', 2) | 2025-01-01 | 2025-01-01 | Passed |
SHA-256 / df2142a21b4c3b1770431f243042925c0215a98fed89f1cfd183bcaba05c0c4d
Verification & scope
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.
Observations recorded using Python 3.12.14 at 2026-09-29T14:38:03.075173+00:00.
Case digest / 7b5fa484c01e1579c28a6b7f05d6130a0beb76409200fe07b1e0247a7c3135de