FAILURE MAP
← Case archive

FA-77261 / Calendar recurrence rules / Open access

Rendering a recurrence rule as a human-readable sentence: list join · case 01

Three weekdays are rendered as "Monday and Wednesday and Friday".

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

ROOT CAUSE

Weekday names are joined with "and" throughout.

VERIFIED REPAIR

At the list join decision use `words[0] if len(words) == 1 else ', '.join(words[:-1]) + ' and ' + words[-1]`, leaving the other decision sites of the model unchanged.

Unsuccessful approach: The partial repair `', '.join(words[:-1]) + ' and ' + words[-1]` breaks the single-day case, rendering " and Monday".

Case contract

House style: "every <unit>" for interval 1, else "every <n> <unit>s"; weekday lists are in Monday-first order without duplicates and joined as "A, B and C"; the exact set MO..FR renders as "on weekdays"; an ordinal renders "on the 2nd Tuesday", -1 as "on the last Friday" and -n (n>1) as "on the 2nd to last Friday"; count renders ", once" for 1 and ", <n> times" otherwise.

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

N = 1
observations = []
def solve(freq, interval, byday, ordinal, count):
    unit = {'DAILY': 'day', 'WEEKLY': 'week', 'MONTHLY': 'month', 'YEARLY': 'year'}[freq]
    text = 'every ' + unit if interval == 1 else 'every %d %ss' % (interval, unit)
    names = {'MO': 'Monday', 'TU': 'Tuesday', 'WE': 'Wednesday', 'TH': 'Thursday', 'FR': 'Friday', 'SA': 'Saturday', 'SU': 'Sunday'}
    order = ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU']
    def nth(n):
        return str(n) + {1: 'st', 2: 'nd', 3: 'rd'}.get(n, 'th')
    if ordinal:
        word = ('last' if ordinal == -1 else nth(-ordinal) + ' to last') if ordinal < 0 else nth(ordinal)
        text += ' on the ' + word + ' ' + names[byday[0]]
    elif byday:
        if set(byday) == {'MO', 'TU', 'WE', 'TH', 'FR'}:
            text += ' on weekdays'
        else:
            words = [names[d] for d in sorted(set(byday), key=order.index)]
            text += ' on ' + (' and '.join(words))
    if count:
        text += ', ' + ('once' if count == 1 else '%d times' % count)
    return text
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: weekly three days',
   ['WEEKLY', 1, ['MO', 'WE', 'FR'], 0, 0],
   'every week on Monday, Wednesday and Friday'),
  ('biweekly single day once', ['WEEKLY', 2, ['TU'], 0, 1], 'every 2 weeks on Tuesday, once'),
  ('last friday monthly', ['MONTHLY', 1, ['FR'], -1, 6], 'every month on the last Friday, 6 times'),
  ('second to last sunday', ['MONTHLY', 3, ['SU'], -2, 0], 'every 3 months on the 2nd to last Sunday'),
  ('second tuesday', ['MONTHLY', 1, ['TU'], 2, 10], 'every month on the 2nd Tuesday, 10 times'),
  ('weekdays exact', ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'FR'], 0, 0], 'every week on weekdays'),
  ('weekdays reordered',
   ['WEEKLY', 1, ['FR', 'MO', 'TU', 'WE', 'TH'], 0, 3],
   'every week on weekdays, 3 times')],
 [('last friday monthly', ['MONTHLY', 1, ['FR'], -1, 6], 'every month on the last Friday, 6 times'),
  ('second to last sunday', ['MONTHLY', 3, ['SU'], -2, 0], 'every 3 months on the 2nd to last Sunday'),
  ('second tuesday', ['MONTHLY', 1, ['TU'], 2, 10], 'every month on the 2nd Tuesday, 10 times'),
  ('weekdays exact', ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'FR'], 0, 0], 'every week on weekdays'),
  ('weekdays reordered',
   ['WEEKLY', 1, ['FR', 'MO', 'TU', 'WE', 'TH'], 0, 3],
   'every week on weekdays, 3 times'),
  ('five days with saturday',
   ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'SA'], 0, 0],
   'every week on Monday, Tuesday, Wednesday, Thursday and Saturday'),
  ('duplicate days', ['WEEKLY', 3, ['SU', 'MO', 'SU'], 0, 2], 'every 3 weeks on Monday and Sunday, 2 times'),
  ('biweekly single day once', ['WEEKLY', 2, ['TU'], 0, 1], 'every 2 weeks on Tuesday, once')],
 [('second tuesday', ['MONTHLY', 1, ['TU'], 2, 10], 'every month on the 2nd Tuesday, 10 times'),
  ('weekdays exact', ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'FR'], 0, 0], 'every week on weekdays'),
  ('weekdays reordered',
   ['WEEKLY', 1, ['FR', 'MO', 'TU', 'WE', 'TH'], 0, 3],
   'every week on weekdays, 3 times'),
  ('five days with saturday',
   ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'SA'], 0, 0],
   'every week on Monday, Tuesday, Wednesday, Thursday and Saturday'),
  ('duplicate days', ['WEEKLY', 3, ['SU', 'MO', 'SU'], 0, 2], 'every 3 weeks on Monday and Sunday, 2 times'),
  ('daily with count one', ['DAILY', 1, [], 0, 1], 'every day, once'),
  ('yearly interval', ['YEARLY', 4, [], 0, 0], 'every 4 years'),
  ('biweekly single day once', ['WEEKLY', 2, ['TU'], 0, 1], 'every 2 weeks on Tuesday, once')],
 [('weekdays reordered',
   ['WEEKLY', 1, ['FR', 'MO', 'TU', 'WE', 'TH'], 0, 3],
   'every week on weekdays, 3 times'),
  ('five days with saturday',
   ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'SA'], 0, 0],
   'every week on Monday, Tuesday, Wednesday, Thursday and Saturday'),
  ('duplicate days', ['WEEKLY', 3, ['SU', 'MO', 'SU'], 0, 2], 'every 3 weeks on Monday and Sunday, 2 times'),
  ('daily with count one', ['DAILY', 1, [], 0, 1], 'every day, once'),
  ('yearly interval', ['YEARLY', 4, [], 0, 0], 'every 4 years'),
  ('two days unordered', ['WEEKLY', 1, ['TH', 'TU'], 0, 1], 'every week on Tuesday and Thursday, once'),
  ('regression: weekly three days',
   ['WEEKLY', 1, ['MO', 'WE', 'FR'], 0, 0],
   'every week on Monday, Wednesday and Friday'),
  ('biweekly single day once', ['WEEKLY', 2, ['TU'], 0, 1], 'every 2 weeks on Tuesday, once')],
 [('duplicate days', ['WEEKLY', 3, ['SU', 'MO', 'SU'], 0, 2], 'every 3 weeks on Monday and Sunday, 2 times'),
  ('daily with count one', ['DAILY', 1, [], 0, 1], 'every day, once'),
  ('yearly interval', ['YEARLY', 4, [], 0, 0], 'every 4 years'),
  ('two days unordered', ['WEEKLY', 1, ['TH', 'TU'], 0, 1], 'every week on Tuesday and Thursday, once'),
  ('regression: weekly three days',
   ['WEEKLY', 1, ['MO', 'WE', 'FR'], 0, 0],
   'every week on Monday, Wednesday and Friday'),
  ('biweekly single day once', ['WEEKLY', 2, ['TU'], 0, 1], 'every 2 weeks on Tuesday, once'),
  ('last friday monthly', ['MONTHLY', 1, ['FR'], -1, 6], 'every month on the last Friday, 6 times')]]
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: weekly three daysevery week on Monday and Wednesday and Fridayevery week on Monday, Wednesday and FridayFailed
biweekly single day onceevery 2 weeks on Tuesday, onceevery 2 weeks on Tuesday, oncePassed
last friday monthlyevery month on the last Friday, 6 timesevery month on the last Friday, 6 timesPassed
second to last sundayevery 3 months on the 2nd to last Sundayevery 3 months on the 2nd to last SundayPassed
second tuesdayevery month on the 2nd Tuesday, 10 timesevery month on the 2nd Tuesday, 10 timesPassed
weekdays exactevery week on weekdaysevery week on weekdaysPassed
weekdays reorderedevery week on weekdays, 3 timesevery week on weekdays, 3 timesPassed

