FA-94206 / Shift rostering labor rules / Open access
Holiday pay granted when only one surrounding shift is worked · case 01
Workers who skip the shift after a holiday still receive holiday pay.
ROOT CAUSE
The last-and-first test uses or.
THE FAILURE
The last-and-first test uses or.
Unsuccessful approach: Checking only the prior day ignores the first shift after the 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 (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 or 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: both sides required 1', ['WAOWW', [2]], [[2, False]]),
('regression variant: both sides required 2', ['WXWAAAWW', [7]], [[7, False]]),
('partial repair guard 3', ['OWWOOO', [2, 0]], [[0, False], [2, False]]),
('boundary control 4', ['OWOOW', [2]], [[2, True]]),
('normal control 5', ['WWWWWOWO', [7, 5]], [[5, True], [7, False]]),
('normal control 6', ['OWXWOOAWWW', [0, 5]], [[0, False], [5, False]]),
('normal control 7', ['WAWOWXXW', [3, 4, 2]], [[2, False], [3, False], [4, False]]),
('normal control 8', ['WOXOWXWW', [1]], [[1, True]])],
[('regression: both sides required 1', ['OOWWW', [0]], [[0, False]]),
('regression variant: both sides required 2', ['WWOWWXAOOW', [8, 7]], [[7, False], [8, False]]),
('partial repair guard 3', ['OOWAWWXOWWO', [9]], [[9, False]]),
('boundary control 4', ['WWOWA', [2]], [[2, True]]),
('boundary control 5', ['WOOOW', [1, 2]], [[1, True], [2, True]]),
('normal control 6', ['WOWAWWOWOW', [4, 8, 1]], [[1, True], [4, False], [8, True]]),
('normal control 7', ['WWWWOAXAWWAW', [8, 4]], [[4, False], [8, False]]),
('normal control 8', ['OWOWWX', [3, 4, 0]], [[0, False], [3, True], [4, True]])],
[('regression: both sides required 1', ['OWWXAAXO', [7]], [[7, False]]),
('regression variant: both sides required 2', ['XWWWWWAOOWA', [2, 5, 8]],
[[2, True], [5, False], [8, False]]),
('partial repair guard 3', ['WOAOWWAO', [5, 7, 3]], [[3, False], [5, False], [7, False]]),
('boundary control 4', ['WXOWX', [2]], [[2, True]]), ('boundary control 5', ['WOOWW', [2]], [[2, True]]),
('normal control 6', ['WXWXOWAWWOW', [7, 9, 4]], [[4, True], [7, False], [9, True]]),
('normal control 7', ['WWWWWW', [5, 0]], [[0, False], [5, False]]),
('normal control 8', ['WOAWAAWOWW', [0, 7, 9]], [[0, False], [7, True], [9, False]])],
[('regression: both sides required 1', ['OOAOWW', [3, 1, 0]], [[0, False], [1, False], [3, False]]),
('regression variant: both sides required 2', ['WAOWOXWOXXWO', [4, 2, 6]],
[[2, False], [4, True], [6, True]]),
('partial repair guard 3', ['XOOXOW', [1, 4, 5]], [[1, True], [4, False], [5, False]]),
('boundary control 4', ['OOWWW', [0]], [[0, False]]), ('boundary control 5', ['OWOOW', [2]], [[2, True]]),
('normal control 6', ['XOOWWWWWAO', [2, 6]], [[2, True], [6, True]]),
('normal control 7', ['OWAAOOA', [5, 0, 4]], [[0, False], [4, False], [5, False]]),
('normal control 8', ['OAWWOWAWX', [0]], [[0, False]])],
[('regression: both sides required 1', ['WOWOWWO', [6, 2, 1]], [[1, True], [2, True], [6, False]]),
('regression variant: both sides required 2', ['OWAAWWWWOOW', [9, 0, 8]],
[[0, False], [8, True], [9, True]]),
('partial repair guard 3', ['WWWXWOOWO', [4, 6, 8]], [[4, True], [6, True], [8, False]]),
('boundary control 4', ['WAOWW', [2]], [[2, False]]), ('boundary control 5', ['WWOWA', [2]], [[2, True]]),
('normal control 6', ['WWWOWWAX', [4]], [[4, True]]),
('normal control 7', ['OOAOOW', [1, 3, 0]], [[0, False], [1, False], [3, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: both sides required 1 | [[2, True]] | [[2, False]] | Failed |
| regression variant: both sides required 2 | [[7, True]] | [[7, False]] | Failed |
| partial repair guard 3 | [[0, True], [2, True]] | [[0, False], [2, False]] | Failed |
| boundary control 4 | [[2, True]] | [[2, True]] | Passed |
| normal control 5 | [[5, True], [7, True]] | [[5, True], [7, False]] | Failed |
| normal control 6 | [[0, True], [5, True]] | [[0, False], [5, False]] | Failed |
| normal control 7 | [[2, True], [3, True], [4, True]] | [[2, False], [3, False], [4, False]] | Failed |
| normal control 8 | [[1, True]] | [[1, True]] | Passed |
SHA-256 / 7b88449eb639dc48bf14135c8654ad2bf3fb5a0a556d5ea4291ff805f66b8965
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' or j in hs):
j += step
return days[j] if 0 <= j < len(days) else None
return [[h, 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: both sides required 1', ['WAOWW', [2]], [[2, False]]),
('regression variant: both sides required 2', ['WXWAAAWW', [7]], [[7, False]]),
('partial repair guard 3', ['OWWOOO', [2, 0]], [[0, False], [2, False]]),
('boundary control 4', ['OWOOW', [2]], [[2, True]]),
('normal control 5', ['WWWWWOWO', [7, 5]], [[5, True], [7, False]]),
('normal control 6', ['OWXWOOAWWW', [0, 5]], [[0, False], [5, False]]),
('normal control 7', ['WAWOWXXW', [3, 4, 2]], [[2, False], [3, False], [4, False]]),
('normal control 8', ['WOXOWXWW', [1]], [[1, True]])],
[('regression: both sides required 1', ['OOWWW', [0]], [[0, False]]),
('regression variant: both sides required 2', ['WWOWWXAOOW', [8, 7]], [[7, False], [8, False]]),
('partial repair guard 3', ['OOWAWWXOWWO', [9]], [[9, False]]),
('boundary control 4', ['WWOWA', [2]], [[2, True]]),
('boundary control 5', ['WOOOW', [1, 2]], [[1, True], [2, True]]),
('normal control 6', ['WOWAWWOWOW', [4, 8, 1]], [[1, True], [4, False], [8, True]]),
('normal control 7', ['WWWWOAXAWWAW', [8, 4]], [[4, False], [8, False]]),
('normal control 8', ['OWOWWX', [3, 4, 0]], [[0, False], [3, True], [4, True]])],
[('regression: both sides required 1', ['OWWXAAXO', [7]], [[7, False]]),
('regression variant: both sides required 2', ['XWWWWWAOOWA', [2, 5, 8]],
[[2, True], [5, False], [8, False]]),
('partial repair guard 3', ['WOAOWWAO', [5, 7, 3]], [[3, False], [5, False], [7, False]]),
('boundary control 4', ['WXOWX', [2]], [[2, True]]), ('boundary control 5', ['WOOWW', [2]], [[2, True]]),
('normal control 6', ['WXWXOWAWWOW', [7, 9, 4]], [[4, True], [7, False], [9, True]]),
('normal control 7', ['WWWWWW', [5, 0]], [[0, False], [5, False]]),
('normal control 8', ['WOAWAAWOWW', [0, 7, 9]], [[0, False], [7, True], [9, False]])],
[('regression: both sides required 1', ['OOAOWW', [3, 1, 0]], [[0, False], [1, False], [3, False]]),
('regression variant: both sides required 2', ['WAOWOXWOXXWO', [4, 2, 6]],
[[2, False], [4, True], [6, True]]),
('partial repair guard 3', ['XOOXOW', [1, 4, 5]], [[1, True], [4, False], [5, False]]),
('boundary control 4', ['OOWWW', [0]], [[0, False]]), ('boundary control 5', ['OWOOW', [2]], [[2, True]]),
('normal control 6', ['XOOWWWWWAO', [2, 6]], [[2, True], [6, True]]),
('normal control 7', ['OWAAOOA', [5, 0, 4]], [[0, False], [4, False], [5, False]]),
('normal control 8', ['OAWWOWAWX', [0]], [[0, False]])],
[('regression: both sides required 1', ['WOWOWWO', [6, 2, 1]], [[1, True], [2, True], [6, False]]),
('regression variant: both sides required 2', ['OWAAWWWWOOW', [9, 0, 8]],
[[0, False], [8, True], [9, True]]),
('partial repair guard 3', ['WWWXWOOWO', [4, 6, 8]], [[4, True], [6, True], [8, False]]),
('boundary control 4', ['WAOWW', [2]], [[2, False]]), ('boundary control 5', ['WWOWA', [2]], [[2, True]]),
('normal control 6', ['WWWOWWAX', [4]], [[4, True]]),
('normal control 7', ['OOAOOW', [1, 3, 0]], [[0, False], [1, False], [3, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: both sides required 1 | [[2, False]] | [[2, False]] | Passed |
| regression variant: both sides required 2 | [[7, True]] | [[7, False]] | Failed |
| partial repair guard 3 | [[0, False], [2, True]] | [[0, False], [2, False]] | Failed |
| boundary control 4 | [[2, True]] | [[2, True]] | Passed |
| normal control 5 | [[5, True], [7, True]] | [[5, True], [7, False]] | Failed |
| normal control 6 | [[0, False], [5, True]] | [[0, False], [5, False]] | Failed |
| normal control 7 | [[2, False], [3, False], [4, False]] | [[2, False], [3, False], [4, False]] | Passed |
| normal control 8 | [[1, True]] | [[1, True]] | Passed |
SHA-256 / 16247207c97988e6f2d05dc1aee7b5eb6aa67404cbe510571c8a68a2c505dd28
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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.137572+00:00.
Case digest / 86dd94322377846eda37d9e2d8b758a74588e823d3a9b1d878a213d3917fb5e3