FA-94046 / Shift rostering labor rules / Open access
Night differential window never matches across midnight · case 01
No minute ever earns the night differential.
ROOT CAUSE
The wrapped night test combines both bounds with and.
VERIFIED REPAIR
Night minutes are those at or after 23:00 or before 07:00.
Unsuccessful approach: Extending the window past 1440 cannot match minute-of-day values after midnight.
Case contract
Shift [start, end] in minutes from Monday 00:00 and a base rate in cents per hour. Each minute earns base * (100 + pct) / 6000 cents where pct is 10 for 15:00-23:00, 15 for 23:00-07:00, else 0; on Saturday and Sunday (days 5 and 6) pct is the larger of that value and 12 (differentials do not stack). The exact total is rounded half up to a cent once.
Why this case matters
Shift differential calculations are where roster data meets payroll; stacking and day attribution errors are common.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(shift, base):
s, e = shift
total = 0
for t in range(s, e):
day = (t // 1440) % 7
m = t % 1440
pct = 0
if 900 <= m < 1380:
pct = 10
if m >= 1380 and m < 420:
pct = 15
if day >= 5:
pct = max(pct, 12)
total += base * (100 + pct)
return (total + 3000) // 6000
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: night window wrap 1', [[6600, 7260], 2000], 24200),
('regression variant: night window wrap 2', [[1800, 1880], 2000], 2967),
('partial repair guard 3', [[9000, 9600], 90], 1011), ('boundary control 4', [[8580, 8700], 2000], 4600),
('boundary control 5', [[900, 960], 1800], 1980), ('normal control 6', [[2061, 2541], 2000], 16670),
('normal control 7', [[420, 480], 2000], 2000), ('normal control 8', [[4680, 5400], 90], 1121)],
[('regression: night window wrap 1', [[7200, 7800], 2000], 22820),
('regression variant: night window wrap 2', [[7560, 7800], 2000], 9020),
('partial repair guard 3', [[8640, 9031], 1800], 13490), ('boundary control 4', [[0, 3], 10], 1),
('boundary control 5', [[8580, 8700], 2000], 4600), ('normal control 6', [[2820, 3300], 2000], 18400),
('normal control 7', [[9960, 10020], 1800], 2016), ('normal control 8', [[8040, 8760], 2150], 29090)],
[('regression: night window wrap 1', [[8580, 8700], 2000], 4600),
('regression variant: night window wrap 2', [[5700, 6180], 90], 828),
('partial repair guard 3', [[8580, 9300], 60], 821), ('boundary control 4', [[6600, 7260], 2000], 24200),
('boundary control 5', [[0, 3], 10], 1), ('normal control 6', [[9184, 9244], 2000], 2240),
('normal control 7', [[9023, 9623], 1800], 20193), ('normal control 8', [[360, 1080], 1800], 22410)],
[('regression: night window wrap 1', [[1320, 1500], 60], 204),
('regression variant: night window wrap 2', [[1440, 2040], 90], 995),
('partial repair guard 3', [[2820, 3394], 1999], 21523),
('boundary control 4', [[6600, 7260], 2000], 24200), ('normal control 5', [[3780, 4380], 90], 999),
('normal control 6', [[9480, 9960], 90], 806), ('normal control 7', [[4200, 4920], 90], 1197),
('normal control 8', [[5160, 5760], 2150], 23543)],
[('regression: night window wrap 1', [[6720, 7320], 1999], 22289),
('regression variant: night window wrap 2', [[7200, 7920], 90], 1229),
('partial repair guard 3', [[8580, 9215], 1999], 24175), ('boundary control 4', [[480, 960], 1999], 16192),
('boundary control 5', [[1320, 1500], 60], 204), ('normal control 6', [[5220, 5280], 1800], 1980),
('normal control 7', [[2400, 3120], 2000], 26900), ('normal control 8', [[2340, 2580], 1999], 8796)]]
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 window wrap 1 | 23840 | 24200 | Failed |
| regression variant: night window wrap 2 | 2667 | 2967 | Failed |
| partial repair guard 3 | 1008 | 1011 | Failed |
| boundary control 4 | 4480 | 4600 | Failed |
| boundary control 5 | 1980 | 1980 | Passed |
| normal control 6 | 16670 | 16670 | Passed |
| normal control 7 | 2000 | 2000 | Passed |
| normal control 8 | 1107 | 1121 | Failed |
SHA-256 / 2d1b08a7666bba6fd0bfa6a0e02d91684ff3ce7298595703dee4a24c76c23484
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(shift, base):
s, e = shift
total = 0
for t in range(s, e):
day = (t // 1440) % 7
m = t % 1440
pct = 0
if 900 <= m < 1380:
pct = 10
if 1380 <= m < 1860:
pct = 15
if day >= 5:
pct = max(pct, 12)
total += base * (100 + pct)
return (total + 3000) // 6000
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: night window wrap 1', [[6600, 7260], 2000], 24200),
('regression variant: night window wrap 2', [[1800, 1880], 2000], 2967),
('partial repair guard 3', [[9000, 9600], 90], 1011), ('boundary control 4', [[8580, 8700], 2000], 4600),
('boundary control 5', [[900, 960], 1800], 1980), ('normal control 6', [[2061, 2541], 2000], 16670),
('normal control 7', [[420, 480], 2000], 2000), ('normal control 8', [[4680, 5400], 90], 1121)],
[('regression: night window wrap 1', [[7200, 7800], 2000], 22820),
('regression variant: night window wrap 2', [[7560, 7800], 2000], 9020),
('partial repair guard 3', [[8640, 9031], 1800], 13490), ('boundary control 4', [[0, 3], 10], 1),
('boundary control 5', [[8580, 8700], 2000], 4600), ('normal control 6', [[2820, 3300], 2000], 18400),
('normal control 7', [[9960, 10020], 1800], 2016), ('normal control 8', [[8040, 8760], 2150], 29090)],
[('regression: night window wrap 1', [[8580, 8700], 2000], 4600),
('regression variant: night window wrap 2', [[5700, 6180], 90], 828),
('partial repair guard 3', [[8580, 9300], 60], 821), ('boundary control 4', [[6600, 7260], 2000], 24200),
('boundary control 5', [[0, 3], 10], 1), ('normal control 6', [[9184, 9244], 2000], 2240),
('normal control 7', [[9023, 9623], 1800], 20193), ('normal control 8', [[360, 1080], 1800], 22410)],
[('regression: night window wrap 1', [[1320, 1500], 60], 204),
('regression variant: night window wrap 2', [[1440, 2040], 90], 995),
('partial repair guard 3', [[2820, 3394], 1999], 21523),
('boundary control 4', [[6600, 7260], 2000], 24200), ('normal control 5', [[3780, 4380], 90], 999),
('normal control 6', [[9480, 9960], 90], 806), ('normal control 7', [[4200, 4920], 90], 1197),
('normal control 8', [[5160, 5760], 2150], 23543)],
[('regression: night window wrap 1', [[6720, 7320], 1999], 22289),
('regression variant: night window wrap 2', [[7200, 7920], 90], 1229),
('partial repair guard 3', [[8580, 9215], 1999], 24175), ('boundary control 4', [[480, 960], 1999], 16192),
('boundary control 5', [[1320, 1500], 60], 204), ('normal control 6', [[5220, 5280], 1800], 1980),
('normal control 7', [[2400, 3120], 2000], 26900), ('normal control 8', [[2340, 2580], 1999], 8796)]]
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 window wrap 1 | 24140 | 24200 | Failed |
| regression variant: night window wrap 2 | 2667 | 2967 | Failed |
| partial repair guard 3 | 1008 | 1011 | Failed |
| boundary control 4 | 4540 | 4600 | Failed |
| boundary control 5 | 1980 | 1980 | Passed |
| normal control 6 | 16670 | 16670 | Passed |
| normal control 7 | 2000 | 2000 | Passed |
| normal control 8 | 1107 | 1121 | Failed |
SHA-256 / 83929d6dcd541baf97a22c5693f6036c72c828488bf9eb398c0a526139fc6e8c
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(shift, base):
s, e = shift
total = 0
for t in range(s, e):
day = (t // 1440) % 7
m = t % 1440
pct = 0
if 900 <= m < 1380:
pct = 10
if m >= 1380 or m < 420:
pct = 15
if day >= 5:
pct = max(pct, 12)
total += base * (100 + pct)
return (total + 3000) // 6000
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: night window wrap 1', [[6600, 7260], 2000], 24200),
('regression variant: night window wrap 2', [[1800, 1880], 2000], 2967),
('partial repair guard 3', [[9000, 9600], 90], 1011), ('boundary control 4', [[8580, 8700], 2000], 4600),
('boundary control 5', [[900, 960], 1800], 1980), ('normal control 6', [[2061, 2541], 2000], 16670),
('normal control 7', [[420, 480], 2000], 2000), ('normal control 8', [[4680, 5400], 90], 1121)],
[('regression: night window wrap 1', [[7200, 7800], 2000], 22820),
('regression variant: night window wrap 2', [[7560, 7800], 2000], 9020),
('partial repair guard 3', [[8640, 9031], 1800], 13490), ('boundary control 4', [[0, 3], 10], 1),
('boundary control 5', [[8580, 8700], 2000], 4600), ('normal control 6', [[2820, 3300], 2000], 18400),
('normal control 7', [[9960, 10020], 1800], 2016), ('normal control 8', [[8040, 8760], 2150], 29090)],
[('regression: night window wrap 1', [[8580, 8700], 2000], 4600),
('regression variant: night window wrap 2', [[5700, 6180], 90], 828),
('partial repair guard 3', [[8580, 9300], 60], 821), ('boundary control 4', [[6600, 7260], 2000], 24200),
('boundary control 5', [[0, 3], 10], 1), ('normal control 6', [[9184, 9244], 2000], 2240),
('normal control 7', [[9023, 9623], 1800], 20193), ('normal control 8', [[360, 1080], 1800], 22410)],
[('regression: night window wrap 1', [[1320, 1500], 60], 204),
('regression variant: night window wrap 2', [[1440, 2040], 90], 995),
('partial repair guard 3', [[2820, 3394], 1999], 21523),
('boundary control 4', [[6600, 7260], 2000], 24200), ('normal control 5', [[3780, 4380], 90], 999),
('normal control 6', [[9480, 9960], 90], 806), ('normal control 7', [[4200, 4920], 90], 1197),
('normal control 8', [[5160, 5760], 2150], 23543)],
[('regression: night window wrap 1', [[6720, 7320], 1999], 22289),
('regression variant: night window wrap 2', [[7200, 7920], 90], 1229),
('partial repair guard 3', [[8580, 9215], 1999], 24175), ('boundary control 4', [[480, 960], 1999], 16192),
('boundary control 5', [[1320, 1500], 60], 204), ('normal control 6', [[5220, 5280], 1800], 1980),
('normal control 7', [[2400, 3120], 2000], 26900), ('normal control 8', [[2340, 2580], 1999], 8796)]]
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 window wrap 1 | 24200 | 24200 | Passed |
| regression variant: night window wrap 2 | 2967 | 2967 | Passed |
| partial repair guard 3 | 1011 | 1011 | Passed |
| boundary control 4 | 4600 | 4600 | Passed |
| boundary control 5 | 1980 | 1980 | Passed |
| normal control 6 | 16670 | 16670 | Passed |
| normal control 7 | 2000 | 2000 | Passed |
| normal control 8 | 1121 | 1121 | Passed |
SHA-256 / aa87ab974f27ff15f996e97c61c35b41d733dccc66a7192769a97f20179a8511
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.675817+00:00.
Case digest / a11fc44de8a5f7983d1f37de53e3837f84780a4e227378375dae576b55f857a3