FAILURE MAP
← Case archive

FA-59251 / Payroll withholding rules / Open access

Wage levy exempt amount: exempt de-annualization · case 01

Semimonthly and monthly employees receive a smaller exempt amount than their annual figure implies.

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

ROOT CAUSE

The weekly exempt amount is multiplied by a whole number of weeks per period.

THE FAILURE

The weekly exempt amount is multiplied by a whole number of weeks per period.

Unsuccessful approach: The attempt converts through a truncated weekly amount, losing cents before dividing.

Case contract

Input {gross, taxes, pre_levy_ded, post_levy_ded, status, dependents, freq}. Annual exempt = standard amount (single 14,600, mfj 29,200, hoh 21,900 dollars) + 5,050.00 per dependent (the taxpayer is not a dependent); per-period exempt = annual/periods half-up (weekly 52, biweekly 26, semimonthly 24, monthly 12). Take-home counts only deductions in place before the levy. Levy = max(0, take-home - exempt). Return [exempt, levy].

Why this case matters

A wage levy takes everything above an exempt amount, so the exempt computation and take-home definition decide the whole paycheck.

1 / The failure

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

N = 1
observations = []
def solve(x):
    periods = {'weekly': 52, 'biweekly': 26, 'semimonthly': 24, 'monthly': 12}[x['freq']]
    std = {'single': 1460000, 'mfj': 2920000, 'hoh': 2190000}[x['status']]
    annual = std + 505000 * x['dependents']
    exempt = annual // 52 * {52: 1, 26: 2, 24: 2, 12: 4}[periods]
    take_home = x['gross'] - x['taxes'] - x['pre_levy_ded']
    levy = max(0, take_home - exempt)
    return [exempt, levy]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'gross': 367596, 'taxes': 19999, 'pre_levy_ded': 20821, 'post_levy_ded': 35382, 'status': 'mfj', 'dependents': 5, 'freq': 'monthly'}, [453750, 0]), ('regression', {'gross': 314207, 'taxes': 9435, 'pre_levy_ded': 16283, 'post_levy_ded': 19170, 'status': 'hoh', 'dependents': 0, 'freq': 'semimonthly'}, [91250, 197239]), ('partial-repair probe', {'gross': 375806, 'taxes': 85086, 'pre_levy_ded': 17388, 'post_levy_ded': 18649, 'status': 'mfj', 'dependents': 1, 'freq': 'semimonthly'}, [142708, 130624]), ('partial-repair probe', {'gross': 662079, 'taxes': 145163, 'pre_levy_ded': 13433, 'post_levy_ded': 24210, 'status': 'mfj', 'dependents': 4, 'freq': 'monthly'}, [411667, 91816]), ('normal control', {'gross': 85343, 'taxes': 8434, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'weekly'}, [37788, 39121]), ('normal control', {'gross': 563938, 'taxes': 31966, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 3, 'freq': 'weekly'}, [71250, 460722]), ('normal control', {'gross': 725985, 'taxes': 84896, 'pre_levy_ded': 30943, 'post_levy_ded': 0, 'status': 'single', 'dependents': 4, 'freq': 'weekly'}, [66923, 543223]), ('normal control', {'gross': 779132, 'taxes': 128015, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'weekly'}, [37788, 613329])], [('regression', {'gross': 314207, 'taxes': 9435, 'pre_levy_ded': 16283, 'post_levy_ded': 19170, 'status': 'hoh', 'dependents': 0, 'freq': 'semimonthly'}, [91250, 197239]), ('regression', {'gross': 375806, 'taxes': 85086, 'pre_levy_ded': 17388, 'post_levy_ded': 18649, 'status': 'mfj', 'dependents': 1, 'freq': 'semimonthly'}, [142708, 130624]), ('partial-repair probe', {'gross': 662079, 'taxes': 145163, 'pre_levy_ded': 13433, 'post_levy_ded': 24210, 'status': 'mfj', 'dependents': 4, 'freq': 'monthly'}, [411667, 91816]), ('partial-repair probe', {'gross': 776186, 'taxes': 132647, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'semimonthly'}, [81875, 561664]), ('normal control', {'gross': 561044, 'taxes': 73700, 'pre_levy_ded': 46955, 'post_levy_ded': 0, 'status': 'mfj', 'dependents': 1, 'freq': 'weekly'}, [65865, 374524]), ('normal control', {'gross': 457089, 'taxes': 16572, 'pre_levy_ded': 0, 'post_levy_ded': 36321, 'status': 'mfj', 'dependents': 3, 'freq': 'weekly'}, [85288, 355229]), ('normal control', {'gross': 483360, 'taxes': 31636, 'pre_levy_ded': 19968, 'post_levy_ded': 0, 'status': 'single', 'dependents': 2, 'freq': 'biweekly'}, [95000, 336756]), ('normal control', {'gross': 322291, 'taxes': 48648, 'pre_levy_ded': 2314, 'post_levy_ded': 38453, 'status': 'single', 'dependents': 2, 'freq': 'biweekly'}, [95000, 176329])], [('regression', {'gross': 375806, 'taxes': 85086, 'pre_levy_ded': 17388, 'post_levy_ded': 18649, 'status': 'mfj', 'dependents': 1, 'freq': 'semimonthly'}, [142708, 130624]), ('regression', {'gross': 662079, 'taxes': 145163, 'pre_levy_ded': 13433, 'post_levy_ded': 24210, 'status': 'mfj', 'dependents': 4, 'freq': 'monthly'}, [411667, 91816]), ('partial-repair probe', {'gross': 776186, 'taxes': 132647, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'semimonthly'}, [81875, 561664]), ('partial-repair probe', {'gross': 479258, 'taxes': 23759, 'pre_levy_ded': 40016, 'post_levy_ded': 17364, 'status': 'mfj', 'dependents': 2, 'freq': 'weekly'}, [75577, 339906]), ('normal control', {'gross': 292245, 'taxes': 28483, 'pre_levy_ded': 0, 'post_levy_ded': 44551, 'status': 'hoh', 'dependents': 5, 'freq': 'weekly'}, [90673, 173089]), ('normal control', {'gross': 498978, 'taxes': 56799, 'pre_levy_ded': 38573, 'post_levy_ded': 19078, 'status': 'hoh', 'dependents': 3, 'freq': 'biweekly'}, [142500, 261106]), ('normal control', {'gross': 135890, 'taxes': 7806, 'pre_levy_ded': 22489, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 5, 'freq': 'biweekly'}, [181346, 0]), ('normal control', {'gross': 660334, 'taxes': 22679, 'pre_levy_ded': 11619, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 3, 'freq': 'weekly'}, [71250, 554786])], [('regression', {'gross': 662079, 'taxes': 145163, 'pre_levy_ded': 13433, 'post_levy_ded': 24210, 'status': 'mfj', 'dependents': 4, 'freq': 'monthly'}, [411667, 91816]), ('regression', {'gross': 776186, 'taxes': 132647, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'semimonthly'}, [81875, 561664]), ('partial-repair probe', {'gross': 138753, 'taxes': 7542, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 0, 'freq': 'weekly'}, [28077, 103134]), ('partial-repair probe', {'gross': 558221, 'taxes': 118600, 'pre_levy_ded': 0, 'post_levy_ded': 47539, 'status': 'hoh', 'dependents': 2, 'freq': 'biweekly'}, [123077, 316544]), ('normal control', {'gross': 78319, 'taxes': 7904, 'pre_levy_ded': 47033, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 5, 'freq': 'weekly'}, [90673, 0]), ('normal control', {'gross': 489973, 'taxes': 77825, 'pre_levy_ded': 1438, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 3, 'freq': 'biweekly'}, [142500, 268210]), ('normal control', {'gross': 771109, 'taxes': 88550, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'mfj', 'dependents': 4, 'freq': 'biweekly'}, [190000, 492559]), ('normal control', {'gross': 555233, 'taxes': 30018, 'pre_levy_ded': 24468, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 5, 'freq': 'biweekly'}, [181346, 319401])], [('regression', {'gross': 776186, 'taxes': 132647, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'semimonthly'}, [81875, 561664]), ('regression', {'gross': 479258, 'taxes': 23759, 'pre_levy_ded': 40016, 'post_levy_ded': 17364, 'status': 'mfj', 'dependents': 2, 'freq': 'weekly'}, [75577, 339906]), ('partial-repair probe', {'gross': 531960, 'taxes': 121383, 'pre_levy_ded': 0, 'post_levy_ded': 49273, 'status': 'mfj', 'dependents': 2, 'freq': 'monthly'}, [327500, 83077]), ('partial-repair probe', {'gross': 714333, 'taxes': 49017, 'pre_levy_ded': 0, 'post_levy_ded': 19873, 'status': 'single', 'dependents': 0, 'freq': 'monthly'}, [121667, 543649]), ('normal control', {'gross': 170013, 'taxes': 32585, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 5, 'freq': 'biweekly'}, [181346, 0]), ('normal control', {'gross': 446675, 'taxes': 105666, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 4, 'freq': 'weekly'}, [66923, 274086]), ('normal control', {'gross': 379980, 'taxes': 42083, 'pre_levy_ded': 23968, 'post_levy_ded': 48603, 'status': 'single', 'dependents': 2, 'freq': 'weekly'}, [47500, 266429]), ('normal control', {'gross': 290615, 'taxes': 49794, 'pre_levy_ded': 9951, 'post_levy_ded': 46367, 'status': 'hoh', 'dependents': 3, 'freq': 'weekly'}, [71250, 159620])]]
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[418844, 0][453750, 0]Failed
regression 1[84230, 204259][91250, 197239]Failed
partial-repair probe 2[131730, 141602][142708, 130624]Failed
partial-repair probe 3[380000, 123483][411667, 91816]Failed
normal control 4[37788, 39121][37788, 39121]Passed
normal control 5[71250, 460722][71250, 460722]Passed
normal control 6[66923, 543223][66923, 543223]Passed
normal control 7[37788, 613329][37788, 613329]Passed

