FA-59266 / Payroll withholding rules / Open access
Daily, weekly and seventh-day overtime split: weekly regular-hour room · case 01
Employees with daily overtime early in the week hit weekly overtime too soon.
ROOT CAUSE
Daily overtime hours are counted toward the 40-hour weekly regular threshold.
VERIFIED REPAIR
Restore the contract rule at the weekly regular-hour room step: use `room = max(0, 40 - reg)`.
Unsuccessful approach: The attempt counts double-time hours toward the threshold instead.
Case contract
Input seven daily hour counts (workweek order). If all seven days are worked, day 7 hours are 1.5x up to 8 and double beyond 8. Other days: first 8 regular, 8-12 at 1.5x, over 12 double; regular hours beyond a weekly total of 40 regular hours become 1.5x. Return [regular, overtime, double].
Why this case matters
Stacked daily and weekly overtime rules must not double count hours or miss the seventh consecutive day.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
hours = x
reg = ot = dt = 0
worked_all = all(h > 0 for h in hours)
for i, h in enumerate(hours):
if i == 6 and worked_all:
ot += min(h, 8)
dt += max(0, h - 8)
continue
d_reg = min(h, 8)
d_ot = max(0, min(h, 12) - 8)
d_dt = max(0, h - 12)
room = max(0, 40 - reg - ot)
if d_reg > room:
d_ot += d_reg - room
d_reg = room
reg += d_reg
ot += d_ot
dt += d_dt
return [reg, ot, dt]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', [8, 7, 14, 0, 12, 0, 8], [39, 8, 2]), ('regression (boundary)', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('partial-repair probe', [14, 9, 8, 7, 0, 12, 0], [39, 9, 2]), ('partial-repair probe', [8, 8, 7, 8, 0, 14, 6], [40, 9, 2]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('normal control', [0, 0, 0, 8, 0, 0, 8], [16, 0, 0]), ('normal control', [0, 8, 0, 1, 6, 7, 6], [28, 0, 0]), ('normal control', [0, 8, 0, 6, 0, 0, 12], [22, 4, 0]), ('normal control', [12, 0, 8, 0, 12, 0, 13], [32, 12, 1])], [('regression', [14, 9, 8, 7, 0, 12, 0], [39, 9, 2]), ('regression', [12, 12, 8, 7, 0, 8, 0], [39, 8, 0]), ('partial-repair probe', [8, 8, 7, 8, 0, 14, 6], [40, 9, 2]), ('partial-repair probe', [13, 8, 0, 0, 12, 14, 8], [40, 12, 3]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('normal control', [0, 0, 0, 7, 10, 8, 0], [23, 2, 0]), ('normal control', [8, 8, 5, 0, 0, 10, 0], [29, 2, 0]), ('normal control', [0, 7, 12, 8, 0, 7, 0], [30, 4, 0]), ('normal control', [0, 4, 4, 9, 8, 8, 0], [32, 1, 0])], [('regression', [8, 8, 7, 8, 0, 14, 6], [40, 9, 2]), ('regression', [6, 8, 9, 0, 8, 3, 8], [40, 2, 0]), ('partial-repair probe', [12, 8, 7, 14, 8, 0, 4], [40, 11, 2]), ('partial-repair probe', [0, 11, 8, 14, 0, 8, 12], [40, 11, 2]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('normal control', [0, 12, 0, 0, 10, 8, 0], [24, 6, 0]), ('normal control', [0, 0, 7, 0, 6, 8, 12], [29, 4, 0]), ('normal control', [0, 12, 8, 0, 7, 0, 8], [31, 4, 0]), ('normal control', [0, 2, 8, 8, 12, 12, 0], [34, 8, 0])], [('regression', [13, 8, 0, 0, 12, 14, 8], [40, 12, 3]), ('regression', [0, 12, 10, 8, 8, 12, 0], [40, 10, 0]), ('partial-repair probe', [7, 8, 12, 14, 0, 0, 12], [39, 12, 2]), ('partial-repair probe', [8, 14, 0, 9, 9, 0, 8], [40, 6, 2]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('normal control', [8, 8, 0, 12, 12, 0, 0], [32, 8, 0]), ('normal control', [8, 0, 0, 12, 8, 0, 7], [31, 4, 0]), ('normal control', [7, 0, 8, 0, 8, 12, 0], [31, 4, 0]), ('normal control', [9, 9, 6, 8, 0, 12, 0], [38, 6, 0])], [('regression', [12, 8, 7, 14, 8, 0, 4], [40, 11, 2]), ('regression', [8, 7, 14, 0, 12, 0, 8], [39, 8, 2]), ('partial-repair probe', [8, 11, 13, 10, 10, 5, 12], [40, 24, 5]), ('partial-repair probe', [0, 13, 6, 4, 8, 8, 8], [40, 6, 1]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('normal control', [0, 6, 0, 10, 9, 0, 8], [30, 3, 0]), ('normal control', [0, 0, 7, 0, 12, 12, 12], [31, 12, 0]), ('normal control', [0, 10, 0, 0, 12, 8, 11], [32, 9, 0]), ('normal control', [0, 12, 12, 8, 0, 0, 9], [32, 9, 0])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
check("%s %d" % (label, i), 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 0 | [32, 15, 2] | [39, 8, 2] | Failed |
| regression (boundary) 1 | [32, 18, 0] | [40, 10, 0] | Failed |
| partial-repair probe 2 | [35, 13, 2] | [39, 9, 2] | Failed |
| partial-repair probe 3 | [39, 10, 2] | [40, 9, 2] | Failed |
| boundary control 4 | [40, 16, 0] | [40, 16, 0] | Passed |
| boundary control 5 | [8, 4, 1] | [8, 4, 1] | Passed |
| normal control 6 | [16, 0, 0] | [16, 0, 0] | Passed |
| normal control 7 | [28, 0, 0] | [28, 0, 0] | Passed |
| normal control 8 | [22, 4, 0] | [22, 4, 0] | Passed |
| normal control 9 | [32, 12, 1] | [32, 12, 1] | Passed |
SHA-256 / 3533eab7ba54d6fb8ecab528c86b478647316b8d07258797fb6ed356a3973605
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
hours = x
reg = ot = dt = 0
worked_all = all(h > 0 for h in hours)
for i, h in enumerate(hours):
if i == 6 and worked_all:
ot += min(h, 8)
dt += max(0, h - 8)
continue
d_reg = min(h, 8)
d_ot = max(0, min(h, 12) - 8)
d_dt = max(0, h - 12)
room = max(0, 40 - reg - dt)
if d_reg > room:
d_ot += d_reg - room
d_reg = room
reg += d_reg
ot += d_ot
dt += d_dt
return [reg, ot, dt]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', [8, 7, 14, 0, 12, 0, 8], [39, 8, 2]), ('regression (boundary)', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('partial-repair probe', [14, 9, 8, 7, 0, 12, 0], [39, 9, 2]), ('partial-repair probe', [8, 8, 7, 8, 0, 14, 6], [40, 9, 2]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('normal control', [0, 0, 0, 8, 0, 0, 8], [16, 0, 0]), ('normal control', [0, 8, 0, 1, 6, 7, 6], [28, 0, 0]), ('normal control', [0, 8, 0, 6, 0, 0, 12], [22, 4, 0]), ('normal control', [12, 0, 8, 0, 12, 0, 13], [32, 12, 1])], [('regression', [14, 9, 8, 7, 0, 12, 0], [39, 9, 2]), ('regression', [12, 12, 8, 7, 0, 8, 0], [39, 8, 0]), ('partial-repair probe', [8, 8, 7, 8, 0, 14, 6], [40, 9, 2]), ('partial-repair probe', [13, 8, 0, 0, 12, 14, 8], [40, 12, 3]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('normal control', [0, 0, 0, 7, 10, 8, 0], [23, 2, 0]), ('normal control', [8, 8, 5, 0, 0, 10, 0], [29, 2, 0]), ('normal control', [0, 7, 12, 8, 0, 7, 0], [30, 4, 0]), ('normal control', [0, 4, 4, 9, 8, 8, 0], [32, 1, 0])], [('regression', [8, 8, 7, 8, 0, 14, 6], [40, 9, 2]), ('regression', [6, 8, 9, 0, 8, 3, 8], [40, 2, 0]), ('partial-repair probe', [12, 8, 7, 14, 8, 0, 4], [40, 11, 2]), ('partial-repair probe', [0, 11, 8, 14, 0, 8, 12], [40, 11, 2]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('normal control', [0, 12, 0, 0, 10, 8, 0], [24, 6, 0]), ('normal control', [0, 0, 7, 0, 6, 8, 12], [29, 4, 0]), ('normal control', [0, 12, 8, 0, 7, 0, 8], [31, 4, 0]), ('normal control', [0, 2, 8, 8, 12, 12, 0], [34, 8, 0])], [('regression', [13, 8, 0, 0, 12, 14, 8], [40, 12, 3]), ('regression', [0, 12, 10, 8, 8, 12, 0], [40, 10, 0]), ('partial-repair probe', [7, 8, 12, 14, 0, 0, 12], [39, 12, 2]), ('partial-repair probe', [8, 14, 0, 9, 9, 0, 8], [40, 6, 2]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('normal control', [8, 8, 0, 12, 12, 0, 0], [32, 8, 0]), ('normal control', [8, 0, 0, 12, 8, 0, 7], [31, 4, 0]), ('normal control', [7, 0, 8, 0, 8, 12, 0], [31, 4, 0]), ('normal control', [9, 9, 6, 8, 0, 12, 0], [38, 6, 0])], [('regression', [12, 8, 7, 14, 8, 0, 4], [40, 11, 2]), ('regression', [8, 7, 14, 0, 12, 0, 8], [39, 8, 2]), ('partial-repair probe', [8, 11, 13, 10, 10, 5, 12], [40, 24, 5]), ('partial-repair probe', [0, 13, 6, 4, 8, 8, 8], [40, 6, 1]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('normal control', [0, 6, 0, 10, 9, 0, 8], [30, 3, 0]), ('normal control', [0, 0, 7, 0, 12, 12, 12], [31, 12, 0]), ('normal control', [0, 10, 0, 0, 12, 8, 11], [32, 9, 0]), ('normal control', [0, 12, 12, 8, 0, 0, 9], [32, 9, 0])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
check("%s %d" % (label, i), 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 0 | [38, 9, 2] | [39, 8, 2] | Failed |
| regression (boundary) 1 | [40, 10, 0] | [40, 10, 0] | Passed |
| partial-repair probe 2 | [38, 10, 2] | [39, 9, 2] | Failed |
| partial-repair probe 3 | [39, 10, 2] | [40, 9, 2] | Failed |
| boundary control 4 | [40, 16, 0] | [40, 16, 0] | Passed |
| boundary control 5 | [8, 4, 1] | [8, 4, 1] | Passed |
| normal control 6 | [16, 0, 0] | [16, 0, 0] | Passed |
| normal control 7 | [28, 0, 0] | [28, 0, 0] | Passed |
| normal control 8 | [22, 4, 0] | [22, 4, 0] | Passed |
| normal control 9 | [32, 12, 1] | [32, 12, 1] | Passed |
SHA-256 / 4cc2829aa3f5f60d04ae22025ff2ad560bf1dbe1bb1bb159a2c4a38f35d087cb
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
hours = x
reg = ot = dt = 0
worked_all = all(h > 0 for h in hours)
for i, h in enumerate(hours):
if i == 6 and worked_all:
ot += min(h, 8)
dt += max(0, h - 8)
continue
d_reg = min(h, 8)
d_ot = max(0, min(h, 12) - 8)
d_dt = max(0, h - 12)
room = max(0, 40 - reg)
if d_reg > room:
d_ot += d_reg - room
d_reg = room
reg += d_reg
ot += d_ot
dt += d_dt
return [reg, ot, dt]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', [8, 7, 14, 0, 12, 0, 8], [39, 8, 2]), ('regression (boundary)', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('partial-repair probe', [14, 9, 8, 7, 0, 12, 0], [39, 9, 2]), ('partial-repair probe', [8, 8, 7, 8, 0, 14, 6], [40, 9, 2]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('normal control', [0, 0, 0, 8, 0, 0, 8], [16, 0, 0]), ('normal control', [0, 8, 0, 1, 6, 7, 6], [28, 0, 0]), ('normal control', [0, 8, 0, 6, 0, 0, 12], [22, 4, 0]), ('normal control', [12, 0, 8, 0, 12, 0, 13], [32, 12, 1])], [('regression', [14, 9, 8, 7, 0, 12, 0], [39, 9, 2]), ('regression', [12, 12, 8, 7, 0, 8, 0], [39, 8, 0]), ('partial-repair probe', [8, 8, 7, 8, 0, 14, 6], [40, 9, 2]), ('partial-repair probe', [13, 8, 0, 0, 12, 14, 8], [40, 12, 3]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('normal control', [0, 0, 0, 7, 10, 8, 0], [23, 2, 0]), ('normal control', [8, 8, 5, 0, 0, 10, 0], [29, 2, 0]), ('normal control', [0, 7, 12, 8, 0, 7, 0], [30, 4, 0]), ('normal control', [0, 4, 4, 9, 8, 8, 0], [32, 1, 0])], [('regression', [8, 8, 7, 8, 0, 14, 6], [40, 9, 2]), ('regression', [6, 8, 9, 0, 8, 3, 8], [40, 2, 0]), ('partial-repair probe', [12, 8, 7, 14, 8, 0, 4], [40, 11, 2]), ('partial-repair probe', [0, 11, 8, 14, 0, 8, 12], [40, 11, 2]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('normal control', [0, 12, 0, 0, 10, 8, 0], [24, 6, 0]), ('normal control', [0, 0, 7, 0, 6, 8, 12], [29, 4, 0]), ('normal control', [0, 12, 8, 0, 7, 0, 8], [31, 4, 0]), ('normal control', [0, 2, 8, 8, 12, 12, 0], [34, 8, 0])], [('regression', [13, 8, 0, 0, 12, 14, 8], [40, 12, 3]), ('regression', [0, 12, 10, 8, 8, 12, 0], [40, 10, 0]), ('partial-repair probe', [7, 8, 12, 14, 0, 0, 12], [39, 12, 2]), ('partial-repair probe', [8, 14, 0, 9, 9, 0, 8], [40, 6, 2]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('normal control', [8, 8, 0, 12, 12, 0, 0], [32, 8, 0]), ('normal control', [8, 0, 0, 12, 8, 0, 7], [31, 4, 0]), ('normal control', [7, 0, 8, 0, 8, 12, 0], [31, 4, 0]), ('normal control', [9, 9, 6, 8, 0, 12, 0], [38, 6, 0])], [('regression', [12, 8, 7, 14, 8, 0, 4], [40, 11, 2]), ('regression', [8, 7, 14, 0, 12, 0, 8], [39, 8, 2]), ('partial-repair probe', [8, 11, 13, 10, 10, 5, 12], [40, 24, 5]), ('partial-repair probe', [0, 13, 6, 4, 8, 8, 8], [40, 6, 1]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('normal control', [0, 6, 0, 10, 9, 0, 8], [30, 3, 0]), ('normal control', [0, 0, 7, 0, 12, 12, 12], [31, 12, 0]), ('normal control', [0, 10, 0, 0, 12, 8, 11], [32, 9, 0]), ('normal control', [0, 12, 12, 8, 0, 0, 9], [32, 9, 0])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
check("%s %d" % (label, i), 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 0 | [39, 8, 2] | [39, 8, 2] | Passed |
| regression (boundary) 1 | [40, 10, 0] | [40, 10, 0] | Passed |
| partial-repair probe 2 | [39, 9, 2] | [39, 9, 2] | Passed |
| partial-repair probe 3 | [40, 9, 2] | [40, 9, 2] | Passed |
| boundary control 4 | [40, 16, 0] | [40, 16, 0] | Passed |
| boundary control 5 | [8, 4, 1] | [8, 4, 1] | Passed |
| normal control 6 | [16, 0, 0] | [16, 0, 0] | Passed |
| normal control 7 | [28, 0, 0] | [28, 0, 0] | Passed |
| normal control 8 | [22, 4, 0] | [22, 4, 0] | Passed |
| normal control 9 | [32, 12, 1] | [32, 12, 1] | Passed |
SHA-256 / 479d2033e2d44f2acd893e5ecc0466f037fad9e1920b823055d6db659099d559
Verification & scope
A deterministic teaching model of a stipulated payroll rule with toy thresholds and rates. It makes no claim of conformance to any tax authority, statute or jurisdiction and is not payroll software. 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:46:34.704271+00:00.
Case digest / d85f49bcef6b7dd7e48f6df53ca114dd98a1ec103afa32d07a714f1b8b0aaa1e