FA-94031 / Shift rostering labor rules / Open access
Exactly-threshold night minutes not classified as a night shift · case 01
A shift with exactly three night hours is not treated as night work.
ROOT CAUSE
The night classification comparison is strict.
THE FAILURE
The night classification comparison is strict.
Unsuccessful approach: Multiplying the minute threshold by 60 treats it as hours and almost nothing qualifies.
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 - 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: night shift threshold 1', [[1380, 1560], 180], [180, True]),
('regression variant: night shift threshold 2', [[3780, 4500], 240], [240, True]),
('partial repair guard 3', [[2760, 3480], 240], [420, True]),
('boundary control 4', [[1380, 1559], 180], [179, False]),
('boundary control 5', [[1320, 1800], 180], [420, True]),
('normal control 6', [[3000, 3030], 120], [30, False]),
('normal control 7', [[3780, 4380], 120], [120, True]),
('normal control 8', [[8520, 8700], 180], [120, False])],
[('regression: night shift threshold 1', [[8600, 8780], 180], [180, True]),
('regression variant: night shift threshold 2', [[2880, 3060], 180], [180, True]),
('partial repair guard 3', [[1440, 2253], 180], [360, True]),
('boundary control 4', [[1800, 2400], 180], [0, False]),
('boundary control 5', [[900, 1410], 180], [30, False]),
('normal control 6', [[360, 390], 180], [0, False]), ('normal control 7', [[7500, 8220], 120], [60, False]),
('normal control 8', [[4200, 4230], 180], [0, False])],
[('regression: night shift threshold 1', [[3000, 3600], 240], [240, True]),
('partial repair guard 2', [[1320, 1911], 240], [420, True]),
('boundary control 3', [[1380, 1560], 180], [180, True]),
('boundary control 4', [[120, 480], 180], [240, True]),
('normal control 5', [[2340, 2670], 240], [0, False]),
('normal control 6', [[1260, 2159], 240], [420, True]),
('normal control 7', [[4320, 4920], 240], [360, True]),
('normal control 8', [[4200, 4230], 120], [0, False])],
[('regression: night shift threshold 1', [[8600, 8840], 240], [240, True]),
('regression variant: night shift threshold 2', [[900, 1620], 240], [240, True]),
('partial repair guard 3', [[2820, 3540], 180], [420, True]),
('boundary control 4', [[2940, 3300], 240], [300, True]),
('boundary control 5', [[1380, 1559], 180], [179, False]),
('normal control 6', [[6060, 6300], 240], [60, False]),
('normal control 7', [[7020, 7260], 120], [120, True]),
('normal control 8', [[4102, 4282], 180], [22, False])],
[('regression: night shift threshold 1', [[5820, 6000], 180], [180, True]),
('regression variant: night shift threshold 2', [[2700, 2940], 120], [120, True]),
('boundary control 3', [[1320, 1800], 180], [420, True]),
('boundary control 4', [[1800, 2400], 180], [0, False]),
('normal control 5', [[6180, 6256], 240], [0, False]),
('normal control 6', [[4200, 4230], 240], [0, False]),
('normal control 7', [[2700, 2880], 120], [60, False]),
('normal control 8', [[6060, 6300], 240], [60, 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: night shift threshold 1 | [180, False] | [180, True] | Failed |
| regression variant: night shift threshold 2 | [240, False] | [240, True] | Failed |
| partial repair guard 3 | [420, True] | [420, True] | Passed |
| boundary control 4 | [179, False] | [179, False] | Passed |
| boundary control 5 | [420, True] | [420, True] | Passed |
| normal control 6 | [30, False] | [30, False] | Passed |
| normal control 7 | [120, False] | [120, True] | Failed |
| normal control 8 | [120, False] | [120, False] | Passed |
SHA-256 / 494a2670c54f2ae6a0117f60be9d8bc3c288623bed96542e88eac85fc0e3f916
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 - 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 * 60]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: night shift threshold 1', [[1380, 1560], 180], [180, True]),
('regression variant: night shift threshold 2', [[3780, 4500], 240], [240, True]),
('partial repair guard 3', [[2760, 3480], 240], [420, True]),
('boundary control 4', [[1380, 1559], 180], [179, False]),
('boundary control 5', [[1320, 1800], 180], [420, True]),
('normal control 6', [[3000, 3030], 120], [30, False]),
('normal control 7', [[3780, 4380], 120], [120, True]),
('normal control 8', [[8520, 8700], 180], [120, False])],
[('regression: night shift threshold 1', [[8600, 8780], 180], [180, True]),
('regression variant: night shift threshold 2', [[2880, 3060], 180], [180, True]),
('partial repair guard 3', [[1440, 2253], 180], [360, True]),
('boundary control 4', [[1800, 2400], 180], [0, False]),
('boundary control 5', [[900, 1410], 180], [30, False]),
('normal control 6', [[360, 390], 180], [0, False]), ('normal control 7', [[7500, 8220], 120], [60, False]),
('normal control 8', [[4200, 4230], 180], [0, False])],
[('regression: night shift threshold 1', [[3000, 3600], 240], [240, True]),
('partial repair guard 2', [[1320, 1911], 240], [420, True]),
('boundary control 3', [[1380, 1560], 180], [180, True]),
('boundary control 4', [[120, 480], 180], [240, True]),
('normal control 5', [[2340, 2670], 240], [0, False]),
('normal control 6', [[1260, 2159], 240], [420, True]),
('normal control 7', [[4320, 4920], 240], [360, True]),
('normal control 8', [[4200, 4230], 120], [0, False])],
[('regression: night shift threshold 1', [[8600, 8840], 240], [240, True]),
('regression variant: night shift threshold 2', [[900, 1620], 240], [240, True]),
('partial repair guard 3', [[2820, 3540], 180], [420, True]),
('boundary control 4', [[2940, 3300], 240], [300, True]),
('boundary control 5', [[1380, 1559], 180], [179, False]),
('normal control 6', [[6060, 6300], 240], [60, False]),
('normal control 7', [[7020, 7260], 120], [120, True]),
('normal control 8', [[4102, 4282], 180], [22, False])],
[('regression: night shift threshold 1', [[5820, 6000], 180], [180, True]),
('regression variant: night shift threshold 2', [[2700, 2940], 120], [120, True]),
('boundary control 3', [[1320, 1800], 180], [420, True]),
('boundary control 4', [[1800, 2400], 180], [0, False]),
('normal control 5', [[6180, 6256], 240], [0, False]),
('normal control 6', [[4200, 4230], 240], [0, False]),
('normal control 7', [[2700, 2880], 120], [60, False]),
('normal control 8', [[6060, 6300], 240], [60, 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: night shift threshold 1 | [180, False] | [180, True] | Failed |
| regression variant: night shift threshold 2 | [240, False] | [240, True] | Failed |
| partial repair guard 3 | [420, False] | [420, True] | Failed |
| boundary control 4 | [179, False] | [179, False] | Passed |
| boundary control 5 | [420, False] | [420, True] | Failed |
| normal control 6 | [30, False] | [30, False] | Passed |
| normal control 7 | [120, False] | [120, True] | Failed |
| normal control 8 | [120, False] | [120, False] | Passed |
SHA-256 / ff6d4b2cc047ac212e957d7eca49ccf194d72c76b6d696b58baf9ca9495242e8
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:00.632231+00:00.
Case digest / cfbfdb35e27fe4721a4370580e5607f4694f9524640fd819dcd4a4d4ae431ae7