FAILURE MAP
← Case archive

FA-6491 / Calendar arithmetic / Open access

Days until next year exclusive · case 01

A fixed ordinary-year length also excludes the current day incorrectly.

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

ROOT CAUSE

A fixed ordinary-year length also excludes the current day incorrectly.

THE FAILURE

A fixed ordinary-year length also excludes the current day incorrectly.

Unsuccessful approach: A constant leap-year assumption fails in ordinary years.

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. The input year is <=9998; count elapsed days until January 1 of the following year. Exact operational definition: (date(date.fromisoformat(text).year+1,1,1)-date.fromisoformat(text)).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(text):
    return 365-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-12-31',)", solve(*('2024-12-31',)), 1)
check("fixture 2: ('2023-12-31',)", solve(*('2023-12-31',)), 1)
check("fixture 3: ('2024-01-01',)", solve(*('2024-01-01',)), 366)
check("fixture 4: ('2023-01-01',)", solve(*('2023-01-01',)), 365)
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-12-31',)-11Failed
fixture 2: ('2023-12-31',)01Failed
fixture 3: ('2024-01-01',)364366Failed
fixture 4: ('2023-01-01',)364365Failed

SHA-256 / 85ce487288dcc10508c6200eb7eff34bc8cf0f67d991db743eaf04916601665a

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 366-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-12-31',)", solve(*('2024-12-31',)), 1)
check("fixture 2: ('2023-12-31',)", solve(*('2023-12-31',)), 1)
check("fixture 3: ('2024-01-01',)", solve(*('2024-01-01',)), 366)
check("fixture 4: ('2023-01-01',)", solve(*('2023-01-01',)), 365)
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-12-31',)01Failed
fixture 2: ('2023-12-31',)11Passed
fixture 3: ('2024-01-01',)365366Failed
fixture 4: ('2023-01-01',)365365Passed

SHA-256 / 944edd5af23902cf5646baa9286edc7e141f654e6266fde0ec6685ccbc5c41bf

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 4 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 3d4125ef02c19446e8f1c7af6e56fee02c513f90b14d181f4ab96fb65f5d92b5