FA-94011 / Shift rostering labor rules / Open access
Night window that began the previous evening is skipped · case 01
A shift starting at 02:00 earns no night minutes for its first four hours.
ROOT CAUSE
Night windows are enumerated from the shift start day, missing the window that opened at 23:00 the day before.
VERIFIED REPAIR
Start enumerating night windows one day before the shift start day.
Unsuccessful approach: Adding a window at the end instead of the start still misses the previous evening.
Case contract
A shift [start, end] in absolute minutes (day 0 starts at minute 0) and a night-shift threshold. The night period runs 23:00 to 06:00 across midnight. Return [night minutes, whether night minutes reach the threshold].
Why this case matters
Night-work classification drives night-worker limits and premiums and must handle shifts that start after midnight.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(shift, threshold):
s, e = shift
night = 0
for d in range(s // 1440, e // 1440 + 1):
lo = d * 1440 + 1380
hi = d * 1440 + 1800
night += max(0, min(e, hi) - max(s, lo))
return [night, night >= threshold]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: previous evening window 1', [[120, 480], 180], [240, True]),
('regression variant: previous evening window 2', [[6060, 6300], 240], [60, False]),
('partial repair guard 3', [[7200, 7920], 240], [360, True]),
('boundary control 4', [[1380, 1559], 180], [179, False]),
('boundary control 5', [[1320, 1800], 180], [420, True]),
('normal control 6', [[8100, 8820], 180], [240, True]),
('normal control 7', [[4680, 5160], 180], [0, False]),
('normal control 8', [[5640, 5703], 120], [3, False])],
[('regression: previous evening window 1', [[2940, 3300], 240], [300, True]),
('regression variant: previous evening window 2', [[5760, 6500], 240], [360, True]),
('partial repair guard 3', [[4620, 4800], 180], [60, False]),
('boundary control 4', [[1800, 2400], 180], [0, False]),
('boundary control 5', [[900, 1410], 180], [30, False]),
('normal control 6', [[5720, 6440], 240], [400, True]),
('normal control 7', [[7080, 7560], 240], [420, True]),
('normal control 8', [[8460, 8940], 120], [360, True])],
[('regression: previous evening window 1', [[4380, 4560], 120], [180, True]),
('regression variant: previous evening window 2', [[7200, 7920], 180], [360, True]),
('partial repair guard 3', [[328, 508], 180], [32, False]),
('boundary control 4', [[1380, 1560], 180], [180, True]),
('boundary control 5', [[120, 480], 180], [240, True]),
('normal control 6', [[3000, 3030], 120], [30, False]),
('normal control 7', [[3000, 3480], 240], [240, True]),
('normal control 8', [[5720, 6440], 120], [400, True])],
[('regression: previous evening window 1', [[1560, 2040], 120], [240, True]),
('regression variant: previous evening window 2', [[60, 660], 120], [300, True]),
('partial repair guard 3', [[3000, 3030], 120], [30, False]),
('boundary control 4', [[2940, 3300], 240], [300, True]),
('boundary control 5', [[1380, 1559], 180], [179, False]),
('normal control 6', [[5700, 6300], 180], [420, True]),
('normal control 7', [[3180, 3360], 120], [60, False]),
('normal control 8', [[6060, 6780], 240], [60, False])],
[('regression: previous evening window 1', [[3000, 3600], 240], [240, True]),
('regression variant: previous evening window 2', [[0, 203], 180], [203, True]),
('partial repair guard 3', [[1740, 2220], 240], [60, False]),
('boundary control 4', [[1320, 1800], 180], [420, True]),
('boundary control 5', [[1800, 2400], 180], [0, False]),
('normal control 6', [[4440, 4636], 180], [196, True]), ('normal control 7', [[420, 450], 180], [0, False]),
('normal control 8', [[6120, 6150], 120], [0, 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: previous evening window 1 | [0, False] | [240, True] | Failed |
| regression variant: previous evening window 2 | [0, False] | [60, False] | Failed |
| partial repair guard 3 | [0, False] | [360, True] | Failed |
| boundary control 4 | [179, False] | [179, False] | Passed |
| boundary control 5 | [420, True] | [420, True] | Passed |
| normal control 6 | [240, True] | [240, True] | Passed |
| normal control 7 | [0, False] | [0, False] | Passed |
| normal control 8 | [3, False] | [3, False] | Passed |
SHA-256 / 9638cf5cd90d0016816baa935ec5d406c1040bce34dd4b5535a994093c7ada9f
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(shift, threshold):
s, e = shift
night = 0
for d in range(s // 1440, e // 1440 + 2):
lo = d * 1440 + 1380
hi = d * 1440 + 1800
night += max(0, min(e, hi) - max(s, lo))
return [night, night >= threshold]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: previous evening window 1', [[120, 480], 180], [240, True]),
('regression variant: previous evening window 2', [[6060, 6300], 240], [60, False]),
('partial repair guard 3', [[7200, 7920], 240], [360, True]),
('boundary control 4', [[1380, 1559], 180], [179, False]),
('boundary control 5', [[1320, 1800], 180], [420, True]),
('normal control 6', [[8100, 8820], 180], [240, True]),
('normal control 7', [[4680, 5160], 180], [0, False]),
('normal control 8', [[5640, 5703], 120], [3, False])],
[('regression: previous evening window 1', [[2940, 3300], 240], [300, True]),
('regression variant: previous evening window 2', [[5760, 6500], 240], [360, True]),
('partial repair guard 3', [[4620, 4800], 180], [60, False]),
('boundary control 4', [[1800, 2400], 180], [0, False]),
('boundary control 5', [[900, 1410], 180], [30, False]),
('normal control 6', [[5720, 6440], 240], [400, True]),
('normal control 7', [[7080, 7560], 240], [420, True]),
('normal control 8', [[8460, 8940], 120], [360, True])],
[('regression: previous evening window 1', [[4380, 4560], 120], [180, True]),
('regression variant: previous evening window 2', [[7200, 7920], 180], [360, True]),
('partial repair guard 3', [[328, 508], 180], [32, False]),
('boundary control 4', [[1380, 1560], 180], [180, True]),
('boundary control 5', [[120, 480], 180], [240, True]),
('normal control 6', [[3000, 3030], 120], [30, False]),
('normal control 7', [[3000, 3480], 240], [240, True]),
('normal control 8', [[5720, 6440], 120], [400, True])],
[('regression: previous evening window 1', [[1560, 2040], 120], [240, True]),
('regression variant: previous evening window 2', [[60, 660], 120], [300, True]),
('partial repair guard 3', [[3000, 3030], 120], [30, False]),
('boundary control 4', [[2940, 3300], 240], [300, True]),
('boundary control 5', [[1380, 1559], 180], [179, False]),
('normal control 6', [[5700, 6300], 180], [420, True]),
('normal control 7', [[3180, 3360], 120], [60, False]),
('normal control 8', [[6060, 6780], 240], [60, False])],
[('regression: previous evening window 1', [[3000, 3600], 240], [240, True]),
('regression variant: previous evening window 2', [[0, 203], 180], [203, True]),
('partial repair guard 3', [[1740, 2220], 240], [60, False]),
('boundary control 4', [[1320, 1800], 180], [420, True]),
('boundary control 5', [[1800, 2400], 180], [0, False]),
('normal control 6', [[4440, 4636], 180], [196, True]), ('normal control 7', [[420, 450], 180], [0, False]),
('normal control 8', [[6120, 6150], 120], [0, 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: previous evening window 1 | [0, False] | [240, True] | Failed |
| regression variant: previous evening window 2 | [0, False] | [60, False] | Failed |
| partial repair guard 3 | [0, False] | [360, True] | Failed |
| boundary control 4 | [179, False] | [179, False] | Passed |
| boundary control 5 | [420, True] | [420, True] | Passed |
| normal control 6 | [240, True] | [240, True] | Passed |
| normal control 7 | [0, False] | [0, False] | Passed |
| normal control 8 | [3, False] | [3, False] | Passed |
SHA-256 / 10af7acb385aea5caf992aeb3d5acae98b7c745090076e9299901478f197871a
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(shift, threshold):
s, e = shift
night = 0
for d in range(s // 1440 - 1, e // 1440 + 1):
lo = d * 1440 + 1380
hi = d * 1440 + 1800
night += max(0, min(e, hi) - max(s, lo))
return [night, night >= threshold]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: previous evening window 1', [[120, 480], 180], [240, True]),
('regression variant: previous evening window 2', [[6060, 6300], 240], [60, False]),
('partial repair guard 3', [[7200, 7920], 240], [360, True]),
('boundary control 4', [[1380, 1559], 180], [179, False]),
('boundary control 5', [[1320, 1800], 180], [420, True]),
('normal control 6', [[8100, 8820], 180], [240, True]),
('normal control 7', [[4680, 5160], 180], [0, False]),
('normal control 8', [[5640, 5703], 120], [3, False])],
[('regression: previous evening window 1', [[2940, 3300], 240], [300, True]),
('regression variant: previous evening window 2', [[5760, 6500], 240], [360, True]),
('partial repair guard 3', [[4620, 4800], 180], [60, False]),
('boundary control 4', [[1800, 2400], 180], [0, False]),
('boundary control 5', [[900, 1410], 180], [30, False]),
('normal control 6', [[5720, 6440], 240], [400, True]),
('normal control 7', [[7080, 7560], 240], [420, True]),
('normal control 8', [[8460, 8940], 120], [360, True])],
[('regression: previous evening window 1', [[4380, 4560], 120], [180, True]),
('regression variant: previous evening window 2', [[7200, 7920], 180], [360, True]),
('partial repair guard 3', [[328, 508], 180], [32, False]),
('boundary control 4', [[1380, 1560], 180], [180, True]),
('boundary control 5', [[120, 480], 180], [240, True]),
('normal control 6', [[3000, 3030], 120], [30, False]),
('normal control 7', [[3000, 3480], 240], [240, True]),
('normal control 8', [[5720, 6440], 120], [400, True])],
[('regression: previous evening window 1', [[1560, 2040], 120], [240, True]),
('regression variant: previous evening window 2', [[60, 660], 120], [300, True]),
('partial repair guard 3', [[3000, 3030], 120], [30, False]),
('boundary control 4', [[2940, 3300], 240], [300, True]),
('boundary control 5', [[1380, 1559], 180], [179, False]),
('normal control 6', [[5700, 6300], 180], [420, True]),
('normal control 7', [[3180, 3360], 120], [60, False]),
('normal control 8', [[6060, 6780], 240], [60, False])],
[('regression: previous evening window 1', [[3000, 3600], 240], [240, True]),
('regression variant: previous evening window 2', [[0, 203], 180], [203, True]),
('partial repair guard 3', [[1740, 2220], 240], [60, False]),
('boundary control 4', [[1320, 1800], 180], [420, True]),
('boundary control 5', [[1800, 2400], 180], [0, False]),
('normal control 6', [[4440, 4636], 180], [196, True]), ('normal control 7', [[420, 450], 180], [0, False]),
('normal control 8', [[6120, 6150], 120], [0, 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: previous evening window 1 | [240, True] | [240, True] | Passed |
| regression variant: previous evening window 2 | [60, False] | [60, False] | Passed |
| partial repair guard 3 | [360, True] | [360, True] | Passed |
| boundary control 4 | [179, False] | [179, False] | Passed |
| boundary control 5 | [420, True] | [420, True] | Passed |
| normal control 6 | [240, True] | [240, True] | Passed |
| normal control 7 | [0, False] | [0, False] | Passed |
| normal control 8 | [3, False] | [3, False] | Passed |
SHA-256 / 56ca5d778837db13a1435e95498198e6dbffd014197285affb738559a4b442fe
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:00.381395+00:00.
Case digest / 8b3c2757584d2269a0cae1fbe41a293a9623afc645846c7ad98c7af8b5212d89