FA-58991 / Payroll withholding rules / Open access
Overtime regular rate with bonuses and differentials: half-time premium · case 01
Overtime hours are paid at two and a half times the rate in total.
ROOT CAUSE
A full time-and-a-half premium is added although straight-time pay for overtime hours is already in the base.
THE FAILURE
A full time-and-a-half premium is added although straight-time pay for overtime hours is already in the base.
Unsuccessful approach: The attempt uses the half-time factor but on the base hourly rate, ignoring bonus and differential in the regular rate.
Case contract
Input weekly {hours, rate, bonus, discretionary, diff_hours, diff}. Straight pay = hours*rate + diff_hours*diff. Regular rate = (straight pay + bonus unless discretionary) / hours. Overtime premium = regular rate * max(0, hours-40) / 2, rounded half-up to the cent. Total = straight pay + bonus + premium. Zero hours returns [0, bonus]. Return [premium, total].
Why this case matters
Nondiscretionary bonuses and shift differentials raise the regular rate, and only a half-time premium is owed on top of straight-time pay.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(x):
h = x['hours']
base = h * x['rate'] + x['diff_hours'] * x['diff']
included = base + (0 if x['discretionary'] else x['bonus'])
if h == 0:
return [0, x['bonus']]
ot = max(0, h - 40)
rr = Fraction(included, h)
premium = rr * ot * 3 / 2
prem_c = math.floor(premium + Fraction(1, 2))
total = base + x['bonus'] + prem_c
return [prem_c, total]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'hours': 56, 'rate': 2894, 'bonus': 0, 'discretionary': True, 'diff_hours': 20, 'diff': 189}, [23692, 189536]), ('regression', {'hours': 48, 'rate': 2361, 'bonus': 0, 'discretionary': False, 'diff_hours': 15, 'diff': 150}, [9632, 125210]), ('partial-repair probe', {'hours': 45, 'rate': 1070, 'bonus': 6593, 'discretionary': True, 'diff_hours': 3, 'diff': 100}, [2692, 57735]), ('partial-repair probe', {'hours': 60, 'rate': 3726, 'bonus': 328, 'discretionary': False, 'diff_hours': 13, 'diff': 0}, [37315, 261203]), ('normal control', {'hours': 29, 'rate': 3185, 'bonus': 18960, 'discretionary': True, 'diff_hours': 0, 'diff': 235}, [0, 111325]), ('normal control', {'hours': 15, 'rate': 1913, 'bonus': 0, 'discretionary': False, 'diff_hours': 3, 'diff': 100}, [0, 28995]), ('normal control', {'hours': 36, 'rate': 1564, 'bonus': 12440, 'discretionary': False, 'diff_hours': 0, 'diff': 150}, [0, 68744]), ('normal control', {'hours': 36, 'rate': 3124, 'bonus': 20788, 'discretionary': False, 'diff_hours': 0, 'diff': 0}, [0, 133252])], [('regression', {'hours': 48, 'rate': 2361, 'bonus': 0, 'discretionary': False, 'diff_hours': 15, 'diff': 150}, [9632, 125210]), ('regression', {'hours': 45, 'rate': 1070, 'bonus': 6593, 'discretionary': True, 'diff_hours': 3, 'diff': 100}, [2692, 57735]), ('partial-repair probe', {'hours': 60, 'rate': 3726, 'bonus': 328, 'discretionary': False, 'diff_hours': 13, 'diff': 0}, [37315, 261203]), ('partial-repair probe', {'hours': 51, 'rate': 1430, 'bonus': 583, 'discretionary': True, 'diff_hours': 17, 'diff': 212}, [8254, 85371]), ('normal control', {'hours': 38, 'rate': 3803, 'bonus': 0, 'discretionary': False, 'diff_hours': 5, 'diff': 175}, [0, 145389]), ('normal control', {'hours': 40, 'rate': 2368, 'bonus': 0, 'discretionary': False, 'diff_hours': 0, 'diff': 0}, [0, 94720]), ('normal control', {'hours': 15, 'rate': 1275, 'bonus': 16297, 'discretionary': False, 'diff_hours': 0, 'diff': 100}, [0, 35422]), ('normal control', {'hours': 0, 'rate': 1235, 'bonus': 452, 'discretionary': False, 'diff_hours': 15, 'diff': 0}, [0, 452])], [('regression', {'hours': 45, 'rate': 1070, 'bonus': 6593, 'discretionary': True, 'diff_hours': 3, 'diff': 100}, [2692, 57735]), ('regression', {'hours': 60, 'rate': 3726, 'bonus': 328, 'discretionary': False, 'diff_hours': 13, 'diff': 0}, [37315, 261203]), ('partial-repair probe', {'hours': 51, 'rate': 1430, 'bonus': 583, 'discretionary': True, 'diff_hours': 17, 'diff': 212}, [8254, 85371]), ('partial-repair probe', {'hours': 42, 'rate': 1092, 'bonus': 0, 'discretionary': False, 'diff_hours': 2, 'diff': 157}, [1099, 47277]), ('normal control', {'hours': 25, 'rate': 2784, 'bonus': 431, 'discretionary': False, 'diff_hours': 0, 'diff': 150}, [0, 70031]), ('normal control', {'hours': 4, 'rate': 2630, 'bonus': 24821, 'discretionary': False, 'diff_hours': 10, 'diff': 100}, [0, 36341]), ('normal control', {'hours': 36, 'rate': 3824, 'bonus': 0, 'discretionary': False, 'diff_hours': 12, 'diff': 100}, [0, 138864]), ('normal control', {'hours': 36, 'rate': 3363, 'bonus': 0, 'discretionary': True, 'diff_hours': 0, 'diff': 0}, [0, 121068])], [('regression', {'hours': 60, 'rate': 3726, 'bonus': 328, 'discretionary': False, 'diff_hours': 13, 'diff': 0}, [37315, 261203]), ('regression', {'hours': 51, 'rate': 1430, 'bonus': 583, 'discretionary': True, 'diff_hours': 17, 'diff': 212}, [8254, 85371]), ('partial-repair probe', {'hours': 41, 'rate': 1070, 'bonus': 0, 'discretionary': False, 'diff_hours': 14, 'diff': 300}, [586, 48656]), ('partial-repair probe', {'hours': 52, 'rate': 2128, 'bonus': 978, 'discretionary': True, 'diff_hours': 9, 'diff': 100}, [12872, 125406]), ('normal control', {'hours': 25, 'rate': 1555, 'bonus': 17670, 'discretionary': True, 'diff_hours': 0, 'diff': 150}, [0, 56545]), ('normal control', {'hours': 13, 'rate': 3420, 'bonus': 0, 'discretionary': True, 'diff_hours': 0, 'diff': 150}, [0, 44460]), ('normal control', {'hours': 17, 'rate': 3366, 'bonus': 396, 'discretionary': True, 'diff_hours': 8, 'diff': 0}, [0, 57618]), ('normal control', {'hours': 1, 'rate': 1458, 'bonus': 0, 'discretionary': False, 'diff_hours': 0, 'diff': 0}, [0, 1458])], [('regression', {'hours': 51, 'rate': 1430, 'bonus': 583, 'discretionary': True, 'diff_hours': 17, 'diff': 212}, [8254, 85371]), ('regression', {'hours': 42, 'rate': 2619, 'bonus': 0, 'discretionary': False, 'diff_hours': 0, 'diff': 150}, [2619, 112617]), ('partial-repair probe', {'hours': 45, 'rate': 3318, 'bonus': 32787, 'discretionary': False, 'diff_hours': 15, 'diff': 100}, [10200, 193797]), ('partial-repair probe', {'hours': 58, 'rate': 1280, 'bonus': 145, 'discretionary': False, 'diff_hours': 5, 'diff': 0}, [11543, 85928]), ('normal control', {'hours': 40, 'rate': 2719, 'bonus': 0, 'discretionary': False, 'diff_hours': 13, 'diff': 100}, [0, 110060]), ('normal control', {'hours': 32, 'rate': 3242, 'bonus': 990, 'discretionary': True, 'diff_hours': 0, 'diff': 48}, [0, 104734]), ('normal control', {'hours': 23, 'rate': 2339, 'bonus': 720, 'discretionary': False, 'diff_hours': 0, 'diff': 0}, [0, 54517]), ('normal control', {'hours': 22, 'rate': 2030, 'bonus': 44512, 'discretionary': False, 'diff_hours': 13, 'diff': 183}, [0, 91551])]]
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 | [71076, 236920] | [23692, 189536] | Failed |
| regression 1 | [28895, 144473] | [9632, 125210] | Failed |
| partial-repair probe 2 | [8075, 63118] | [2692, 57735] | Failed |
| partial-repair probe 3 | [111944, 335832] | [37315, 261203] | Failed |
| normal control 4 | [0, 111325] | [0, 111325] | Passed |
| normal control 5 | [0, 28995] | [0, 28995] | Passed |
| normal control 6 | [0, 68744] | [0, 68744] | Passed |
| normal control 7 | [0, 133252] | [0, 133252] | Passed |
SHA-256 / 7e1f1ec08f171f43e642e7cabe4bf22a41b70681746b4fc0415ceb02f8f4fbb9
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(x):
h = x['hours']
base = h * x['rate'] + x['diff_hours'] * x['diff']
included = base + (0 if x['discretionary'] else x['bonus'])
if h == 0:
return [0, x['bonus']]
ot = max(0, h - 40)
rr = Fraction(included, h)
premium = Fraction(x['rate']) * ot / 2
prem_c = math.floor(premium + Fraction(1, 2))
total = base + x['bonus'] + prem_c
return [prem_c, total]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'hours': 56, 'rate': 2894, 'bonus': 0, 'discretionary': True, 'diff_hours': 20, 'diff': 189}, [23692, 189536]), ('regression', {'hours': 48, 'rate': 2361, 'bonus': 0, 'discretionary': False, 'diff_hours': 15, 'diff': 150}, [9632, 125210]), ('partial-repair probe', {'hours': 45, 'rate': 1070, 'bonus': 6593, 'discretionary': True, 'diff_hours': 3, 'diff': 100}, [2692, 57735]), ('partial-repair probe', {'hours': 60, 'rate': 3726, 'bonus': 328, 'discretionary': False, 'diff_hours': 13, 'diff': 0}, [37315, 261203]), ('normal control', {'hours': 29, 'rate': 3185, 'bonus': 18960, 'discretionary': True, 'diff_hours': 0, 'diff': 235}, [0, 111325]), ('normal control', {'hours': 15, 'rate': 1913, 'bonus': 0, 'discretionary': False, 'diff_hours': 3, 'diff': 100}, [0, 28995]), ('normal control', {'hours': 36, 'rate': 1564, 'bonus': 12440, 'discretionary': False, 'diff_hours': 0, 'diff': 150}, [0, 68744]), ('normal control', {'hours': 36, 'rate': 3124, 'bonus': 20788, 'discretionary': False, 'diff_hours': 0, 'diff': 0}, [0, 133252])], [('regression', {'hours': 48, 'rate': 2361, 'bonus': 0, 'discretionary': False, 'diff_hours': 15, 'diff': 150}, [9632, 125210]), ('regression', {'hours': 45, 'rate': 1070, 'bonus': 6593, 'discretionary': True, 'diff_hours': 3, 'diff': 100}, [2692, 57735]), ('partial-repair probe', {'hours': 60, 'rate': 3726, 'bonus': 328, 'discretionary': False, 'diff_hours': 13, 'diff': 0}, [37315, 261203]), ('partial-repair probe', {'hours': 51, 'rate': 1430, 'bonus': 583, 'discretionary': True, 'diff_hours': 17, 'diff': 212}, [8254, 85371]), ('normal control', {'hours': 38, 'rate': 3803, 'bonus': 0, 'discretionary': False, 'diff_hours': 5, 'diff': 175}, [0, 145389]), ('normal control', {'hours': 40, 'rate': 2368, 'bonus': 0, 'discretionary': False, 'diff_hours': 0, 'diff': 0}, [0, 94720]), ('normal control', {'hours': 15, 'rate': 1275, 'bonus': 16297, 'discretionary': False, 'diff_hours': 0, 'diff': 100}, [0, 35422]), ('normal control', {'hours': 0, 'rate': 1235, 'bonus': 452, 'discretionary': False, 'diff_hours': 15, 'diff': 0}, [0, 452])], [('regression', {'hours': 45, 'rate': 1070, 'bonus': 6593, 'discretionary': True, 'diff_hours': 3, 'diff': 100}, [2692, 57735]), ('regression', {'hours': 60, 'rate': 3726, 'bonus': 328, 'discretionary': False, 'diff_hours': 13, 'diff': 0}, [37315, 261203]), ('partial-repair probe', {'hours': 51, 'rate': 1430, 'bonus': 583, 'discretionary': True, 'diff_hours': 17, 'diff': 212}, [8254, 85371]), ('partial-repair probe', {'hours': 42, 'rate': 1092, 'bonus': 0, 'discretionary': False, 'diff_hours': 2, 'diff': 157}, [1099, 47277]), ('normal control', {'hours': 25, 'rate': 2784, 'bonus': 431, 'discretionary': False, 'diff_hours': 0, 'diff': 150}, [0, 70031]), ('normal control', {'hours': 4, 'rate': 2630, 'bonus': 24821, 'discretionary': False, 'diff_hours': 10, 'diff': 100}, [0, 36341]), ('normal control', {'hours': 36, 'rate': 3824, 'bonus': 0, 'discretionary': False, 'diff_hours': 12, 'diff': 100}, [0, 138864]), ('normal control', {'hours': 36, 'rate': 3363, 'bonus': 0, 'discretionary': True, 'diff_hours': 0, 'diff': 0}, [0, 121068])], [('regression', {'hours': 60, 'rate': 3726, 'bonus': 328, 'discretionary': False, 'diff_hours': 13, 'diff': 0}, [37315, 261203]), ('regression', {'hours': 51, 'rate': 1430, 'bonus': 583, 'discretionary': True, 'diff_hours': 17, 'diff': 212}, [8254, 85371]), ('partial-repair probe', {'hours': 41, 'rate': 1070, 'bonus': 0, 'discretionary': False, 'diff_hours': 14, 'diff': 300}, [586, 48656]), ('partial-repair probe', {'hours': 52, 'rate': 2128, 'bonus': 978, 'discretionary': True, 'diff_hours': 9, 'diff': 100}, [12872, 125406]), ('normal control', {'hours': 25, 'rate': 1555, 'bonus': 17670, 'discretionary': True, 'diff_hours': 0, 'diff': 150}, [0, 56545]), ('normal control', {'hours': 13, 'rate': 3420, 'bonus': 0, 'discretionary': True, 'diff_hours': 0, 'diff': 150}, [0, 44460]), ('normal control', {'hours': 17, 'rate': 3366, 'bonus': 396, 'discretionary': True, 'diff_hours': 8, 'diff': 0}, [0, 57618]), ('normal control', {'hours': 1, 'rate': 1458, 'bonus': 0, 'discretionary': False, 'diff_hours': 0, 'diff': 0}, [0, 1458])], [('regression', {'hours': 51, 'rate': 1430, 'bonus': 583, 'discretionary': True, 'diff_hours': 17, 'diff': 212}, [8254, 85371]), ('regression', {'hours': 42, 'rate': 2619, 'bonus': 0, 'discretionary': False, 'diff_hours': 0, 'diff': 150}, [2619, 112617]), ('partial-repair probe', {'hours': 45, 'rate': 3318, 'bonus': 32787, 'discretionary': False, 'diff_hours': 15, 'diff': 100}, [10200, 193797]), ('partial-repair probe', {'hours': 58, 'rate': 1280, 'bonus': 145, 'discretionary': False, 'diff_hours': 5, 'diff': 0}, [11543, 85928]), ('normal control', {'hours': 40, 'rate': 2719, 'bonus': 0, 'discretionary': False, 'diff_hours': 13, 'diff': 100}, [0, 110060]), ('normal control', {'hours': 32, 'rate': 3242, 'bonus': 990, 'discretionary': True, 'diff_hours': 0, 'diff': 48}, [0, 104734]), ('normal control', {'hours': 23, 'rate': 2339, 'bonus': 720, 'discretionary': False, 'diff_hours': 0, 'diff': 0}, [0, 54517]), ('normal control', {'hours': 22, 'rate': 2030, 'bonus': 44512, 'discretionary': False, 'diff_hours': 13, 'diff': 183}, [0, 91551])]]
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 | [23152, 188996] | [23692, 189536] | Failed |
| regression 1 | [9444, 125022] | [9632, 125210] | Failed |
| partial-repair probe 2 | [2675, 57718] | [2692, 57735] | Failed |
| partial-repair probe 3 | [37260, 261148] | [37315, 261203] | Failed |
| normal control 4 | [0, 111325] | [0, 111325] | Passed |
| normal control 5 | [0, 28995] | [0, 28995] | Passed |
| normal control 6 | [0, 68744] | [0, 68744] | Passed |
| normal control 7 | [0, 133252] | [0, 133252] | Passed |
SHA-256 / 737c0c87839f2d15dfb3368a8cb9796804ad220f561e63d017ebd5cbfa6aab4c
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
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:32.066589+00:00.
Case digest / 7ddcb21697de47981307fdaa97850ebcfb2049924c21c40c615411d07310dd86