FAILURE MAP
← Case archive

FA-6486 / Calendar arithmetic / Open access

Ordinal day of year · case 01

Month lengths are approximated by thirty days.

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

ROOT CAUSE

Month lengths are approximated by thirty days.

VERIFIED REPAIR

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

Unsuccessful approach: A zero-based elapsed-day count is returned under a one-based ordinal contract.

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. Ordinal day of year. Exact operational definition: date.fromisoformat(text).timetuple().tm_yday

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).month-1)*30+date.fromisoformat(text).day
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-03-01',)", solve(*('2024-03-01',)), 61)
check("fixture 2: ('2023-03-01',)", solve(*('2023-03-01',)), 60)
check("fixture 3: ('2024-01-01',)", solve(*('2024-01-01',)), 1)
check("fixture 4: ('2024-12-31',)", solve(*('2024-12-31',)), 366)
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-03-01',)6161Passed
fixture 2: ('2023-03-01',)6160Failed
fixture 3: ('2024-01-01',)11Passed
fixture 4: ('2024-12-31',)361366Failed

SHA-256 / 95b0e98c476206ef260d7d56aa35532dc97efca0ef4d2a54c61248f53dda8c98

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)-date(date.fromisoformat(text).year,1,1)).days
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-03-01',)", solve(*('2024-03-01',)), 61)
check("fixture 2: ('2023-03-01',)", solve(*('2023-03-01',)), 60)
check("fixture 3: ('2024-01-01',)", solve(*('2024-01-01',)), 1)
check("fixture 4: ('2024-12-31',)", solve(*('2024-12-31',)), 366)
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-03-01',)6061Failed
fixture 2: ('2023-03-01',)5960Failed
fixture 3: ('2024-01-01',)01Failed
fixture 4: ('2024-12-31',)365366Failed

SHA-256 / b15d6a74a41e65e0f9bdf3943cb907b7a4d611750be9aa8c239a10bd5da39dff

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).timetuple().tm_yday
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-03-01',)", solve(*('2024-03-01',)), 61)
check("fixture 2: ('2023-03-01',)", solve(*('2023-03-01',)), 60)
check("fixture 3: ('2024-01-01',)", solve(*('2024-01-01',)), 1)
check("fixture 4: ('2024-12-31',)", solve(*('2024-12-31',)), 366)
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-03-01',)6161Passed
fixture 2: ('2023-03-01',)6060Passed
fixture 3: ('2024-01-01',)11Passed
fixture 4: ('2024-12-31',)366366Passed

SHA-256 / b74a7a558b957b3869fc1168cc9cd59dbbaef904939d1f9748c6b876069801e1

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

Case digest / d38ee4b02f3baa9acb823c821d57a122043efbab9d04765f05e07f2f2a011c35