FAILURE MAP
← Case archive

FA-6521 / Calendar arithmetic / Open access

Month end date · case 01

A day-thirty target is not every calendar month end.

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

ROOT CAUSE

A day-thirty target is not every calendar month end.

THE FAILURE

A day-thirty target is not every calendar month end.

Unsuccessful approach: A universal day twenty-eight avoids invalidity while truncating valid month ends.

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. Month end date. Exact operational definition: date(date.fromisoformat(text).year,date.fromisoformat(text).month,calendar.monthrange(date.fromisoformat(text).year,date.fromisoformat(text).month)[1]).isoformat()

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)+timedelta(days=30-date.fromisoformat(text).day)).isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-02-10',)", solve(*('2024-02-10',)), '2024-02-29')
check("fixture 2: ('2023-02-10',)", solve(*('2023-02-10',)), '2023-02-28')
check("fixture 3: ('2024-04-02',)", solve(*('2024-04-02',)), '2024-04-30')
check("fixture 4: ('2024-07-31',)", solve(*('2024-07-31',)), '2024-07-31')
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-02-10',)2024-03-012024-02-29Failed
fixture 2: ('2023-02-10',)2023-03-022023-02-28Failed
fixture 3: ('2024-04-02',)2024-04-302024-04-30Passed
fixture 4: ('2024-07-31',)2024-07-302024-07-31Failed

SHA-256 / ab203218d4064af2fe1eded05e7ab245b4696804c6b31a915b0b3e8fa68aefee

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(date.fromisoformat(text).year,date.fromisoformat(text).month,28).isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check("fixture 1: ('2024-02-10',)", solve(*('2024-02-10',)), '2024-02-29')
check("fixture 2: ('2023-02-10',)", solve(*('2023-02-10',)), '2023-02-28')
check("fixture 3: ('2024-04-02',)", solve(*('2024-04-02',)), '2024-04-30')
check("fixture 4: ('2024-07-31',)", solve(*('2024-07-31',)), '2024-07-31')
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-02-10',)2024-02-282024-02-29Failed
fixture 2: ('2023-02-10',)2023-02-282023-02-28Passed
fixture 3: ('2024-04-02',)2024-04-282024-04-30Failed
fixture 4: ('2024-07-31',)2024-07-282024-07-31Failed

SHA-256 / 7787a05ae78c24db99e6198d8444197e0953e3737be7afdaeb24c476f2fb710c

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

Case digest / 1c3a1d823b31d7cdd29dc1552dd5b0a0b50359f42ebaa03f305d53319f49d45a