{"abstract":"BYSETPOS=1,-5 in a month with five candidates emits the same day twice.","category":"Calendar recurrence rules","checks":7,"contract":"FREQ=MONTHLY;BYDAY=<weekdays>;BYSETPOS=<positions>. For each month from the dtstart month, the candidate set is every day of the whole month whose weekday is listed, in date order. Positions are 1-based, negative from the end; out-of-range positions are ignored and positions naming the same day yield it once. Selected days are emitted chronologically; days before dtstart are dropped after selection. Return the first count ISO dates.","evaluation_group":"w2-calendar-recurrence-rules-monthly-bysetpos","failed_approach":"The partial repair `cand[idx] != (picked[-1] if picked else None)` only rejects a repeat of the most recently picked day.","family":"w2-calendar-recurrence-rules-monthly-bysetpos-dup-guard","id":"FA-76931","implementations":{"attempt":{"sha256":"3e90c326a7a92367e824ce0ee4972fe75d4ec030a4e5cf18e41484524c84f1c6","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport datetime as dt\nimport calendar\nN = 1\nobservations = []\ndef solve(dtstart, weekdays, setpos, count):\n    start = dt.date.fromisoformat(dtstart)\n    out = []\n    for k in range(240):\n        mi = start.month - 1 + k\n        y, m = start.year + mi // 12, mi % 12 + 1\n        dim = calendar.monthrange(y, m)[1]\n        cand = [x for x in [dt.date(y, m, d) for d in range(1, dim + 1)] if x.weekday() in weekdays and x >= dt.date(y, m, 1)]\n        picked = []\n        for p in setpos:\n            idx = p - 1 if p > 0 else len(cand) + p\n            if 0 <= idx < len(cand) and cand[idx] != (picked[-1] if picked else None):\n                picked.append(cand[idx])\n        for d in sorted(picked):\n            if d < start:\n                continue\n            out.append(d.isoformat())\n            if len(out) >= count:\n                return out\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: last weekday of month',\n   ['2024-01-01', [0, 1, 2, 3, 4], [-1], 4],\n   ['2024-01-31', '2024-02-29', '2024-03-29', '2024-04-30']),\n  ('first weekday, dtstart mid-month',\n   ['2024-01-10', [0, 1, 2, 3, 4], [1], 3],\n   ['2024-02-01', '2024-03-01', '2024-04-01']),\n  ('first and last in reverse order',\n   ['2024-03-01', [0, 1, 2, 3, 4], [-1, 1], 4],\n   ['2024-03-01', '2024-03-29', '2024-04-01', '2024-04-30']),\n  ('coinciding positions',\n   ['2024-01-01', [0], [1, -5], 4],\n   ['2024-01-01', '2024-02-05', '2024-03-04', '2024-04-01']),\n  ('three positions with repeat',\n   ['2024-04-01', [2], [1, -1, -5], 5],\n   ['2024-04-03', '2024-04-24', '2024-05-01', '2024-05-29', '2024-06-05']),\n  ('out of range negative', ['2024-01-01', [5, 6], [-7, 1], 3], ['2024-01-06', '2024-01-07', '2024-02-03']),\n  ('out of range positive', ['2024-02-01', [0], [5], 3], ['2024-04-29', '2024-07-29', '2024-09-30'])],\n [('first and last in reverse order',\n   ['2024-03-01', [0, 1, 2, 3, 4], [-1, 1], 4],\n   ['2024-03-01', '2024-03-29', '2024-04-01', '2024-04-30']),\n  ('coinciding positions',\n   ['2024-01-01', [0], [1, -5], 4],\n   ['2024-01-01', '2024-02-05', '2024-03-04', '2024-04-01']),\n  ('three positions with repeat',\n   ['2024-04-01', [2], [1, -1, -5], 5],\n   ['2024-04-03', '2024-04-24', '2024-05-01', '2024-05-29', '2024-06-05']),\n  ('out of range negative', ['2024-01-01', [5, 6], [-7, 1], 3], ['2024-01-06', '2024-01-07', '2024-02-03']),\n  ('out of range positive', ['2024-02-01', [0], [5], 3], ['2024-04-29', '2024-07-29', '2024-09-30']),\n  ('second weekend day', ['2024-06-15', [5, 6], [2], 3], ['2024-07-07', '2024-08-04', '2024-09-07']),\n  ('second to last weekday',\n   ['2024-07-01', [0, 1, 2, 3, 4], [-2], 3],\n   ['2024-07-30', '2024-08-29', '2024-09-27'])],\n [('three positions with repeat',\n   ['2024-04-01', [2], [1, -1, -5], 5],\n   ['2024-04-03', '2024-04-24', '2024-05-01', '2024-05-29', '2024-06-05']),\n  ('out of range negative', ['2024-01-01', [5, 6], [-7, 1], 3], ['2024-01-06', '2024-01-07', '2024-02-03']),\n  ('out of range positive', ['2024-02-01', [0], [5], 3], ['2024-04-29', '2024-07-29', '2024-09-30']),\n  ('second weekend day', ['2024-06-15', [5, 6], [2], 3], ['2024-07-07', '2024-08-04', '2024-09-07']),\n  ('second to last weekday',\n   ['2024-07-01', [0, 1, 2, 3, 4], [-2], 3],\n   ['2024-07-30', '2024-08-29', '2024-09-27']),\n  ('position 3 of TU,TH mid month',\n   ['2024-09-12', [1, 3], [3, -1], 4],\n   ['2024-09-26', '2024-10-08', '2024-10-31', '2024-11-12']),\n  ('december rollover',\n   ['2024-12-01', [4], [1, -1], 4],\n   ['2024-12-06', '2024-12-27', '2025-01-03', '2025-01-31'])],\n [('out of range positive', ['2024-02-01', [0], [5], 3], ['2024-04-29', '2024-07-29', '2024-09-30']),\n  ('second weekend day', ['2024-06-15', [5, 6], [2], 3], ['2024-07-07', '2024-08-04', '2024-09-07']),\n  ('second to last weekday',\n   ['2024-07-01', [0, 1, 2, 3, 4], [-2], 3],\n   ['2024-07-30', '2024-08-29', '2024-09-27']),\n  ('position 3 of TU,TH mid month',\n   ['2024-09-12', [1, 3], [3, -1], 4],\n   ['2024-09-26', '2024-10-08', '2024-10-31', '2024-11-12']),\n  ('december rollover',\n   ['2024-12-01', [4], [1, -1], 4],\n   ['2024-12-06', '2024-12-27', '2025-01-03', '2025-01-31']),\n  ('dtstart equals picked day', ['2024-05-31', [0, 1, 2, 3, 4], [-1], 2], ['2024-05-31', '2024-06-28']),\n  ('regression: last weekday of month',\n   ['2024-01-01', [0, 1, 2, 3, 4], [-1], 4],\n   ['2024-01-31', '2024-02-29', '2024-03-29', '2024-04-30']),\n  ('three positions with repeat',\n   ['2024-04-01', [2], [1, -1, -5], 5],\n   ['2024-04-03', '2024-04-24', '2024-05-01', '2024-05-29', '2024-06-05'])],\n [('second to last weekday',\n   ['2024-07-01', [0, 1, 2, 3, 4], [-2], 3],\n   ['2024-07-30', '2024-08-29', '2024-09-27']),\n  ('position 3 of TU,TH mid month',\n   ['2024-09-12', [1, 3], [3, -1], 4],\n   ['2024-09-26', '2024-10-08', '2024-10-31', '2024-11-12']),\n  ('december rollover',\n   ['2024-12-01', [4], [1, -1], 4],\n   ['2024-12-06', '2024-12-27', '2025-01-03', '2025-01-31']),\n  ('dtstart equals picked day', ['2024-05-31', [0, 1, 2, 3, 4], [-1], 2], ['2024-05-31', '2024-06-28']),\n  ('regression: last weekday of month',\n   ['2024-01-01', [0, 1, 2, 3, 4], [-1], 4],\n   ['2024-01-31', '2024-02-29', '2024-03-29', '2024-04-30']),\n  ('first weekday, dtstart mid-month',\n   ['2024-01-10', [0, 1, 2, 3, 4], [1], 3],\n   ['2024-02-01', '2024-03-01', '2024-04-01']),\n  ('first and last in reverse order',\n   ['2024-03-01', [0, 1, 2, 3, 4], [-1, 1], 4],\n   ['2024-03-01', '2024-03-29', '2024-04-01', '2024-04-30']),\n  ('coinciding positions',\n   ['2024-01-01', [0], [1, -5], 4],\n   ['2024-01-01', '2024-02-05', '2024-03-04', '2024-04-01']),\n  ('three positions with repeat',\n   ['2024-04-01', [2], [1, -1, -5], 5],\n   ['2024-04-03', '2024-04-24', '2024-05-01', '2024-05-29', '2024-06-05'])]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"c30ff03748231b9aa96ab7102c961165a679dabd05c30650fa17175fc06842c9","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport datetime as dt\nimport calendar\nN = 1\nobservations = []\ndef solve(dtstart, weekdays, setpos, count):\n    start = dt.date.fromisoformat(dtstart)\n    out = []\n    for k in range(240):\n        mi = start.month - 1 + k\n        y, m = start.year + mi // 12, mi % 12 + 1\n        dim = calendar.monthrange(y, m)[1]\n        cand = [x for x in [dt.date(y, m, d) for d in range(1, dim + 1)] if x.weekday() in weekdays and x >= dt.date(y, m, 1)]\n        picked = []\n        for p in setpos:\n            idx = p - 1 if p > 0 else len(cand) + p\n            if 0 <= idx < len(cand) and True:\n                picked.append(cand[idx])\n        for d in sorted(picked):\n            if d < start:\n                continue\n            out.append(d.isoformat())\n            if len(out) >= count:\n                return out\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: last weekday of month',\n   ['2024-01-01', [0, 1, 2, 3, 4], [-1], 4],\n   ['2024-01-31', '2024-02-29', '2024-03-29', '2024-04-30']),\n  ('first weekday, dtstart mid-month',\n   ['2024-01-10', [0, 1, 2, 3, 4], [1], 3],\n   ['2024-02-01', '2024-03-01', '2024-04-01']),\n  ('first and last in reverse order',\n   ['2024-03-01', [0, 1, 2, 3, 4], [-1, 1], 4],\n   ['2024-03-01', '2024-03-29', '2024-04-01', '2024-04-30']),\n  ('coinciding positions',\n   ['2024-01-01', [0], [1, -5], 4],\n   ['2024-01-01', '2024-02-05', '2024-03-04', '2024-04-01']),\n  ('three positions with repeat',\n   ['2024-04-01', [2], [1, -1, -5], 5],\n   ['2024-04-03', '2024-04-24', '2024-05-01', '2024-05-29', '2024-06-05']),\n  ('out of range negative', ['2024-01-01', [5, 6], [-7, 1], 3], ['2024-01-06', '2024-01-07', '2024-02-03']),\n  ('out of range positive', ['2024-02-01', [0], [5], 3], ['2024-04-29', '2024-07-29', '2024-09-30'])],\n [('first and last in reverse order',\n   ['2024-03-01', [0, 1, 2, 3, 4], [-1, 1], 4],\n   ['2024-03-01', '2024-03-29', '2024-04-01', '2024-04-30']),\n  ('coinciding positions',\n   ['2024-01-01', [0], [1, -5], 4],\n   ['2024-01-01', '2024-02-05', '2024-03-04', '2024-04-01']),\n  ('three positions with repeat',\n   ['2024-04-01', [2], [1, -1, -5], 5],\n   ['2024-04-03', '2024-04-24', '2024-05-01', '2024-05-29', '2024-06-05']),\n  ('out of range negative', ['2024-01-01', [5, 6], [-7, 1], 3], ['2024-01-06', '2024-01-07', '2024-02-03']),\n  ('out of range positive', ['2024-02-01', [0], [5], 3], ['2024-04-29', '2024-07-29', '2024-09-30']),\n  ('second weekend day', ['2024-06-15', [5, 6], [2], 3], ['2024-07-07', '2024-08-04', '2024-09-07']),\n  ('second to last weekday',\n   ['2024-07-01', [0, 1, 2, 3, 4], [-2], 3],\n   ['2024-07-30', '2024-08-29', '2024-09-27'])],\n [('three positions with repeat',\n   ['2024-04-01', [2], [1, -1, -5], 5],\n   ['2024-04-03', '2024-04-24', '2024-05-01', '2024-05-29', '2024-06-05']),\n  ('out of range negative', ['2024-01-01', [5, 6], [-7, 1], 3], ['2024-01-06', '2024-01-07', '2024-02-03']),\n  ('out of range positive', ['2024-02-01', [0], [5], 3], ['2024-04-29', '2024-07-29', '2024-09-30']),\n  ('second weekend day', ['2024-06-15', [5, 6], [2], 3], ['2024-07-07', '2024-08-04', '2024-09-07']),\n  ('second to last weekday',\n   ['2024-07-01', [0, 1, 2, 3, 4], [-2], 3],\n   ['2024-07-30', '2024-08-29', '2024-09-27']),\n  ('position 3 of TU,TH mid month',\n   ['2024-09-12', [1, 3], [3, -1], 4],\n   ['2024-09-26', '2024-10-08', '2024-10-31', '2024-11-12']),\n  ('december rollover',\n   ['2024-12-01', [4], [1, -1], 4],\n   ['2024-12-06', '2024-12-27', '2025-01-03', '2025-01-31'])],\n [('out of range positive', ['2024-02-01', [0], [5], 3], ['2024-04-29', '2024-07-29', '2024-09-30']),\n  ('second weekend day', ['2024-06-15', [5, 6], [2], 3], ['2024-07-07', '2024-08-04', '2024-09-07']),\n  ('second to last weekday',\n   ['2024-07-01', [0, 1, 2, 3, 4], [-2], 3],\n   ['2024-07-30', '2024-08-29', '2024-09-27']),\n  ('position 3 of TU,TH mid month',\n   ['2024-09-12', [1, 3], [3, -1], 4],\n   ['2024-09-26', '2024-10-08', '2024-10-31', '2024-11-12']),\n  ('december rollover',\n   ['2024-12-01', [4], [1, -1], 4],\n   ['2024-12-06', '2024-12-27', '2025-01-03', '2025-01-31']),\n  ('dtstart equals picked day', ['2024-05-31', [0, 1, 2, 3, 4], [-1], 2], ['2024-05-31', '2024-06-28']),\n  ('regression: last weekday of month',\n   ['2024-01-01', [0, 1, 2, 3, 4], [-1], 4],\n   ['2024-01-31', '2024-02-29', '2024-03-29', '2024-04-30']),\n  ('three positions with repeat',\n   ['2024-04-01', [2], [1, -1, -5], 5],\n   ['2024-04-03', '2024-04-24', '2024-05-01', '2024-05-29', '2024-06-05'])],\n [('second to last weekday',\n   ['2024-07-01', [0, 1, 2, 3, 4], [-2], 3],\n   ['2024-07-30', '2024-08-29', '2024-09-27']),\n  ('position 3 of TU,TH mid month',\n   ['2024-09-12', [1, 3], [3, -1], 4],\n   ['2024-09-26', '2024-10-08', '2024-10-31', '2024-11-12']),\n  ('december rollover',\n   ['2024-12-01', [4], [1, -1], 4],\n   ['2024-12-06', '2024-12-27', '2025-01-03', '2025-01-31']),\n  ('dtstart equals picked day', ['2024-05-31', [0, 1, 2, 3, 4], [-1], 2], ['2024-05-31', '2024-06-28']),\n  ('regression: last weekday of month',\n   ['2024-01-01', [0, 1, 2, 3, 4], [-1], 4],\n   ['2024-01-31', '2024-02-29', '2024-03-29', '2024-04-30']),\n  ('first weekday, dtstart mid-month',\n   ['2024-01-10', [0, 1, 2, 3, 4], [1], 3],\n   ['2024-02-01', '2024-03-01', '2024-04-01']),\n  ('first and last in reverse order',\n   ['2024-03-01', [0, 1, 2, 3, 4], [-1, 1], 4],\n   ['2024-03-01', '2024-03-29', '2024-04-01', '2024-04-30']),\n  ('coinciding positions',\n   ['2024-01-01', [0], [1, -5], 4],\n   ['2024-01-01', '2024-02-05', '2024-03-04', '2024-04-01']),\n  ('three positions with repeat',\n   ['2024-04-01', [2], [1, -1, -5], 5],\n   ['2024-04-03', '2024-04-24', '2024-05-01', '2024-05-29', '2024-06-05'])]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"61c5314eafd4567bdb168e09f1a89eca0f56e7ecc2aca46570d477f2dc0e2d26","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport datetime as dt\nimport calendar\nN = 1\nobservations = []\ndef solve(dtstart, weekdays, setpos, count):\n    start = dt.date.fromisoformat(dtstart)\n    out = []\n    for k in range(240):\n        mi = start.month - 1 + k\n        y, m = start.year + mi // 12, mi % 12 + 1\n        dim = calendar.monthrange(y, m)[1]\n        cand = [x for x in [dt.date(y, m, d) for d in range(1, dim + 1)] if x.weekday() in weekdays and x >= dt.date(y, m, 1)]\n        picked = []\n        for p in setpos:\n            idx = p - 1 if p > 0 else len(cand) + p\n            if 0 <= idx < len(cand) and cand[idx] not in picked:\n                picked.append(cand[idx])\n        for d in sorted(picked):\n            if d < start:\n                continue\n            out.append(d.isoformat())\n            if len(out) >= count:\n                return out\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: last weekday of month',\n   ['2024-01-01', [0, 1, 2, 3, 4], [-1], 4],\n   ['2024-01-31', '2024-02-29', '2024-03-29', '2024-04-30']),\n  ('first weekday, dtstart mid-month',\n   ['2024-01-10', [0, 1, 2, 3, 4], [1], 3],\n   ['2024-02-01', '2024-03-01', '2024-04-01']),\n  ('first and last in reverse order',\n   ['2024-03-01', [0, 1, 2, 3, 4], [-1, 1], 4],\n   ['2024-03-01', '2024-03-29', '2024-04-01', '2024-04-30']),\n  ('coinciding positions',\n   ['2024-01-01', [0], [1, -5], 4],\n   ['2024-01-01', '2024-02-05', '2024-03-04', '2024-04-01']),\n  ('three positions with repeat',\n   ['2024-04-01', [2], [1, -1, -5], 5],\n   ['2024-04-03', '2024-04-24', '2024-05-01', '2024-05-29', '2024-06-05']),\n  ('out of range negative', ['2024-01-01', [5, 6], [-7, 1], 3], ['2024-01-06', '2024-01-07', '2024-02-03']),\n  ('out of range positive', ['2024-02-01', [0], [5], 3], ['2024-04-29', '2024-07-29', '2024-09-30'])],\n [('first and last in reverse order',\n   ['2024-03-01', [0, 1, 2, 3, 4], [-1, 1], 4],\n   ['2024-03-01', '2024-03-29', '2024-04-01', '2024-04-30']),\n  ('coinciding positions',\n   ['2024-01-01', [0], [1, -5], 4],\n   ['2024-01-01', '2024-02-05', '2024-03-04', '2024-04-01']),\n  ('three positions with repeat',\n   ['2024-04-01', [2], [1, -1, -5], 5],\n   ['2024-04-03', '2024-04-24', '2024-05-01', '2024-05-29', '2024-06-05']),\n  ('out of range negative', ['2024-01-01', [5, 6], [-7, 1], 3], ['2024-01-06', '2024-01-07', '2024-02-03']),\n  ('out of range positive', ['2024-02-01', [0], [5], 3], ['2024-04-29', '2024-07-29', '2024-09-30']),\n  ('second weekend day', ['2024-06-15', [5, 6], [2], 3], ['2024-07-07', '2024-08-04', '2024-09-07']),\n  ('second to last weekday',\n   ['2024-07-01', [0, 1, 2, 3, 4], [-2], 3],\n   ['2024-07-30', '2024-08-29', '2024-09-27'])],\n [('three positions with repeat',\n   ['2024-04-01', [2], [1, -1, -5], 5],\n   ['2024-04-03', '2024-04-24', '2024-05-01', '2024-05-29', '2024-06-05']),\n  ('out of range negative', ['2024-01-01', [5, 6], [-7, 1], 3], ['2024-01-06', '2024-01-07', '2024-02-03']),\n  ('out of range positive', ['2024-02-01', [0], [5], 3], ['2024-04-29', '2024-07-29', '2024-09-30']),\n  ('second weekend day', ['2024-06-15', [5, 6], [2], 3], ['2024-07-07', '2024-08-04', '2024-09-07']),\n  ('second to last weekday',\n   ['2024-07-01', [0, 1, 2, 3, 4], [-2], 3],\n   ['2024-07-30', '2024-08-29', '2024-09-27']),\n  ('position 3 of TU,TH mid month',\n   ['2024-09-12', [1, 3], [3, -1], 4],\n   ['2024-09-26', '2024-10-08', '2024-10-31', '2024-11-12']),\n  ('december rollover',\n   ['2024-12-01', [4], [1, -1], 4],\n   ['2024-12-06', '2024-12-27', '2025-01-03', '2025-01-31'])],\n [('out of range positive', ['2024-02-01', [0], [5], 3], ['2024-04-29', '2024-07-29', '2024-09-30']),\n  ('second weekend day', ['2024-06-15', [5, 6], [2], 3], ['2024-07-07', '2024-08-04', '2024-09-07']),\n  ('second to last weekday',\n   ['2024-07-01', [0, 1, 2, 3, 4], [-2], 3],\n   ['2024-07-30', '2024-08-29', '2024-09-27']),\n  ('position 3 of TU,TH mid month',\n   ['2024-09-12', [1, 3], [3, -1], 4],\n   ['2024-09-26', '2024-10-08', '2024-10-31', '2024-11-12']),\n  ('december rollover',\n   ['2024-12-01', [4], [1, -1], 4],\n   ['2024-12-06', '2024-12-27', '2025-01-03', '2025-01-31']),\n  ('dtstart equals picked day', ['2024-05-31', [0, 1, 2, 3, 4], [-1], 2], ['2024-05-31', '2024-06-28']),\n  ('regression: last weekday of month',\n   ['2024-01-01', [0, 1, 2, 3, 4], [-1], 4],\n   ['2024-01-31', '2024-02-29', '2024-03-29', '2024-04-30']),\n  ('three positions with repeat',\n   ['2024-04-01', [2], [1, -1, -5], 5],\n   ['2024-04-03', '2024-04-24', '2024-05-01', '2024-05-29', '2024-06-05'])],\n [('second to last weekday',\n   ['2024-07-01', [0, 1, 2, 3, 4], [-2], 3],\n   ['2024-07-30', '2024-08-29', '2024-09-27']),\n  ('position 3 of TU,TH mid month',\n   ['2024-09-12', [1, 3], [3, -1], 4],\n   ['2024-09-26', '2024-10-08', '2024-10-31', '2024-11-12']),\n  ('december rollover',\n   ['2024-12-01', [4], [1, -1], 4],\n   ['2024-12-06', '2024-12-27', '2025-01-03', '2025-01-31']),\n  ('dtstart equals picked day', ['2024-05-31', [0, 1, 2, 3, 4], [-1], 2], ['2024-05-31', '2024-06-28']),\n  ('regression: last weekday of month',\n   ['2024-01-01', [0, 1, 2, 3, 4], [-1], 4],\n   ['2024-01-31', '2024-02-29', '2024-03-29', '2024-04-30']),\n  ('first weekday, dtstart mid-month',\n   ['2024-01-10', [0, 1, 2, 3, 4], [1], 3],\n   ['2024-02-01', '2024-03-01', '2024-04-01']),\n  ('first and last in reverse order',\n   ['2024-03-01', [0, 1, 2, 3, 4], [-1, 1], 4],\n   ['2024-03-01', '2024-03-29', '2024-04-01', '2024-04-30']),\n  ('coinciding positions',\n   ['2024-01-01', [0], [1, -5], 4],\n   ['2024-01-01', '2024-02-05', '2024-03-04', '2024-04-01']),\n  ('three positions with repeat',\n   ['2024-04-01', [2], [1, -1, -5], 5],\n   ['2024-04-03', '2024-04-24', '2024-05-01', '2024-05-29', '2024-06-05'])]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-calendar-recurrence-rules-monthly-bysetpos-dup-guard","generated_at":"2026-09-29T14:49:20.678240+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Recurring calendar series are expanded into concrete instances for display, reminders and conflict checks.","repair":"At the dup guard decision use `cand[idx] not in picked`, leaving the other decision sites of the model unchanged.","root_cause":"Positions that resolve to the same candidate are both appended.","sha256":"ebde19cc71813f00ba80ba829ed5eee16b95dc275b97e335f4a84a54e2d3b76c","title":"Monthly BYSETPOS selection from a weekday set: dup guard · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":43.014,"exit_code":1,"observations":[{"actual":["2024-01-31","2024-02-29","2024-03-29","2024-04-30"],"check":"regression: last weekday of month","expected":["2024-01-31","2024-02-29","2024-03-29","2024-04-30"],"passed":true},{"actual":["2024-02-01","2024-03-01","2024-04-01"],"check":"first weekday, dtstart mid-month","expected":["2024-02-01","2024-03-01","2024-04-01"],"passed":true},{"actual":["2024-03-01","2024-03-29","2024-04-01","2024-04-30"],"check":"first and last in reverse order","expected":["2024-03-01","2024-03-29","2024-04-01","2024-04-30"],"passed":true},{"actual":["2024-01-01","2024-02-05","2024-03-04","2024-04-01"],"check":"coinciding positions","expected":["2024-01-01","2024-02-05","2024-03-04","2024-04-01"],"passed":true},{"actual":["2024-04-03","2024-04-24","2024-05-01","2024-05-01","2024-05-29"],"check":"three positions with repeat","expected":["2024-04-03","2024-04-24","2024-05-01","2024-05-29","2024-06-05"],"passed":false},{"actual":["2024-01-06","2024-01-07","2024-02-03"],"check":"out of range negative","expected":["2024-01-06","2024-01-07","2024-02-03"],"passed":true},{"actual":["2024-04-29","2024-07-29","2024-09-30"],"check":"out of range positive","expected":["2024-04-29","2024-07-29","2024-09-30"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: last weekday of month\", \"actual\": [\"2024-01-31\", \"2024-02-29\", \"2024-03-29\", \"2024-04-30\"], \"expected\": [\"2024-01-31\", \"2024-02-29\", \"2024-03-29\", \"2024-04-30\"], \"passed\": true}, {\"check\": \"first weekday, dtstart mid-month\", \"actual\": [\"2024-02-01\", \"2024-03-01\", \"2024-04-01\"], \"expected\": [\"2024-02-01\", \"2024-03-01\", \"2024-04-01\"], \"passed\": true}, {\"check\": \"first and last in reverse order\", \"actual\": [\"2024-03-01\", \"2024-03-29\", \"2024-04-01\", \"2024-04-30\"], \"expected\": [\"2024-03-01\", \"2024-03-29\", \"2024-04-01\", \"2024-04-30\"], \"passed\": true}, {\"check\": \"coinciding positions\", \"actual\": [\"2024-01-01\", \"2024-02-05\", \"2024-03-04\", \"2024-04-01\"], \"expected\": [\"2024-01-01\", \"2024-02-05\", \"2024-03-04\", \"2024-04-01\"], \"passed\": true}, {\"check\": \"three positions with repeat\", \"actual\": [\"2024-04-03\", \"2024-04-24\", \"2024-05-01\", \"2024-05-01\", \"2024-05-29\"], \"expected\": [\"2024-04-03\", \"2024-04-24\", \"2024-05-01\", \"2024-05-29\", \"2024-06-05\"], \"passed\": false}, {\"check\": \"out of range negative\", \"actual\": [\"2024-01-06\", \"2024-01-07\", \"2024-02-03\"], \"expected\": [\"2024-01-06\", \"2024-01-07\", \"2024-02-03\"], \"passed\": true}, {\"check\": \"out of range positive\", \"actual\": [\"2024-04-29\", \"2024-07-29\", \"2024-09-30\"], \"expected\": [\"2024-04-29\", \"2024-07-29\", \"2024-09-30\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.435,"exit_code":1,"observations":[{"actual":["2024-01-31","2024-02-29","2024-03-29","2024-04-30"],"check":"regression: last weekday of month","expected":["2024-01-31","2024-02-29","2024-03-29","2024-04-30"],"passed":true},{"actual":["2024-02-01","2024-03-01","2024-04-01"],"check":"first weekday, dtstart mid-month","expected":["2024-02-01","2024-03-01","2024-04-01"],"passed":true},{"actual":["2024-03-01","2024-03-29","2024-04-01","2024-04-30"],"check":"first and last in reverse order","expected":["2024-03-01","2024-03-29","2024-04-01","2024-04-30"],"passed":true},{"actual":["2024-01-01","2024-01-01","2024-02-05","2024-03-04"],"check":"coinciding positions","expected":["2024-01-01","2024-02-05","2024-03-04","2024-04-01"],"passed":false},{"actual":["2024-04-03","2024-04-24","2024-05-01","2024-05-01","2024-05-29"],"check":"three positions with repeat","expected":["2024-04-03","2024-04-24","2024-05-01","2024-05-29","2024-06-05"],"passed":false},{"actual":["2024-01-06","2024-01-07","2024-02-03"],"check":"out of range negative","expected":["2024-01-06","2024-01-07","2024-02-03"],"passed":true},{"actual":["2024-04-29","2024-07-29","2024-09-30"],"check":"out of range positive","expected":["2024-04-29","2024-07-29","2024-09-30"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: last weekday of month\", \"actual\": [\"2024-01-31\", \"2024-02-29\", \"2024-03-29\", \"2024-04-30\"], \"expected\": [\"2024-01-31\", \"2024-02-29\", \"2024-03-29\", \"2024-04-30\"], \"passed\": true}, {\"check\": \"first weekday, dtstart mid-month\", \"actual\": [\"2024-02-01\", \"2024-03-01\", \"2024-04-01\"], \"expected\": [\"2024-02-01\", \"2024-03-01\", \"2024-04-01\"], \"passed\": true}, {\"check\": \"first and last in reverse order\", \"actual\": [\"2024-03-01\", \"2024-03-29\", \"2024-04-01\", \"2024-04-30\"], \"expected\": [\"2024-03-01\", \"2024-03-29\", \"2024-04-01\", \"2024-04-30\"], \"passed\": true}, {\"check\": \"coinciding positions\", \"actual\": [\"2024-01-01\", \"2024-01-01\", \"2024-02-05\", \"2024-03-04\"], \"expected\": [\"2024-01-01\", \"2024-02-05\", \"2024-03-04\", \"2024-04-01\"], \"passed\": false}, {\"check\": \"three positions with repeat\", \"actual\": [\"2024-04-03\", \"2024-04-24\", \"2024-05-01\", \"2024-05-01\", \"2024-05-29\"], \"expected\": [\"2024-04-03\", \"2024-04-24\", \"2024-05-01\", \"2024-05-29\", \"2024-06-05\"], \"passed\": false}, {\"check\": \"out of range negative\", \"actual\": [\"2024-01-06\", \"2024-01-07\", \"2024-02-03\"], \"expected\": [\"2024-01-06\", \"2024-01-07\", \"2024-02-03\"], \"passed\": true}, {\"check\": \"out of range positive\", \"actual\": [\"2024-04-29\", \"2024-07-29\", \"2024-09-30\"], \"expected\": [\"2024-04-29\", \"2024-07-29\", \"2024-09-30\"], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.768,"exit_code":0,"observations":[{"actual":["2024-01-31","2024-02-29","2024-03-29","2024-04-30"],"check":"regression: last weekday of month","expected":["2024-01-31","2024-02-29","2024-03-29","2024-04-30"],"passed":true},{"actual":["2024-02-01","2024-03-01","2024-04-01"],"check":"first weekday, dtstart mid-month","expected":["2024-02-01","2024-03-01","2024-04-01"],"passed":true},{"actual":["2024-03-01","2024-03-29","2024-04-01","2024-04-30"],"check":"first and last in reverse order","expected":["2024-03-01","2024-03-29","2024-04-01","2024-04-30"],"passed":true},{"actual":["2024-01-01","2024-02-05","2024-03-04","2024-04-01"],"check":"coinciding positions","expected":["2024-01-01","2024-02-05","2024-03-04","2024-04-01"],"passed":true},{"actual":["2024-04-03","2024-04-24","2024-05-01","2024-05-29","2024-06-05"],"check":"three positions with repeat","expected":["2024-04-03","2024-04-24","2024-05-01","2024-05-29","2024-06-05"],"passed":true},{"actual":["2024-01-06","2024-01-07","2024-02-03"],"check":"out of range negative","expected":["2024-01-06","2024-01-07","2024-02-03"],"passed":true},{"actual":["2024-04-29","2024-07-29","2024-09-30"],"check":"out of range positive","expected":["2024-04-29","2024-07-29","2024-09-30"],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: last weekday of month\", \"actual\": [\"2024-01-31\", \"2024-02-29\", \"2024-03-29\", \"2024-04-30\"], \"expected\": [\"2024-01-31\", \"2024-02-29\", \"2024-03-29\", \"2024-04-30\"], \"passed\": true}, {\"check\": \"first weekday, dtstart mid-month\", \"actual\": [\"2024-02-01\", \"2024-03-01\", \"2024-04-01\"], \"expected\": [\"2024-02-01\", \"2024-03-01\", \"2024-04-01\"], \"passed\": true}, {\"check\": \"first and last in reverse order\", \"actual\": [\"2024-03-01\", \"2024-03-29\", \"2024-04-01\", \"2024-04-30\"], \"expected\": [\"2024-03-01\", \"2024-03-29\", \"2024-04-01\", \"2024-04-30\"], \"passed\": true}, {\"check\": \"coinciding positions\", \"actual\": [\"2024-01-01\", \"2024-02-05\", \"2024-03-04\", \"2024-04-01\"], \"expected\": [\"2024-01-01\", \"2024-02-05\", \"2024-03-04\", \"2024-04-01\"], \"passed\": true}, {\"check\": \"three positions with repeat\", \"actual\": [\"2024-04-03\", \"2024-04-24\", \"2024-05-01\", \"2024-05-29\", \"2024-06-05\"], \"expected\": [\"2024-04-03\", \"2024-04-24\", \"2024-05-01\", \"2024-05-29\", \"2024-06-05\"], \"passed\": true}, {\"check\": \"out of range negative\", \"actual\": [\"2024-01-06\", \"2024-01-07\", \"2024-02-03\"], \"expected\": [\"2024-01-06\", \"2024-01-07\", \"2024-02-03\"], \"passed\": true}, {\"check\": \"out of range positive\", \"actual\": [\"2024-04-29\", \"2024-07-29\", \"2024-09-30\"], \"expected\": [\"2024-04-29\", \"2024-07-29\", \"2024-09-30\"], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}