FAILURE MAP
← Case archive

FA-301 / Calendar arithmetic / Open access

A calendar year is paired with a week from the previous ISO year · case 01

Dates near New Year receive a week number from one ISO year and a year label from another.

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

ROOT CAUSE

The calendar year field is combined with ISO week and weekday fields.

THE FAILURE

The calendar year field is combined with ISO week and weekday fields.

Unsuccessful approach: Adjusting December dates in week one handles forward rollover but leaves January dates belonging to the previous ISO year incorrect.

Case contract

Return YYYY-Www-d for a valid ISO date using ISO week numbering: Monday is weekday one, and week one is the week containing January fourth. The year field is the ISO week year.

Why this case matters

Weekly partition names and report keys can collide or be assigned to the wrong year when calendar and week-based fields are mixed.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from datetime import date
N = 1
observations = []
def solve(text):
    value = date.fromisoformat(text)
    _, week, weekday = value.isocalendar()
    return f'{value.year:04d}-W{week:02d}-{weekday}'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
january = ['2016-01-01', '2017-01-01', '2021-01-01', '2022-01-01', '2023-01-01'][N - 1]
expected = ['2015-W53-5', '2016-W52-7', '2020-W53-5', '2021-W52-6', '2022-W52-7'][N - 1]
check('January belongs to preceding ISO year', solve(january), expected)
check('December belongs to following ISO year', solve('2018-12-31'), '2019-W01-1')
check('December remains in week fifty-three', solve('2020-12-31'), '2020-W53-4')
check('Monday January first', solve('2024-01-01'), '2024-W01-1')
check('leap day', solve('2024-02-29'), '2024-W09-4')
check('Sunday ends the same ISO week', solve('2024-03-03'), '2024-W09-7')
check('Monday advances the week', solve('2024-03-04'), '2024-W10-1')
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
January belongs to preceding ISO year2016-W53-52015-W53-5Failed
December belongs to following ISO year2018-W01-12019-W01-1Failed
December remains in week fifty-three2020-W53-42020-W53-4Passed
Monday January first2024-W01-12024-W01-1Passed
leap day2024-W09-42024-W09-4Passed
Sunday ends the same ISO week2024-W09-72024-W09-7Passed
Monday advances the week2024-W10-12024-W10-1Passed

SHA-256 / 902338a9d54eeb406df9bcfc8316d9fb30f664b111d3ea59e3c87f896bd8b316

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from datetime import date
N = 1
observations = []
def solve(text):
    value = date.fromisoformat(text)
    _, week, weekday = value.isocalendar()
    year = value.year + (value.month == 12 and week == 1)
    return f'{year:04d}-W{week:02d}-{weekday}'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
january = ['2016-01-01', '2017-01-01', '2021-01-01', '2022-01-01', '2023-01-01'][N - 1]
expected = ['2015-W53-5', '2016-W52-7', '2020-W53-5', '2021-W52-6', '2022-W52-7'][N - 1]
check('January belongs to preceding ISO year', solve(january), expected)
check('December belongs to following ISO year', solve('2018-12-31'), '2019-W01-1')
check('December remains in week fifty-three', solve('2020-12-31'), '2020-W53-4')
check('Monday January first', solve('2024-01-01'), '2024-W01-1')
check('leap day', solve('2024-02-29'), '2024-W09-4')
check('Sunday ends the same ISO week', solve('2024-03-03'), '2024-W09-7')
check('Monday advances the week', solve('2024-03-04'), '2024-W10-1')
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
January belongs to preceding ISO year2016-W53-52015-W53-5Failed
December belongs to following ISO year2019-W01-12019-W01-1Passed
December remains in week fifty-three2020-W53-42020-W53-4Passed
Monday January first2024-W01-12024-W01-1Passed
leap day2024-W09-42024-W09-4Passed
Sunday ends the same ISO week2024-W09-72024-W09-7Passed
Monday advances the week2024-W10-12024-W10-1Passed

SHA-256 / 4143eab0782fbdf1ad12aef718b4559e000ec4c19aa519499bc67d6871cfeefe

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 7 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:36:52.069412+00:00.

Case digest / dfcf20d4f27413604c097539ab3ba5c8e475f57279ee863325354ab81d1f8d0f