FAILURE MAP
← Case archive

FA-6496 / Calendar arithmetic / Open access

Iso weekday monday one · case 01

A zero-based weekday is returned where Monday is one.

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

ROOT CAUSE

A zero-based weekday is returned where Monday is one.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return date.fromisoformat(text).isoweekday()

Unsuccessful approach: Modulo maps Sunday to zero rather than seven.

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. Iso weekday monday one. Exact operational definition: date.fromisoformat(text).isoweekday()

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',)), 7)
check("fixture 3: ('2024-02-29',)", solve(*('2024-02-29',)), 4)
check("fixture 4: ('2023-12-31',)", solve(*('2023-12-31',)), 7)
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',)67Failed
fixture 3: ('2024-02-29',)34Failed
fixture 4: ('2023-12-31',)67Failed

SHA-256 / 91b67e83f5326842f0133bd2ffd98aa2b470c0bc4c453391a83a2fdb32d5d905

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).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',)), 7)
check("fixture 3: ('2024-02-29',)", solve(*('2024-02-29',)), 4)
check("fixture 4: ('2023-12-31',)", solve(*('2023-12-31',)), 7)
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',)07Failed
fixture 3: ('2024-02-29',)44Passed
fixture 4: ('2023-12-31',)07Failed

SHA-256 / 73a35c460ebeed62516e71405fef11242404d9bb6b3640c91362ffbd1fbf8a65

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).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',)), 7)
check("fixture 3: ('2024-02-29',)", solve(*('2024-02-29',)), 4)
check("fixture 4: ('2023-12-31',)", solve(*('2023-12-31',)), 7)
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',)77Passed
fixture 3: ('2024-02-29',)44Passed
fixture 4: ('2023-12-31',)77Passed

SHA-256 / 3e5e78867d87cad2ec6f93e1a705666b5424487c1ab8c29080fdea428907ac3c

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

Case digest / d2bf0c3cc0e04885cb06b09a4db7d0777161c290f3490f6ba50cb9a9e4a874f3