SHA-256 / b533cdbb4f4ae38b224083bdbdcb575c69312c2e08ae91b8befa22b308ebc2eb

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    periods = {'weekly': 52, 'biweekly': 26, 'semimonthly': 24, 'monthly': 12}[x['freq']]
    std = {'single': 1460000, 'mfj': 2920000, 'hoh': 2190000}[x['status']]
    annual = std + 505000 * x['dependents']
    exempt = annual // 52 * 52 // periods
    take_home = x['gross'] - x['taxes'] - x['pre_levy_ded']
    levy = max(0, take_home - exempt)
    return [exempt, levy]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'gross': 367596, 'taxes': 19999, 'pre_levy_ded': 20821, 'post_levy_ded': 35382, 'status': 'mfj', 'dependents': 5, 'freq': 'monthly'}, [453750, 0]), ('regression', {'gross': 314207, 'taxes': 9435, 'pre_levy_ded': 16283, 'post_levy_ded': 19170, 'status': 'hoh', 'dependents': 0, 'freq': 'semimonthly'}, [91250, 197239]), ('partial-repair probe', {'gross': 375806, 'taxes': 85086, 'pre_levy_ded': 17388, 'post_levy_ded': 18649, 'status': 'mfj', 'dependents': 1, 'freq': 'semimonthly'}, [142708, 130624]), ('partial-repair probe', {'gross': 662079, 'taxes': 145163, 'pre_levy_ded': 13433, 'post_levy_ded': 24210, 'status': 'mfj', 'dependents': 4, 'freq': 'monthly'}, [411667, 91816]), ('normal control', {'gross': 85343, 'taxes': 8434, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'weekly'}, [37788, 39121]), ('normal control', {'gross': 563938, 'taxes': 31966, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 3, 'freq': 'weekly'}, [71250, 460722]), ('normal control', {'gross': 725985, 'taxes': 84896, 'pre_levy_ded': 30943, 'post_levy_ded': 0, 'status': 'single', 'dependents': 4, 'freq': 'weekly'}, [66923, 543223]), ('normal control', {'gross': 779132, 'taxes': 128015, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'weekly'}, [37788, 613329])], [('regression', {'gross': 314207, 'taxes': 9435, 'pre_levy_ded': 16283, 'post_levy_ded': 19170, 'status': 'hoh', 'dependents': 0, 'freq': 'semimonthly'}, [91250, 197239]), ('regression', {'gross': 375806, 'taxes': 85086, 'pre_levy_ded': 17388, 'post_levy_ded': 18649, 'status': 'mfj', 'dependents': 1, 'freq': 'semimonthly'}, [142708, 130624]), ('partial-repair probe', {'gross': 662079, 'taxes': 145163, 'pre_levy_ded': 13433, 'post_levy_ded': 24210, 'status': 'mfj', 'dependents': 4, 'freq': 'monthly'}, [411667, 91816]), ('partial-repair probe', {'gross': 776186, 'taxes': 132647, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'semimonthly'}, [81875, 561664]), ('normal control', {'gross': 561044, 'taxes': 73700, 'pre_levy_ded': 46955, 'post_levy_ded': 0, 'status': 'mfj', 'dependents': 1, 'freq': 'weekly'}, [65865, 374524]), ('normal control', {'gross': 457089, 'taxes': 16572, 'pre_levy_ded': 0, 'post_levy_ded': 36321, 'status': 'mfj', 'dependents': 3, 'freq': 'weekly'}, [85288, 355229]), ('normal control', {'gross': 483360, 'taxes': 31636, 'pre_levy_ded': 19968, 'post_levy_ded': 0, 'status': 'single', 'dependents': 2, 'freq': 'biweekly'}, [95000, 336756]), ('normal control', {'gross': 322291, 'taxes': 48648, 'pre_levy_ded': 2314, 'post_levy_ded': 38453, 'status': 'single', 'dependents': 2, 'freq': 'biweekly'}, [95000, 176329])], [('regression', {'gross': 375806, 'taxes': 85086, 'pre_levy_ded': 17388, 'post_levy_ded': 18649, 'status': 'mfj', 'dependents': 1, 'freq': 'semimonthly'}, [142708, 130624]), ('regression', {'gross': 662079, 'taxes': 145163, 'pre_levy_ded': 13433, 'post_levy_ded': 24210, 'status': 'mfj', 'dependents': 4, 'freq': 'monthly'}, [411667, 91816]), ('partial-repair probe', {'gross': 776186, 'taxes': 132647, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'semimonthly'}, [81875, 561664]), ('partial-repair probe', {'gross': 479258, 'taxes': 23759, 'pre_levy_ded': 40016, 'post_levy_ded': 17364, 'status': 'mfj', 'dependents': 2, 'freq': 'weekly'}, [75577, 339906]), ('normal control', {'gross': 292245, 'taxes': 28483, 'pre_levy_ded': 0, 'post_levy_ded': 44551, 'status': 'hoh', 'dependents': 5, 'freq': 'weekly'}, [90673, 173089]), ('normal control', {'gross': 498978, 'taxes': 56799, 'pre_levy_ded': 38573, 'post_levy_ded': 19078, 'status': 'hoh', 'dependents': 3, 'freq': 'biweekly'}, [142500, 261106]), ('normal control', {'gross': 135890, 'taxes': 7806, 'pre_levy_ded': 22489, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 5, 'freq': 'biweekly'}, [181346, 0]), ('normal control', {'gross': 660334, 'taxes': 22679, 'pre_levy_ded': 11619, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 3, 'freq': 'weekly'}, [71250, 554786])], [('regression', {'gross': 662079, 'taxes': 145163, 'pre_levy_ded': 13433, 'post_levy_ded': 24210, 'status': 'mfj', 'dependents': 4, 'freq': 'monthly'}, [411667, 91816]), ('regression', {'gross': 776186, 'taxes': 132647, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'semimonthly'}, [81875, 561664]), ('partial-repair probe', {'gross': 138753, 'taxes': 7542, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 0, 'freq': 'weekly'}, [28077, 103134]), ('partial-repair probe', {'gross': 558221, 'taxes': 118600, 'pre_levy_ded': 0, 'post_levy_ded': 47539, 'status': 'hoh', 'dependents': 2, 'freq': 'biweekly'}, [123077, 316544]), ('normal control', {'gross': 78319, 'taxes': 7904, 'pre_levy_ded': 47033, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 5, 'freq': 'weekly'}, [90673, 0]), ('normal control', {'gross': 489973, 'taxes': 77825, 'pre_levy_ded': 1438, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 3, 'freq': 'biweekly'}, [142500, 268210]), ('normal control', {'gross': 771109, 'taxes': 88550, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'mfj', 'dependents': 4, 'freq': 'biweekly'}, [190000, 492559]), ('normal control', {'gross': 555233, 'taxes': 30018, 'pre_levy_ded': 24468, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 5, 'freq': 'biweekly'}, [181346, 319401])], [('regression', {'gross': 776186, 'taxes': 132647, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'semimonthly'}, [81875, 561664]), ('regression', {'gross': 479258, 'taxes': 23759, 'pre_levy_ded': 40016, 'post_levy_ded': 17364, 'status': 'mfj', 'dependents': 2, 'freq': 'weekly'}, [75577, 339906]), ('partial-repair probe', {'gross': 531960, 'taxes': 121383, 'pre_levy_ded': 0, 'post_levy_ded': 49273, 'status': 'mfj', 'dependents': 2, 'freq': 'monthly'}, [327500, 83077]), ('partial-repair probe', {'gross': 714333, 'taxes': 49017, 'pre_levy_ded': 0, 'post_levy_ded': 19873, 'status': 'single', 'dependents': 0, 'freq': 'monthly'}, [121667, 543649]), ('normal control', {'gross': 170013, 'taxes': 32585, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 5, 'freq': 'biweekly'}, [181346, 0]), ('normal control', {'gross': 446675, 'taxes': 105666, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 4, 'freq': 'weekly'}, [66923, 274086]), ('normal control', {'gross': 379980, 'taxes': 42083, 'pre_levy_ded': 23968, 'post_levy_ded': 48603, 'status': 'single', 'dependents': 2, 'freq': 'weekly'}, [47500, 266429]), ('normal control', {'gross': 290615, 'taxes': 49794, 'pre_levy_ded': 9951, 'post_levy_ded': 46367, 'status': 'hoh', 'dependents': 3, 'freq': 'weekly'}, [71250, 159620])]]
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[453747, 0][453750, 0]Failed
regression 1[91249, 197240][91250, 197239]Failed
partial-repair probe 2[142707, 130625][142708, 130624]Failed
partial-repair probe 3[411666, 91817][411667, 91816]Failed
normal control 4[37788, 39121][37788, 39121]Passed
normal control 5[71250, 460722][71250, 460722]Passed
normal control 6[66923, 543223][66923, 543223]Passed
normal control 7[37788, 613329][37788, 613329]Passed

SHA-256 / 9f3142176242feb18b962dc12c72390466c22b42d5c11da492f22272124ee9e7

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

Case digest / 94245d4ab090f8387598b46ef252f47902d0d41c106932575b32b9bd18b36712