FAILURE MAP
← Case archive

FA-77001 / Calendar recurrence rules / Open access

Applying moved and cancelled instance overrides in a window query: override value · case 01

A cancelled instance still appears on the calendar.

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

ROOT CAUSE

A None override is treated as no change.

VERIFIED REPAIR

At the override value decision use `None if new is None else dt.date.fromisoformat(new)`, leaving the other decision sites of the model unchanged.

Unsuccessful approach: The partial repair `None if new in (None, orig) else dt.date.fromisoformat(new)` also cancels an override that reasserts the original date.

Case contract

A daily-interval series of count instances. overrides is an ordered list of [original_date, new_date] where new_date None cancels; for repeated originals the last override wins; overrides whose original is not a series instance are ignored. Return [original, actual] pairs for instances whose actual date lies in [window_start, window_end], sorted by actual then original date.

Why this case matters

Recurring calendar series are expanded into concrete instances for display, reminders and conflict checks.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime as dt
import calendar
N = 1
observations = []
def solve(dtstart, interval, count, overrides, window_start, window_end):
    start = dt.date.fromisoformat(dtstart)
    ws = dt.date.fromisoformat(window_start)
    we = dt.date.fromisoformat(window_end)
    originals = [start + dt.timedelta(days=k * interval) for k in range(count)]
    origset = set(originals)
    actual = {o: o for o in originals}
    for orig, new in overrides:
        o = dt.date.fromisoformat(orig)
        if o not in origset:
            continue
        actual[o] = dt.date.fromisoformat(new) if new else o
    rows = [[o.isoformat(), a.isoformat()] for o, a in actual.items() if a is not None and ws <= a <= we]
    return sorted(rows, key=lambda r: (r[1], r[0]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: moved into window',
   ['2024-01-01', 1, 10, [['2024-01-02', '2024-01-06']], '2024-01-05', '2024-01-07'],
   [['2024-01-05', '2024-01-05'],
    ['2024-01-02', '2024-01-06'],
    ['2024-01-06', '2024-01-06'],
    ['2024-01-07', '2024-01-07']]),
  ('moved out of window',
   ['2024-01-01', 1, 10, [['2024-01-06', '2024-01-20']], '2024-01-05', '2024-01-07'],
   [['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07']]),
  ('cancelled instance',
   ['2024-01-01', 2, 5, [['2024-01-03', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'],
    ['2024-01-05', '2024-01-05'],
    ['2024-01-07', '2024-01-07'],
    ['2024-01-09', '2024-01-09']]),
  ('orphan move',
   ['2024-01-01', 2, 5, [['2024-01-02', '2024-01-04']], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'],
    ['2024-01-03', '2024-01-03'],
    ['2024-01-05', '2024-01-05'],
    ['2024-01-07', '2024-01-07'],
    ['2024-01-09', '2024-01-09']]),
  ('orphan cancel',
   ['2024-01-01', 2, 3, [['2024-01-04', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05']]),
  ('last override wins',
   ['2024-02-01',
    1,
    4,
    [['2024-02-02', '2024-02-10'], ['2024-02-02', '2024-02-03']],
    '2024-02-01',
    '2024-02-10'],
   [['2024-02-01', '2024-02-01'],
    ['2024-02-02', '2024-02-03'],
    ['2024-02-03', '2024-02-03'],
    ['2024-02-04', '2024-02-04']]),
  ('cancel then move',
   ['2024-02-01', 1, 3, [['2024-02-02', None], ['2024-02-02', '2024-02-05']], '2024-02-01', '2024-02-05'],
   [['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']]),
  ('restated original date',
   ['2024-03-01', 7, 3, [['2024-03-08', '2024-03-08']], '2024-03-01', '2024-03-31'],
   [['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']])],
 [('cancelled instance',
   ['2024-01-01', 2, 5, [['2024-01-03', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'],
    ['2024-01-05', '2024-01-05'],
    ['2024-01-07', '2024-01-07'],
    ['2024-01-09', '2024-01-09']]),
  ('orphan move',
   ['2024-01-01', 2, 5, [['2024-01-02', '2024-01-04']], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'],
    ['2024-01-03', '2024-01-03'],
    ['2024-01-05', '2024-01-05'],
    ['2024-01-07', '2024-01-07'],
    ['2024-01-09', '2024-01-09']]),
  ('orphan cancel',
   ['2024-01-01', 2, 3, [['2024-01-04', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05']]),
  ('last override wins',
   ['2024-02-01',
    1,
    4,
    [['2024-02-02', '2024-02-10'], ['2024-02-02', '2024-02-03']],
    '2024-02-01',
    '2024-02-10'],
   [['2024-02-01', '2024-02-01'],
    ['2024-02-02', '2024-02-03'],
    ['2024-02-03', '2024-02-03'],
    ['2024-02-04', '2024-02-04']]),
  ('cancel then move',
   ['2024-02-01', 1, 3, [['2024-02-02', None], ['2024-02-02', '2024-02-05']], '2024-02-01', '2024-02-05'],
   [['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']]),
  ('restated original date',
   ['2024-03-01', 7, 3, [['2024-03-08', '2024-03-08']], '2024-03-01', '2024-03-31'],
   [['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']]),
  ('two moved onto same day',
   ['2024-04-01',
    1,
    5,
    [['2024-04-04', '2024-04-02'], ['2024-04-05', '2024-04-02']],
    '2024-04-02',
    '2024-04-03'],
   [['2024-04-02', '2024-04-02'],
    ['2024-04-04', '2024-04-02'],
    ['2024-04-05', '2024-04-02'],
    ['2024-04-03', '2024-04-03']])],
 [('orphan cancel',
   ['2024-01-01', 2, 3, [['2024-01-04', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05']]),
  ('last override wins',
   ['2024-02-01',
    1,
    4,
    [['2024-02-02', '2024-02-10'], ['2024-02-02', '2024-02-03']],
    '2024-02-01',
    '2024-02-10'],
   [['2024-02-01', '2024-02-01'],
    ['2024-02-02', '2024-02-03'],
    ['2024-02-03', '2024-02-03'],
    ['2024-02-04', '2024-02-04']]),
  ('cancel then move',
   ['2024-02-01', 1, 3, [['2024-02-02', None], ['2024-02-02', '2024-02-05']], '2024-02-01', '2024-02-05'],
   [['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']]),
  ('restated original date',
   ['2024-03-01', 7, 3, [['2024-03-08', '2024-03-08']], '2024-03-01', '2024-03-31'],
   [['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']]),
  ('two moved onto same day',
   ['2024-04-01',
    1,
    5,
    [['2024-04-04', '2024-04-02'], ['2024-04-05', '2024-04-02']],
    '2024-04-02',
    '2024-04-03'],
   [['2024-04-02', '2024-04-02'],
    ['2024-04-04', '2024-04-02'],
    ['2024-04-05', '2024-04-02'],
    ['2024-04-03', '2024-04-03']]),
  ('orphan after series end',
   ['2024-05-01', 1, 3, [['2024-05-10', '2024-05-02']], '2024-05-01', '2024-05-10'],
   [['2024-05-01', '2024-05-01'], ['2024-05-02', '2024-05-02'], ['2024-05-03', '2024-05-03']]),
  ('move then cancel',
   ['2024-06-01', 1, 3, [['2024-06-03', '2024-06-01'], ['2024-06-03', None]], '2024-06-01', '2024-06-05'],
   [['2024-06-01', '2024-06-01'], ['2024-06-02', '2024-06-02']])],
 [('cancel then move',
   ['2024-02-01', 1, 3, [['2024-02-02', None], ['2024-02-02', '2024-02-05']], '2024-02-01', '2024-02-05'],
   [['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']]),
  ('restated original date',
   ['2024-03-01', 7, 3, [['2024-03-08', '2024-03-08']], '2024-03-01', '2024-03-31'],
   [['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']]),
  ('two moved onto same day',
   ['2024-04-01',
    1,
    5,
    [['2024-04-04', '2024-04-02'], ['2024-04-05', '2024-04-02']],
    '2024-04-02',
    '2024-04-03'],
   [['2024-04-02', '2024-04-02'],
    ['2024-04-04', '2024-04-02'],
    ['2024-04-05', '2024-04-02'],
    ['2024-04-03', '2024-04-03']]),
  ('orphan after series end',
   ['2024-05-01', 1, 3, [['2024-05-10', '2024-05-02']], '2024-05-01', '2024-05-10'],
   [['2024-05-01', '2024-05-01'], ['2024-05-02', '2024-05-02'], ['2024-05-03', '2024-05-03']]),
  ('move then cancel',
   ['2024-06-01', 1, 3, [['2024-06-03', '2024-06-01'], ['2024-06-03', None]], '2024-06-01', '2024-06-05'],
   [['2024-06-01', '2024-06-01'], ['2024-06-02', '2024-06-02']]),
  ('no overrides',
   ['2024-06-01', 3, 3, [], '2024-06-02', '2024-06-07'],
   [['2024-06-04', '2024-06-04'], ['2024-06-07', '2024-06-07']]),
  ('regression: moved into window',
   ['2024-01-01', 1, 10, [['2024-01-02', '2024-01-06']], '2024-01-05', '2024-01-07'],
   [['2024-01-05', '2024-01-05'],
    ['2024-01-02', '2024-01-06'],
    ['2024-01-06', '2024-01-06'],
    ['2024-01-07', '2024-01-07']])],
 [('two moved onto same day',
   ['2024-04-01',
    1,
    5,
    [['2024-04-04', '2024-04-02'], ['2024-04-05', '2024-04-02']],
    '2024-04-02',
    '2024-04-03'],
   [['2024-04-02', '2024-04-02'],
    ['2024-04-04', '2024-04-02'],
    ['2024-04-05', '2024-04-02'],
    ['2024-04-03', '2024-04-03']]),
  ('orphan after series end',
   ['2024-05-01', 1, 3, [['2024-05-10', '2024-05-02']], '2024-05-01', '2024-05-10'],
   [['2024-05-01', '2024-05-01'], ['2024-05-02', '2024-05-02'], ['2024-05-03', '2024-05-03']]),
  ('move then cancel',
   ['2024-06-01', 1, 3, [['2024-06-03', '2024-06-01'], ['2024-06-03', None]], '2024-06-01', '2024-06-05'],
   [['2024-06-01', '2024-06-01'], ['2024-06-02', '2024-06-02']]),
  ('no overrides',
   ['2024-06-01', 3, 3, [], '2024-06-02', '2024-06-07'],
   [['2024-06-04', '2024-06-04'], ['2024-06-07', '2024-06-07']]),
  ('regression: moved into window',
   ['2024-01-01', 1, 10, [['2024-01-02', '2024-01-06']], '2024-01-05', '2024-01-07'],
   [['2024-01-05', '2024-01-05'],
    ['2024-01-02', '2024-01-06'],
    ['2024-01-06', '2024-01-06'],
    ['2024-01-07', '2024-01-07']]),
  ('moved out of window',
   ['2024-01-01', 1, 10, [['2024-01-06', '2024-01-20']], '2024-01-05', '2024-01-07'],
   [['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07']]),
  ('cancelled instance',
   ['2024-01-01', 2, 5, [['2024-01-03', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'],
    ['2024-01-05', '2024-01-05'],
    ['2024-01-07', '2024-01-07'],
    ['2024-01-09', '2024-01-09']]),
  ('restated original date',
   ['2024-03-01', 7, 3, [['2024-03-08', '2024-03-08']], '2024-03-01', '2024-03-31'],
   [['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
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
regression: moved into window[['2024-01-05', '2024-01-05'], ['2024-01-02', '2024-01-06'], ['2024-01-06', '2024-01-06'], ['2024-01-07', '2024-01-07']][['2024-01-05', '2024-01-05'], ['2024-01-02', '2024-01-06'], ['2024-01-06', '2024-01-06'], ['2024-01-07', '2024-01-07']]Passed
moved out of window[['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07']][['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07']]Passed
cancelled instance[['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07'], ['2024-01-09', '2024-01-09']][['2024-01-01', '2024-01-01'], ['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07'], ['2024-01-09', '2024-01-09']]Failed
orphan move[['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07'], ['2024-01-09', '2024-01-09']][['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07'], ['2024-01-09', '2024-01-09']]Passed
orphan cancel[['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05']][['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05']]Passed
last override wins[['2024-02-01', '2024-02-01'], ['2024-02-02', '2024-02-03'], ['2024-02-03', '2024-02-03'], ['2024-02-04', '2024-02-04']][['2024-02-01', '2024-02-01'], ['2024-02-02', '2024-02-03'], ['2024-02-03', '2024-02-03'], ['2024-02-04', '2024-02-04']]Passed
cancel then move[['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']][['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']]Passed
restated original date[['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']][['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']]Passed

SHA-256 / c5e9928f0013afd34f53d3e31d017df002fe263892fbd5fe2a3e9bfc56ebd9dd

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime as dt
import calendar
N = 1
observations = []
def solve(dtstart, interval, count, overrides, window_start, window_end):
    start = dt.date.fromisoformat(dtstart)
    ws = dt.date.fromisoformat(window_start)
    we = dt.date.fromisoformat(window_end)
    originals = [start + dt.timedelta(days=k * interval) for k in range(count)]
    origset = set(originals)
    actual = {o: o for o in originals}
    for orig, new in overrides:
        o = dt.date.fromisoformat(orig)
        if o not in origset:
            continue
        actual[o] = None if new in (None, orig) else dt.date.fromisoformat(new)
    rows = [[o.isoformat(), a.isoformat()] for o, a in actual.items() if a is not None and ws <= a <= we]
    return sorted(rows, key=lambda r: (r[1], r[0]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: moved into window',
   ['2024-01-01', 1, 10, [['2024-01-02', '2024-01-06']], '2024-01-05', '2024-01-07'],
   [['2024-01-05', '2024-01-05'],
    ['2024-01-02', '2024-01-06'],
    ['2024-01-06', '2024-01-06'],
    ['2024-01-07', '2024-01-07']]),
  ('moved out of window',
   ['2024-01-01', 1, 10, [['2024-01-06', '2024-01-20']], '2024-01-05', '2024-01-07'],
   [['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07']]),
  ('cancelled instance',
   ['2024-01-01', 2, 5, [['2024-01-03', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'],
    ['2024-01-05', '2024-01-05'],
    ['2024-01-07', '2024-01-07'],
    ['2024-01-09', '2024-01-09']]),
  ('orphan move',
   ['2024-01-01', 2, 5, [['2024-01-02', '2024-01-04']], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'],
    ['2024-01-03', '2024-01-03'],
    ['2024-01-05', '2024-01-05'],
    ['2024-01-07', '2024-01-07'],
    ['2024-01-09', '2024-01-09']]),
  ('orphan cancel',
   ['2024-01-01', 2, 3, [['2024-01-04', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05']]),
  ('last override wins',
   ['2024-02-01',
    1,
    4,
    [['2024-02-02', '2024-02-10'], ['2024-02-02', '2024-02-03']],
    '2024-02-01',
    '2024-02-10'],
   [['2024-02-01', '2024-02-01'],
    ['2024-02-02', '2024-02-03'],
    ['2024-02-03', '2024-02-03'],
    ['2024-02-04', '2024-02-04']]),
  ('cancel then move',
   ['2024-02-01', 1, 3, [['2024-02-02', None], ['2024-02-02', '2024-02-05']], '2024-02-01', '2024-02-05'],
   [['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']]),
  ('restated original date',
   ['2024-03-01', 7, 3, [['2024-03-08', '2024-03-08']], '2024-03-01', '2024-03-31'],
   [['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']])],
 [('cancelled instance',
   ['2024-01-01', 2, 5, [['2024-01-03', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'],
    ['2024-01-05', '2024-01-05'],
    ['2024-01-07', '2024-01-07'],
    ['2024-01-09', '2024-01-09']]),
  ('orphan move',
   ['2024-01-01', 2, 5, [['2024-01-02', '2024-01-04']], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'],
    ['2024-01-03', '2024-01-03'],
    ['2024-01-05', '2024-01-05'],
    ['2024-01-07', '2024-01-07'],
    ['2024-01-09', '2024-01-09']]),
  ('orphan cancel',
   ['2024-01-01', 2, 3, [['2024-01-04', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05']]),
  ('last override wins',
   ['2024-02-01',
    1,
    4,
    [['2024-02-02', '2024-02-10'], ['2024-02-02', '2024-02-03']],
    '2024-02-01',
    '2024-02-10'],
   [['2024-02-01', '2024-02-01'],
    ['2024-02-02', '2024-02-03'],
    ['2024-02-03', '2024-02-03'],
    ['2024-02-04', '2024-02-04']]),
  ('cancel then move',
   ['2024-02-01', 1, 3, [['2024-02-02', None], ['2024-02-02', '2024-02-05']], '2024-02-01', '2024-02-05'],
   [['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']]),
  ('restated original date',
   ['2024-03-01', 7, 3, [['2024-03-08', '2024-03-08']], '2024-03-01', '2024-03-31'],
   [['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']]),
  ('two moved onto same day',
   ['2024-04-01',
    1,
    5,
    [['2024-04-04', '2024-04-02'], ['2024-04-05', '2024-04-02']],
    '2024-04-02',
    '2024-04-03'],
   [['2024-04-02', '2024-04-02'],
    ['2024-04-04', '2024-04-02'],
    ['2024-04-05', '2024-04-02'],
    ['2024-04-03', '2024-04-03']])],
 [('orphan cancel',
   ['2024-01-01', 2, 3, [['2024-01-04', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05']]),
  ('last override wins',
   ['2024-02-01',
    1,
    4,
    [['2024-02-02', '2024-02-10'], ['2024-02-02', '2024-02-03']],
    '2024-02-01',
    '2024-02-10'],
   [['2024-02-01', '2024-02-01'],
    ['2024-02-02', '2024-02-03'],
    ['2024-02-03', '2024-02-03'],
    ['2024-02-04', '2024-02-04']]),
  ('cancel then move',
   ['2024-02-01', 1, 3, [['2024-02-02', None], ['2024-02-02', '2024-02-05']], '2024-02-01', '2024-02-05'],
   [['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']]),
  ('restated original date',
   ['2024-03-01', 7, 3, [['2024-03-08', '2024-03-08']], '2024-03-01', '2024-03-31'],
   [['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']]),
  ('two moved onto same day',
   ['2024-04-01',
    1,
    5,
    [['2024-04-04', '2024-04-02'], ['2024-04-05', '2024-04-02']],
    '2024-04-02',
    '2024-04-03'],
   [['2024-04-02', '2024-04-02'],
    ['2024-04-04', '2024-04-02'],
    ['2024-04-05', '2024-04-02'],
    ['2024-04-03', '2024-04-03']]),
  ('orphan after series end',
   ['2024-05-01', 1, 3, [['2024-05-10', '2024-05-02']], '2024-05-01', '2024-05-10'],
   [['2024-05-01', '2024-05-01'], ['2024-05-02', '2024-05-02'], ['2024-05-03', '2024-05-03']]),
  ('move then cancel',
   ['2024-06-01', 1, 3, [['2024-06-03', '2024-06-01'], ['2024-06-03', None]], '2024-06-01', '2024-06-05'],
   [['2024-06-01', '2024-06-01'], ['2024-06-02', '2024-06-02']])],
 [('cancel then move',
   ['2024-02-01', 1, 3, [['2024-02-02', None], ['2024-02-02', '2024-02-05']], '2024-02-01', '2024-02-05'],
   [['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']]),
  ('restated original date',
   ['2024-03-01', 7, 3, [['2024-03-08', '2024-03-08']], '2024-03-01', '2024-03-31'],
   [['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']]),
  ('two moved onto same day',
   ['2024-04-01',
    1,
    5,
    [['2024-04-04', '2024-04-02'], ['2024-04-05', '2024-04-02']],
    '2024-04-02',
    '2024-04-03'],
   [['2024-04-02', '2024-04-02'],
    ['2024-04-04', '2024-04-02'],
    ['2024-04-05', '2024-04-02'],
    ['2024-04-03', '2024-04-03']]),
  ('orphan after series end',
   ['2024-05-01', 1, 3, [['2024-05-10', '2024-05-02']], '2024-05-01', '2024-05-10'],
   [['2024-05-01', '2024-05-01'], ['2024-05-02', '2024-05-02'], ['2024-05-03', '2024-05-03']]),
  ('move then cancel',
   ['2024-06-01', 1, 3, [['2024-06-03', '2024-06-01'], ['2024-06-03', None]], '2024-06-01', '2024-06-05'],
   [['2024-06-01', '2024-06-01'], ['2024-06-02', '2024-06-02']]),
  ('no overrides',
   ['2024-06-01', 3, 3, [], '2024-06-02', '2024-06-07'],
   [['2024-06-04', '2024-06-04'], ['2024-06-07', '2024-06-07']]),
  ('regression: moved into window',
   ['2024-01-01', 1, 10, [['2024-01-02', '2024-01-06']], '2024-01-05', '2024-01-07'],
   [['2024-01-05', '2024-01-05'],
    ['2024-01-02', '2024-01-06'],
    ['2024-01-06', '2024-01-06'],
    ['2024-01-07', '2024-01-07']])],
 [('two moved onto same day',
   ['2024-04-01',
    1,
    5,
    [['2024-04-04', '2024-04-02'], ['2024-04-05', '2024-04-02']],
    '2024-04-02',
    '2024-04-03'],
   [['2024-04-02', '2024-04-02'],
    ['2024-04-04', '2024-04-02'],
    ['2024-04-05', '2024-04-02'],
    ['2024-04-03', '2024-04-03']]),
  ('orphan after series end',
   ['2024-05-01', 1, 3, [['2024-05-10', '2024-05-02']], '2024-05-01', '2024-05-10'],
   [['2024-05-01', '2024-05-01'], ['2024-05-02', '2024-05-02'], ['2024-05-03', '2024-05-03']]),
  ('move then cancel',
   ['2024-06-01', 1, 3, [['2024-06-03', '2024-06-01'], ['2024-06-03', None]], '2024-06-01', '2024-06-05'],
   [['2024-06-01', '2024-06-01'], ['2024-06-02', '2024-06-02']]),
  ('no overrides',
   ['2024-06-01', 3, 3, [], '2024-06-02', '2024-06-07'],
   [['2024-06-04', '2024-06-04'], ['2024-06-07', '2024-06-07']]),
  ('regression: moved into window',
   ['2024-01-01', 1, 10, [['2024-01-02', '2024-01-06']], '2024-01-05', '2024-01-07'],
   [['2024-01-05', '2024-01-05'],
    ['2024-01-02', '2024-01-06'],
    ['2024-01-06', '2024-01-06'],
    ['2024-01-07', '2024-01-07']]),
  ('moved out of window',
   ['2024-01-01', 1, 10, [['2024-01-06', '2024-01-20']], '2024-01-05', '2024-01-07'],
   [['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07']]),
  ('cancelled instance',
   ['2024-01-01', 2, 5, [['2024-01-03', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'],
    ['2024-01-05', '2024-01-05'],
    ['2024-01-07', '2024-01-07'],
    ['2024-01-09', '2024-01-09']]),
  ('restated original date',
   ['2024-03-01', 7, 3, [['2024-03-08', '2024-03-08']], '2024-03-01', '2024-03-31'],
   [['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
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
regression: moved into window[['2024-01-05', '2024-01-05'], ['2024-01-02', '2024-01-06'], ['2024-01-06', '2024-01-06'], ['2024-01-07', '2024-01-07']][['2024-01-05', '2024-01-05'], ['2024-01-02', '2024-01-06'], ['2024-01-06', '2024-01-06'], ['2024-01-07', '2024-01-07']]Passed
moved out of window[['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07']][['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07']]Passed
cancelled instance[['2024-01-01', '2024-01-01'], ['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07'], ['2024-01-09', '2024-01-09']][['2024-01-01', '2024-01-01'], ['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07'], ['2024-01-09', '2024-01-09']]Passed
orphan move[['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07'], ['2024-01-09', '2024-01-09']][['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07'], ['2024-01-09', '2024-01-09']]Passed
orphan cancel[['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05']][['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05']]Passed
last override wins[['2024-02-01', '2024-02-01'], ['2024-02-02', '2024-02-03'], ['2024-02-03', '2024-02-03'], ['2024-02-04', '2024-02-04']][['2024-02-01', '2024-02-01'], ['2024-02-02', '2024-02-03'], ['2024-02-03', '2024-02-03'], ['2024-02-04', '2024-02-04']]Passed
cancel then move[['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']][['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']]Passed
restated original date[['2024-03-01', '2024-03-01'], ['2024-03-15', '2024-03-15']][['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']]Failed

SHA-256 / 9eb639bde660aa951469323632b7ad7f674ae55142dc9295eaaa0180f992491c

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime as dt
import calendar
N = 1
observations = []
def solve(dtstart, interval, count, overrides, window_start, window_end):
    start = dt.date.fromisoformat(dtstart)
    ws = dt.date.fromisoformat(window_start)
    we = dt.date.fromisoformat(window_end)
    originals = [start + dt.timedelta(days=k * interval) for k in range(count)]
    origset = set(originals)
    actual = {o: o for o in originals}
    for orig, new in overrides:
        o = dt.date.fromisoformat(orig)
        if o not in origset:
            continue
        actual[o] = None if new is None else dt.date.fromisoformat(new)
    rows = [[o.isoformat(), a.isoformat()] for o, a in actual.items() if a is not None and ws <= a <= we]
    return sorted(rows, key=lambda r: (r[1], r[0]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: moved into window',
   ['2024-01-01', 1, 10, [['2024-01-02', '2024-01-06']], '2024-01-05', '2024-01-07'],
   [['2024-01-05', '2024-01-05'],
    ['2024-01-02', '2024-01-06'],
    ['2024-01-06', '2024-01-06'],
    ['2024-01-07', '2024-01-07']]),
  ('moved out of window',
   ['2024-01-01', 1, 10, [['2024-01-06', '2024-01-20']], '2024-01-05', '2024-01-07'],
   [['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07']]),
  ('cancelled instance',
   ['2024-01-01', 2, 5, [['2024-01-03', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'],
    ['2024-01-05', '2024-01-05'],
    ['2024-01-07', '2024-01-07'],
    ['2024-01-09', '2024-01-09']]),
  ('orphan move',
   ['2024-01-01', 2, 5, [['2024-01-02', '2024-01-04']], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'],
    ['2024-01-03', '2024-01-03'],
    ['2024-01-05', '2024-01-05'],
    ['2024-01-07', '2024-01-07'],
    ['2024-01-09', '2024-01-09']]),
  ('orphan cancel',
   ['2024-01-01', 2, 3, [['2024-01-04', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05']]),
  ('last override wins',
   ['2024-02-01',
    1,
    4,
    [['2024-02-02', '2024-02-10'], ['2024-02-02', '2024-02-03']],
    '2024-02-01',
    '2024-02-10'],
   [['2024-02-01', '2024-02-01'],
    ['2024-02-02', '2024-02-03'],
    ['2024-02-03', '2024-02-03'],
    ['2024-02-04', '2024-02-04']]),
  ('cancel then move',
   ['2024-02-01', 1, 3, [['2024-02-02', None], ['2024-02-02', '2024-02-05']], '2024-02-01', '2024-02-05'],
   [['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']]),
  ('restated original date',
   ['2024-03-01', 7, 3, [['2024-03-08', '2024-03-08']], '2024-03-01', '2024-03-31'],
   [['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']])],
 [('cancelled instance',
   ['2024-01-01', 2, 5, [['2024-01-03', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'],
    ['2024-01-05', '2024-01-05'],
    ['2024-01-07', '2024-01-07'],
    ['2024-01-09', '2024-01-09']]),
  ('orphan move',
   ['2024-01-01', 2, 5, [['2024-01-02', '2024-01-04']], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'],
    ['2024-01-03', '2024-01-03'],
    ['2024-01-05', '2024-01-05'],
    ['2024-01-07', '2024-01-07'],
    ['2024-01-09', '2024-01-09']]),
  ('orphan cancel',
   ['2024-01-01', 2, 3, [['2024-01-04', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05']]),
  ('last override wins',
   ['2024-02-01',
    1,
    4,
    [['2024-02-02', '2024-02-10'], ['2024-02-02', '2024-02-03']],
    '2024-02-01',
    '2024-02-10'],
   [['2024-02-01', '2024-02-01'],
    ['2024-02-02', '2024-02-03'],
    ['2024-02-03', '2024-02-03'],
    ['2024-02-04', '2024-02-04']]),
  ('cancel then move',
   ['2024-02-01', 1, 3, [['2024-02-02', None], ['2024-02-02', '2024-02-05']], '2024-02-01', '2024-02-05'],
   [['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']]),
  ('restated original date',
   ['2024-03-01', 7, 3, [['2024-03-08', '2024-03-08']], '2024-03-01', '2024-03-31'],
   [['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']]),
  ('two moved onto same day',
   ['2024-04-01',
    1,
    5,
    [['2024-04-04', '2024-04-02'], ['2024-04-05', '2024-04-02']],
    '2024-04-02',
    '2024-04-03'],
   [['2024-04-02', '2024-04-02'],
    ['2024-04-04', '2024-04-02'],
    ['2024-04-05', '2024-04-02'],
    ['2024-04-03', '2024-04-03']])],
 [('orphan cancel',
   ['2024-01-01', 2, 3, [['2024-01-04', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05']]),
  ('last override wins',
   ['2024-02-01',
    1,
    4,
    [['2024-02-02', '2024-02-10'], ['2024-02-02', '2024-02-03']],
    '2024-02-01',
    '2024-02-10'],
   [['2024-02-01', '2024-02-01'],
    ['2024-02-02', '2024-02-03'],
    ['2024-02-03', '2024-02-03'],
    ['2024-02-04', '2024-02-04']]),
  ('cancel then move',
   ['2024-02-01', 1, 3, [['2024-02-02', None], ['2024-02-02', '2024-02-05']], '2024-02-01', '2024-02-05'],
   [['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']]),
  ('restated original date',
   ['2024-03-01', 7, 3, [['2024-03-08', '2024-03-08']], '2024-03-01', '2024-03-31'],
   [['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']]),
  ('two moved onto same day',
   ['2024-04-01',
    1,
    5,
    [['2024-04-04', '2024-04-02'], ['2024-04-05', '2024-04-02']],
    '2024-04-02',
    '2024-04-03'],
   [['2024-04-02', '2024-04-02'],
    ['2024-04-04', '2024-04-02'],
    ['2024-04-05', '2024-04-02'],
    ['2024-04-03', '2024-04-03']]),
  ('orphan after series end',
   ['2024-05-01', 1, 3, [['2024-05-10', '2024-05-02']], '2024-05-01', '2024-05-10'],
   [['2024-05-01', '2024-05-01'], ['2024-05-02', '2024-05-02'], ['2024-05-03', '2024-05-03']]),
  ('move then cancel',
   ['2024-06-01', 1, 3, [['2024-06-03', '2024-06-01'], ['2024-06-03', None]], '2024-06-01', '2024-06-05'],
   [['2024-06-01', '2024-06-01'], ['2024-06-02', '2024-06-02']])],
 [('cancel then move',
   ['2024-02-01', 1, 3, [['2024-02-02', None], ['2024-02-02', '2024-02-05']], '2024-02-01', '2024-02-05'],
   [['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']]),
  ('restated original date',
   ['2024-03-01', 7, 3, [['2024-03-08', '2024-03-08']], '2024-03-01', '2024-03-31'],
   [['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']]),
  ('two moved onto same day',
   ['2024-04-01',
    1,
    5,
    [['2024-04-04', '2024-04-02'], ['2024-04-05', '2024-04-02']],
    '2024-04-02',
    '2024-04-03'],
   [['2024-04-02', '2024-04-02'],
    ['2024-04-04', '2024-04-02'],
    ['2024-04-05', '2024-04-02'],
    ['2024-04-03', '2024-04-03']]),
  ('orphan after series end',
   ['2024-05-01', 1, 3, [['2024-05-10', '2024-05-02']], '2024-05-01', '2024-05-10'],
   [['2024-05-01', '2024-05-01'], ['2024-05-02', '2024-05-02'], ['2024-05-03', '2024-05-03']]),
  ('move then cancel',
   ['2024-06-01', 1, 3, [['2024-06-03', '2024-06-01'], ['2024-06-03', None]], '2024-06-01', '2024-06-05'],
   [['2024-06-01', '2024-06-01'], ['2024-06-02', '2024-06-02']]),
  ('no overrides',
   ['2024-06-01', 3, 3, [], '2024-06-02', '2024-06-07'],
   [['2024-06-04', '2024-06-04'], ['2024-06-07', '2024-06-07']]),
  ('regression: moved into window',
   ['2024-01-01', 1, 10, [['2024-01-02', '2024-01-06']], '2024-01-05', '2024-01-07'],
   [['2024-01-05', '2024-01-05'],
    ['2024-01-02', '2024-01-06'],
    ['2024-01-06', '2024-01-06'],
    ['2024-01-07', '2024-01-07']])],
 [('two moved onto same day',
   ['2024-04-01',
    1,
    5,
    [['2024-04-04', '2024-04-02'], ['2024-04-05', '2024-04-02']],
    '2024-04-02',
    '2024-04-03'],
   [['2024-04-02', '2024-04-02'],
    ['2024-04-04', '2024-04-02'],
    ['2024-04-05', '2024-04-02'],
    ['2024-04-03', '2024-04-03']]),
  ('orphan after series end',
   ['2024-05-01', 1, 3, [['2024-05-10', '2024-05-02']], '2024-05-01', '2024-05-10'],
   [['2024-05-01', '2024-05-01'], ['2024-05-02', '2024-05-02'], ['2024-05-03', '2024-05-03']]),
  ('move then cancel',
   ['2024-06-01', 1, 3, [['2024-06-03', '2024-06-01'], ['2024-06-03', None]], '2024-06-01', '2024-06-05'],
   [['2024-06-01', '2024-06-01'], ['2024-06-02', '2024-06-02']]),
  ('no overrides',
   ['2024-06-01', 3, 3, [], '2024-06-02', '2024-06-07'],
   [['2024-06-04', '2024-06-04'], ['2024-06-07', '2024-06-07']]),
  ('regression: moved into window',
   ['2024-01-01', 1, 10, [['2024-01-02', '2024-01-06']], '2024-01-05', '2024-01-07'],
   [['2024-01-05', '2024-01-05'],
    ['2024-01-02', '2024-01-06'],
    ['2024-01-06', '2024-01-06'],
    ['2024-01-07', '2024-01-07']]),
  ('moved out of window',
   ['2024-01-01', 1, 10, [['2024-01-06', '2024-01-20']], '2024-01-05', '2024-01-07'],
   [['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07']]),
  ('cancelled instance',
   ['2024-01-01', 2, 5, [['2024-01-03', None]], '2024-01-01', '2024-01-09'],
   [['2024-01-01', '2024-01-01'],
    ['2024-01-05', '2024-01-05'],
    ['2024-01-07', '2024-01-07'],
    ['2024-01-09', '2024-01-09']]),
  ('restated original date',
   ['2024-03-01', 7, 3, [['2024-03-08', '2024-03-08']], '2024-03-01', '2024-03-31'],
   [['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
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
regression: moved into window[['2024-01-05', '2024-01-05'], ['2024-01-02', '2024-01-06'], ['2024-01-06', '2024-01-06'], ['2024-01-07', '2024-01-07']][['2024-01-05', '2024-01-05'], ['2024-01-02', '2024-01-06'], ['2024-01-06', '2024-01-06'], ['2024-01-07', '2024-01-07']]Passed
moved out of window[['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07']][['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07']]Passed
cancelled instance[['2024-01-01', '2024-01-01'], ['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07'], ['2024-01-09', '2024-01-09']][['2024-01-01', '2024-01-01'], ['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07'], ['2024-01-09', '2024-01-09']]Passed
orphan move[['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07'], ['2024-01-09', '2024-01-09']][['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05'], ['2024-01-07', '2024-01-07'], ['2024-01-09', '2024-01-09']]Passed
orphan cancel[['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05']][['2024-01-01', '2024-01-01'], ['2024-01-03', '2024-01-03'], ['2024-01-05', '2024-01-05']]Passed
last override wins[['2024-02-01', '2024-02-01'], ['2024-02-02', '2024-02-03'], ['2024-02-03', '2024-02-03'], ['2024-02-04', '2024-02-04']][['2024-02-01', '2024-02-01'], ['2024-02-02', '2024-02-03'], ['2024-02-03', '2024-02-03'], ['2024-02-04', '2024-02-04']]Passed
cancel then move[['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']][['2024-02-01', '2024-02-01'], ['2024-02-03', '2024-02-03'], ['2024-02-02', '2024-02-05']]Passed
restated original date[['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']][['2024-03-01', '2024-03-01'], ['2024-03-08', '2024-03-08'], ['2024-03-15', '2024-03-15']]Passed

SHA-256 / af71eafc8a2be569a0ee316924bc4ccf9da48348d66e70cfe0932514a830bf73

Verification & scope

Stipulated, bounded recurrence-expansion model evaluated offline on explicit fixtures; it is not a complete iCalendar implementation and makes no claim of standards conformance. 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:49:21.323824+00:00.

Case digest / ef66d697ea43daf47e44f29a58006e6c671885b06fa63fdf6ec7b4be67f1a623