FA-6551 / Calendar arithmetic / Open access
Weekday count half open date range · case 01
Weekend days are counted as working weekdays.
ROOT CAUSE
Weekend days are counted as working weekdays.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return sum((date.fromisoformat(start)+timedelta(days=i)).weekday()<5 for i in range((date.fromisoformat(end)-date.fromisoformat(start)).days))
Unsuccessful approach: The exclusive terminal date is included.
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. start<=end; count Monday through Friday in [start,end), without public-holiday exclusions. Exact operational definition: sum((date.fromisoformat(start)+timedelta(days=i)).weekday()<5 for i in range((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
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01', '2024-01-08')", solve(*('2024-01-01', '2024-01-08')), 5)
check("fixture 2: ('2024-01-05', '2024-01-08')", solve(*('2024-01-05', '2024-01-08')), 1)
check("fixture 3: ('2024-01-06', '2024-01-08')", solve(*('2024-01-06', '2024-01-08')), 0)
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-01-01', '2024-01-08') | 7 | 5 | Failed |
| fixture 2: ('2024-01-05', '2024-01-08') | 3 | 1 | Failed |
| fixture 3: ('2024-01-06', '2024-01-08') | 2 | 0 | Failed |
| fixture 4: ('2024-01-01', '2024-01-01') | 0 | 0 | Passed |
SHA-256 / 04b7db32764282e6f3a77e88c04e4e7520d42664b683771e562d4041de5f4666
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 sum((date.fromisoformat(start)+timedelta(days=i)).weekday()<5 for i in range((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-01-01', '2024-01-08')", solve(*('2024-01-01', '2024-01-08')), 5)
check("fixture 2: ('2024-01-05', '2024-01-08')", solve(*('2024-01-05', '2024-01-08')), 1)
check("fixture 3: ('2024-01-06', '2024-01-08')", solve(*('2024-01-06', '2024-01-08')), 0)
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-01-01', '2024-01-08') | 6 | 5 | Failed |
| fixture 2: ('2024-01-05', '2024-01-08') | 2 | 1 | Failed |
| fixture 3: ('2024-01-06', '2024-01-08') | 1 | 0 | Failed |
| fixture 4: ('2024-01-01', '2024-01-01') | 1 | 0 | Failed |
SHA-256 / d289dedde5e1590c50c2e56a57205ec02767175fce489c31340af5420aebcac4
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 sum((date.fromisoformat(start)+timedelta(days=i)).weekday()<5 for i in range((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-01-01', '2024-01-08')", solve(*('2024-01-01', '2024-01-08')), 5)
check("fixture 2: ('2024-01-05', '2024-01-08')", solve(*('2024-01-05', '2024-01-08')), 1)
check("fixture 3: ('2024-01-06', '2024-01-08')", solve(*('2024-01-06', '2024-01-08')), 0)
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-01-01', '2024-01-08') | 5 | 5 | Passed |
| fixture 2: ('2024-01-05', '2024-01-08') | 1 | 1 | Passed |
| fixture 3: ('2024-01-06', '2024-01-08') | 0 | 0 | Passed |
| fixture 4: ('2024-01-01', '2024-01-01') | 0 | 0 | Passed |
SHA-256 / 6b99e7f7df4bf6323ceaaf8ded503b9417b34b958125f1084ec18556838e5baf
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.075347+00:00.
Case digest / e11f23aea624a31169e908f633ae4603cfc091607437ef6080e4a8077da4f82b