SHA-256 / dfb41f89a509b1cde033e53ece0746b9b1cd9ded0b6fcd1cdd86c31b04936959

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(freq, interval, byday, ordinal, count):
    unit = {'DAILY': 'day', 'WEEKLY': 'week', 'MONTHLY': 'month', 'YEARLY': 'year'}[freq]
    text = 'every ' + unit if interval == 1 else 'every %d %ss' % (interval, unit)
    names = {'MO': 'Monday', 'TU': 'Tuesday', 'WE': 'Wednesday', 'TH': 'Thursday', 'FR': 'Friday', 'SA': 'Saturday', 'SU': 'Sunday'}
    order = ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU']
    def nth(n):
        return str(n) + {1: 'st', 2: 'nd', 3: 'rd'}.get(n, 'th')
    if ordinal:
        word = ('last' if ordinal == -1 else nth(-ordinal) + ' to last') if ordinal < 0 else nth(ordinal)
        text += ' on the ' + word + ' ' + names[byday[0]]
    elif byday:
        if set(byday) == {'MO', 'TU', 'WE', 'TH', 'FR'}:
            text += ' on weekdays'
        else:
            words = [names[d] for d in sorted(set(byday), key=order.index)]
            text += ' on ' + (', '.join(words[:-1]) + ' and ' + words[-1])
    if count:
        text += ', ' + ('once' if count == 1 else '%d times' % count)
    return text
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: weekly three days',
   ['WEEKLY', 1, ['MO', 'WE', 'FR'], 0, 0],
   'every week on Monday, Wednesday and Friday'),
  ('biweekly single day once', ['WEEKLY', 2, ['TU'], 0, 1], 'every 2 weeks on Tuesday, once'),
  ('last friday monthly', ['MONTHLY', 1, ['FR'], -1, 6], 'every month on the last Friday, 6 times'),
  ('second to last sunday', ['MONTHLY', 3, ['SU'], -2, 0], 'every 3 months on the 2nd to last Sunday'),
  ('second tuesday', ['MONTHLY', 1, ['TU'], 2, 10], 'every month on the 2nd Tuesday, 10 times'),
  ('weekdays exact', ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'FR'], 0, 0], 'every week on weekdays'),
  ('weekdays reordered',
   ['WEEKLY', 1, ['FR', 'MO', 'TU', 'WE', 'TH'], 0, 3],
   'every week on weekdays, 3 times')],
 [('last friday monthly', ['MONTHLY', 1, ['FR'], -1, 6], 'every month on the last Friday, 6 times'),
  ('second to last sunday', ['MONTHLY', 3, ['SU'], -2, 0], 'every 3 months on the 2nd to last Sunday'),
  ('second tuesday', ['MONTHLY', 1, ['TU'], 2, 10], 'every month on the 2nd Tuesday, 10 times'),
  ('weekdays exact', ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'FR'], 0, 0], 'every week on weekdays'),
  ('weekdays reordered',
   ['WEEKLY', 1, ['FR', 'MO', 'TU', 'WE', 'TH'], 0, 3],
   'every week on weekdays, 3 times'),
  ('five days with saturday',
   ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'SA'], 0, 0],
   'every week on Monday, Tuesday, Wednesday, Thursday and Saturday'),
  ('duplicate days', ['WEEKLY', 3, ['SU', 'MO', 'SU'], 0, 2], 'every 3 weeks on Monday and Sunday, 2 times'),
  ('biweekly single day once', ['WEEKLY', 2, ['TU'], 0, 1], 'every 2 weeks on Tuesday, once')],
 [('second tuesday', ['MONTHLY', 1, ['TU'], 2, 10], 'every month on the 2nd Tuesday, 10 times'),
  ('weekdays exact', ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'FR'], 0, 0], 'every week on weekdays'),
  ('weekdays reordered',
   ['WEEKLY', 1, ['FR', 'MO', 'TU', 'WE', 'TH'], 0, 3],
   'every week on weekdays, 3 times'),
  ('five days with saturday',
   ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'SA'], 0, 0],
   'every week on Monday, Tuesday, Wednesday, Thursday and Saturday'),
  ('duplicate days', ['WEEKLY', 3, ['SU', 'MO', 'SU'], 0, 2], 'every 3 weeks on Monday and Sunday, 2 times'),
  ('daily with count one', ['DAILY', 1, [], 0, 1], 'every day, once'),
  ('yearly interval', ['YEARLY', 4, [], 0, 0], 'every 4 years'),
  ('biweekly single day once', ['WEEKLY', 2, ['TU'], 0, 1], 'every 2 weeks on Tuesday, once')],
 [('weekdays reordered',
   ['WEEKLY', 1, ['FR', 'MO', 'TU', 'WE', 'TH'], 0, 3],
   'every week on weekdays, 3 times'),
  ('five days with saturday',
   ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'SA'], 0, 0],
   'every week on Monday, Tuesday, Wednesday, Thursday and Saturday'),
  ('duplicate days', ['WEEKLY', 3, ['SU', 'MO', 'SU'], 0, 2], 'every 3 weeks on Monday and Sunday, 2 times'),
  ('daily with count one', ['DAILY', 1, [], 0, 1], 'every day, once'),
  ('yearly interval', ['YEARLY', 4, [], 0, 0], 'every 4 years'),
  ('two days unordered', ['WEEKLY', 1, ['TH', 'TU'], 0, 1], 'every week on Tuesday and Thursday, once'),
  ('regression: weekly three days',
   ['WEEKLY', 1, ['MO', 'WE', 'FR'], 0, 0],
   'every week on Monday, Wednesday and Friday'),
  ('biweekly single day once', ['WEEKLY', 2, ['TU'], 0, 1], 'every 2 weeks on Tuesday, once')],
 [('duplicate days', ['WEEKLY', 3, ['SU', 'MO', 'SU'], 0, 2], 'every 3 weeks on Monday and Sunday, 2 times'),
  ('daily with count one', ['DAILY', 1, [], 0, 1], 'every day, once'),
  ('yearly interval', ['YEARLY', 4, [], 0, 0], 'every 4 years'),
  ('two days unordered', ['WEEKLY', 1, ['TH', 'TU'], 0, 1], 'every week on Tuesday and Thursday, once'),
  ('regression: weekly three days',
   ['WEEKLY', 1, ['MO', 'WE', 'FR'], 0, 0],
   'every week on Monday, Wednesday and Friday'),
  ('biweekly single day once', ['WEEKLY', 2, ['TU'], 0, 1], 'every 2 weeks on Tuesday, once'),
  ('last friday monthly', ['MONTHLY', 1, ['FR'], -1, 6], 'every month on the last Friday, 6 times')]]
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: weekly three daysevery week on Monday, Wednesday and Fridayevery week on Monday, Wednesday and FridayPassed
biweekly single day onceevery 2 weeks on and Tuesday, onceevery 2 weeks on Tuesday, onceFailed
last friday monthlyevery month on the last Friday, 6 timesevery month on the last Friday, 6 timesPassed
second to last sundayevery 3 months on the 2nd to last Sundayevery 3 months on the 2nd to last SundayPassed
second tuesdayevery month on the 2nd Tuesday, 10 timesevery month on the 2nd Tuesday, 10 timesPassed
weekdays exactevery week on weekdaysevery week on weekdaysPassed
weekdays reorderedevery week on weekdays, 3 timesevery week on weekdays, 3 timesPassed

