FA-6546 / Calendar arithmetic / Open access
Whole birthday years february 28 policy · case 01
Year subtraction increments age before the birthday.
ROOT CAUSE
Year subtraction increments age before the birthday.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return (date.fromisoformat(today).year-date.fromisoformat(born).year)-int(date.fromisoformat(today)<date(date.fromisoformat(today).year,date.fromisoformat(born).month,min(date.fromisoformat(born).day,calendar.monthrange(date.fromisoformat(today).year,date.fromisoformat(born).month)[1])))
Unsuccessful approach: A fixed 365-day duration drifts across leap years.
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. born<=today; February 29 anniversaries are observed on February 28 in nonleap years. Exact operational definition: (date.fromisoformat(today).year-date.fromisoformat(born).year)-int(date.fromisoformat(today)<date(date.fromisoformat(today).year,date.fromisoformat(born).month,min(date.fromisoformat(born).day,calendar.monthrange(date.fromisoformat(today).year,date.fromisoformat(born).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(born, today):
return date.fromisoformat(today).year-date.fromisoformat(born).year
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2000-06-15', '2024-06-14')", solve(*('2000-06-15', '2024-06-14')), 23)
check("fixture 2: ('2000-06-15', '2024-06-15')", solve(*('2000-06-15', '2024-06-15')), 24)
check("fixture 3: ('2000-02-29', '2023-02-28')", solve(*('2000-02-29', '2023-02-28')), 23)
check("fixture 4: ('2024-01-01', '2024-01-01')", solve(*('2024-01-01', '2024-01-01')), 0)
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: ('2000-06-15', '2024-06-14') | 24 | 23 | Failed |
| fixture 2: ('2000-06-15', '2024-06-15') | 24 | 24 | Passed |
| fixture 3: ('2000-02-29', '2023-02-28') | 23 | 23 | Passed |
| fixture 4: ('2024-01-01', '2024-01-01') | 0 | 0 | Passed |
SHA-256 / 896ffb58eecec78392695c091af3a9998df7c5cbbf5ae74c0211fba5a112f636
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(born, today):
return int((date.fromisoformat(today)-date.fromisoformat(born)).days/365)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2000-06-15', '2024-06-14')", solve(*('2000-06-15', '2024-06-14')), 23)
check("fixture 2: ('2000-06-15', '2024-06-15')", solve(*('2000-06-15', '2024-06-15')), 24)
check("fixture 3: ('2000-02-29', '2023-02-28')", solve(*('2000-02-29', '2023-02-28')), 23)
check("fixture 4: ('2024-01-01', '2024-01-01')", solve(*('2024-01-01', '2024-01-01')), 0)
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: ('2000-06-15', '2024-06-14') | 24 | 23 | Failed |
| fixture 2: ('2000-06-15', '2024-06-15') | 24 | 24 | Passed |
| fixture 3: ('2000-02-29', '2023-02-28') | 23 | 23 | Passed |
| fixture 4: ('2024-01-01', '2024-01-01') | 0 | 0 | Passed |
SHA-256 / 62951eac008c4d756ede92d8321b9e5c307287c05445fcca1f5571e6f03878bf
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(born, today):
return (date.fromisoformat(today).year-date.fromisoformat(born).year)-int(date.fromisoformat(today)<date(date.fromisoformat(today).year,date.fromisoformat(born).month,min(date.fromisoformat(born).day,calendar.monthrange(date.fromisoformat(today).year,date.fromisoformat(born).month)[1])))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2000-06-15', '2024-06-14')", solve(*('2000-06-15', '2024-06-14')), 23)
check("fixture 2: ('2000-06-15', '2024-06-15')", solve(*('2000-06-15', '2024-06-15')), 24)
check("fixture 3: ('2000-02-29', '2023-02-28')", solve(*('2000-02-29', '2023-02-28')), 23)
check("fixture 4: ('2024-01-01', '2024-01-01')", solve(*('2024-01-01', '2024-01-01')), 0)
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: ('2000-06-15', '2024-06-14') | 23 | 23 | Passed |
| fixture 2: ('2000-06-15', '2024-06-15') | 24 | 24 | Passed |
| fixture 3: ('2000-02-29', '2023-02-28') | 23 | 23 | Passed |
| fixture 4: ('2024-01-01', '2024-01-01') | 0 | 0 | Passed |
SHA-256 / 3390fd054363270d3c0e1a1a40183a20b224dd3e07df4f2694922ab43dc788e9
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.077725+00:00.
Case digest / 56e5e66b3b86911fe25eba7727b68a963c97f021038e5ce8618ef3dee8bdd714