FA-6481 / Calendar arithmetic / Open access
Calendar month length · case 01
A fixed thirty-day model loses long months and leap days.
ROOT CAUSE
A fixed thirty-day model loses long months and leap days.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return calendar.monthrange(year,month)[1]
Unsuccessful approach: The February repair uses an incomplete century rule.
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 month length. Exact operational definition: calendar.monthrange(year,month)[1]
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(year, month):
return 30 if month!=2 else 28
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2024, 2)', solve(*(2024, 2)), 29)
check('fixture 2: (2100, 2)', solve(*(2100, 2)), 28)
check('fixture 3: (2023, 1)', solve(*(2023, 1)), 31)
check('fixture 4: (2023, 4)', solve(*(2023, 4)), 30)
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, 2) | 28 | 29 | Failed |
| fixture 2: (2100, 2) | 28 | 28 | Passed |
| fixture 3: (2023, 1) | 30 | 31 | Failed |
| fixture 4: (2023, 4) | 30 | 30 | Passed |
SHA-256 / ef64be1cd9e4511f28aca57e589903cacf467aece92e4208b2ec84f6f66b018c
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(year, month):
return 29 if month==2 and year%4==0 else (28 if month==2 else (31 if month in [1,3,5,7,8,10,12] else 30))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2024, 2)', solve(*(2024, 2)), 29)
check('fixture 2: (2100, 2)', solve(*(2100, 2)), 28)
check('fixture 3: (2023, 1)', solve(*(2023, 1)), 31)
check('fixture 4: (2023, 4)', solve(*(2023, 4)), 30)
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, 2) | 29 | 29 | Passed |
| fixture 2: (2100, 2) | 29 | 28 | Failed |
| fixture 3: (2023, 1) | 31 | 31 | Passed |
| fixture 4: (2023, 4) | 30 | 30 | Passed |
SHA-256 / 0c123c4ed9d03f3b7d7ddaa82afc4f41a24f1fbb17931fbd2ae5d36074771bef
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(year, month):
return calendar.monthrange(year,month)[1]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2024, 2)', solve(*(2024, 2)), 29)
check('fixture 2: (2100, 2)', solve(*(2100, 2)), 28)
check('fixture 3: (2023, 1)', solve(*(2023, 1)), 31)
check('fixture 4: (2023, 4)', solve(*(2023, 4)), 30)
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, 2) | 29 | 29 | Passed |
| fixture 2: (2100, 2) | 28 | 28 | Passed |
| fixture 3: (2023, 1) | 31 | 31 | Passed |
| fixture 4: (2023, 4) | 30 | 30 | Passed |
SHA-256 / ff492778d9f49978f967bcb8e82f6676986bc8e731c827c915a5e4cdbad9a6cb
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.415814+00:00.
Case digest / 766d88cc0f74ed579b81a879d7dce73355cbed407b2b14f9479e81c8b3864da8