FA-6576 / Calendar arithmetic / Open access
Proleptic gregorian date distance · case 01
An inclusive date count replaces signed elapsed-day distance.
ROOT CAUSE
An inclusive date count replaces signed elapsed-day distance.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return (date.fromisoformat(end)-date.fromisoformat(start)).days
Unsuccessful approach: Absolute value erases chronology direction.
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. Proleptic gregorian date distance. Exact operational definition: (date.fromisoformat(end)-date.fromisoformat(start)).days
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(start, end):
return (date.fromisoformat(end)-date.fromisoformat(start)).days+1
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-02-28', '2024-03-01')", solve(*('2024-02-28', '2024-03-01')), 2)
check("fixture 2: ('2023-02-28', '2023-03-01')", solve(*('2023-02-28', '2023-03-01')), 1)
check("fixture 3: ('2024-01-02', '2024-01-01')", solve(*('2024-01-02', '2024-01-01')), -1)
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: ('2024-02-28', '2024-03-01') | 3 | 2 | Failed |
| fixture 2: ('2023-02-28', '2023-03-01') | 2 | 1 | Failed |
| fixture 3: ('2024-01-02', '2024-01-01') | 0 | -1 | Failed |
| fixture 4: ('2024-01-01', '2024-01-01') | 1 | 0 | Failed |
SHA-256 / 4cfa45a67213857e8e00fbe9c8ad91d712a6c4ff94cee473a27513707bd1b520
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(start, end):
return abs((date.fromisoformat(end)-date.fromisoformat(start)).days)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-02-28', '2024-03-01')", solve(*('2024-02-28', '2024-03-01')), 2)
check("fixture 2: ('2023-02-28', '2023-03-01')", solve(*('2023-02-28', '2023-03-01')), 1)
check("fixture 3: ('2024-01-02', '2024-01-01')", solve(*('2024-01-02', '2024-01-01')), -1)
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: ('2024-02-28', '2024-03-01') | 2 | 2 | Passed |
| fixture 2: ('2023-02-28', '2023-03-01') | 1 | 1 | Passed |
| fixture 3: ('2024-01-02', '2024-01-01') | 1 | -1 | Failed |
| fixture 4: ('2024-01-01', '2024-01-01') | 0 | 0 | Passed |
SHA-256 / e5ab1391d915df32f0735a121855270fd239d3591a18bdf9e07196f145a59004
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(start, end):
return (date.fromisoformat(end)-date.fromisoformat(start)).days
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-02-28', '2024-03-01')", solve(*('2024-02-28', '2024-03-01')), 2)
check("fixture 2: ('2023-02-28', '2023-03-01')", solve(*('2023-02-28', '2023-03-01')), 1)
check("fixture 3: ('2024-01-02', '2024-01-01')", solve(*('2024-01-02', '2024-01-01')), -1)
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: ('2024-02-28', '2024-03-01') | 2 | 2 | Passed |
| fixture 2: ('2023-02-28', '2023-03-01') | 1 | 1 | Passed |
| fixture 3: ('2024-01-02', '2024-01-01') | -1 | -1 | Passed |
| fixture 4: ('2024-01-01', '2024-01-01') | 0 | 0 | Passed |
SHA-256 / 8c3b2f08b5cfe4857025262d121167abef36b69732a8944a5b9e534b4d74e5ea
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.364675+00:00.
Case digest / e14dc5f6e5897b4db0f3099bff8a741d97b3345bf89ce4ee1007ac8aa0b748fb