FA-94041 / Shift rostering labor rules / Open access
Weekend detection assumes a Sunday-first week · case 01
Monday minutes receive the weekend premium and Saturday minutes do not.
ROOT CAUSE
Day indices are interpreted with Sunday as day 0.
VERIFIED REPAIR
With Monday as day 0, Saturday and Sunday are days 5 and 6.
Unsuccessful approach: Checking only day 6 still drops Saturday.
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 or m < 420:
pct = 15
if day in (0, 6):
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: weekend day index 1', [[900, 960], 1800], 1980),
('regression variant: weekend day index 2', [[7140, 7860], 1999], 27346),
('partial repair guard 3', [[7080, 7680], 90], 1028), ('boundary control 4', [[8580, 8700], 2000], 4600),
('normal control 5', [[7560, 7620], 1999], 2299), ('normal control 6', [[2820, 3420], 1800], 20160),
('normal control 7', [[360, 840], 90], 734), ('normal control 8', [[3621, 4018], 2000], 14027)],
[('regression: weekend day index 1', [[7200, 7800], 2000], 22820),
('regression variant: weekend day index 2', [[900, 1140], 1999], 8796),
('partial repair guard 3', [[8040, 8100], 1999], 2239), ('boundary control 4', [[0, 3], 10], 1),
('boundary control 5', [[8580, 8700], 2000], 4600), ('normal control 6', [[9068, 9123], 1800], 1848),
('normal control 7', [[2820, 3420], 1800], 20160), ('normal control 8', [[3240, 3953], 2150], 26492)],
[('regression: weekend day index 1', [[1320, 1500], 60], 204),
('regression variant: weekend day index 2', [[7560, 8069], 1999], 19053),
('partial repair guard 3', [[8160, 8760], 60], 677), ('boundary control 4', [[6600, 7260], 2000], 24200),
('boundary control 5', [[0, 3], 10], 1), ('normal control 6', [[4740, 4980], 60], 240),
('normal control 7', [[7140, 7860], 1800], 24624), ('normal control 8', [[3840, 4320], 2000], 17700)],
[('regression: weekend day index 1', [[480, 960], 1999], 16192),
('regression variant: weekend day index 2', [[7560, 8280], 1999], 26927),
('partial repair guard 3', [[8040, 8280], 90], 403), ('boundary control 4', [[1320, 1500], 60], 204),
('boundary control 5', [[6600, 7260], 2000], 24200), ('normal control 6', [[1320, 1920], 2000], 22600),
('normal control 7', [[5220, 5502], 60], 310), ('normal control 8', [[8313, 8373], 60], 67)],
[('regression: weekend day index 1', [[7958, 8472], 1999], 19180),
('regression variant: weekend day index 2', [[10020, 10740], 90], 1188),
('partial repair guard 3', [[8160, 8880], 60], 815), ('boundary control 4', [[480, 960], 1999], 16192),
('boundary control 5', [[1320, 1500], 60], 204), ('normal control 6', [[5760, 6000], 2000], 9200),
('normal control 7', [[6660, 6720], 2150], 2365), ('normal control 8', [[4740, 5460], 2000], 24800)]]
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: weekend day index 1 | 2016 | 1980 | Failed |
| regression variant: weekend day index 2 | 26387 | 27346 | Failed |
| partial repair guard 3 | 1017 | 1028 | Failed |
| boundary control 4 | 4600 | 4600 | Passed |
| normal control 5 | 2299 | 2299 | Passed |
| normal control 6 | 20160 | 20160 | Passed |
| normal control 7 | 809 | 734 | Failed |
| normal control 8 | 14027 | 14027 | Passed |
SHA-256 / 9a7528b182f45586f8b1b4ab47df9ec27f77603e720c046f169da16f038f159d
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 m >= 1380 or m < 420:
pct = 15
if day >= 6:
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: weekend day index 1', [[900, 960], 1800], 1980),
('regression variant: weekend day index 2', [[7140, 7860], 1999], 27346),
('partial repair guard 3', [[7080, 7680], 90], 1028), ('boundary control 4', [[8580, 8700], 2000], 4600),
('normal control 5', [[7560, 7620], 1999], 2299), ('normal control 6', [[2820, 3420], 1800], 20160),
('normal control 7', [[360, 840], 90], 734), ('normal control 8', [[3621, 4018], 2000], 14027)],
[('regression: weekend day index 1', [[7200, 7800], 2000], 22820),
('regression variant: weekend day index 2', [[900, 1140], 1999], 8796),
('partial repair guard 3', [[8040, 8100], 1999], 2239), ('boundary control 4', [[0, 3], 10], 1),
('boundary control 5', [[8580, 8700], 2000], 4600), ('normal control 6', [[9068, 9123], 1800], 1848),
('normal control 7', [[2820, 3420], 1800], 20160), ('normal control 8', [[3240, 3953], 2150], 26492)],
[('regression: weekend day index 1', [[1320, 1500], 60], 204),
('regression variant: weekend day index 2', [[7560, 8069], 1999], 19053),
('partial repair guard 3', [[8160, 8760], 60], 677), ('boundary control 4', [[6600, 7260], 2000], 24200),
('boundary control 5', [[0, 3], 10], 1), ('normal control 6', [[4740, 4980], 60], 240),
('normal control 7', [[7140, 7860], 1800], 24624), ('normal control 8', [[3840, 4320], 2000], 17700)],
[('regression: weekend day index 1', [[480, 960], 1999], 16192),
('regression variant: weekend day index 2', [[7560, 8280], 1999], 26927),
('partial repair guard 3', [[8040, 8280], 90], 403), ('boundary control 4', [[1320, 1500], 60], 204),
('boundary control 5', [[6600, 7260], 2000], 24200), ('normal control 6', [[1320, 1920], 2000], 22600),
('normal control 7', [[5220, 5502], 60], 310), ('normal control 8', [[8313, 8373], 60], 67)],
[('regression: weekend day index 1', [[7958, 8472], 1999], 19180),
('regression variant: weekend day index 2', [[10020, 10740], 90], 1188),
('partial repair guard 3', [[8160, 8880], 60], 815), ('boundary control 4', [[480, 960], 1999], 16192),
('boundary control 5', [[1320, 1500], 60], 204), ('normal control 6', [[5760, 6000], 2000], 9200),
('normal control 7', [[6660, 6720], 2150], 2365), ('normal control 8', [[4740, 5460], 2000], 24800)]]
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: weekend day index 1 | 1980 | 1980 | Passed |
| regression variant: weekend day index 2 | 26387 | 27346 | Failed |
| partial repair guard 3 | 1017 | 1028 | Failed |
| boundary control 4 | 4600 | 4600 | Passed |
| normal control 5 | 2299 | 2299 | Passed |
| normal control 6 | 20160 | 20160 | Passed |
| normal control 7 | 734 | 734 | Passed |
| normal control 8 | 14027 | 14027 | Passed |
SHA-256 / 32db360b8d8a34494d07a9fca7d9ff24e4e309416093f8ebdf53726213823052
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: weekend day index 1', [[900, 960], 1800], 1980),
('regression variant: weekend day index 2', [[7140, 7860], 1999], 27346),
('partial repair guard 3', [[7080, 7680], 90], 1028), ('boundary control 4', [[8580, 8700], 2000], 4600),
('normal control 5', [[7560, 7620], 1999], 2299), ('normal control 6', [[2820, 3420], 1800], 20160),
('normal control 7', [[360, 840], 90], 734), ('normal control 8', [[3621, 4018], 2000], 14027)],
[('regression: weekend day index 1', [[7200, 7800], 2000], 22820),
('regression variant: weekend day index 2', [[900, 1140], 1999], 8796),
('partial repair guard 3', [[8040, 8100], 1999], 2239), ('boundary control 4', [[0, 3], 10], 1),
('boundary control 5', [[8580, 8700], 2000], 4600), ('normal control 6', [[9068, 9123], 1800], 1848),
('normal control 7', [[2820, 3420], 1800], 20160), ('normal control 8', [[3240, 3953], 2150], 26492)],
[('regression: weekend day index 1', [[1320, 1500], 60], 204),
('regression variant: weekend day index 2', [[7560, 8069], 1999], 19053),
('partial repair guard 3', [[8160, 8760], 60], 677), ('boundary control 4', [[6600, 7260], 2000], 24200),
('boundary control 5', [[0, 3], 10], 1), ('normal control 6', [[4740, 4980], 60], 240),
('normal control 7', [[7140, 7860], 1800], 24624), ('normal control 8', [[3840, 4320], 2000], 17700)],
[('regression: weekend day index 1', [[480, 960], 1999], 16192),
('regression variant: weekend day index 2', [[7560, 8280], 1999], 26927),
('partial repair guard 3', [[8040, 8280], 90], 403), ('boundary control 4', [[1320, 1500], 60], 204),
('boundary control 5', [[6600, 7260], 2000], 24200), ('normal control 6', [[1320, 1920], 2000], 22600),
('normal control 7', [[5220, 5502], 60], 310), ('normal control 8', [[8313, 8373], 60], 67)],
[('regression: weekend day index 1', [[7958, 8472], 1999], 19180),
('regression variant: weekend day index 2', [[10020, 10740], 90], 1188),
('partial repair guard 3', [[8160, 8880], 60], 815), ('boundary control 4', [[480, 960], 1999], 16192),
('boundary control 5', [[1320, 1500], 60], 204), ('normal control 6', [[5760, 6000], 2000], 9200),
('normal control 7', [[6660, 6720], 2150], 2365), ('normal control 8', [[4740, 5460], 2000], 24800)]]
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: weekend day index 1 | 1980 | 1980 | Passed |
| regression variant: weekend day index 2 | 27346 | 27346 | Passed |
| partial repair guard 3 | 1028 | 1028 | Passed |
| boundary control 4 | 4600 | 4600 | Passed |
| normal control 5 | 2299 | 2299 | Passed |
| normal control 6 | 20160 | 20160 | Passed |
| normal control 7 | 734 | 734 | Passed |
| normal control 8 | 14027 | 14027 | Passed |
SHA-256 / 0261f7a97133271e307c43486966736f096e65a5beb400a795ce817c4f5bac04
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.675395+00:00.
Case digest / 666481f8970d112cf8c751a88dc820a9e4901493e1df734009133efafc592b72