FAILURE MAP
← Case archive

FA-58931 / Payroll withholding rules / Open access

Supplemental flat-rate withholding tiers: tier rounding stage · case 01

Crossing bonuses are withheld one cent more than the contract amount.

Verified by executionVariant 1 · 10 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Each tier is rounded separately and then summed instead of rounding the combined withholding once.

VERIFIED REPAIR

Restore the contract rule at the tier rounding stage step: use `wh = (low * 22 + high * 37 + 50) // 100`.

Unsuccessful approach: The attempt still rounds per tier and truncates each, so the total is often a cent short.

Case contract

Input [ytd_supplemental, bonus] in cents. Supplemental wages up to a cumulative 1,000,000.00 are withheld at 22%; the part of cumulative supplemental wages above that is withheld at 37%. Withholding = (low*22 + high*37) rounded half-up to the cent once. Return [low, high, withholding].

Why this case matters

The mandatory 37% tier depends on cumulative supplemental wages and must split the crossing payment.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    ytd, bonus = x
    limit = 100000000
    below_room = max(0, limit - ytd)
    low = min(bonus, below_room)
    high = bonus - low
    wh = (low * 22 + 50) // 100 + (high * 37 + 50) // 100
    return [low, high, wh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', [98797663, 40240022], [1202337, 39037685, 14708458]), ('regression', [82759503, 45428822], [17240497, 28188325, 14222590]), ('partial-repair probe (boundary)', [99999950, 101], [50, 51, 30]), ('partial-repair probe', [2185641, 20897159], [20897159, 0, 4597375]), ('boundary control', [100000000, 100], [0, 100, 37]), ('boundary control', [0, 0], [0, 0, 0]), ('normal control', [98022676, 574037], [574037, 0, 126288]), ('normal control', [3276820, 34567110], [34567110, 0, 7604764]), ('normal control', [49161621, 69310], [69310, 0, 15248]), ('normal control', [66640759, 96623], [96623, 0, 21257])], [('regression', [82759503, 45428822], [17240497, 28188325, 14222590]), ('regression', [99121299, 4951921], [878701, 4073220, 1700406]), ('partial-repair probe', [100000000, 6674805], [0, 6674805, 2469678]), ('partial-repair probe', [100000000, 2071189], [0, 2071189, 766340]), ('boundary control', [99000000, 1000000], [1000000, 0, 220000]), ('boundary control', [150000000, 33], [0, 33, 12]), ('normal control', [100000000, 52968], [0, 52968, 19598]), ('normal control', [2545996, 41743464], [41743464, 0, 9183562]), ('normal control', [100000000, 21687395], [0, 21687395, 8024336]), ('normal control', [374880, 70400], [70400, 0, 15488])], [('regression', [99121299, 4951921], [878701, 4073220, 1700406]), ('regression', [97165412, 46185905], [2834588, 43351317, 16663597]), ('partial-repair probe', [97846124, 8522], [8522, 0, 1875]), ('partial-repair probe', [100849097, 11351881], [0, 11351881, 4200196]), ('boundary control', [100000000, 100], [0, 100, 37]), ('boundary control', [0, 0], [0, 0, 0]), ('normal control', [688889, 1036750], [1036750, 0, 228085]), ('normal control', [99561826, 3108388], [438174, 2670214, 1084377]), ('normal control', [100000000, 75200], [0, 75200, 27824]), ('normal control', [98276481, 26306241], [1723519, 24582722, 9474781])], [('regression', [97165412, 46185905], [2834588, 43351317, 16663597]), ('regression', [99684298, 1209484], [315702, 893782, 400154]), ('partial-repair probe', [3045185, 81939], [81939, 0, 18027]), ('partial-repair probe', [107387654, 40335762], [0, 40335762, 14924232]), ('boundary control', [99000000, 1000000], [1000000, 0, 220000]), ('boundary control', [150000000, 33], [0, 33, 12]), ('normal control', [63981087, 6343691], [6343691, 0, 1395612]), ('normal control', [2334092, 64988], [64988, 0, 14297]), ('normal control', [105717987, 5743298], [0, 5743298, 2125020]), ('normal control', [27124697, 75911], [75911, 0, 16700])], [('regression', [99684298, 1209484], [315702, 893782, 400154]), ('regression', [98057948, 8504199], [1942052, 6562147, 2855246]), ('partial-repair probe', [63007595, 8068739], [8068739, 0, 1775123]), ('partial-repair probe', [64670743, 3021249], [3021249, 0, 664675]), ('boundary control', [100000000, 100], [0, 100, 37]), ('boundary control', [0, 0], [0, 0, 0]), ('normal control', [95783477, 7789713], [4216523, 3573190, 2249715]), ('normal control', [100000000, 76030], [0, 76030, 28131]), ('normal control', [100000000, 5769322], [0, 5769322, 2134649]), ('normal control', [19110078, 54047], [54047, 0, 11890])]]
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 fixtureActualExpectedOutcome
regression 0[1202337, 39037685, 14708457][1202337, 39037685, 14708458]Failed
regression 1[17240497, 28188325, 14222589][17240497, 28188325, 14222590]Failed
partial-repair probe (boundary) 2[50, 51, 30][50, 51, 30]Passed
partial-repair probe 3[20897159, 0, 4597375][20897159, 0, 4597375]Passed
boundary control 4[0, 100, 37][0, 100, 37]Passed
boundary control 5[0, 0, 0][0, 0, 0]Passed
normal control 6[574037, 0, 126288][574037, 0, 126288]Passed
normal control 7[34567110, 0, 7604764][34567110, 0, 7604764]Passed
normal control 8[69310, 0, 15248][69310, 0, 15248]Passed
normal control 9[96623, 0, 21257][96623, 0, 21257]Passed

SHA-256 / 392ddff0aa162ec1449fd2bf338638ce3c9981c8cc161f858d3e2346d6d18d89

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    ytd, bonus = x
    limit = 100000000
    below_room = max(0, limit - ytd)
    low = min(bonus, below_room)
    high = bonus - low
    wh = low * 22 // 100 + high * 37 // 100
    return [low, high, wh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', [98797663, 40240022], [1202337, 39037685, 14708458]), ('regression', [82759503, 45428822], [17240497, 28188325, 14222590]), ('partial-repair probe (boundary)', [99999950, 101], [50, 51, 30]), ('partial-repair probe', [2185641, 20897159], [20897159, 0, 4597375]), ('boundary control', [100000000, 100], [0, 100, 37]), ('boundary control', [0, 0], [0, 0, 0]), ('normal control', [98022676, 574037], [574037, 0, 126288]), ('normal control', [3276820, 34567110], [34567110, 0, 7604764]), ('normal control', [49161621, 69310], [69310, 0, 15248]), ('normal control', [66640759, 96623], [96623, 0, 21257])], [('regression', [82759503, 45428822], [17240497, 28188325, 14222590]), ('regression', [99121299, 4951921], [878701, 4073220, 1700406]), ('partial-repair probe', [100000000, 6674805], [0, 6674805, 2469678]), ('partial-repair probe', [100000000, 2071189], [0, 2071189, 766340]), ('boundary control', [99000000, 1000000], [1000000, 0, 220000]), ('boundary control', [150000000, 33], [0, 33, 12]), ('normal control', [100000000, 52968], [0, 52968, 19598]), ('normal control', [2545996, 41743464], [41743464, 0, 9183562]), ('normal control', [100000000, 21687395], [0, 21687395, 8024336]), ('normal control', [374880, 70400], [70400, 0, 15488])], [('regression', [99121299, 4951921], [878701, 4073220, 1700406]), ('regression', [97165412, 46185905], [2834588, 43351317, 16663597]), ('partial-repair probe', [97846124, 8522], [8522, 0, 1875]), ('partial-repair probe', [100849097, 11351881], [0, 11351881, 4200196]), ('boundary control', [100000000, 100], [0, 100, 37]), ('boundary control', [0, 0], [0, 0, 0]), ('normal control', [688889, 1036750], [1036750, 0, 228085]), ('normal control', [99561826, 3108388], [438174, 2670214, 1084377]), ('normal control', [100000000, 75200], [0, 75200, 27824]), ('normal control', [98276481, 26306241], [1723519, 24582722, 9474781])], [('regression', [97165412, 46185905], [2834588, 43351317, 16663597]), ('regression', [99684298, 1209484], [315702, 893782, 400154]), ('partial-repair probe', [3045185, 81939], [81939, 0, 18027]), ('partial-repair probe', [107387654, 40335762], [0, 40335762, 14924232]), ('boundary control', [99000000, 1000000], [1000000, 0, 220000]), ('boundary control', [150000000, 33], [0, 33, 12]), ('normal control', [63981087, 6343691], [6343691, 0, 1395612]), ('normal control', [2334092, 64988], [64988, 0, 14297]), ('normal control', [105717987, 5743298], [0, 5743298, 2125020]), ('normal control', [27124697, 75911], [75911, 0, 16700])], [('regression', [99684298, 1209484], [315702, 893782, 400154]), ('regression', [98057948, 8504199], [1942052, 6562147, 2855246]), ('partial-repair probe', [63007595, 8068739], [8068739, 0, 1775123]), ('partial-repair probe', [64670743, 3021249], [3021249, 0, 664675]), ('boundary control', [100000000, 100], [0, 100, 37]), ('boundary control', [0, 0], [0, 0, 0]), ('normal control', [95783477, 7789713], [4216523, 3573190, 2249715]), ('normal control', [100000000, 76030], [0, 76030, 28131]), ('normal control', [100000000, 5769322], [0, 5769322, 2134649]), ('normal control', [19110078, 54047], [54047, 0, 11890])]]
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 fixtureActualExpectedOutcome
regression 0[1202337, 39037685, 14708457][1202337, 39037685, 14708458]Failed
regression 1[17240497, 28188325, 14222589][17240497, 28188325, 14222590]Failed
partial-repair probe (boundary) 2[50, 51, 29][50, 51, 30]Failed
partial-repair probe 3[20897159, 0, 4597374][20897159, 0, 4597375]Failed
boundary control 4[0, 100, 37][0, 100, 37]Passed
boundary control 5[0, 0, 0][0, 0, 0]Passed
normal control 6[574037, 0, 126288][574037, 0, 126288]Passed
normal control 7[34567110, 0, 7604764][34567110, 0, 7604764]Passed
normal control 8[69310, 0, 15248][69310, 0, 15248]Passed
normal control 9[96623, 0, 21257][96623, 0, 21257]Passed

SHA-256 / e266c1a915233b571086ff0ff037b45884d609f3795cad6c844af750119c9123

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    ytd, bonus = x
    limit = 100000000
    below_room = max(0, limit - ytd)
    low = min(bonus, below_room)
    high = bonus - low
    wh = (low * 22 + high * 37 + 50) // 100
    return [low, high, wh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', [98797663, 40240022], [1202337, 39037685, 14708458]), ('regression', [82759503, 45428822], [17240497, 28188325, 14222590]), ('partial-repair probe (boundary)', [99999950, 101], [50, 51, 30]), ('partial-repair probe', [2185641, 20897159], [20897159, 0, 4597375]), ('boundary control', [100000000, 100], [0, 100, 37]), ('boundary control', [0, 0], [0, 0, 0]), ('normal control', [98022676, 574037], [574037, 0, 126288]), ('normal control', [3276820, 34567110], [34567110, 0, 7604764]), ('normal control', [49161621, 69310], [69310, 0, 15248]), ('normal control', [66640759, 96623], [96623, 0, 21257])], [('regression', [82759503, 45428822], [17240497, 28188325, 14222590]), ('regression', [99121299, 4951921], [878701, 4073220, 1700406]), ('partial-repair probe', [100000000, 6674805], [0, 6674805, 2469678]), ('partial-repair probe', [100000000, 2071189], [0, 2071189, 766340]), ('boundary control', [99000000, 1000000], [1000000, 0, 220000]), ('boundary control', [150000000, 33], [0, 33, 12]), ('normal control', [100000000, 52968], [0, 52968, 19598]), ('normal control', [2545996, 41743464], [41743464, 0, 9183562]), ('normal control', [100000000, 21687395], [0, 21687395, 8024336]), ('normal control', [374880, 70400], [70400, 0, 15488])], [('regression', [99121299, 4951921], [878701, 4073220, 1700406]), ('regression', [97165412, 46185905], [2834588, 43351317, 16663597]), ('partial-repair probe', [97846124, 8522], [8522, 0, 1875]), ('partial-repair probe', [100849097, 11351881], [0, 11351881, 4200196]), ('boundary control', [100000000, 100], [0, 100, 37]), ('boundary control', [0, 0], [0, 0, 0]), ('normal control', [688889, 1036750], [1036750, 0, 228085]), ('normal control', [99561826, 3108388], [438174, 2670214, 1084377]), ('normal control', [100000000, 75200], [0, 75200, 27824]), ('normal control', [98276481, 26306241], [1723519, 24582722, 9474781])], [('regression', [97165412, 46185905], [2834588, 43351317, 16663597]), ('regression', [99684298, 1209484], [315702, 893782, 400154]), ('partial-repair probe', [3045185, 81939], [81939, 0, 18027]), ('partial-repair probe', [107387654, 40335762], [0, 40335762, 14924232]), ('boundary control', [99000000, 1000000], [1000000, 0, 220000]), ('boundary control', [150000000, 33], [0, 33, 12]), ('normal control', [63981087, 6343691], [6343691, 0, 1395612]), ('normal control', [2334092, 64988], [64988, 0, 14297]), ('normal control', [105717987, 5743298], [0, 5743298, 2125020]), ('normal control', [27124697, 75911], [75911, 0, 16700])], [('regression', [99684298, 1209484], [315702, 893782, 400154]), ('regression', [98057948, 8504199], [1942052, 6562147, 2855246]), ('partial-repair probe', [63007595, 8068739], [8068739, 0, 1775123]), ('partial-repair probe', [64670743, 3021249], [3021249, 0, 664675]), ('boundary control', [100000000, 100], [0, 100, 37]), ('boundary control', [0, 0], [0, 0, 0]), ('normal control', [95783477, 7789713], [4216523, 3573190, 2249715]), ('normal control', [100000000, 76030], [0, 76030, 28131]), ('normal control', [100000000, 5769322], [0, 5769322, 2134649]), ('normal control', [19110078, 54047], [54047, 0, 11890])]]
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 fixtureActualExpectedOutcome
regression 0[1202337, 39037685, 14708458][1202337, 39037685, 14708458]Passed
regression 1[17240497, 28188325, 14222590][17240497, 28188325, 14222590]Passed
partial-repair probe (boundary) 2[50, 51, 30][50, 51, 30]Passed
partial-repair probe 3[20897159, 0, 4597375][20897159, 0, 4597375]Passed
boundary control 4[0, 100, 37][0, 100, 37]Passed
boundary control 5[0, 0, 0][0, 0, 0]Passed
normal control 6[574037, 0, 126288][574037, 0, 126288]Passed
normal control 7[34567110, 0, 7604764][34567110, 0, 7604764]Passed
normal control 8[69310, 0, 15248][69310, 0, 15248]Passed
normal control 9[96623, 0, 21257][96623, 0, 21257]Passed

SHA-256 / 4ba7f63eb2feed0bae5e0ccd973fcc6c03308980c916e7a2191c17c1738b2574

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:31.418257+00:00.

Case digest / c8403d3421f01108838c25af3fc864498c564ba950115bf712ceb1995255e3e1