FAILURE MAP
← Case archive

FA-94196 / Shift rostering labor rules / Open access

Rostered days off break holiday pay eligibility · case 01

A holiday falling after a weekend off is never paid.

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

ROOT CAUSE

The neighbour search stops at unscheduled days instead of skipping them.

VERIFIED REPAIR

Skip both unscheduled days and other holidays when finding neighbours.

Unsuccessful approach: Skipping only O days stops at an adjacent worked holiday.

Case contract

A day-status string (W worked, A unexcused absence, X excused absence, O not scheduled) and holiday indices. A holiday is paid if the nearest scheduled day before it and the nearest after it (skipping O days and other holidays) are both W or X; if either does not exist in the roster, it is not paid. Return [holiday, eligible] in holiday order.

Why this case matters

Last-and-first-shift holiday pay rules are frequently misapplied around days off and adjacent holidays.

1 / The failure

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

N = 1
observations = []
def solve(days, holidays):
    hs = set(holidays)
    ok = ('W', 'X')
    def near(i, step):
        j = i + step
        while 0 <= j < len(days) and (j in hs):
            j += step
        return days[j] if 0 <= j < len(days) else None
    return [[h, near(h, -1) in ok and near(h, 1) in ok] for h in sorted(holidays)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: skip unscheduled days 1', ['WOOWW', [2]], [[2, True]]),
  ('regression variant: skip unscheduled days 2', ['WXWOWWOOOOWX', [9]], [[9, True]]),
  ('partial repair guard 3', ['WOWOXWOWOOW', [9, 10, 1]], [[1, True], [9, False], [10, False]]),
  ('boundary control 4', ['OWOOW', [2]], [[2, True]]), ('boundary control 5', ['WAOWW', [2]], [[2, False]]),
  ('normal control 6', ['WWWWWWWWWAWO', [11, 6, 8]], [[6, True], [8, False], [11, False]]),
  ('normal control 7', ['WWWAWWO', [4, 5, 2]], [[2, False], [4, False], [5, False]]),
  ('normal control 8', ['WWXAWOOW', [0, 5, 6]], [[0, False], [5, True], [6, True]])],
 [('regression: skip unscheduled days 1', ['OWOOW', [2]], [[2, True]]),
  ('regression variant: skip unscheduled days 2', ['WWOOOWWWAOAX', [3, 4, 7]],
   [[3, True], [4, True], [7, False]]),
  ('partial repair guard 3', ['WOWOWOX', [0, 1, 4]], [[0, False], [1, False], [4, True]]),
  ('boundary control 4', ['WWOWA', [2]], [[2, True]]),
  ('boundary control 5', ['WOOOW', [1, 2]], [[1, True], [2, True]]),
  ('normal control 6', ['WOAOWWAO', [5, 7, 3]], [[3, False], [5, False], [7, False]]),
  ('normal control 7', ['OXOOXAWWXOO', [3, 10, 2]], [[2, True], [3, True], [10, False]]),
  ('normal control 8', ['WOOWOWWXWW', [4]], [[4, True]])],
 [('regression: skip unscheduled days 1', ['WOOOW', [1, 2]], [[1, True], [2, True]]),
  ('regression variant: skip unscheduled days 2', ['WXWOXOWWWOWO', [6]], [[6, True]]),
  ('partial repair guard 3', ['WWOAWOXWWO', [5, 4, 2]], [[2, False], [4, False], [5, False]]),
  ('boundary control 4', ['WXOWX', [2]], [[2, True]]), ('boundary control 5', ['WOOWW', [2]], [[2, True]]),
  ('normal control 6', ['WOWXOWXOO', [1, 2, 5]], [[1, True], [2, True], [5, True]]),
  ('normal control 7', ['WXOWWWOOXW', [2, 9, 6]], [[2, True], [6, True], [9, False]]),
  ('normal control 8', ['WXWOAWWO', [6, 3]], [[3, False], [6, False]])],
 [('regression: skip unscheduled days 1', ['WWOWXXXWO', [3]], [[3, True]]),
  ('regression variant: skip unscheduled days 2', ['AXWWOOW', [2, 5]], [[2, True], [5, True]]),
  ('partial repair guard 3', ['WWXOAWXXWOWO', [10, 11, 9]], [[9, False], [10, False], [11, False]]),
  ('boundary control 4', ['OOWWW', [0]], [[0, False]]), ('boundary control 5', ['OWOOW', [2]], [[2, True]]),
  ('normal control 6', ['WOWOXWOWOOW', [9, 10, 1]], [[1, True], [9, False], [10, False]]),
  ('normal control 7', ['XOOAWWAWWAW', [10, 2]], [[2, False], [10, False]]),
  ('normal control 8', ['WXOWWWOOXW', [2, 9, 6]], [[2, True], [6, True], [9, False]])],
 [('regression: skip unscheduled days 1', ['WOWOWWO', [6, 2, 1]], [[1, True], [2, True], [6, False]]),
  ('regression variant: skip unscheduled days 2', ['OXXWOOOWWO', [9, 3, 6]],
   [[3, True], [6, True], [9, False]]),
  ('partial repair guard 3', ['WWWWOW', [4, 5]], [[4, False], [5, False]]),
  ('boundary control 4', ['WAOWW', [2]], [[2, False]]), ('boundary control 5', ['WWOWA', [2]], [[2, True]]),
  ('normal control 6', ['AWWWWWXWOOWW', [9, 8]], [[8, True], [9, True]]),
  ('normal control 7', ['OOWAWX', [0]], [[0, False]]),
  ('normal control 8', ['WWWWWAOOWW', [6, 9, 7]], [[6, False], [7, False], [9, False]])]]
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: skip unscheduled days 1[[2, False]][[2, True]]Failed
regression variant: skip unscheduled days 2[[9, False]][[9, True]]Failed
partial repair guard 3[[1, True], [9, False], [10, False]][[1, True], [9, False], [10, False]]Passed
boundary control 4[[2, False]][[2, True]]Failed
boundary control 5[[2, False]][[2, False]]Passed
normal control 6[[6, True], [8, False], [11, False]][[6, True], [8, False], [11, False]]Passed
normal control 7[[2, False], [4, False], [5, False]][[2, False], [4, False], [5, False]]Passed
normal control 8[[0, False], [5, True], [6, True]][[0, False], [5, True], [6, True]]Passed

