FAILURE MAP
← Case archive

FA-6501 / Calendar arithmetic / Open access

Sunday zero weekday · case 01

The weekday origin remains Monday.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The weekday origin remains Monday.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return (date.fromisoformat(text).weekday()+1)%7

Unsuccessful approach: Sunday retains ISO value seven instead of zero.

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. Sunday zero weekday. Exact operational definition: (date.fromisoformat(text).weekday()+1)%7

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.fromisoformat(text).weekday()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01',)", solve(*('2024-01-01',)), 1)
check("fixture 2: ('2024-01-07',)", solve(*('2024-01-07',)), 0)
check("fixture 3: ('2024-02-29',)", solve(*('2024-02-29',)), 4)
check("fixture 4: ('2024-01-06',)", solve(*('2024-01-06',)), 6)
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 fixtureActualExpectedOutcome
fixture 1: ('2024-01-01',)01Failed
fixture 2: ('2024-01-07',)60Failed
fixture 3: ('2024-02-29',)34Failed
fixture 4: ('2024-01-06',)56Failed

SHA-256 / 215003776f1a33a1f7ad22dbe4221a2d2db8417d867515aed1fb1536f8355e19

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.fromisoformat(text).isoweekday()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01',)", solve(*('2024-01-01',)), 1)
check("fixture 2: ('2024-01-07',)", solve(*('2024-01-07',)), 0)
check("fixture 3: ('2024-02-29',)", solve(*('2024-02-29',)), 4)
check("fixture 4: ('2024-01-06',)", solve(*('2024-01-06',)), 6)
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 fixtureActualExpectedOutcome
fixture 1: ('2024-01-01',)11Passed
fixture 2: ('2024-01-07',)70Failed
fixture 3: ('2024-02-29',)44Passed
fixture 4: ('2024-01-06',)66Passed

SHA-256 / db00e0a90565a24bba862852f8b3efbc9f53aa5add50acfb737b07d95877edb2

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.fromisoformat(text).weekday()+1)%7
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-01-01',)", solve(*('2024-01-01',)), 1)
check("fixture 2: ('2024-01-07',)", solve(*('2024-01-07',)), 0)
check("fixture 3: ('2024-02-29',)", solve(*('2024-02-29',)), 4)
check("fixture 4: ('2024-01-06',)", solve(*('2024-01-06',)), 6)
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 fixtureActualExpectedOutcome
fixture 1: ('2024-01-01',)11Passed
fixture 2: ('2024-01-07',)00Passed
fixture 3: ('2024-02-29',)44Passed
fixture 4: ('2024-01-06',)66Passed

SHA-256 / 8150ed151e37aba878d818a2b17354c2228add3ae0821fbef7ec2879a3981b04

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.543265+00:00.

Case digest / 7b353375af4a23704ad6e92d4d4e359bdba5df3f496c698d6bf6567f07278a34