FAILURE MAP
← Case archive

FA-76881 / Calendar recurrence rules / Open access

Monthly BYMONTHDAY expansion with negative and invalid days: dedupe coinciding · case 01

BYMONTHDAY=31,-1 emits the 31st twice in long months.

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

ROOT CAUSE

Month-day values that resolve to the same date are not merged.

VERIFIED REPAIR

At the dedupe coinciding decision use `sorted(set(days))`, leaving the other decision sites of the model unchanged.

Unsuccessful approach: The partial repair `list(dict.fromkeys(days))` deduplicates but keeps list order, so a -1 listed before 1 is emitted out of chronological order.

Case contract

FREQ=MONTHLY with a BYMONTHDAY list. Positive values count from the first day, negative values from the last day (-1 is the last day). A value that does not exist in a month is skipped for that month, never clamped. Months step by interval from the dtstart month; instances before dtstart are dropped; coinciding values yield one instance. Return the first count ISO dates in chronological order.

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, monthdays, count):
    start = dt.date.fromisoformat(dtstart)
    out = []
    for k in range(400):
        mi = start.month - 1 + k * interval
        y, m = start.year + mi // 12, mi % 12 + 1
        dim = calendar.monthrange(y, m)[1]
        days = []
        for md in monthdays:
            day = md if md > 0 else dim + md + 1
            if 1 <= day <= dim:
                days.append(day)
        for day in sorted(days):
            d = dt.date(y, m, day)
            if d < start:
                continue
            if len(out) >= count:
                return out
            out.append(d.isoformat())
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: 31st skips short months',
   ['2024-01-31', 1, [31], 5],
   ['2024-01-31', '2024-03-31', '2024-05-31', '2024-07-31', '2024-08-31']),
  ('last day of month', ['2024-01-15', 1, [-1], 4], ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']),
  ('31 and -1 coincide',
   ['2024-01-01', 1, [31, -1], 4],
   ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']),
  ('first and last listed last-first',
   ['2024-03-10', 1, [-1, 1], 5],
   ['2024-03-31', '2024-04-01', '2024-04-30', '2024-05-01', '2024-05-31']),
  ('crossing december interval 2',
   ['2024-11-05', 2, [5], 4],
   ['2024-11-05', '2025-01-05', '2025-03-05', '2025-05-05']),
  ('december start interval 1',
   ['2024-12-10', 1, [10, -3], 4],
   ['2024-12-10', '2024-12-29', '2025-01-10', '2025-01-29']),
  ('dtstart after listed day',
   ['2024-05-20', 1, [3, 25], 4],
   ['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03'])],
 [('31 and -1 coincide',
   ['2024-01-01', 1, [31, -1], 4],
   ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']),
  ('first and last listed last-first',
   ['2024-03-10', 1, [-1, 1], 5],
   ['2024-03-31', '2024-04-01', '2024-04-30', '2024-05-01', '2024-05-31']),
  ('crossing december interval 2',
   ['2024-11-05', 2, [5], 4],
   ['2024-11-05', '2025-01-05', '2025-03-05', '2025-05-05']),
  ('december start interval 1',
   ['2024-12-10', 1, [10, -3], 4],
   ['2024-12-10', '2024-12-29', '2025-01-10', '2025-01-29']),
  ('dtstart after listed day',
   ['2024-05-20', 1, [3, 25], 4],
   ['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03']),
  ('negative beyond month',
   ['2023-02-01', 1, [-30], 4],
   ['2023-03-02', '2023-04-01', '2023-05-02', '2023-06-01']),
  ('interval 3 from october',
   ['2023-10-15', 3, [15, -1], 5],
   ['2023-10-15', '2023-10-31', '2024-01-15', '2024-01-31', '2024-04-15'])],
 [('crossing december interval 2',
   ['2024-11-05', 2, [5], 4],
   ['2024-11-05', '2025-01-05', '2025-03-05', '2025-05-05']),
  ('december start interval 1',
   ['2024-12-10', 1, [10, -3], 4],
   ['2024-12-10', '2024-12-29', '2025-01-10', '2025-01-29']),
  ('dtstart after listed day',
   ['2024-05-20', 1, [3, 25], 4],
   ['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03']),
  ('negative beyond month',
   ['2023-02-01', 1, [-30], 4],
   ['2023-03-02', '2023-04-01', '2023-05-02', '2023-06-01']),
  ('interval 3 from october',
   ['2023-10-15', 3, [15, -1], 5],
   ['2023-10-15', '2023-10-31', '2024-01-15', '2024-01-31', '2024-04-15']),
  ('count zero', ['2024-01-01', 1, [1], 0], []),
  ('leap february 29', ['2023-12-29', 2, [29], 4], ['2023-12-29', '2024-02-29', '2024-04-29', '2024-06-29']),
  ('dtstart equals listed day',
   ['2024-06-30', 1, [30, 1], 4],
   ['2024-06-30', '2024-07-01', '2024-07-30', '2024-08-01']),
  ('31 and -1 coincide',
   ['2024-01-01', 1, [31, -1], 4],
   ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30'])],
 [('dtstart after listed day',
   ['2024-05-20', 1, [3, 25], 4],
   ['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03']),
  ('negative beyond month',
   ['2023-02-01', 1, [-30], 4],
   ['2023-03-02', '2023-04-01', '2023-05-02', '2023-06-01']),
  ('interval 3 from october',
   ['2023-10-15', 3, [15, -1], 5],
   ['2023-10-15', '2023-10-31', '2024-01-15', '2024-01-31', '2024-04-15']),
  ('count zero', ['2024-01-01', 1, [1], 0], []),
  ('leap february 29', ['2023-12-29', 2, [29], 4], ['2023-12-29', '2024-02-29', '2024-04-29', '2024-06-29']),
  ('dtstart equals listed day',
   ['2024-06-30', 1, [30, 1], 4],
   ['2024-06-30', '2024-07-01', '2024-07-30', '2024-08-01']),
  ('regression: 31st skips short months',
   ['2024-01-31', 1, [31], 5],
   ['2024-01-31', '2024-03-31', '2024-05-31', '2024-07-31', '2024-08-31']),
  ('31 and -1 coincide',
   ['2024-01-01', 1, [31, -1], 4],
   ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30'])],
 [('interval 3 from october',
   ['2023-10-15', 3, [15, -1], 5],
   ['2023-10-15', '2023-10-31', '2024-01-15', '2024-01-31', '2024-04-15']),
  ('count zero', ['2024-01-01', 1, [1], 0], []),
  ('leap february 29', ['2023-12-29', 2, [29], 4], ['2023-12-29', '2024-02-29', '2024-04-29', '2024-06-29']),
  ('dtstart equals listed day',
   ['2024-06-30', 1, [30, 1], 4],
   ['2024-06-30', '2024-07-01', '2024-07-30', '2024-08-01']),
  ('regression: 31st skips short months',
   ['2024-01-31', 1, [31], 5],
   ['2024-01-31', '2024-03-31', '2024-05-31', '2024-07-31', '2024-08-31']),
  ('last day of month', ['2024-01-15', 1, [-1], 4], ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']),
  ('31 and -1 coincide',
   ['2024-01-01', 1, [31, -1], 4],
   ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30'])]]
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: 31st skips short months['2024-01-31', '2024-03-31', '2024-05-31', '2024-07-31', '2024-08-31']['2024-01-31', '2024-03-31', '2024-05-31', '2024-07-31', '2024-08-31']Passed
last day of month['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']Passed
31 and -1 coincide['2024-01-31', '2024-01-31', '2024-02-29', '2024-03-31']['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']Failed
first and last listed last-first['2024-03-31', '2024-04-01', '2024-04-30', '2024-05-01', '2024-05-31']['2024-03-31', '2024-04-01', '2024-04-30', '2024-05-01', '2024-05-31']Passed
crossing december interval 2['2024-11-05', '2025-01-05', '2025-03-05', '2025-05-05']['2024-11-05', '2025-01-05', '2025-03-05', '2025-05-05']Passed
december start interval 1['2024-12-10', '2024-12-29', '2025-01-10', '2025-01-29']['2024-12-10', '2024-12-29', '2025-01-10', '2025-01-29']Passed
dtstart after listed day['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03']['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03']Passed

SHA-256 / 6bce13447b688b7214cee4846160b87ce6c0656e58dac6bb52bd9bc9a1c2567e

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, monthdays, count):
    start = dt.date.fromisoformat(dtstart)
    out = []
    for k in range(400):
        mi = start.month - 1 + k * interval
        y, m = start.year + mi // 12, mi % 12 + 1
        dim = calendar.monthrange(y, m)[1]
        days = []
        for md in monthdays:
            day = md if md > 0 else dim + md + 1
            if 1 <= day <= dim:
                days.append(day)
        for day in list(dict.fromkeys(days)):
            d = dt.date(y, m, day)
            if d < start:
                continue
            if len(out) >= count:
                return out
            out.append(d.isoformat())
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: 31st skips short months',
   ['2024-01-31', 1, [31], 5],
   ['2024-01-31', '2024-03-31', '2024-05-31', '2024-07-31', '2024-08-31']),
  ('last day of month', ['2024-01-15', 1, [-1], 4], ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']),
  ('31 and -1 coincide',
   ['2024-01-01', 1, [31, -1], 4],
   ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']),
  ('first and last listed last-first',
   ['2024-03-10', 1, [-1, 1], 5],
   ['2024-03-31', '2024-04-01', '2024-04-30', '2024-05-01', '2024-05-31']),
  ('crossing december interval 2',
   ['2024-11-05', 2, [5], 4],
   ['2024-11-05', '2025-01-05', '2025-03-05', '2025-05-05']),
  ('december start interval 1',
   ['2024-12-10', 1, [10, -3], 4],
   ['2024-12-10', '2024-12-29', '2025-01-10', '2025-01-29']),
  ('dtstart after listed day',
   ['2024-05-20', 1, [3, 25], 4],
   ['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03'])],
 [('31 and -1 coincide',
   ['2024-01-01', 1, [31, -1], 4],
   ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']),
  ('first and last listed last-first',
   ['2024-03-10', 1, [-1, 1], 5],
   ['2024-03-31', '2024-04-01', '2024-04-30', '2024-05-01', '2024-05-31']),
  ('crossing december interval 2',
   ['2024-11-05', 2, [5], 4],
   ['2024-11-05', '2025-01-05', '2025-03-05', '2025-05-05']),
  ('december start interval 1',
   ['2024-12-10', 1, [10, -3], 4],
   ['2024-12-10', '2024-12-29', '2025-01-10', '2025-01-29']),
  ('dtstart after listed day',
   ['2024-05-20', 1, [3, 25], 4],
   ['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03']),
  ('negative beyond month',
   ['2023-02-01', 1, [-30], 4],
   ['2023-03-02', '2023-04-01', '2023-05-02', '2023-06-01']),
  ('interval 3 from october',
   ['2023-10-15', 3, [15, -1], 5],
   ['2023-10-15', '2023-10-31', '2024-01-15', '2024-01-31', '2024-04-15'])],
 [('crossing december interval 2',
   ['2024-11-05', 2, [5], 4],
   ['2024-11-05', '2025-01-05', '2025-03-05', '2025-05-05']),
  ('december start interval 1',
   ['2024-12-10', 1, [10, -3], 4],
   ['2024-12-10', '2024-12-29', '2025-01-10', '2025-01-29']),
  ('dtstart after listed day',
   ['2024-05-20', 1, [3, 25], 4],
   ['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03']),
  ('negative beyond month',
   ['2023-02-01', 1, [-30], 4],
   ['2023-03-02', '2023-04-01', '2023-05-02', '2023-06-01']),
  ('interval 3 from october',
   ['2023-10-15', 3, [15, -1], 5],
   ['2023-10-15', '2023-10-31', '2024-01-15', '2024-01-31', '2024-04-15']),
  ('count zero', ['2024-01-01', 1, [1], 0], []),
  ('leap february 29', ['2023-12-29', 2, [29], 4], ['2023-12-29', '2024-02-29', '2024-04-29', '2024-06-29']),
  ('dtstart equals listed day',
   ['2024-06-30', 1, [30, 1], 4],
   ['2024-06-30', '2024-07-01', '2024-07-30', '2024-08-01']),
  ('31 and -1 coincide',
   ['2024-01-01', 1, [31, -1], 4],
   ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30'])],
 [('dtstart after listed day',
   ['2024-05-20', 1, [3, 25], 4],
   ['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03']),
  ('negative beyond month',
   ['2023-02-01', 1, [-30], 4],
   ['2023-03-02', '2023-04-01', '2023-05-02', '2023-06-01']),
  ('interval 3 from october',
   ['2023-10-15', 3, [15, -1], 5],
   ['2023-10-15', '2023-10-31', '2024-01-15', '2024-01-31', '2024-04-15']),
  ('count zero', ['2024-01-01', 1, [1], 0], []),
  ('leap february 29', ['2023-12-29', 2, [29], 4], ['2023-12-29', '2024-02-29', '2024-04-29', '2024-06-29']),
  ('dtstart equals listed day',
   ['2024-06-30', 1, [30, 1], 4],
   ['2024-06-30', '2024-07-01', '2024-07-30', '2024-08-01']),
  ('regression: 31st skips short months',
   ['2024-01-31', 1, [31], 5],
   ['2024-01-31', '2024-03-31', '2024-05-31', '2024-07-31', '2024-08-31']),
  ('31 and -1 coincide',
   ['2024-01-01', 1, [31, -1], 4],
   ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30'])],
 [('interval 3 from october',
   ['2023-10-15', 3, [15, -1], 5],
   ['2023-10-15', '2023-10-31', '2024-01-15', '2024-01-31', '2024-04-15']),
  ('count zero', ['2024-01-01', 1, [1], 0], []),
  ('leap february 29', ['2023-12-29', 2, [29], 4], ['2023-12-29', '2024-02-29', '2024-04-29', '2024-06-29']),
  ('dtstart equals listed day',
   ['2024-06-30', 1, [30, 1], 4],
   ['2024-06-30', '2024-07-01', '2024-07-30', '2024-08-01']),
  ('regression: 31st skips short months',
   ['2024-01-31', 1, [31], 5],
   ['2024-01-31', '2024-03-31', '2024-05-31', '2024-07-31', '2024-08-31']),
  ('last day of month', ['2024-01-15', 1, [-1], 4], ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']),
  ('31 and -1 coincide',
   ['2024-01-01', 1, [31, -1], 4],
   ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30'])]]
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: 31st skips short months['2024-01-31', '2024-03-31', '2024-05-31', '2024-07-31', '2024-08-31']['2024-01-31', '2024-03-31', '2024-05-31', '2024-07-31', '2024-08-31']Passed
last day of month['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']Passed
31 and -1 coincide['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']Passed
first and last listed last-first['2024-03-31', '2024-04-30', '2024-04-01', '2024-05-31', '2024-05-01']['2024-03-31', '2024-04-01', '2024-04-30', '2024-05-01', '2024-05-31']Failed
crossing december interval 2['2024-11-05', '2025-01-05', '2025-03-05', '2025-05-05']['2024-11-05', '2025-01-05', '2025-03-05', '2025-05-05']Passed
december start interval 1['2024-12-10', '2024-12-29', '2025-01-10', '2025-01-29']['2024-12-10', '2024-12-29', '2025-01-10', '2025-01-29']Passed
dtstart after listed day['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03']['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03']Passed

SHA-256 / f306b7f20d0b9a172e0e05ff607957bf902e74118263c7ebfedfeb6e26ae57c5

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, monthdays, count):
    start = dt.date.fromisoformat(dtstart)
    out = []
    for k in range(400):
        mi = start.month - 1 + k * interval
        y, m = start.year + mi // 12, mi % 12 + 1
        dim = calendar.monthrange(y, m)[1]
        days = []
        for md in monthdays:
            day = md if md > 0 else dim + md + 1
            if 1 <= day <= dim:
                days.append(day)
        for day in sorted(set(days)):
            d = dt.date(y, m, day)
            if d < start:
                continue
            if len(out) >= count:
                return out
            out.append(d.isoformat())
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: 31st skips short months',
   ['2024-01-31', 1, [31], 5],
   ['2024-01-31', '2024-03-31', '2024-05-31', '2024-07-31', '2024-08-31']),
  ('last day of month', ['2024-01-15', 1, [-1], 4], ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']),
  ('31 and -1 coincide',
   ['2024-01-01', 1, [31, -1], 4],
   ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']),
  ('first and last listed last-first',
   ['2024-03-10', 1, [-1, 1], 5],
   ['2024-03-31', '2024-04-01', '2024-04-30', '2024-05-01', '2024-05-31']),
  ('crossing december interval 2',
   ['2024-11-05', 2, [5], 4],
   ['2024-11-05', '2025-01-05', '2025-03-05', '2025-05-05']),
  ('december start interval 1',
   ['2024-12-10', 1, [10, -3], 4],
   ['2024-12-10', '2024-12-29', '2025-01-10', '2025-01-29']),
  ('dtstart after listed day',
   ['2024-05-20', 1, [3, 25], 4],
   ['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03'])],
 [('31 and -1 coincide',
   ['2024-01-01', 1, [31, -1], 4],
   ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']),
  ('first and last listed last-first',
   ['2024-03-10', 1, [-1, 1], 5],
   ['2024-03-31', '2024-04-01', '2024-04-30', '2024-05-01', '2024-05-31']),
  ('crossing december interval 2',
   ['2024-11-05', 2, [5], 4],
   ['2024-11-05', '2025-01-05', '2025-03-05', '2025-05-05']),
  ('december start interval 1',
   ['2024-12-10', 1, [10, -3], 4],
   ['2024-12-10', '2024-12-29', '2025-01-10', '2025-01-29']),
  ('dtstart after listed day',
   ['2024-05-20', 1, [3, 25], 4],
   ['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03']),
  ('negative beyond month',
   ['2023-02-01', 1, [-30], 4],
   ['2023-03-02', '2023-04-01', '2023-05-02', '2023-06-01']),
  ('interval 3 from october',
   ['2023-10-15', 3, [15, -1], 5],
   ['2023-10-15', '2023-10-31', '2024-01-15', '2024-01-31', '2024-04-15'])],
 [('crossing december interval 2',
   ['2024-11-05', 2, [5], 4],
   ['2024-11-05', '2025-01-05', '2025-03-05', '2025-05-05']),
  ('december start interval 1',
   ['2024-12-10', 1, [10, -3], 4],
   ['2024-12-10', '2024-12-29', '2025-01-10', '2025-01-29']),
  ('dtstart after listed day',
   ['2024-05-20', 1, [3, 25], 4],
   ['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03']),
  ('negative beyond month',
   ['2023-02-01', 1, [-30], 4],
   ['2023-03-02', '2023-04-01', '2023-05-02', '2023-06-01']),
  ('interval 3 from october',
   ['2023-10-15', 3, [15, -1], 5],
   ['2023-10-15', '2023-10-31', '2024-01-15', '2024-01-31', '2024-04-15']),
  ('count zero', ['2024-01-01', 1, [1], 0], []),
  ('leap february 29', ['2023-12-29', 2, [29], 4], ['2023-12-29', '2024-02-29', '2024-04-29', '2024-06-29']),
  ('dtstart equals listed day',
   ['2024-06-30', 1, [30, 1], 4],
   ['2024-06-30', '2024-07-01', '2024-07-30', '2024-08-01']),
  ('31 and -1 coincide',
   ['2024-01-01', 1, [31, -1], 4],
   ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30'])],
 [('dtstart after listed day',
   ['2024-05-20', 1, [3, 25], 4],
   ['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03']),
  ('negative beyond month',
   ['2023-02-01', 1, [-30], 4],
   ['2023-03-02', '2023-04-01', '2023-05-02', '2023-06-01']),
  ('interval 3 from october',
   ['2023-10-15', 3, [15, -1], 5],
   ['2023-10-15', '2023-10-31', '2024-01-15', '2024-01-31', '2024-04-15']),
  ('count zero', ['2024-01-01', 1, [1], 0], []),
  ('leap february 29', ['2023-12-29', 2, [29], 4], ['2023-12-29', '2024-02-29', '2024-04-29', '2024-06-29']),
  ('dtstart equals listed day',
   ['2024-06-30', 1, [30, 1], 4],
   ['2024-06-30', '2024-07-01', '2024-07-30', '2024-08-01']),
  ('regression: 31st skips short months',
   ['2024-01-31', 1, [31], 5],
   ['2024-01-31', '2024-03-31', '2024-05-31', '2024-07-31', '2024-08-31']),
  ('31 and -1 coincide',
   ['2024-01-01', 1, [31, -1], 4],
   ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30'])],
 [('interval 3 from october',
   ['2023-10-15', 3, [15, -1], 5],
   ['2023-10-15', '2023-10-31', '2024-01-15', '2024-01-31', '2024-04-15']),
  ('count zero', ['2024-01-01', 1, [1], 0], []),
  ('leap february 29', ['2023-12-29', 2, [29], 4], ['2023-12-29', '2024-02-29', '2024-04-29', '2024-06-29']),
  ('dtstart equals listed day',
   ['2024-06-30', 1, [30, 1], 4],
   ['2024-06-30', '2024-07-01', '2024-07-30', '2024-08-01']),
  ('regression: 31st skips short months',
   ['2024-01-31', 1, [31], 5],
   ['2024-01-31', '2024-03-31', '2024-05-31', '2024-07-31', '2024-08-31']),
  ('last day of month', ['2024-01-15', 1, [-1], 4], ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']),
  ('31 and -1 coincide',
   ['2024-01-01', 1, [31, -1], 4],
   ['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30'])]]
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: 31st skips short months['2024-01-31', '2024-03-31', '2024-05-31', '2024-07-31', '2024-08-31']['2024-01-31', '2024-03-31', '2024-05-31', '2024-07-31', '2024-08-31']Passed
last day of month['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']Passed
31 and -1 coincide['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']['2024-01-31', '2024-02-29', '2024-03-31', '2024-04-30']Passed
first and last listed last-first['2024-03-31', '2024-04-01', '2024-04-30', '2024-05-01', '2024-05-31']['2024-03-31', '2024-04-01', '2024-04-30', '2024-05-01', '2024-05-31']Passed
crossing december interval 2['2024-11-05', '2025-01-05', '2025-03-05', '2025-05-05']['2024-11-05', '2025-01-05', '2025-03-05', '2025-05-05']Passed
december start interval 1['2024-12-10', '2024-12-29', '2025-01-10', '2025-01-29']['2024-12-10', '2024-12-29', '2025-01-10', '2025-01-29']Passed
dtstart after listed day['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03']['2024-05-25', '2024-06-03', '2024-06-25', '2024-07-03']Passed

SHA-256 / 8815dadd4bdd580b72cbe68ac4e70d53fe193c8c080b8db64810cbd41f404d8c

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

Case digest / 9d2f37db4b9298a0b42d49fe2ba14c0dc8c2a8f8f994eb0d89a0765253a26fb6