FA-94051 / Shift rostering labor rules / Open access
Differential pay truncated to the cent · case 01
Shift pay that ends in half a cent or more loses a cent.
ROOT CAUSE
The exact total is floor-divided.
THE FAILURE
The exact total is floor-divided.
Unsuccessful approach: round() applies banker's rounding to exact half cents.
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 >= 5:
pct = max(pct, 12)
total += base * (100 + pct)
return total // 6000
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: differential rounding 1', [[0, 1], 30], 1),
('regression variant: differential rounding 2', [[2880, 2940], 2150], 2473),
('partial repair guard 3', [[9600, 10320], 2150], 29219),
('boundary control 4', [[8580, 8700], 2000], 4600), ('boundary control 5', [[900, 960], 1800], 1980),
('normal control 6', [[3840, 4440], 2000], 22300), ('normal control 7', [[2061, 2541], 2000], 16670),
('normal control 8', [[7620, 7860], 90], 403)],
[('regression: differential rounding 1', [[0, 3], 10], 1),
('regression variant: differential rounding 2', [[9960, 10020], 90], 101),
('partial repair guard 3', [[6720, 7200], 90], 797), ('boundary control 4', [[8580, 8700], 2000], 4600),
('normal control 5', [[7620, 8340], 2000], 26880), ('normal control 6', [[1800, 2280], 2000], 16300),
('normal control 7', [[8313, 8373], 60], 67), ('normal control 8', [[7620, 8220], 2000], 22400)],
[('regression: differential rounding 1', [[480, 960], 1999], 16192),
('regression variant: differential rounding 2', [[7200, 7920], 90], 1229),
('partial repair guard 3', [[9540, 10224], 2150], 27671),
('boundary control 4', [[6600, 7260], 2000], 24200), ('boundary control 5', [[0, 3], 10], 1),
('normal control 6', [[4561, 4804], 60], 270), ('normal control 7', [[4200, 4680], 60], 549),
('normal control 8', [[3780, 4380], 2000], 22200)],
[('regression: differential rounding 1', [[6720, 7320], 1999], 22289),
('regression variant: differential rounding 2', [[9600, 10320], 2150], 29219),
('partial repair guard 3', [[1800, 2040], 2150], 8923), ('boundary control 4', [[1320, 1500], 60], 204),
('boundary control 5', [[6600, 7260], 2000], 24200), ('normal control 6', [[9480, 10080], 60], 674),
('normal control 7', [[2340, 3060], 90], 1206), ('normal control 8', [[7080, 7140], 1999], 2199)],
[('regression: differential rounding 1', [[9000, 9600], 90], 1011),
('regression variant: differential rounding 2', [[5220, 5775], 2150], 22011),
('partial repair guard 3', [[1440, 2040], 90], 995), ('boundary control 4', [[480, 960], 1999], 16192),
('boundary control 5', [[1320, 1500], 60], 204), ('normal control 6', [[5763, 5823], 60], 69),
('normal control 7', [[8040, 8520], 2150], 19264), ('normal control 8', [[9540, 10020], 1999], 17911)]]
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: differential rounding 1 | 0 | 1 | Failed |
| regression variant: differential rounding 2 | 2472 | 2473 | Failed |
| partial repair guard 3 | 29218 | 29219 | Failed |
| boundary control 4 | 4600 | 4600 | Passed |
| boundary control 5 | 1980 | 1980 | Passed |
| normal control 6 | 22300 | 22300 | Passed |
| normal control 7 | 16670 | 16670 | Passed |
| normal control 8 | 403 | 403 | Passed |
SHA-256 / e90d432b3a6ed7f6f3a5ce1b7a9a7ac2f4e6f3e7835a1eabab21d7d3b8829b4e
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 >= 5:
pct = max(pct, 12)
total += base * (100 + pct)
return round(total / 6000)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: differential rounding 1', [[0, 1], 30], 1),
('regression variant: differential rounding 2', [[2880, 2940], 2150], 2473),
('partial repair guard 3', [[9600, 10320], 2150], 29219),
('boundary control 4', [[8580, 8700], 2000], 4600), ('boundary control 5', [[900, 960], 1800], 1980),
('normal control 6', [[3840, 4440], 2000], 22300), ('normal control 7', [[2061, 2541], 2000], 16670),
('normal control 8', [[7620, 7860], 90], 403)],
[('regression: differential rounding 1', [[0, 3], 10], 1),
('regression variant: differential rounding 2', [[9960, 10020], 90], 101),
('partial repair guard 3', [[6720, 7200], 90], 797), ('boundary control 4', [[8580, 8700], 2000], 4600),
('normal control 5', [[7620, 8340], 2000], 26880), ('normal control 6', [[1800, 2280], 2000], 16300),
('normal control 7', [[8313, 8373], 60], 67), ('normal control 8', [[7620, 8220], 2000], 22400)],
[('regression: differential rounding 1', [[480, 960], 1999], 16192),
('regression variant: differential rounding 2', [[7200, 7920], 90], 1229),
('partial repair guard 3', [[9540, 10224], 2150], 27671),
('boundary control 4', [[6600, 7260], 2000], 24200), ('boundary control 5', [[0, 3], 10], 1),
('normal control 6', [[4561, 4804], 60], 270), ('normal control 7', [[4200, 4680], 60], 549),
('normal control 8', [[3780, 4380], 2000], 22200)],
[('regression: differential rounding 1', [[6720, 7320], 1999], 22289),
('regression variant: differential rounding 2', [[9600, 10320], 2150], 29219),
('partial repair guard 3', [[1800, 2040], 2150], 8923), ('boundary control 4', [[1320, 1500], 60], 204),
('boundary control 5', [[6600, 7260], 2000], 24200), ('normal control 6', [[9480, 10080], 60], 674),
('normal control 7', [[2340, 3060], 90], 1206), ('normal control 8', [[7080, 7140], 1999], 2199)],
[('regression: differential rounding 1', [[9000, 9600], 90], 1011),
('regression variant: differential rounding 2', [[5220, 5775], 2150], 22011),
('partial repair guard 3', [[1440, 2040], 90], 995), ('boundary control 4', [[480, 960], 1999], 16192),
('boundary control 5', [[1320, 1500], 60], 204), ('normal control 6', [[5763, 5823], 60], 69),
('normal control 7', [[8040, 8520], 2150], 19264), ('normal control 8', [[9540, 10020], 1999], 17911)]]
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: differential rounding 1 | 1 | 1 | Passed |
| regression variant: differential rounding 2 | 2472 | 2473 | Failed |
| partial repair guard 3 | 29218 | 29219 | Failed |
| boundary control 4 | 4600 | 4600 | Passed |
| boundary control 5 | 1980 | 1980 | Passed |
| normal control 6 | 22300 | 22300 | Passed |
| normal control 7 | 16670 | 16670 | Passed |
| normal control 8 | 403 | 403 | Passed |
SHA-256 / d73b9d15c60f887e8ea31c12a0d8db2539c53d9fce7979d80c54aacda874b6fe
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.712009+00:00.
Case digest / db30892a76144d81855f95eb6bcc26108c14813f5c9a329ed5a3754a1fac3ce7