FA-6536 / Calendar arithmetic / Open access
Strictly next weekday · case 01
Inclusive matching returns the current day under a strictly-next contract.
ROOT CAUSE
Inclusive matching returns the current day under a strictly-next contract.
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 or 7)).isoformat()
Unsuccessful approach: Absolute weekday distance loses forward week wrap.
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. Strictly next weekday. Exact operational definition: (date.fromisoformat(text)+timedelta(days=(weekday-date.fromisoformat(text).weekday())%7 or 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)).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-08')
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-08 | 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 / f7721ecb3ca686055b55ee505577b52f2bd9360f107af45422a18425206ac729
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=abs(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-08')
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-08 | Failed |
| fixture 2: ('2024-01-05', 0) | 2024-01-09 | 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 / f88e22ba2d6c6c26df7cb72e91380894a4233ee9ed7b3388feb541d088e274c7
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 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-08')
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-08 | 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 / fe25f8e97b3e5063e10d813f9520bfc9787082420fbab827a59b77806a1226b9
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.032990+00:00.
Case digest / 613f92126fb1f5947c3b131e27416ece6e14629adc9854cf52ef6918e6905023