FA-93891 / Shift rostering labor rules / Open access
Gross pay truncates half cents instead of rounding half up · case 01
Pay lines ending in exactly half a cent (or more) lose a cent.
ROOT CAUSE
The exact half-cent total is floor-divided.
THE FAILURE
The exact half-cent total is floor-divided.
Unsuccessful approach: Python round() uses banker's rounding, so even-cent halves still round down.
Case contract
Seven daily worked minutes (Mon..Sun) and an hourly rate in cents. Daily: first 480 minutes regular, next 240 at 1.5x, beyond 720 at 2x. If all seven days are worked, day 7 pays its first 480 minutes at 1.5x and the rest at 2x. Regular minutes above 2400 in the week move to 1.5x (daily overtime minutes never count toward the weekly threshold). Pay is computed exactly and rounded half up to a cent once. Return [regular, ot15, ot2, pay_cents].
Why this case matters
Overtime classification mistakes are a classic payroll-roster defect: pyramiding, seventh-day rules and rounding stage all change what workers are paid.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(days, rate):
reg = ot15 = ot2 = 0
seventh = all(m > 0 for m in days)
for d, m in enumerate(days):
if d == 6 and seventh:
ot15 += min(m, 480)
ot2 += max(m - 480, 0)
continue
reg += min(m, 480)
ot15 += min(max(m - 480, 0), 240)
ot2 += max(m - 720, 0)
excess = max(reg - 2400, 0)
reg -= excess
ot15 += excess
units = reg * rate * 2 + ot15 * rate * 3 + ot2 * rate * 4
pay = units // 120
return [reg, ot15, ot2, pay]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: pay rounding mode 1', [[9, 0, 0, 0, 0, 0, 0], 30], [9, 0, 0, 5]),
('regression variant: pay rounding mode 2', [[480, 300, 600, 300, 510, 600, 480], 90],
[2400, 870, 0, 5558]),
('partial repair guard 3', [[900, 0, 480, 600, 165, 0, 540], 2250], [2085, 420, 180, 115313]),
('boundary control 4', [[480, 480, 480, 480, 480, 480, 0], 2000], [2400, 480, 0, 104000]),
('normal control 5', [[0, 600, 480, 480, 900, 600, 780], 30], [2400, 1200, 240, 2340]),
('normal control 6', [[480, 481, 721, 600, 540, 546, 900], 2250], [2400, 1447, 421, 202969]),
('normal control 7', [[300, 480, 480, 300, 510, 300, 480], 90], [2340, 510, 0, 4658]),
('normal control 8', [[510, 510, 600, 480, 300, 600, 480], 1725], [2400, 1080, 0, 115575])],
[('regression: pay rounding mode 1', [[27, 0, 0, 0, 0, 0, 0], 30], [27, 0, 0, 14]),
('regression variant: pay rounding mode 2', [[721, 450, 477, 0, 0, 900, 480], 90], [2367, 480, 181, 5174]),
('partial repair guard 3', [[240, 600, 0, 780, 450, 900, 900], 90], [2400, 1050, 420, 7223]),
('boundary control 4', [[0, 480, 480, 480, 480, 480, 480], 1500], [2400, 480, 0, 78000]),
('boundary control 5', [[480, 480, 480, 480, 480, 480, 0], 2000], [2400, 480, 0, 104000]),
('normal control 6', [[0, 780, 600, 480, 480, 240, 721], 2250], [2400, 840, 61, 141825]),
('normal control 7', [[480, 600, 510, 480, 600, 510, 510], 30], [2400, 1260, 30, 2175]),
('normal control 8', [[721, 540, 0, 600, 480, 540, 0], 2250], [2400, 480, 1, 117075])],
[('regression: pay rounding mode 1', [[300, 600, 300, 600, 510, 600, 480], 90], [2400, 990, 0, 5828]),
('regression variant: pay rounding mode 2', [[300, 600, 480, 300, 600, 600, 300], 1725],
[2400, 780, 0, 102638]),
('partial repair guard 3', [[510, 300, 300, 600, 600, 300, 510], 30], [2340, 750, 30, 1763]),
('boundary control 4', [[27, 0, 0, 0, 0, 0, 0], 30], [27, 0, 0, 14]),
('boundary control 5', [[0, 480, 480, 480, 480, 480, 480], 1500], [2400, 480, 0, 78000]),
('normal control 6', [[0, 0, 481, 780, 874, 721, 92], 30], [2012, 721, 215, 1762]),
('normal control 7', [[481, 0, 900, 240, 540, 900, 480], 2250], [2400, 781, 360, 160931]),
('normal control 8', [[0, 450, 480, 600, 240, 540, 720], 1500], [2400, 630, 0, 83625])],
[('regression: pay rounding mode 1', [[300, 600, 480, 600, 480, 510, 510], 90], [2400, 1050, 30, 6053]),
('regression variant: pay rounding mode 2', [[900, 720, 0, 480, 450, 240, 600], 2250],
[2400, 810, 180, 149063]),
('partial repair guard 3', [[510, 510, 510, 510, 480, 510, 300], 2250], [2400, 930, 0, 142313]),
('boundary control 4', [[600, 600, 600, 600, 600, 0, 0], 1500], [2400, 600, 0, 82500]),
('boundary control 5', [[27, 0, 0, 0, 0, 0, 0], 30], [27, 0, 0, 14]),
('normal control 6', [[300, 480, 300, 300, 480, 600, 600], 2250], [2340, 600, 120, 130500]),
('normal control 7', [[720, 780, 720, 540, 450, 900, 721], 1500], [2400, 1950, 481, 157175]),
('normal control 8', [[300, 300, 480, 510, 510, 600, 600], 1500], [2400, 780, 120, 95250])],
[('regression: pay rounding mode 1', [[481, 119, 900, 256, 240, 20, 480], 2000], [1595, 721, 180, 101217]),
('regression variant: pay rounding mode 2', [[780, 450, 900, 900, 780, 900, 780], 1810],
[2400, 2130, 960, 226703]),
('partial repair guard 3', [[240, 600, 240, 13, 780, 0, 540], 90], [1933, 420, 60, 4025]),
('boundary control 4', [[540, 540, 540, 540, 540, 540, 60], 2000], [2400, 900, 0, 125000]),
('boundary control 5', [[600, 600, 600, 600, 600, 0, 0], 1500], [2400, 600, 0, 82500]),
('normal control 6', [[0, 240, 721, 751, 481, 900, 0], 1810], [2160, 721, 212, 110576]),
('normal control 7', [[600, 600, 600, 480, 600, 600, 600], 1810], [2400, 1560, 120, 150230]),
('normal control 8', [[481, 900, 720, 481, 540, 540, 0], 1725], [2400, 1082, 180, 126011])]]
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: pay rounding mode 1 | [9, 0, 0, 4] | [9, 0, 0, 5] | Failed |
| regression variant: pay rounding mode 2 | [2400, 870, 0, 5557] | [2400, 870, 0, 5558] | Failed |
| partial repair guard 3 | [2085, 420, 180, 115312] | [2085, 420, 180, 115313] | Failed |
| boundary control 4 | [2400, 480, 0, 104000] | [2400, 480, 0, 104000] | Passed |
| normal control 5 | [2400, 1200, 240, 2340] | [2400, 1200, 240, 2340] | Passed |
| normal control 6 | [2400, 1447, 421, 202968] | [2400, 1447, 421, 202969] | Failed |
| normal control 7 | [2340, 510, 0, 4657] | [2340, 510, 0, 4658] | Failed |
| normal control 8 | [2400, 1080, 0, 115575] | [2400, 1080, 0, 115575] | Passed |
SHA-256 / 8883c232bc98449674096942fe7e5089698ef5a2659b97a43c7dbbbf97b6663c
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(days, rate):
reg = ot15 = ot2 = 0
seventh = all(m > 0 for m in days)
for d, m in enumerate(days):
if d == 6 and seventh:
ot15 += min(m, 480)
ot2 += max(m - 480, 0)
continue
reg += min(m, 480)
ot15 += min(max(m - 480, 0), 240)
ot2 += max(m - 720, 0)
excess = max(reg - 2400, 0)
reg -= excess
ot15 += excess
units = reg * rate * 2 + ot15 * rate * 3 + ot2 * rate * 4
pay = round(units / 120)
return [reg, ot15, ot2, pay]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: pay rounding mode 1', [[9, 0, 0, 0, 0, 0, 0], 30], [9, 0, 0, 5]),
('regression variant: pay rounding mode 2', [[480, 300, 600, 300, 510, 600, 480], 90],
[2400, 870, 0, 5558]),
('partial repair guard 3', [[900, 0, 480, 600, 165, 0, 540], 2250], [2085, 420, 180, 115313]),
('boundary control 4', [[480, 480, 480, 480, 480, 480, 0], 2000], [2400, 480, 0, 104000]),
('normal control 5', [[0, 600, 480, 480, 900, 600, 780], 30], [2400, 1200, 240, 2340]),
('normal control 6', [[480, 481, 721, 600, 540, 546, 900], 2250], [2400, 1447, 421, 202969]),
('normal control 7', [[300, 480, 480, 300, 510, 300, 480], 90], [2340, 510, 0, 4658]),
('normal control 8', [[510, 510, 600, 480, 300, 600, 480], 1725], [2400, 1080, 0, 115575])],
[('regression: pay rounding mode 1', [[27, 0, 0, 0, 0, 0, 0], 30], [27, 0, 0, 14]),
('regression variant: pay rounding mode 2', [[721, 450, 477, 0, 0, 900, 480], 90], [2367, 480, 181, 5174]),
('partial repair guard 3', [[240, 600, 0, 780, 450, 900, 900], 90], [2400, 1050, 420, 7223]),
('boundary control 4', [[0, 480, 480, 480, 480, 480, 480], 1500], [2400, 480, 0, 78000]),
('boundary control 5', [[480, 480, 480, 480, 480, 480, 0], 2000], [2400, 480, 0, 104000]),
('normal control 6', [[0, 780, 600, 480, 480, 240, 721], 2250], [2400, 840, 61, 141825]),
('normal control 7', [[480, 600, 510, 480, 600, 510, 510], 30], [2400, 1260, 30, 2175]),
('normal control 8', [[721, 540, 0, 600, 480, 540, 0], 2250], [2400, 480, 1, 117075])],
[('regression: pay rounding mode 1', [[300, 600, 300, 600, 510, 600, 480], 90], [2400, 990, 0, 5828]),
('regression variant: pay rounding mode 2', [[300, 600, 480, 300, 600, 600, 300], 1725],
[2400, 780, 0, 102638]),
('partial repair guard 3', [[510, 300, 300, 600, 600, 300, 510], 30], [2340, 750, 30, 1763]),
('boundary control 4', [[27, 0, 0, 0, 0, 0, 0], 30], [27, 0, 0, 14]),
('boundary control 5', [[0, 480, 480, 480, 480, 480, 480], 1500], [2400, 480, 0, 78000]),
('normal control 6', [[0, 0, 481, 780, 874, 721, 92], 30], [2012, 721, 215, 1762]),
('normal control 7', [[481, 0, 900, 240, 540, 900, 480], 2250], [2400, 781, 360, 160931]),
('normal control 8', [[0, 450, 480, 600, 240, 540, 720], 1500], [2400, 630, 0, 83625])],
[('regression: pay rounding mode 1', [[300, 600, 480, 600, 480, 510, 510], 90], [2400, 1050, 30, 6053]),
('regression variant: pay rounding mode 2', [[900, 720, 0, 480, 450, 240, 600], 2250],
[2400, 810, 180, 149063]),
('partial repair guard 3', [[510, 510, 510, 510, 480, 510, 300], 2250], [2400, 930, 0, 142313]),
('boundary control 4', [[600, 600, 600, 600, 600, 0, 0], 1500], [2400, 600, 0, 82500]),
('boundary control 5', [[27, 0, 0, 0, 0, 0, 0], 30], [27, 0, 0, 14]),
('normal control 6', [[300, 480, 300, 300, 480, 600, 600], 2250], [2340, 600, 120, 130500]),
('normal control 7', [[720, 780, 720, 540, 450, 900, 721], 1500], [2400, 1950, 481, 157175]),
('normal control 8', [[300, 300, 480, 510, 510, 600, 600], 1500], [2400, 780, 120, 95250])],
[('regression: pay rounding mode 1', [[481, 119, 900, 256, 240, 20, 480], 2000], [1595, 721, 180, 101217]),
('regression variant: pay rounding mode 2', [[780, 450, 900, 900, 780, 900, 780], 1810],
[2400, 2130, 960, 226703]),
('partial repair guard 3', [[240, 600, 240, 13, 780, 0, 540], 90], [1933, 420, 60, 4025]),
('boundary control 4', [[540, 540, 540, 540, 540, 540, 60], 2000], [2400, 900, 0, 125000]),
('boundary control 5', [[600, 600, 600, 600, 600, 0, 0], 1500], [2400, 600, 0, 82500]),
('normal control 6', [[0, 240, 721, 751, 481, 900, 0], 1810], [2160, 721, 212, 110576]),
('normal control 7', [[600, 600, 600, 480, 600, 600, 600], 1810], [2400, 1560, 120, 150230]),
('normal control 8', [[481, 900, 720, 481, 540, 540, 0], 1725], [2400, 1082, 180, 126011])]]
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: pay rounding mode 1 | [9, 0, 0, 4] | [9, 0, 0, 5] | Failed |
| regression variant: pay rounding mode 2 | [2400, 870, 0, 5558] | [2400, 870, 0, 5558] | Passed |
| partial repair guard 3 | [2085, 420, 180, 115312] | [2085, 420, 180, 115313] | Failed |
| boundary control 4 | [2400, 480, 0, 104000] | [2400, 480, 0, 104000] | Passed |
| normal control 5 | [2400, 1200, 240, 2340] | [2400, 1200, 240, 2340] | Passed |
| normal control 6 | [2400, 1447, 421, 202969] | [2400, 1447, 421, 202969] | Passed |
| normal control 7 | [2340, 510, 0, 4658] | [2340, 510, 0, 4658] | Passed |
| normal control 8 | [2400, 1080, 0, 115575] | [2400, 1080, 0, 115575] | Passed |
SHA-256 / 0465fc0f7bb65b4221bcb66731938e163b8ce9b5a79cf04a85ff407579ea30f2
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:51:59.344909+00:00.
Case digest / a9af15265b722905bcde0fe98ab41743f7ded3325489c5f0eb86936afed4498f