SHA-256 / 8323dbde6b99a18fb9f213029799365bd137194fe0d2d066b1bdcefd32db2170

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(freq, interval, byday, ordinal, count):
    unit = {'DAILY': 'day', 'WEEKLY': 'week', 'MONTHLY': 'month', 'YEARLY': 'year'}[freq]
    text = 'every ' + unit if interval == 1 else 'every %d %ss' % (interval, unit)
    names = {'MO': 'Monday', 'TU': 'Tuesday', 'WE': 'Wednesday', 'TH': 'Thursday', 'FR': 'Friday', 'SA': 'Saturday', 'SU': 'Sunday'}
    order = ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU']
    def nth(n):
        return str(n) + {1: 'st', 2: 'nd', 3: 'rd'}.get(n, 'th')
    if ordinal:
        word = ('last' if ordinal == -1 else nth(-ordinal) + ' to last') if ordinal < 0 else nth(ordinal)
        text += ' on the ' + word + ' ' + names[byday[0]]
    elif byday:
        if set(byday) == {'MO', 'TU', 'WE', 'TH', 'FR'}:
            text += ' on weekdays'
        else:
            words = [names[d] for d in sorted(set(byday), key=order.index)]
            text += ' on ' + (words[0] if len(words) == 1 else ', '.join(words[:-1]) + ' and ' + words[-1])
    if count:
        text += ', ' + ('once' if count == 1 else '%d times' % count)
    return text
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: weekly three days',
   ['WEEKLY', 1, ['MO', 'WE', 'FR'], 0, 0],
   'every week on Monday, Wednesday and Friday'),
  ('biweekly single day once', ['WEEKLY', 2, ['TU'], 0, 1], 'every 2 weeks on Tuesday, once'),
  ('last friday monthly', ['MONTHLY', 1, ['FR'], -1, 6], 'every month on the last Friday, 6 times'),
  ('second to last sunday', ['MONTHLY', 3, ['SU'], -2, 0], 'every 3 months on the 2nd to last Sunday'),
  ('second tuesday', ['MONTHLY', 1, ['TU'], 2, 10], 'every month on the 2nd Tuesday, 10 times'),
  ('weekdays exact', ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'FR'], 0, 0], 'every week on weekdays'),
  ('weekdays reordered',
   ['WEEKLY', 1, ['FR', 'MO', 'TU', 'WE', 'TH'], 0, 3],
   'every week on weekdays, 3 times')],
 [('last friday monthly', ['MONTHLY', 1, ['FR'], -1, 6], 'every month on the last Friday, 6 times'),
  ('second to last sunday', ['MONTHLY', 3, ['SU'], -2, 0], 'every 3 months on the 2nd to last Sunday'),
  ('second tuesday', ['MONTHLY', 1, ['TU'], 2, 10], 'every month on the 2nd Tuesday, 10 times'),
  ('weekdays exact', ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'FR'], 0, 0], 'every week on weekdays'),
  ('weekdays reordered',
   ['WEEKLY', 1, ['FR', 'MO', 'TU', 'WE', 'TH'], 0, 3],
   'every week on weekdays, 3 times'),
  ('five days with saturday',
   ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'SA'], 0, 0],
   'every week on Monday, Tuesday, Wednesday, Thursday and Saturday'),
  ('duplicate days', ['WEEKLY', 3, ['SU', 'MO', 'SU'], 0, 2], 'every 3 weeks on Monday and Sunday, 2 times'),
  ('biweekly single day once', ['WEEKLY', 2, ['TU'], 0, 1], 'every 2 weeks on Tuesday, once')],
 [('second tuesday', ['MONTHLY', 1, ['TU'], 2, 10], 'every month on the 2nd Tuesday, 10 times'),
  ('weekdays exact', ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'FR'], 0, 0], 'every week on weekdays'),
  ('weekdays reordered',
   ['WEEKLY', 1, ['FR', 'MO', 'TU', 'WE', 'TH'], 0, 3],
   'every week on weekdays, 3 times'),
  ('five days with saturday',
   ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'SA'], 0, 0],
   'every week on Monday, Tuesday, Wednesday, Thursday and Saturday'),
  ('duplicate days', ['WEEKLY', 3, ['SU', 'MO', 'SU'], 0, 2], 'every 3 weeks on Monday and Sunday, 2 times'),
  ('daily with count one', ['DAILY', 1, [], 0, 1], 'every day, once'),
  ('yearly interval', ['YEARLY', 4, [], 0, 0], 'every 4 years'),
  ('biweekly single day once', ['WEEKLY', 2, ['TU'], 0, 1], 'every 2 weeks on Tuesday, once')],
 [('weekdays reordered',
   ['WEEKLY', 1, ['FR', 'MO', 'TU', 'WE', 'TH'], 0, 3],
   'every week on weekdays, 3 times'),
  ('five days with saturday',
   ['WEEKLY', 1, ['MO', 'TU', 'WE', 'TH', 'SA'], 0, 0],
   'every week on Monday, Tuesday, Wednesday, Thursday and Saturday'),
  ('duplicate days', ['WEEKLY', 3, ['SU', 'MO', 'SU'], 0, 2], 'every 3 weeks on Monday and Sunday, 2 times'),
  ('daily with count one', ['DAILY', 1, [], 0, 1], 'every day, once'),
  ('yearly interval', ['YEARLY', 4, [], 0, 0], 'every 4 years'),
  ('two days unordered', ['WEEKLY', 1, ['TH', 'TU'], 0, 1], 'every week on Tuesday and Thursday, once'),
  ('regression: weekly three days',
   ['WEEKLY', 1, ['MO', 'WE', 'FR'], 0, 0],
   'every week on Monday, Wednesday and Friday'),
  ('biweekly single day once', ['WEEKLY', 2, ['TU'], 0, 1], 'every 2 weeks on Tuesday, once')],
 [('duplicate days', ['WEEKLY', 3, ['SU', 'MO', 'SU'], 0, 2], 'every 3 weeks on Monday and Sunday, 2 times'),
  ('daily with count one', ['DAILY', 1, [], 0, 1], 'every day, once'),
  ('yearly interval', ['YEARLY', 4, [], 0, 0], 'every 4 years'),
  ('two days unordered', ['WEEKLY', 1, ['TH', 'TU'], 0, 1], 'every week on Tuesday and Thursday, once'),
  ('regression: weekly three days',
   ['WEEKLY', 1, ['MO', 'WE', 'FR'], 0, 0],
   'every week on Monday, Wednesday and Friday'),
  ('biweekly single day once', ['WEEKLY', 2, ['TU'], 0, 1], 'every 2 weeks on Tuesday, once'),
  ('last friday monthly', ['MONTHLY', 1, ['FR'], -1, 6], 'every month on the last Friday, 6 times')]]
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: weekly three daysevery week on Monday, Wednesday and Fridayevery week on Monday, Wednesday and FridayPassed
biweekly single day onceevery 2 weeks on Tuesday, onceevery 2 weeks on Tuesday, oncePassed
last friday monthlyevery month on the last Friday, 6 timesevery month on the last Friday, 6 timesPassed
second to last sundayevery 3 months on the 2nd to last Sundayevery 3 months on the 2nd to last SundayPassed
second tuesdayevery month on the 2nd Tuesday, 10 timesevery month on the 2nd Tuesday, 10 timesPassed
weekdays exactevery week on weekdaysevery week on weekdaysPassed
weekdays reorderedevery week on weekdays, 3 timesevery week on weekdays, 3 timesPassed

SHA-256 / 477484e6f0a5596f408ca54a2a6efa471b13bc86fe9f04669e6914d3fe4e1da2

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

Case digest / 5d714130d2cfa436ef3284a3b880dc9bd2d5c2f49de1b311f5271020c73edf08