SHA-256 / b534df292924a3d48ad23eb524719e05e491394022ae55b0daeec5c245af22b8

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(days, holidays):
    hs = set(holidays)
    ok = ('W', 'X')
    def near(i, step):
        j = i + step
        while 0 <= j < len(days) and (days[j] == 'O'):
            j += step
        return days[j] if 0 <= j < len(days) else None
    return [[h, near(h, -1) in ok and near(h, 1) in ok] for h in sorted(holidays)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: skip unscheduled days 1', ['WOOWW', [2]], [[2, True]]),
  ('regression variant: skip unscheduled days 2', ['WXWOWWOOOOWX', [9]], [[9, True]]),
  ('partial repair guard 3', ['WOWOXWOWOOW', [9, 10, 1]], [[1, True], [9, False], [10, False]]),
  ('boundary control 4', ['OWOOW', [2]], [[2, True]]), ('boundary control 5', ['WAOWW', [2]], [[2, False]]),
  ('normal control 6', ['WWWWWWWWWAWO', [11, 6, 8]], [[6, True], [8, False], [11, False]]),
  ('normal control 7', ['WWWAWWO', [4, 5, 2]], [[2, False], [4, False], [5, False]]),
  ('normal control 8', ['WWXAWOOW', [0, 5, 6]], [[0, False], [5, True], [6, True]])],
 [('regression: skip unscheduled days 1', ['OWOOW', [2]], [[2, True]]),
  ('regression variant: skip unscheduled days 2', ['WWOOOWWWAOAX', [3, 4, 7]],
   [[3, True], [4, True], [7, False]]),
  ('partial repair guard 3', ['WOWOWOX', [0, 1, 4]], [[0, False], [1, False], [4, True]]),
  ('boundary control 4', ['WWOWA', [2]], [[2, True]]),
  ('boundary control 5', ['WOOOW', [1, 2]], [[1, True], [2, True]]),
  ('normal control 6', ['WOAOWWAO', [5, 7, 3]], [[3, False], [5, False], [7, False]]),
  ('normal control 7', ['OXOOXAWWXOO', [3, 10, 2]], [[2, True], [3, True], [10, False]]),
  ('normal control 8', ['WOOWOWWXWW', [4]], [[4, True]])],
 [('regression: skip unscheduled days 1', ['WOOOW', [1, 2]], [[1, True], [2, True]]),
  ('regression variant: skip unscheduled days 2', ['WXWOXOWWWOWO', [6]], [[6, True]]),
  ('partial repair guard 3', ['WWOAWOXWWO', [5, 4, 2]], [[2, False], [4, False], [5, False]]),
  ('boundary control 4', ['WXOWX', [2]], [[2, True]]), ('boundary control 5', ['WOOWW', [2]], [[2, True]]),
  ('normal control 6', ['WOWXOWXOO', [1, 2, 5]], [[1, True], [2, True], [5, True]]),
  ('normal control 7', ['WXOWWWOOXW', [2, 9, 6]], [[2, True], [6, True], [9, False]]),
  ('normal control 8', ['WXWOAWWO', [6, 3]], [[3, False], [6, False]])],
 [('regression: skip unscheduled days 1', ['WWOWXXXWO', [3]], [[3, True]]),
  ('regression variant: skip unscheduled days 2', ['AXWWOOW', [2, 5]], [[2, True], [5, True]]),
  ('partial repair guard 3', ['WWXOAWXXWOWO', [10, 11, 9]], [[9, False], [10, False], [11, False]]),
  ('boundary control 4', ['OOWWW', [0]], [[0, False]]), ('boundary control 5', ['OWOOW', [2]], [[2, True]]),
  ('normal control 6', ['WOWOXWOWOOW', [9, 10, 1]], [[1, True], [9, False], [10, False]]),
  ('normal control 7', ['XOOAWWAWWAW', [10, 2]], [[2, False], [10, False]]),
  ('normal control 8', ['WXOWWWOOXW', [2, 9, 6]], [[2, True], [6, True], [9, False]])],
 [('regression: skip unscheduled days 1', ['WOWOWWO', [6, 2, 1]], [[1, True], [2, True], [6, False]]),
  ('regression variant: skip unscheduled days 2', ['OXXWOOOWWO', [9, 3, 6]],
   [[3, True], [6, True], [9, False]]),
  ('partial repair guard 3', ['WWWWOW', [4, 5]], [[4, False], [5, False]]),
  ('boundary control 4', ['WAOWW', [2]], [[2, False]]), ('boundary control 5', ['WWOWA', [2]], [[2, True]]),
  ('normal control 6', ['AWWWWWXWOOWW', [9, 8]], [[8, True], [9, True]]),
  ('normal control 7', ['OOWAWX', [0]], [[0, False]]),
  ('normal control 8', ['WWWWWAOOWW', [6, 9, 7]], [[6, False], [7, False], [9, False]])]]
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: skip unscheduled days 1[[2, True]][[2, True]]Passed
regression variant: skip unscheduled days 2[[9, True]][[9, True]]Passed
partial repair guard 3[[1, True], [9, True], [10, False]][[1, True], [9, False], [10, False]]Failed
boundary control 4[[2, True]][[2, True]]Passed
boundary control 5[[2, False]][[2, False]]Passed
normal control 6[[6, True], [8, False], [11, False]][[6, True], [8, False], [11, False]]Passed
normal control 7[[2, False], [4, False], [5, False]][[2, False], [4, False], [5, False]]Passed
normal control 8[[0, False], [5, True], [6, True]][[0, False], [5, True], [6, True]]Passed

