FAILURE MAP
← Case archive

FA-76996 / Calendar recurrence rules / Open access

Applying moved and cancelled instance overrides in a window query: orphan guard · case 01

An override for a date that is not an instance adds a phantom occurrence.

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

ROOT CAUSE

Only overrides dated before the series start are discarded.

VERIFIED REPAIR

At the orphan guard decision use `o not in origset`, leaving the other decision sites of the model unchanged.

Unsuccessful approach: The partial repair `o not in origset and new is None` only discards orphan cancellations; orphan moves still create phantom instances.

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 < start:
            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']])],
 [('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']])]]
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-02', '2024-01-04'], ['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']]Failed
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

SHA-256 / cf27f0a7de8e354610804f37afd1a4d5ee8dd0f1d1ef91e35b8b78f3fa695b49

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 and new is None:
            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']])],
 [('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']])]]
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-02', '2024-01-04'], ['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']]Failed
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

SHA-256 / 74cfa54fe52afe451561b64d62894aaf3f1b1afb1716bbf65a02a5472889294b

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']])],
 [('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']])]]
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

SHA-256 / 423101d484a86734c384865243a3af20492ccb7cfb288497688157f467eb9038

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

Case digest / f368b10973ef9dd913174ca70a051529b0b69c99e21cecb108bcd2de00e81637