FA-94266 / Shift rostering labor rules / Open access
Average exactly at the limit flagged · case 01
A worker averaging exactly 48 hours is treated as in breach.
ROOT CAUSE
The limit comparison is inclusive.
VERIFIED REPAIR
Only an average above the limit is a breach.
Unsuccessful approach: Comparing the total against limit * ref misjudges short records.
Case contract
Weeks [worked minutes, excluded leave/sick days]. The reference period needs ref counted weeks: weeks with any excluded day are skipped and replaced by following weeks. If fewer weeks are available, average the counted weeks. Return [counted weeks, floor average, average > limit] or [0, 0, False] when none count.
Why this case matters
Averaged weekly-hours limits require excluding leave weeks and extending the reference period.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(weeks, ref, limit):
counted = []
for m, ex in weeks:
if len(counted) == ref:
break
if ex == 0:
counted.append(m)
if not counted:
return [0, 0, False]
avg = sum(counted) // len(counted)
return [len(counted), avg, avg >= limit]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: limit comparison 1', [[[2880, 0], [2880, 0], [2880, 0]], 3, 2880], [3, 2880, False]),
('regression variant: limit comparison 2', [[[2880, 0], [2881, 0], [3300, 3], [2880, 1]], 5, 2880],
[2, 2880, False]),
('partial repair guard 3', [[[3300, 0], [0, 1], [3000, 0]], 5, 2880], [2, 3150, True]),
('boundary control 4', [[[2000, 1], [3000, 0]], 3, 2880], [1, 3000, True]),
('normal control 5', [[[0, 0], [2880, 0], [3000, 3], [3300, 0]], 3, 2880], [3, 2060, False]),
('normal control 6', [[[0, 0], [2400, 0], [0, 1], [2881, 3]], 5, 2880], [2, 1200, False]),
('normal control 7', [[[2881, 5], [2400, 3], [2881, 1], [0, 5]], 4, 2880], [0, 0, False]),
('normal control 8', [[[0, 3], [1800, 0], [0, 7], [2880, 3], [1800, 7]], 4, 2880], [1, 1800, False])],
[('regression: limit comparison 1',
[[[0, 1], [2880, 0], [2880, 0], [0, 5], [1800, 3], [2400, 7], [3000, 1], [2881, 7], [2880, 5]], 3, 2880],
[2, 2880, False]),
('regression variant: limit comparison 2', [[[2881, 0], [3300, 7], [2880, 0]], 5, 2880], [2, 2880, False]),
('partial repair guard 3', [[[3300, 0], [1800, 3], [0, 5]], 3, 2880], [1, 3300, True]),
('boundary control 4', [[[3000, 0], [1000, 2], [3000, 0], [3000, 0]], 3, 2880], [3, 3000, True]),
('boundary control 5', [[[2000, 1], [3000, 0]], 3, 2880], [1, 3000, True]),
('normal control 6',
[[[3300, 0], [3300, 5], [2881, 1], [2881, 0], [2881, 0], [2400, 1], [2400, 3], [0, 5]], 4, 2880],
[3, 3020, True]),
('normal control 7', [[[2400, 3], [2400, 0], [3300, 1], [3300, 0], [1800, 1]], 5, 2880], [2, 2850, False]),
('normal control 8',
[[[3300, 7], [3300, 1], [2881, 0], [0, 7], [1800, 7], [1800, 0], [0, 3], [3300, 0]], 3, 2880],
[3, 2660, False])],
[('regression: limit comparison 1', [[[2881, 0], [3300, 7], [2880, 0]], 5, 2880], [2, 2880, False]),
('regression variant: limit comparison 2',
[[[1800, 3], [3000, 5], [2880, 0], [3000, 1], [1800, 5], [2880, 1]], 5, 2880], [1, 2880, False]),
('partial repair guard 3', [[[3300, 0], [3300, 0], [2880, 0], [2400, 3], [2400, 7]], 4, 2880],
[3, 3160, True]),
('boundary control 4', [[[3000, 0], [0, 7], [2800, 0], [2900, 0]], 3, 2880], [3, 2900, True]),
('boundary control 5', [[[3000, 0], [1000, 2], [3000, 0], [3000, 0]], 3, 2880], [3, 3000, True]),
('normal control 6', [[[3000, 5], [2881, 1], [3000, 0], [3000, 5], [2881, 0]], 5, 2880], [2, 2940, True]),
('normal control 7',
[[[3000, 0], [2400, 0], [3000, 0], [2880, 0], [2880, 7], [3300, 1], [0, 1], [2400, 5], [3300, 7]], 4,
2880],
[4, 2820, False]),
('normal control 8', [[[1800, 0], [3300, 3], [1800, 7], [2880, 0]], 5, 2880], [2, 2340, False])],
[('regression: limit comparison 1', [[[0, 7], [2880, 0], [2880, 1]], 5, 2880], [1, 2880, False]),
('regression variant: limit comparison 2',
[[[0, 1], [2880, 0], [2880, 0], [0, 5], [1800, 3], [2400, 7], [3000, 1], [2881, 7], [2880, 5]], 3, 2880],
[2, 2880, False]),
('partial repair guard 3', [[[3300, 5], [3000, 7], [2880, 1], [2881, 0], [3300, 0]], 5, 2880],
[2, 3090, True]),
('boundary control 4', [[[2880, 0], [2880, 0], [2880, 0]], 3, 2880], [3, 2880, False]),
('boundary control 5', [[[3000, 0], [0, 7], [2800, 0], [2900, 0]], 3, 2880], [3, 2900, True]),
('normal control 6',
[[[3000, 5], [2400, 0], [3300, 0], [3300, 1], [1800, 3], [3300, 7], [2880, 5], [0, 3]], 4, 2880],
[2, 2850, False]),
('normal control 7', [[[3000, 5], [3000, 1], [1800, 7], [2881, 0], [0, 5]], 4, 2880], [1, 2881, True]),
('normal control 8', [[[2880, 1], [3300, 0], [3300, 3], [2881, 7], [0, 5]], 3, 2880], [1, 3300, True])],
[('regression: limit comparison 1', [[[2400, 7], [0, 1], [3000, 3], [2880, 0]], 3, 2880], [1, 2880, False]),
('regression variant: limit comparison 2', [[[2881, 7], [2880, 0], [2400, 3], [2880, 3]], 3, 2880],
[1, 2880, False]),
('partial repair guard 3', [[[3000, 3], [2881, 0], [3300, 5], [2400, 5], [2881, 3]], 3, 2880],
[1, 2881, True]),
('boundary control 4', [[[2000, 1], [3000, 0]], 3, 2880], [1, 3000, True]),
('boundary control 5', [[[2880, 0], [2880, 0], [2880, 0]], 3, 2880], [3, 2880, False]),
('normal control 6', [[[3000, 0], [3300, 5], [0, 3]], 4, 2880], [1, 3000, True]),
('normal control 7', [[[2881, 0], [2400, 1], [0, 0], [3300, 7], [3000, 1], [2881, 5], [2881, 1]], 4, 2880],
[2, 1440, False]),
('normal control 8', [[[0, 7], [1800, 7], [2400, 0], [2400, 7], [2400, 0], [1800, 5], [2400, 5]], 5, 2880],
[2, 2400, 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: limit comparison 1 | [3, 2880, True] | [3, 2880, False] | Failed |
| regression variant: limit comparison 2 | [2, 2880, True] | [2, 2880, False] | Failed |
| partial repair guard 3 | [2, 3150, True] | [2, 3150, True] | Passed |
| boundary control 4 | [1, 3000, True] | [1, 3000, True] | Passed |
| normal control 5 | [3, 2060, False] | [3, 2060, False] | Passed |
| normal control 6 | [2, 1200, False] | [2, 1200, False] | Passed |
| normal control 7 | [0, 0, False] | [0, 0, False] | Passed |
| normal control 8 | [1, 1800, False] | [1, 1800, False] | Passed |
SHA-256 / dc025bf0c6ea1cf35ac5b133f9c1dce41d29c5bc351214696b46b10cf23975d1
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(weeks, ref, limit):
counted = []
for m, ex in weeks:
if len(counted) == ref:
break
if ex == 0:
counted.append(m)
if not counted:
return [0, 0, False]
avg = sum(counted) // len(counted)
return [len(counted), avg, sum(counted) > limit * ref]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: limit comparison 1', [[[2880, 0], [2880, 0], [2880, 0]], 3, 2880], [3, 2880, False]),
('regression variant: limit comparison 2', [[[2880, 0], [2881, 0], [3300, 3], [2880, 1]], 5, 2880],
[2, 2880, False]),
('partial repair guard 3', [[[3300, 0], [0, 1], [3000, 0]], 5, 2880], [2, 3150, True]),
('boundary control 4', [[[2000, 1], [3000, 0]], 3, 2880], [1, 3000, True]),
('normal control 5', [[[0, 0], [2880, 0], [3000, 3], [3300, 0]], 3, 2880], [3, 2060, False]),
('normal control 6', [[[0, 0], [2400, 0], [0, 1], [2881, 3]], 5, 2880], [2, 1200, False]),
('normal control 7', [[[2881, 5], [2400, 3], [2881, 1], [0, 5]], 4, 2880], [0, 0, False]),
('normal control 8', [[[0, 3], [1800, 0], [0, 7], [2880, 3], [1800, 7]], 4, 2880], [1, 1800, False])],
[('regression: limit comparison 1',
[[[0, 1], [2880, 0], [2880, 0], [0, 5], [1800, 3], [2400, 7], [3000, 1], [2881, 7], [2880, 5]], 3, 2880],
[2, 2880, False]),
('regression variant: limit comparison 2', [[[2881, 0], [3300, 7], [2880, 0]], 5, 2880], [2, 2880, False]),
('partial repair guard 3', [[[3300, 0], [1800, 3], [0, 5]], 3, 2880], [1, 3300, True]),
('boundary control 4', [[[3000, 0], [1000, 2], [3000, 0], [3000, 0]], 3, 2880], [3, 3000, True]),
('boundary control 5', [[[2000, 1], [3000, 0]], 3, 2880], [1, 3000, True]),
('normal control 6',
[[[3300, 0], [3300, 5], [2881, 1], [2881, 0], [2881, 0], [2400, 1], [2400, 3], [0, 5]], 4, 2880],
[3, 3020, True]),
('normal control 7', [[[2400, 3], [2400, 0], [3300, 1], [3300, 0], [1800, 1]], 5, 2880], [2, 2850, False]),
('normal control 8',
[[[3300, 7], [3300, 1], [2881, 0], [0, 7], [1800, 7], [1800, 0], [0, 3], [3300, 0]], 3, 2880],
[3, 2660, False])],
[('regression: limit comparison 1', [[[2881, 0], [3300, 7], [2880, 0]], 5, 2880], [2, 2880, False]),
('regression variant: limit comparison 2',
[[[1800, 3], [3000, 5], [2880, 0], [3000, 1], [1800, 5], [2880, 1]], 5, 2880], [1, 2880, False]),
('partial repair guard 3', [[[3300, 0], [3300, 0], [2880, 0], [2400, 3], [2400, 7]], 4, 2880],
[3, 3160, True]),
('boundary control 4', [[[3000, 0], [0, 7], [2800, 0], [2900, 0]], 3, 2880], [3, 2900, True]),
('boundary control 5', [[[3000, 0], [1000, 2], [3000, 0], [3000, 0]], 3, 2880], [3, 3000, True]),
('normal control 6', [[[3000, 5], [2881, 1], [3000, 0], [3000, 5], [2881, 0]], 5, 2880], [2, 2940, True]),
('normal control 7',
[[[3000, 0], [2400, 0], [3000, 0], [2880, 0], [2880, 7], [3300, 1], [0, 1], [2400, 5], [3300, 7]], 4,
2880],
[4, 2820, False]),
('normal control 8', [[[1800, 0], [3300, 3], [1800, 7], [2880, 0]], 5, 2880], [2, 2340, False])],
[('regression: limit comparison 1', [[[0, 7], [2880, 0], [2880, 1]], 5, 2880], [1, 2880, False]),
('regression variant: limit comparison 2',
[[[0, 1], [2880, 0], [2880, 0], [0, 5], [1800, 3], [2400, 7], [3000, 1], [2881, 7], [2880, 5]], 3, 2880],
[2, 2880, False]),
('partial repair guard 3', [[[3300, 5], [3000, 7], [2880, 1], [2881, 0], [3300, 0]], 5, 2880],
[2, 3090, True]),
('boundary control 4', [[[2880, 0], [2880, 0], [2880, 0]], 3, 2880], [3, 2880, False]),
('boundary control 5', [[[3000, 0], [0, 7], [2800, 0], [2900, 0]], 3, 2880], [3, 2900, True]),
('normal control 6',
[[[3000, 5], [2400, 0], [3300, 0], [3300, 1], [1800, 3], [3300, 7], [2880, 5], [0, 3]], 4, 2880],
[2, 2850, False]),
('normal control 7', [[[3000, 5], [3000, 1], [1800, 7], [2881, 0], [0, 5]], 4, 2880], [1, 2881, True]),
('normal control 8', [[[2880, 1], [3300, 0], [3300, 3], [2881, 7], [0, 5]], 3, 2880], [1, 3300, True])],
[('regression: limit comparison 1', [[[2400, 7], [0, 1], [3000, 3], [2880, 0]], 3, 2880], [1, 2880, False]),
('regression variant: limit comparison 2', [[[2881, 7], [2880, 0], [2400, 3], [2880, 3]], 3, 2880],
[1, 2880, False]),
('partial repair guard 3', [[[3000, 3], [2881, 0], [3300, 5], [2400, 5], [2881, 3]], 3, 2880],
[1, 2881, True]),
('boundary control 4', [[[2000, 1], [3000, 0]], 3, 2880], [1, 3000, True]),
('boundary control 5', [[[2880, 0], [2880, 0], [2880, 0]], 3, 2880], [3, 2880, False]),
('normal control 6', [[[3000, 0], [3300, 5], [0, 3]], 4, 2880], [1, 3000, True]),
('normal control 7', [[[2881, 0], [2400, 1], [0, 0], [3300, 7], [3000, 1], [2881, 5], [2881, 1]], 4, 2880],
[2, 1440, False]),
('normal control 8', [[[0, 7], [1800, 7], [2400, 0], [2400, 7], [2400, 0], [1800, 5], [2400, 5]], 5, 2880],
[2, 2400, 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: limit comparison 1 | [3, 2880, False] | [3, 2880, False] | Passed |
| regression variant: limit comparison 2 | [2, 2880, False] | [2, 2880, False] | Passed |
| partial repair guard 3 | [2, 3150, False] | [2, 3150, True] | Failed |
| boundary control 4 | [1, 3000, False] | [1, 3000, True] | Failed |
| normal control 5 | [3, 2060, False] | [3, 2060, False] | Passed |
| normal control 6 | [2, 1200, False] | [2, 1200, False] | Passed |
| normal control 7 | [0, 0, False] | [0, 0, False] | Passed |
| normal control 8 | [1, 1800, False] | [1, 1800, False] | Passed |
SHA-256 / 5e3124dfa9a115450f65f6bda77b3378538c5bb8bcd72ffce90778bc9e9cd1b7
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(weeks, ref, limit):
counted = []
for m, ex in weeks:
if len(counted) == ref:
break
if ex == 0:
counted.append(m)
if not counted:
return [0, 0, False]
avg = sum(counted) // len(counted)
return [len(counted), avg, avg > limit]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: limit comparison 1', [[[2880, 0], [2880, 0], [2880, 0]], 3, 2880], [3, 2880, False]),
('regression variant: limit comparison 2', [[[2880, 0], [2881, 0], [3300, 3], [2880, 1]], 5, 2880],
[2, 2880, False]),
('partial repair guard 3', [[[3300, 0], [0, 1], [3000, 0]], 5, 2880], [2, 3150, True]),
('boundary control 4', [[[2000, 1], [3000, 0]], 3, 2880], [1, 3000, True]),
('normal control 5', [[[0, 0], [2880, 0], [3000, 3], [3300, 0]], 3, 2880], [3, 2060, False]),
('normal control 6', [[[0, 0], [2400, 0], [0, 1], [2881, 3]], 5, 2880], [2, 1200, False]),
('normal control 7', [[[2881, 5], [2400, 3], [2881, 1], [0, 5]], 4, 2880], [0, 0, False]),
('normal control 8', [[[0, 3], [1800, 0], [0, 7], [2880, 3], [1800, 7]], 4, 2880], [1, 1800, False])],
[('regression: limit comparison 1',
[[[0, 1], [2880, 0], [2880, 0], [0, 5], [1800, 3], [2400, 7], [3000, 1], [2881, 7], [2880, 5]], 3, 2880],
[2, 2880, False]),
('regression variant: limit comparison 2', [[[2881, 0], [3300, 7], [2880, 0]], 5, 2880], [2, 2880, False]),
('partial repair guard 3', [[[3300, 0], [1800, 3], [0, 5]], 3, 2880], [1, 3300, True]),
('boundary control 4', [[[3000, 0], [1000, 2], [3000, 0], [3000, 0]], 3, 2880], [3, 3000, True]),
('boundary control 5', [[[2000, 1], [3000, 0]], 3, 2880], [1, 3000, True]),
('normal control 6',
[[[3300, 0], [3300, 5], [2881, 1], [2881, 0], [2881, 0], [2400, 1], [2400, 3], [0, 5]], 4, 2880],
[3, 3020, True]),
('normal control 7', [[[2400, 3], [2400, 0], [3300, 1], [3300, 0], [1800, 1]], 5, 2880], [2, 2850, False]),
('normal control 8',
[[[3300, 7], [3300, 1], [2881, 0], [0, 7], [1800, 7], [1800, 0], [0, 3], [3300, 0]], 3, 2880],
[3, 2660, False])],
[('regression: limit comparison 1', [[[2881, 0], [3300, 7], [2880, 0]], 5, 2880], [2, 2880, False]),
('regression variant: limit comparison 2',
[[[1800, 3], [3000, 5], [2880, 0], [3000, 1], [1800, 5], [2880, 1]], 5, 2880], [1, 2880, False]),
('partial repair guard 3', [[[3300, 0], [3300, 0], [2880, 0], [2400, 3], [2400, 7]], 4, 2880],
[3, 3160, True]),
('boundary control 4', [[[3000, 0], [0, 7], [2800, 0], [2900, 0]], 3, 2880], [3, 2900, True]),
('boundary control 5', [[[3000, 0], [1000, 2], [3000, 0], [3000, 0]], 3, 2880], [3, 3000, True]),
('normal control 6', [[[3000, 5], [2881, 1], [3000, 0], [3000, 5], [2881, 0]], 5, 2880], [2, 2940, True]),
('normal control 7',
[[[3000, 0], [2400, 0], [3000, 0], [2880, 0], [2880, 7], [3300, 1], [0, 1], [2400, 5], [3300, 7]], 4,
2880],
[4, 2820, False]),
('normal control 8', [[[1800, 0], [3300, 3], [1800, 7], [2880, 0]], 5, 2880], [2, 2340, False])],
[('regression: limit comparison 1', [[[0, 7], [2880, 0], [2880, 1]], 5, 2880], [1, 2880, False]),
('regression variant: limit comparison 2',
[[[0, 1], [2880, 0], [2880, 0], [0, 5], [1800, 3], [2400, 7], [3000, 1], [2881, 7], [2880, 5]], 3, 2880],
[2, 2880, False]),
('partial repair guard 3', [[[3300, 5], [3000, 7], [2880, 1], [2881, 0], [3300, 0]], 5, 2880],
[2, 3090, True]),
('boundary control 4', [[[2880, 0], [2880, 0], [2880, 0]], 3, 2880], [3, 2880, False]),
('boundary control 5', [[[3000, 0], [0, 7], [2800, 0], [2900, 0]], 3, 2880], [3, 2900, True]),
('normal control 6',
[[[3000, 5], [2400, 0], [3300, 0], [3300, 1], [1800, 3], [3300, 7], [2880, 5], [0, 3]], 4, 2880],
[2, 2850, False]),
('normal control 7', [[[3000, 5], [3000, 1], [1800, 7], [2881, 0], [0, 5]], 4, 2880], [1, 2881, True]),
('normal control 8', [[[2880, 1], [3300, 0], [3300, 3], [2881, 7], [0, 5]], 3, 2880], [1, 3300, True])],
[('regression: limit comparison 1', [[[2400, 7], [0, 1], [3000, 3], [2880, 0]], 3, 2880], [1, 2880, False]),
('regression variant: limit comparison 2', [[[2881, 7], [2880, 0], [2400, 3], [2880, 3]], 3, 2880],
[1, 2880, False]),
('partial repair guard 3', [[[3000, 3], [2881, 0], [3300, 5], [2400, 5], [2881, 3]], 3, 2880],
[1, 2881, True]),
('boundary control 4', [[[2000, 1], [3000, 0]], 3, 2880], [1, 3000, True]),
('boundary control 5', [[[2880, 0], [2880, 0], [2880, 0]], 3, 2880], [3, 2880, False]),
('normal control 6', [[[3000, 0], [3300, 5], [0, 3]], 4, 2880], [1, 3000, True]),
('normal control 7', [[[2881, 0], [2400, 1], [0, 0], [3300, 7], [3000, 1], [2881, 5], [2881, 1]], 4, 2880],
[2, 1440, False]),
('normal control 8', [[[0, 7], [1800, 7], [2400, 0], [2400, 7], [2400, 0], [1800, 5], [2400, 5]], 5, 2880],
[2, 2400, 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: limit comparison 1 | [3, 2880, False] | [3, 2880, False] | Passed |
| regression variant: limit comparison 2 | [2, 2880, False] | [2, 2880, False] | Passed |
| partial repair guard 3 | [2, 3150, True] | [2, 3150, True] | Passed |
| boundary control 4 | [1, 3000, True] | [1, 3000, True] | Passed |
| normal control 5 | [3, 2060, False] | [3, 2060, False] | Passed |
| normal control 6 | [2, 1200, False] | [2, 1200, False] | Passed |
| normal control 7 | [0, 0, False] | [0, 0, False] | Passed |
| normal control 8 | [1, 1800, False] | [1, 1800, False] | Passed |
SHA-256 / 300cdf939fae757f04a04a02e8d584dc6a006d82cab2872ac5ee4b172ae18838
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.718388+00:00.
Case digest / 2ab57d5fdc82c305f6682ce518378ca7dd1b958f3666707748ac8bb20c1c85e4