SHA-256 / 9fd2004e76c8018a8c4349adbd32d807bc98a15eaf51d643aa44b1b952abe967

3 / The verified repair

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

N = 1
observations = []
def solve(days, holidays):
    hs = set(holidays)
    ok = ('W', 'X')
    def near(i, step):
        j = i + step
        while 0 <= j < len(days) and (days[j] == 'O' or j in hs):
            j += step
        return days[j] if 0 <= j < len(days) else None
    return [[h, near(h, -1) in ok and near(h, 1) in ok] for h in sorted(holidays)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: skip unscheduled days 1', ['WOOWW', [2]], [[2, True]]),
  ('regression variant: skip unscheduled days 2', ['WXWOWWOOOOWX', [9]], [[9, True]]),
  ('partial repair guard 3', ['WOWOXWOWOOW', [9, 10, 1]], [[1, True], [9, False], [10, False]]),
  ('boundary control 4', ['OWOOW', [2]], [[2, True]]), ('boundary control 5', ['WAOWW', [2]], [[2, False]]),
  ('normal control 6', ['WWWWWWWWWAWO', [11, 6, 8]], [[6, True], [8, False], [11, False]]),
  ('normal control 7', ['WWWAWWO', [4, 5, 2]], [[2, False], [4, False], [5, False]]),
  ('normal control 8', ['WWXAWOOW', [0, 5, 6]], [[0, False], [5, True], [6, True]])],
 [('regression: skip unscheduled days 1', ['OWOOW', [2]], [[2, True]]),
  ('regression variant: skip unscheduled days 2', ['WWOOOWWWAOAX', [3, 4, 7]],
   [[3, True], [4, True], [7, False]]),
  ('partial repair guard 3', ['WOWOWOX', [0, 1, 4]], [[0, False], [1, False], [4, True]]),
  ('boundary control 4', ['WWOWA', [2]], [[2, True]]),
  ('boundary control 5', ['WOOOW', [1, 2]], [[1, True], [2, True]]),
  ('normal control 6', ['WOAOWWAO', [5, 7, 3]], [[3, False], [5, False], [7, False]]),
  ('normal control 7', ['OXOOXAWWXOO', [3, 10, 2]], [[2, True], [3, True], [10, False]]),
  ('normal control 8', ['WOOWOWWXWW', [4]], [[4, True]])],
 [('regression: skip unscheduled days 1', ['WOOOW', [1, 2]], [[1, True], [2, True]]),
  ('regression variant: skip unscheduled days 2', ['WXWOXOWWWOWO', [6]], [[6, True]]),
  ('partial repair guard 3', ['WWOAWOXWWO', [5, 4, 2]], [[2, False], [4, False], [5, False]]),
  ('boundary control 4', ['WXOWX', [2]], [[2, True]]), ('boundary control 5', ['WOOWW', [2]], [[2, True]]),
  ('normal control 6', ['WOWXOWXOO', [1, 2, 5]], [[1, True], [2, True], [5, True]]),
  ('normal control 7', ['WXOWWWOOXW', [2, 9, 6]], [[2, True], [6, True], [9, False]]),
  ('normal control 8', ['WXWOAWWO', [6, 3]], [[3, False], [6, False]])],
 [('regression: skip unscheduled days 1', ['WWOWXXXWO', [3]], [[3, True]]),
  ('regression variant: skip unscheduled days 2', ['AXWWOOW', [2, 5]], [[2, True], [5, True]]),
  ('partial repair guard 3', ['WWXOAWXXWOWO', [10, 11, 9]], [[9, False], [10, False], [11, False]]),
  ('boundary control 4', ['OOWWW', [0]], [[0, False]]), ('boundary control 5', ['OWOOW', [2]], [[2, True]]),
  ('normal control 6', ['WOWOXWOWOOW', [9, 10, 1]], [[1, True], [9, False], [10, False]]),
  ('normal control 7', ['XOOAWWAWWAW', [10, 2]], [[2, False], [10, False]]),
  ('normal control 8', ['WXOWWWOOXW', [2, 9, 6]], [[2, True], [6, True], [9, False]])],
 [('regression: skip unscheduled days 1', ['WOWOWWO', [6, 2, 1]], [[1, True], [2, True], [6, False]]),
  ('regression variant: skip unscheduled days 2', ['OXXWOOOWWO', [9, 3, 6]],
   [[3, True], [6, True], [9, False]]),
  ('partial repair guard 3', ['WWWWOW', [4, 5]], [[4, False], [5, False]]),
  ('boundary control 4', ['WAOWW', [2]], [[2, False]]), ('boundary control 5', ['WWOWA', [2]], [[2, True]]),
  ('normal control 6', ['AWWWWWXWOOWW', [9, 8]], [[8, True], [9, True]]),
  ('normal control 7', ['OOWAWX', [0]], [[0, False]]),
  ('normal control 8', ['WWWWWAOOWW', [6, 9, 7]], [[6, False], [7, False], [9, False]])]]
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: skip unscheduled days 1[[2, True]][[2, True]]Passed
regression variant: skip unscheduled days 2[[9, True]][[9, True]]Passed
partial repair guard 3[[1, True], [9, False], [10, False]][[1, True], [9, False], [10, False]]Passed
boundary control 4[[2, True]][[2, True]]Passed
boundary control 5[[2, False]][[2, False]]Passed
normal control 6[[6, True], [8, False], [11, False]][[6, True], [8, False], [11, False]]Passed
normal control 7[[2, False], [4, False], [5, False]][[2, False], [4, False], [5, False]]Passed
normal control 8[[0, False], [5, True], [6, True]][[0, False], [5, True], [6, True]]Passed

SHA-256 / 885ee4bebd2368dccea78e2249458ad4ca7793fe9c6c17d4cd5b11fc258b84d7

Verification & scope

Stipulated toy labor rule for a bounded roster model; it is not legal advice and does not claim conformance with any jurisdiction, award, or collective agreement. 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:52:02.049573+00:00.

Case digest / 076b14d3b73111c25555ced540ecf49c9dbcc431197c81dbc0f98fc283a799ad