FA-59191 / Payroll withholding rules / Open access
Cumulative wages withholding method: bracket upper tier · case 01
High earners are withheld far more than the bracket schedule implies.
ROOT CAUSE
The top bracket slice starts at the first threshold, double taxing the middle slice.
THE FAILURE
The top bracket slice starts at the first threshold, double taxing the middle slice.
Unsuccessful approach: The attempt uses the right slice but the middle bracket rate.
Case contract
Input {ytd_wages, ytd_wh, wage, period_index k (1-based, includes this period), periods}. Annualized = (ytd_wages + wage)*periods/k exactly. Annual tax: 0% to 10,000.00, 12% to 40,000.00, 24% above. Tax to date = annual tax * k/periods. Withholding = max(0, tax_to_date - ytd_wh) rounded half-up at the end.
Why this case matters
The cumulative method spreads irregular pay across elapsed periods and trues up against prior withholding.
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):
k = x['period_index']
total = x['ytd_wages'] + x['wage']
annual = Fraction(total * x['periods'], k)
def tax(a):
t = Fraction(0)
if a > 1000000:
t += (min(a, 4000000) - 1000000) * Fraction(12, 100)
if a > 4000000:
t += (a - 1000000) * Fraction(24, 100)
return t
due = tax(annual) * k / x['periods']
wh = max(0, due - x['ytd_wh'])
return math.floor(wh + Fraction(1, 2))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'ytd_wages': 7060061, 'ytd_wh': 424656, 'wage': 491569, 'period_index': 24, 'periods': 52}, 1110812), ('regression', {'ytd_wages': 9590400, 'ytd_wh': 237513, 'wage': 534789, 'period_index': 22, 'periods': 26}, 1684840), ('partial-repair probe', {'ytd_wages': 8775450, 'ytd_wh': 1616919, 'wage': 334681, 'period_index': 24, 'periods': 26}, 15666), ('partial-repair probe', {'ytd_wages': 6145936, 'ytd_wh': 219937, 'wage': 315568, 'period_index': 15, 'periods': 52}, 1157747), ('normal control', {'ytd_wages': 2182615, 'ytd_wh': 379871, 'wage': 414670, 'period_index': 20, 'periods': 26}, 0), ('normal control', {'ytd_wages': 3504142, 'ytd_wh': 423680, 'wage': 219362, 'period_index': 26, 'periods': 26}, 0), ('normal control', {'ytd_wages': 953768, 'ytd_wh': 32122, 'wage': 67782, 'period_index': 21, 'periods': 26}, 0), ('normal control', {'ytd_wages': 185427, 'ytd_wh': 36091, 'wage': 108159, 'period_index': 2, 'periods': 12}, 0)], [('regression', {'ytd_wages': 9590400, 'ytd_wh': 237513, 'wage': 534789, 'period_index': 22, 'periods': 26}, 1684840), ('regression', {'ytd_wages': 8775450, 'ytd_wh': 1616919, 'wage': 334681, 'period_index': 24, 'periods': 26}, 15666), ('partial-repair probe', {'ytd_wages': 6145936, 'ytd_wh': 219937, 'wage': 315568, 'period_index': 15, 'periods': 52}, 1157747), ('partial-repair probe', {'ytd_wages': 0, 'ytd_wh': 1, 'wage': 366567, 'period_index': 1, 'periods': 12}, 37975), ('normal control', {'ytd_wages': 2268722, 'ytd_wh': 255963, 'wage': 370037, 'period_index': 8, 'periods': 12}, 0), ('normal control', {'ytd_wages': 141603, 'ytd_wh': 11497, 'wage': 15563, 'period_index': 7, 'periods': 12}, 0), ('normal control', {'ytd_wages': 29165, 'ytd_wh': 3348, 'wage': 5167, 'period_index': 8, 'periods': 52}, 0), ('normal control', {'ytd_wages': 32735, 'ytd_wh': 3167, 'wage': 155253, 'period_index': 2, 'periods': 12}, 0)], [('regression', {'ytd_wages': 8775450, 'ytd_wh': 1616919, 'wage': 334681, 'period_index': 24, 'periods': 26}, 15666), ('regression', {'ytd_wages': 6145936, 'ytd_wh': 219937, 'wage': 315568, 'period_index': 15, 'periods': 52}, 1157747), ('partial-repair probe', {'ytd_wages': 0, 'ytd_wh': 1, 'wage': 366567, 'period_index': 1, 'periods': 12}, 37975), ('partial-repair probe', {'ytd_wages': 4585857, 'ytd_wh': 265867, 'wage': 360821, 'period_index': 12, 'periods': 26}, 644413), ('normal control', {'ytd_wages': 507467, 'ytd_wh': 39498, 'wage': 384392, 'period_index': 10, 'periods': 12}, 0), ('normal control', {'ytd_wages': 2675147, 'ytd_wh': 522064, 'wage': 171429, 'period_index': 26, 'periods': 26}, 0), ('normal control', {'ytd_wages': 3055036, 'ytd_wh': 132701, 'wage': 516493, 'period_index': 12, 'periods': 12}, 175882), ('normal control', {'ytd_wages': 36870, 'ytd_wh': 6321, 'wage': 487926, 'period_index': 2, 'periods': 12}, 36655)], [('regression', {'ytd_wages': 6145936, 'ytd_wh': 219937, 'wage': 315568, 'period_index': 15, 'periods': 52}, 1157747), ('regression', {'ytd_wages': 0, 'ytd_wh': 1, 'wage': 366567, 'period_index': 1, 'periods': 12}, 37975), ('partial-repair probe', {'ytd_wages': 2724662, 'ytd_wh': 86701, 'wage': 332622, 'period_index': 7, 'periods': 52}, 566278), ('partial-repair probe', {'ytd_wages': 1665992, 'ytd_wh': 58323, 'wage': 387492, 'period_index': 4, 'periods': 12}, 234513), ('normal control', {'ytd_wages': 1078164, 'ytd_wh': 161049, 'wage': 458540, 'period_index': 6, 'periods': 12}, 0), ('normal control', {'ytd_wages': 978329, 'ytd_wh': 122337, 'wage': 298469, 'period_index': 9, 'periods': 26}, 0), ('normal control', {'ytd_wages': 81196, 'ytd_wh': 9361, 'wage': 306786, 'period_index': 2, 'periods': 12}, 17197), ('normal control', {'ytd_wages': 78474, 'ytd_wh': 12616, 'wage': 2681, 'period_index': 35, 'periods': 52}, 0)], [('regression', {'ytd_wages': 0, 'ytd_wh': 1, 'wage': 366567, 'period_index': 1, 'periods': 12}, 37975), ('regression', {'ytd_wages': 4585857, 'ytd_wh': 265867, 'wage': 360821, 'period_index': 12, 'periods': 26}, 644413), ('partial-repair probe', {'ytd_wages': 17382079, 'ytd_wh': 703861, 'wage': 564605, 'period_index': 25, 'periods': 52}, 3314882), ('partial-repair probe', {'ytd_wages': 7572146, 'ytd_wh': 1352041, 'wage': 228907, 'period_index': 18, 'periods': 52}, 312519), ('normal control', {'ytd_wages': 1412754, 'ytd_wh': 40526, 'wage': 95617, 'period_index': 11, 'periods': 12}, 30479), ('normal control', {'ytd_wages': 867698, 'ytd_wh': 9315, 'wage': 86343, 'period_index': 8, 'periods': 12}, 25170), ('normal control', {'ytd_wages': 179570, 'ytd_wh': 6855, 'wage': 84088, 'period_index': 5, 'periods': 52}, 13245), ('normal control', {'ytd_wages': 780083, 'ytd_wh': 115357, 'wage': 60520, 'period_index': 12, 'periods': 26}, 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 | 1443120 | 1110812 | Failed |
| regression 1 | 2294071 | 1684840 | Failed |
| partial-repair probe 2 | 680282 | 15666 | Failed |
| partial-repair probe 3 | 1365439 | 1157747 | Failed |
| normal control 4 | 0 | 0 | Passed |
| normal control 5 | 0 | 0 | Passed |
| normal control 6 | 0 | 0 | Passed |
| normal control 7 | 0 | 0 | Passed |
SHA-256 / 9ec32133817fe212151c396066303fd372dadcd3d989c2bf07c30c0bc672285a
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):
k = x['period_index']
total = x['ytd_wages'] + x['wage']
annual = Fraction(total * x['periods'], k)
def tax(a):
t = Fraction(0)
if a > 1000000:
t += (min(a, 4000000) - 1000000) * Fraction(12, 100)
if a > 4000000:
t += (a - 4000000) * Fraction(12, 100)
return t
due = tax(annual) * k / x['periods']
wh = max(0, due - x['ytd_wh'])
return math.floor(wh + Fraction(1, 2))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'ytd_wages': 7060061, 'ytd_wh': 424656, 'wage': 491569, 'period_index': 24, 'periods': 52}, 1110812), ('regression', {'ytd_wages': 9590400, 'ytd_wh': 237513, 'wage': 534789, 'period_index': 22, 'periods': 26}, 1684840), ('partial-repair probe', {'ytd_wages': 8775450, 'ytd_wh': 1616919, 'wage': 334681, 'period_index': 24, 'periods': 26}, 15666), ('partial-repair probe', {'ytd_wages': 6145936, 'ytd_wh': 219937, 'wage': 315568, 'period_index': 15, 'periods': 52}, 1157747), ('normal control', {'ytd_wages': 2182615, 'ytd_wh': 379871, 'wage': 414670, 'period_index': 20, 'periods': 26}, 0), ('normal control', {'ytd_wages': 3504142, 'ytd_wh': 423680, 'wage': 219362, 'period_index': 26, 'periods': 26}, 0), ('normal control', {'ytd_wages': 953768, 'ytd_wh': 32122, 'wage': 67782, 'period_index': 21, 'periods': 26}, 0), ('normal control', {'ytd_wages': 185427, 'ytd_wh': 36091, 'wage': 108159, 'period_index': 2, 'periods': 12}, 0)], [('regression', {'ytd_wages': 9590400, 'ytd_wh': 237513, 'wage': 534789, 'period_index': 22, 'periods': 26}, 1684840), ('regression', {'ytd_wages': 8775450, 'ytd_wh': 1616919, 'wage': 334681, 'period_index': 24, 'periods': 26}, 15666), ('partial-repair probe', {'ytd_wages': 6145936, 'ytd_wh': 219937, 'wage': 315568, 'period_index': 15, 'periods': 52}, 1157747), ('partial-repair probe', {'ytd_wages': 0, 'ytd_wh': 1, 'wage': 366567, 'period_index': 1, 'periods': 12}, 37975), ('normal control', {'ytd_wages': 2268722, 'ytd_wh': 255963, 'wage': 370037, 'period_index': 8, 'periods': 12}, 0), ('normal control', {'ytd_wages': 141603, 'ytd_wh': 11497, 'wage': 15563, 'period_index': 7, 'periods': 12}, 0), ('normal control', {'ytd_wages': 29165, 'ytd_wh': 3348, 'wage': 5167, 'period_index': 8, 'periods': 52}, 0), ('normal control', {'ytd_wages': 32735, 'ytd_wh': 3167, 'wage': 155253, 'period_index': 2, 'periods': 12}, 0)], [('regression', {'ytd_wages': 8775450, 'ytd_wh': 1616919, 'wage': 334681, 'period_index': 24, 'periods': 26}, 15666), ('regression', {'ytd_wages': 6145936, 'ytd_wh': 219937, 'wage': 315568, 'period_index': 15, 'periods': 52}, 1157747), ('partial-repair probe', {'ytd_wages': 0, 'ytd_wh': 1, 'wage': 366567, 'period_index': 1, 'periods': 12}, 37975), ('partial-repair probe', {'ytd_wages': 4585857, 'ytd_wh': 265867, 'wage': 360821, 'period_index': 12, 'periods': 26}, 644413), ('normal control', {'ytd_wages': 507467, 'ytd_wh': 39498, 'wage': 384392, 'period_index': 10, 'periods': 12}, 0), ('normal control', {'ytd_wages': 2675147, 'ytd_wh': 522064, 'wage': 171429, 'period_index': 26, 'periods': 26}, 0), ('normal control', {'ytd_wages': 3055036, 'ytd_wh': 132701, 'wage': 516493, 'period_index': 12, 'periods': 12}, 175882), ('normal control', {'ytd_wages': 36870, 'ytd_wh': 6321, 'wage': 487926, 'period_index': 2, 'periods': 12}, 36655)], [('regression', {'ytd_wages': 6145936, 'ytd_wh': 219937, 'wage': 315568, 'period_index': 15, 'periods': 52}, 1157747), ('regression', {'ytd_wages': 0, 'ytd_wh': 1, 'wage': 366567, 'period_index': 1, 'periods': 12}, 37975), ('partial-repair probe', {'ytd_wages': 2724662, 'ytd_wh': 86701, 'wage': 332622, 'period_index': 7, 'periods': 52}, 566278), ('partial-repair probe', {'ytd_wages': 1665992, 'ytd_wh': 58323, 'wage': 387492, 'period_index': 4, 'periods': 12}, 234513), ('normal control', {'ytd_wages': 1078164, 'ytd_wh': 161049, 'wage': 458540, 'period_index': 6, 'periods': 12}, 0), ('normal control', {'ytd_wages': 978329, 'ytd_wh': 122337, 'wage': 298469, 'period_index': 9, 'periods': 26}, 0), ('normal control', {'ytd_wages': 81196, 'ytd_wh': 9361, 'wage': 306786, 'period_index': 2, 'periods': 12}, 17197), ('normal control', {'ytd_wages': 78474, 'ytd_wh': 12616, 'wage': 2681, 'period_index': 35, 'periods': 52}, 0)], [('regression', {'ytd_wages': 0, 'ytd_wh': 1, 'wage': 366567, 'period_index': 1, 'periods': 12}, 37975), ('regression', {'ytd_wages': 4585857, 'ytd_wh': 265867, 'wage': 360821, 'period_index': 12, 'periods': 26}, 644413), ('partial-repair probe', {'ytd_wages': 17382079, 'ytd_wh': 703861, 'wage': 564605, 'period_index': 25, 'periods': 52}, 3314882), ('partial-repair probe', {'ytd_wages': 7572146, 'ytd_wh': 1352041, 'wage': 228907, 'period_index': 18, 'periods': 52}, 312519), ('normal control', {'ytd_wages': 1412754, 'ytd_wh': 40526, 'wage': 95617, 'period_index': 11, 'periods': 12}, 30479), ('normal control', {'ytd_wages': 867698, 'ytd_wh': 9315, 'wage': 86343, 'period_index': 8, 'periods': 12}, 25170), ('normal control', {'ytd_wages': 179570, 'ytd_wh': 6855, 'wage': 84088, 'period_index': 5, 'periods': 52}, 13245), ('normal control', {'ytd_wages': 780083, 'ytd_wh': 115357, 'wage': 60520, 'period_index': 12, 'periods': 26}, 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 | 426155 | 1110812 | Failed |
| regression 1 | 875971 | 1684840 | Failed |
| partial-repair probe 2 | 0 | 15666 | Failed |
| partial-repair probe 3 | 520828 | 1157747 | Failed |
| normal control 4 | 0 | 0 | Passed |
| normal control 5 | 0 | 0 | Passed |
| normal control 6 | 0 | 0 | Passed |
| normal control 7 | 0 | 0 | Passed |
SHA-256 / ae551262cfe946cf6bd785c8b354ad57a7ba60b1b02e52f39e07dab26d1b8e88
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:33.871824+00:00.
Case digest / 80b4c45c31c34513f2f0508c5cd79eaf1be1a780f694d83a3cfa34bf488cd764