FA-6526 / Calendar arithmetic / Open access
Calendar quarter start · case 01
Month start replaces quarter start.
ROOT CAUSE
Month start replaces quarter start.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return date(date.fromisoformat(text).year,3*((date.fromisoformat(text).month-1)//3)+1,1).isoformat()
Unsuccessful approach: The quarter division shifts terminal months into the following quarter.
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. Calendar quarter start. Exact operational definition: date(date.fromisoformat(text).year,3*((date.fromisoformat(text).month-1)//3)+1,1).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):
return date(date.fromisoformat(text).year,date.fromisoformat(text).month,1).isoformat()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-03-31',)", solve(*('2024-03-31',)), '2024-01-01')
check("fixture 2: ('2024-04-15',)", solve(*('2024-04-15',)), '2024-04-01')
check("fixture 3: ('2024-12-31',)", solve(*('2024-12-31',)), '2024-10-01')
check("fixture 4: ('2024-01-01',)", solve(*('2024-01-01',)), '2024-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-03-31',) | 2024-03-01 | 2024-01-01 | Failed |
| fixture 2: ('2024-04-15',) | 2024-04-01 | 2024-04-01 | Passed |
| fixture 3: ('2024-12-31',) | 2024-12-01 | 2024-10-01 | Failed |
| fixture 4: ('2024-01-01',) | 2024-01-01 | 2024-01-01 | Passed |
SHA-256 / 6521ef9b633abcf232e266557ed37b6c4d1ed69b9bc6b2cfb75e591ab3ed81e4
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):
return date(date.fromisoformat(text).year,3*(date.fromisoformat(text).month//3)+1,1).isoformat() if date.fromisoformat(text).month<12 else date(date.fromisoformat(text).year+1,1,1).isoformat()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-03-31',)", solve(*('2024-03-31',)), '2024-01-01')
check("fixture 2: ('2024-04-15',)", solve(*('2024-04-15',)), '2024-04-01')
check("fixture 3: ('2024-12-31',)", solve(*('2024-12-31',)), '2024-10-01')
check("fixture 4: ('2024-01-01',)", solve(*('2024-01-01',)), '2024-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-03-31',) | 2024-04-01 | 2024-01-01 | Failed |
| fixture 2: ('2024-04-15',) | 2024-04-01 | 2024-04-01 | Passed |
| fixture 3: ('2024-12-31',) | 2025-01-01 | 2024-10-01 | Failed |
| fixture 4: ('2024-01-01',) | 2024-01-01 | 2024-01-01 | Passed |
SHA-256 / 77d0a1a7a07007c3fc3166501cb60bc27b7775b435ce5b40a23f42b93f8021b1
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):
return date(date.fromisoformat(text).year,3*((date.fromisoformat(text).month-1)//3)+1,1).isoformat()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-03-31',)", solve(*('2024-03-31',)), '2024-01-01')
check("fixture 2: ('2024-04-15',)", solve(*('2024-04-15',)), '2024-04-01')
check("fixture 3: ('2024-12-31',)", solve(*('2024-12-31',)), '2024-10-01')
check("fixture 4: ('2024-01-01',)", solve(*('2024-01-01',)), '2024-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-03-31',) | 2024-01-01 | 2024-01-01 | Passed |
| fixture 2: ('2024-04-15',) | 2024-04-01 | 2024-04-01 | Passed |
| fixture 3: ('2024-12-31',) | 2024-10-01 | 2024-10-01 | Passed |
| fixture 4: ('2024-01-01',) | 2024-01-01 | 2024-01-01 | Passed |
SHA-256 / e85d5f20b0278454806c9437993d01c6cdf32e84477ade54ec3b2d8c579bd5aa
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:02.940997+00:00.
Case digest / c497b73cbc5a114e1f271482e5d5675561c6b674e59a226f7ca3f2c2d7c81428