FAILURE MAP
← Case archive

FA-59081 / Payroll withholding rules / Open access

FUTA liability with credit-reduction states: liability rounding stage · case 01

Quarterly FUTA liability differs by a few cents from the rate applied to total taxable wages.

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

ROOT CAUSE

Each employee line is rounded to cents before summation instead of rounding the aggregate once.

VERIFIED REPAIR

Restore the contract rule at the liability rounding stage step: use `total_bp += line`.

Unsuccessful approach: The attempt truncates each employee line, drifting the total downward.

Case contract

Input {employees: [[ytd, wages, state]], credit_reduction: {state: basis points}, carry}. Per employee taxable = min(wages, max(0, 7,000.00 - ytd)). Each line costs taxable*(60 + reduction bp); lines are summed in cent-basis-point units and the quarter liability is rounded half-up once. A deposit is due when liability plus carried undeposited liability is more than 500.00. Return [taxable_total, liability, deposit_due].

Why this case matters

FUTA credit reductions apply only to taxable wages in the affected state, and deposit timing depends on accumulated liability.

1 / The failure

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

N = 1
observations = []
def solve(x):
    total_bp = 0
    taxable_total = 0
    for ytd, wages, st in x['employees']:
        t = min(wages, max(0, 700000 - ytd))
        taxable_total += t
        line = t * (60 + x['credit_reduction'].get(st, 0))
        total_bp += (line + 5000) // 10000 * 10000
    liability = (total_bp + 5000) // 10000
    return [taxable_total, liability, liability + x['carry'] > 50000]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'employees': [[0, 1366, 'TX'], [0, 110884, 'CT']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 0}, [112250, 674, False]), ('regression', {'employees': [[376476, 262345, 'CA'], [0, 47415, 'TX']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 21513}, [309760, 4220, False]), ('partial-repair probe', {'employees': [[700000, 169234, 'NY'], [1252894, 424268, 'CT'], [0, 17305, 'CA']], 'credit_reduction': {}, 'carry': 6676}, [17305, 104, False]), ('partial-repair probe', {'employees': [[0, 271790, 'CT'], [0, 338127, 'NY'], [641967, 53016, 'CA']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [662933, 4455, True]), ('boundary control', {'employees': [[0, 5000000, 'CA']], 'credit_reduction': {}, 'carry': 50000}, [700000, 4200, True]), ('boundary control', {'employees': [[0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 1333334, 'TX']], 'credit_reduction': {}, 'carry': 0}, [4200000, 25200, False]), ('normal control', {'employees': [[700000, 386714, 'CT'], [700000, 335040, 'TX']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 50000}, [0, 0, False]), ('normal control', {'employees': [[700000, 92238, 'TX']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 50000}, [0, 0, False]), ('normal control', {'employees': [[1226498, 242483, 'CT'], [700000, 208545, 'CA'], [1294547, 6890, 'NY']], 'credit_reduction': {'CA': 90}, 'carry': 16440}, [0, 0, False]), ('normal control', {'employees': [[278512, 329204, 'CT'], [726123, 497336, 'NY']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 48178}, [329204, 1975, True])], [('regression', {'employees': [[376476, 262345, 'CA'], [0, 47415, 'TX']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 21513}, [309760, 4220, False]), ('regression', {'employees': [[396254, 477582, 'NY'], [839542, 250192, 'TX'], [1310770, 427394, 'TX'], [1503697, 51559, 'TX'], [188874, 4682, 'TX']], 'credit_reduction': {'CA': 90}, 'carry': 0}, [308428, 1851, False]), ('partial-repair probe', {'employees': [[0, 271790, 'CT'], [0, 338127, 'NY'], [641967, 53016, 'CA']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [662933, 4455, True]), ('partial-repair probe', {'employees': [[1804354, 167912, 'CT'], [501525, 208360, 'CA'], [0, 261050, 'CT']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 50000}, [459525, 5922, True]), ('boundary control', {'employees': [[0, 5000000, 'CA']], 'credit_reduction': {}, 'carry': 50000}, [700000, 4200, True]), ('boundary control', {'employees': [[0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 1333334, 'TX']], 'credit_reduction': {}, 'carry': 0}, [4200000, 25200, False]), ('normal control', {'employees': [[0, 395432, 'NY']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 50000}, [395432, 4745, True]), ('normal control', {'employees': [[700000, 276921, 'CT']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 45461}, [0, 0, False]), ('normal control', {'employees': [[1883523, 169842, 'CA']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 50000}, [0, 0, False]), ('normal control', {'employees': [[700000, 489338, 'CT']], 'credit_reduction': {'CA': 90}, 'carry': 0}, [0, 0, False])], [('regression', {'employees': [[396254, 477582, 'NY'], [839542, 250192, 'TX'], [1310770, 427394, 'TX'], [1503697, 51559, 'TX'], [188874, 4682, 'TX']], 'credit_reduction': {'CA': 90}, 'carry': 0}, [308428, 1851, False]), ('regression', {'employees': [[189443, 281945, 'TX'], [0, 460002, 'TX'], [33055, 315242, 'CA']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [1057189, 9180, True]), ('partial-repair probe', {'employees': [[376476, 262345, 'CA'], [0, 47415, 'TX']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 21513}, [309760, 4220, False]), ('partial-repair probe', {'employees': [[0, 152949, 'CT'], [199614, 315226, 'TX']], 'credit_reduction': {}, 'carry': 23841}, [468175, 2809, False]), ('boundary control', {'employees': [[0, 5000000, 'CA']], 'credit_reduction': {}, 'carry': 50000}, [700000, 4200, True]), ('boundary control', {'employees': [[0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 1333334, 'TX']], 'credit_reduction': {}, 'carry': 0}, [4200000, 25200, False]), ('normal control', {'employees': [[700000, 204593, 'CA'], [700000, 443120, 'TX']], 'credit_reduction': {}, 'carry': 50000}, [0, 0, False]), ('normal control', {'employees': [[997952, 486233, 'CT'], [1510820, 394052, 'TX']], 'credit_reduction': {}, 'carry': 5423}, [0, 0, False]), ('normal control', {'employees': [[700000, 16090, 'NY'], [1237814, 31301, 'TX']], 'credit_reduction': {}, 'carry': 50000}, [0, 0, False]), ('normal control', {'employees': [[700000, 185137, 'TX']], 'credit_reduction': {'CA': 90}, 'carry': 31444}, [0, 0, False])], [('regression', {'employees': [[189443, 281945, 'TX'], [0, 460002, 'TX'], [33055, 315242, 'CA']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [1057189, 9180, True]), ('regression', {'employees': [[526959, 328635, 'CT'], [319400, 23395, 'CT'], [700000, 350261, 'CT'], [700000, 458444, 'TX']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [196436, 1179, True]), ('partial-repair probe', {'employees': [[0, 80817, 'CA'], [1367038, 69564, 'CT']], 'credit_reduction': {}, 'carry': 50000}, [80817, 485, True]), ('partial-repair probe', {'employees': [[700000, 197663, 'CA'], [1911040, 104779, 'CT'], [0, 119592, 'NY']], 'credit_reduction': {}, 'carry': 39745}, [119592, 718, False]), ('boundary control', {'employees': [[0, 5000000, 'CA']], 'credit_reduction': {}, 'carry': 50000}, [700000, 4200, True]), ('boundary control', {'employees': [[0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 1333334, 'TX']], 'credit_reduction': {}, 'carry': 0}, [4200000, 25200, False]), ('normal control', {'employees': [[209483, 408670, 'NY'], [1754601, 20957, 'TX'], [839652, 414637, 'TX'], [534708, 392249, 'CA'], [700000, 141320, 'CA']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 14909}, [573962, 7383, False]), ('normal control', {'employees': [[700000, 132484, 'NY']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 0}, [0, 0, False]), ('normal control', {'employees': [[1144116, 183620, 'CA'], [913960, 129867, 'NY'], [604265, 205102, 'CT'], [1068658, 443383, 'TX']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 0}, [95735, 574, False]), ('normal control', {'employees': [[0, 229094, 'NY']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 44833}, [229094, 2749, False])], [('regression', {'employees': [[526959, 328635, 'CT'], [319400, 23395, 'CT'], [700000, 350261, 'CT'], [700000, 458444, 'TX']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [196436, 1179, True]), ('regression', {'employees': [[600906, 231669, 'CA'], [0, 335471, 'CA'], [700000, 233980, 'CA'], [163691, 35969, 'CA'], [93071, 55837, 'TX']], 'credit_reduction': {}, 'carry': 50000}, [526371, 3158, True]), ('partial-repair probe', {'employees': [[1148812, 65672, 'TX'], [874881, 68496, 'TX'], [700000, 246758, 'CA'], [1529600, 133370, 'NY'], [0, 22316, 'TX']], 'credit_reduction': {}, 'carry': 0}, [22316, 134, False]), ('partial-repair probe', {'employees': [[150141, 484498, 'NY'], [700000, 187126, 'CT']], 'credit_reduction': {}, 'carry': 50000}, [484498, 2907, True]), ('boundary control', {'employees': [[0, 5000000, 'CA']], 'credit_reduction': {}, 'carry': 50000}, [700000, 4200, True]), ('boundary control', {'employees': [[0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 1333334, 'TX']], 'credit_reduction': {}, 'carry': 0}, [4200000, 25200, False]), ('normal control', {'employees': [[0, 223552, 'TX']], 'credit_reduction': {}, 'carry': 50000}, [223552, 1341, True]), ('normal control', {'employees': [[757466, 156766, 'TX'], [700000, 33282, 'CT']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 0}, [0, 0, False]), ('normal control', {'employees': [[892995, 392688, 'CA']], 'credit_reduction': {}, 'carry': 0}, [0, 0, False]), ('normal control', {'employees': [[700000, 101649, 'TX'], [255245, 435415, 'NY'], [1060191, 58223, 'CA'], [700000, 244076, 'NY'], [767509, 385008, 'CA']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 26061}, [435415, 2612, False])]]
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[112250, 673, False][112250, 674, False]Failed
regression 1[309760, 4219, False][309760, 4220, False]Failed
partial-repair probe 2[17305, 104, False][17305, 104, False]Passed
partial-repair probe 3[662933, 4455, True][662933, 4455, True]Passed
boundary control 4[700000, 4200, True][700000, 4200, True]Passed
boundary control 5[4200000, 25200, False][4200000, 25200, False]Passed
normal control 6[0, 0, False][0, 0, False]Passed
normal control 7[0, 0, False][0, 0, False]Passed
normal control 8[0, 0, False][0, 0, False]Passed
normal control 9[329204, 1975, True][329204, 1975, True]Passed

SHA-256 / 437bf6d4cbc35b67a87b0f75319c921ead208c449324b31f3848f4d4a55e9cab

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    total_bp = 0
    taxable_total = 0
    for ytd, wages, st in x['employees']:
        t = min(wages, max(0, 700000 - ytd))
        taxable_total += t
        line = t * (60 + x['credit_reduction'].get(st, 0))
        total_bp += line // 10000 * 10000
    liability = (total_bp + 5000) // 10000
    return [taxable_total, liability, liability + x['carry'] > 50000]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'employees': [[0, 1366, 'TX'], [0, 110884, 'CT']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 0}, [112250, 674, False]), ('regression', {'employees': [[376476, 262345, 'CA'], [0, 47415, 'TX']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 21513}, [309760, 4220, False]), ('partial-repair probe', {'employees': [[700000, 169234, 'NY'], [1252894, 424268, 'CT'], [0, 17305, 'CA']], 'credit_reduction': {}, 'carry': 6676}, [17305, 104, False]), ('partial-repair probe', {'employees': [[0, 271790, 'CT'], [0, 338127, 'NY'], [641967, 53016, 'CA']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [662933, 4455, True]), ('boundary control', {'employees': [[0, 5000000, 'CA']], 'credit_reduction': {}, 'carry': 50000}, [700000, 4200, True]), ('boundary control', {'employees': [[0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 1333334, 'TX']], 'credit_reduction': {}, 'carry': 0}, [4200000, 25200, False]), ('normal control', {'employees': [[700000, 386714, 'CT'], [700000, 335040, 'TX']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 50000}, [0, 0, False]), ('normal control', {'employees': [[700000, 92238, 'TX']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 50000}, [0, 0, False]), ('normal control', {'employees': [[1226498, 242483, 'CT'], [700000, 208545, 'CA'], [1294547, 6890, 'NY']], 'credit_reduction': {'CA': 90}, 'carry': 16440}, [0, 0, False]), ('normal control', {'employees': [[278512, 329204, 'CT'], [726123, 497336, 'NY']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 48178}, [329204, 1975, True])], [('regression', {'employees': [[376476, 262345, 'CA'], [0, 47415, 'TX']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 21513}, [309760, 4220, False]), ('regression', {'employees': [[396254, 477582, 'NY'], [839542, 250192, 'TX'], [1310770, 427394, 'TX'], [1503697, 51559, 'TX'], [188874, 4682, 'TX']], 'credit_reduction': {'CA': 90}, 'carry': 0}, [308428, 1851, False]), ('partial-repair probe', {'employees': [[0, 271790, 'CT'], [0, 338127, 'NY'], [641967, 53016, 'CA']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [662933, 4455, True]), ('partial-repair probe', {'employees': [[1804354, 167912, 'CT'], [501525, 208360, 'CA'], [0, 261050, 'CT']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 50000}, [459525, 5922, True]), ('boundary control', {'employees': [[0, 5000000, 'CA']], 'credit_reduction': {}, 'carry': 50000}, [700000, 4200, True]), ('boundary control', {'employees': [[0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 1333334, 'TX']], 'credit_reduction': {}, 'carry': 0}, [4200000, 25200, False]), ('normal control', {'employees': [[0, 395432, 'NY']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 50000}, [395432, 4745, True]), ('normal control', {'employees': [[700000, 276921, 'CT']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 45461}, [0, 0, False]), ('normal control', {'employees': [[1883523, 169842, 'CA']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 50000}, [0, 0, False]), ('normal control', {'employees': [[700000, 489338, 'CT']], 'credit_reduction': {'CA': 90}, 'carry': 0}, [0, 0, False])], [('regression', {'employees': [[396254, 477582, 'NY'], [839542, 250192, 'TX'], [1310770, 427394, 'TX'], [1503697, 51559, 'TX'], [188874, 4682, 'TX']], 'credit_reduction': {'CA': 90}, 'carry': 0}, [308428, 1851, False]), ('regression', {'employees': [[189443, 281945, 'TX'], [0, 460002, 'TX'], [33055, 315242, 'CA']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [1057189, 9180, True]), ('partial-repair probe', {'employees': [[376476, 262345, 'CA'], [0, 47415, 'TX']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 21513}, [309760, 4220, False]), ('partial-repair probe', {'employees': [[0, 152949, 'CT'], [199614, 315226, 'TX']], 'credit_reduction': {}, 'carry': 23841}, [468175, 2809, False]), ('boundary control', {'employees': [[0, 5000000, 'CA']], 'credit_reduction': {}, 'carry': 50000}, [700000, 4200, True]), ('boundary control', {'employees': [[0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 1333334, 'TX']], 'credit_reduction': {}, 'carry': 0}, [4200000, 25200, False]), ('normal control', {'employees': [[700000, 204593, 'CA'], [700000, 443120, 'TX']], 'credit_reduction': {}, 'carry': 50000}, [0, 0, False]), ('normal control', {'employees': [[997952, 486233, 'CT'], [1510820, 394052, 'TX']], 'credit_reduction': {}, 'carry': 5423}, [0, 0, False]), ('normal control', {'employees': [[700000, 16090, 'NY'], [1237814, 31301, 'TX']], 'credit_reduction': {}, 'carry': 50000}, [0, 0, False]), ('normal control', {'employees': [[700000, 185137, 'TX']], 'credit_reduction': {'CA': 90}, 'carry': 31444}, [0, 0, False])], [('regression', {'employees': [[189443, 281945, 'TX'], [0, 460002, 'TX'], [33055, 315242, 'CA']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [1057189, 9180, True]), ('regression', {'employees': [[526959, 328635, 'CT'], [319400, 23395, 'CT'], [700000, 350261, 'CT'], [700000, 458444, 'TX']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [196436, 1179, True]), ('partial-repair probe', {'employees': [[0, 80817, 'CA'], [1367038, 69564, 'CT']], 'credit_reduction': {}, 'carry': 50000}, [80817, 485, True]), ('partial-repair probe', {'employees': [[700000, 197663, 'CA'], [1911040, 104779, 'CT'], [0, 119592, 'NY']], 'credit_reduction': {}, 'carry': 39745}, [119592, 718, False]), ('boundary control', {'employees': [[0, 5000000, 'CA']], 'credit_reduction': {}, 'carry': 50000}, [700000, 4200, True]), ('boundary control', {'employees': [[0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 1333334, 'TX']], 'credit_reduction': {}, 'carry': 0}, [4200000, 25200, False]), ('normal control', {'employees': [[209483, 408670, 'NY'], [1754601, 20957, 'TX'], [839652, 414637, 'TX'], [534708, 392249, 'CA'], [700000, 141320, 'CA']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 14909}, [573962, 7383, False]), ('normal control', {'employees': [[700000, 132484, 'NY']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 0}, [0, 0, False]), ('normal control', {'employees': [[1144116, 183620, 'CA'], [913960, 129867, 'NY'], [604265, 205102, 'CT'], [1068658, 443383, 'TX']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 0}, [95735, 574, False]), ('normal control', {'employees': [[0, 229094, 'NY']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 44833}, [229094, 2749, False])], [('regression', {'employees': [[526959, 328635, 'CT'], [319400, 23395, 'CT'], [700000, 350261, 'CT'], [700000, 458444, 'TX']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [196436, 1179, True]), ('regression', {'employees': [[600906, 231669, 'CA'], [0, 335471, 'CA'], [700000, 233980, 'CA'], [163691, 35969, 'CA'], [93071, 55837, 'TX']], 'credit_reduction': {}, 'carry': 50000}, [526371, 3158, True]), ('partial-repair probe', {'employees': [[1148812, 65672, 'TX'], [874881, 68496, 'TX'], [700000, 246758, 'CA'], [1529600, 133370, 'NY'], [0, 22316, 'TX']], 'credit_reduction': {}, 'carry': 0}, [22316, 134, False]), ('partial-repair probe', {'employees': [[150141, 484498, 'NY'], [700000, 187126, 'CT']], 'credit_reduction': {}, 'carry': 50000}, [484498, 2907, True]), ('boundary control', {'employees': [[0, 5000000, 'CA']], 'credit_reduction': {}, 'carry': 50000}, [700000, 4200, True]), ('boundary control', {'employees': [[0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 1333334, 'TX']], 'credit_reduction': {}, 'carry': 0}, [4200000, 25200, False]), ('normal control', {'employees': [[0, 223552, 'TX']], 'credit_reduction': {}, 'carry': 50000}, [223552, 1341, True]), ('normal control', {'employees': [[757466, 156766, 'TX'], [700000, 33282, 'CT']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 0}, [0, 0, False]), ('normal control', {'employees': [[892995, 392688, 'CA']], 'credit_reduction': {}, 'carry': 0}, [0, 0, False]), ('normal control', {'employees': [[700000, 101649, 'TX'], [255245, 435415, 'NY'], [1060191, 58223, 'CA'], [700000, 244076, 'NY'], [767509, 385008, 'CA']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 26061}, [435415, 2612, False])]]
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[112250, 673, False][112250, 674, False]Failed
regression 1[309760, 4219, False][309760, 4220, False]Failed
partial-repair probe 2[17305, 103, False][17305, 104, False]Failed
partial-repair probe 3[662933, 4453, True][662933, 4455, True]Failed
boundary control 4[700000, 4200, True][700000, 4200, True]Passed
boundary control 5[4200000, 25200, False][4200000, 25200, False]Passed
normal control 6[0, 0, False][0, 0, False]Passed
normal control 7[0, 0, False][0, 0, False]Passed
normal control 8[0, 0, False][0, 0, False]Passed
normal control 9[329204, 1975, True][329204, 1975, True]Passed

SHA-256 / 54889be7d3bb8ecdf0da15916d40f281e84051bdab62132c6703d16deacccf09

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    total_bp = 0
    taxable_total = 0
    for ytd, wages, st in x['employees']:
        t = min(wages, max(0, 700000 - ytd))
        taxable_total += t
        line = t * (60 + x['credit_reduction'].get(st, 0))
        total_bp += line
    liability = (total_bp + 5000) // 10000
    return [taxable_total, liability, liability + x['carry'] > 50000]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'employees': [[0, 1366, 'TX'], [0, 110884, 'CT']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 0}, [112250, 674, False]), ('regression', {'employees': [[376476, 262345, 'CA'], [0, 47415, 'TX']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 21513}, [309760, 4220, False]), ('partial-repair probe', {'employees': [[700000, 169234, 'NY'], [1252894, 424268, 'CT'], [0, 17305, 'CA']], 'credit_reduction': {}, 'carry': 6676}, [17305, 104, False]), ('partial-repair probe', {'employees': [[0, 271790, 'CT'], [0, 338127, 'NY'], [641967, 53016, 'CA']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [662933, 4455, True]), ('boundary control', {'employees': [[0, 5000000, 'CA']], 'credit_reduction': {}, 'carry': 50000}, [700000, 4200, True]), ('boundary control', {'employees': [[0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 1333334, 'TX']], 'credit_reduction': {}, 'carry': 0}, [4200000, 25200, False]), ('normal control', {'employees': [[700000, 386714, 'CT'], [700000, 335040, 'TX']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 50000}, [0, 0, False]), ('normal control', {'employees': [[700000, 92238, 'TX']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 50000}, [0, 0, False]), ('normal control', {'employees': [[1226498, 242483, 'CT'], [700000, 208545, 'CA'], [1294547, 6890, 'NY']], 'credit_reduction': {'CA': 90}, 'carry': 16440}, [0, 0, False]), ('normal control', {'employees': [[278512, 329204, 'CT'], [726123, 497336, 'NY']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 48178}, [329204, 1975, True])], [('regression', {'employees': [[376476, 262345, 'CA'], [0, 47415, 'TX']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 21513}, [309760, 4220, False]), ('regression', {'employees': [[396254, 477582, 'NY'], [839542, 250192, 'TX'], [1310770, 427394, 'TX'], [1503697, 51559, 'TX'], [188874, 4682, 'TX']], 'credit_reduction': {'CA': 90}, 'carry': 0}, [308428, 1851, False]), ('partial-repair probe', {'employees': [[0, 271790, 'CT'], [0, 338127, 'NY'], [641967, 53016, 'CA']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [662933, 4455, True]), ('partial-repair probe', {'employees': [[1804354, 167912, 'CT'], [501525, 208360, 'CA'], [0, 261050, 'CT']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 50000}, [459525, 5922, True]), ('boundary control', {'employees': [[0, 5000000, 'CA']], 'credit_reduction': {}, 'carry': 50000}, [700000, 4200, True]), ('boundary control', {'employees': [[0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 1333334, 'TX']], 'credit_reduction': {}, 'carry': 0}, [4200000, 25200, False]), ('normal control', {'employees': [[0, 395432, 'NY']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 50000}, [395432, 4745, True]), ('normal control', {'employees': [[700000, 276921, 'CT']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 45461}, [0, 0, False]), ('normal control', {'employees': [[1883523, 169842, 'CA']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 50000}, [0, 0, False]), ('normal control', {'employees': [[700000, 489338, 'CT']], 'credit_reduction': {'CA': 90}, 'carry': 0}, [0, 0, False])], [('regression', {'employees': [[396254, 477582, 'NY'], [839542, 250192, 'TX'], [1310770, 427394, 'TX'], [1503697, 51559, 'TX'], [188874, 4682, 'TX']], 'credit_reduction': {'CA': 90}, 'carry': 0}, [308428, 1851, False]), ('regression', {'employees': [[189443, 281945, 'TX'], [0, 460002, 'TX'], [33055, 315242, 'CA']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [1057189, 9180, True]), ('partial-repair probe', {'employees': [[376476, 262345, 'CA'], [0, 47415, 'TX']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 21513}, [309760, 4220, False]), ('partial-repair probe', {'employees': [[0, 152949, 'CT'], [199614, 315226, 'TX']], 'credit_reduction': {}, 'carry': 23841}, [468175, 2809, False]), ('boundary control', {'employees': [[0, 5000000, 'CA']], 'credit_reduction': {}, 'carry': 50000}, [700000, 4200, True]), ('boundary control', {'employees': [[0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 1333334, 'TX']], 'credit_reduction': {}, 'carry': 0}, [4200000, 25200, False]), ('normal control', {'employees': [[700000, 204593, 'CA'], [700000, 443120, 'TX']], 'credit_reduction': {}, 'carry': 50000}, [0, 0, False]), ('normal control', {'employees': [[997952, 486233, 'CT'], [1510820, 394052, 'TX']], 'credit_reduction': {}, 'carry': 5423}, [0, 0, False]), ('normal control', {'employees': [[700000, 16090, 'NY'], [1237814, 31301, 'TX']], 'credit_reduction': {}, 'carry': 50000}, [0, 0, False]), ('normal control', {'employees': [[700000, 185137, 'TX']], 'credit_reduction': {'CA': 90}, 'carry': 31444}, [0, 0, False])], [('regression', {'employees': [[189443, 281945, 'TX'], [0, 460002, 'TX'], [33055, 315242, 'CA']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [1057189, 9180, True]), ('regression', {'employees': [[526959, 328635, 'CT'], [319400, 23395, 'CT'], [700000, 350261, 'CT'], [700000, 458444, 'TX']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [196436, 1179, True]), ('partial-repair probe', {'employees': [[0, 80817, 'CA'], [1367038, 69564, 'CT']], 'credit_reduction': {}, 'carry': 50000}, [80817, 485, True]), ('partial-repair probe', {'employees': [[700000, 197663, 'CA'], [1911040, 104779, 'CT'], [0, 119592, 'NY']], 'credit_reduction': {}, 'carry': 39745}, [119592, 718, False]), ('boundary control', {'employees': [[0, 5000000, 'CA']], 'credit_reduction': {}, 'carry': 50000}, [700000, 4200, True]), ('boundary control', {'employees': [[0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 1333334, 'TX']], 'credit_reduction': {}, 'carry': 0}, [4200000, 25200, False]), ('normal control', {'employees': [[209483, 408670, 'NY'], [1754601, 20957, 'TX'], [839652, 414637, 'TX'], [534708, 392249, 'CA'], [700000, 141320, 'CA']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 14909}, [573962, 7383, False]), ('normal control', {'employees': [[700000, 132484, 'NY']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 0}, [0, 0, False]), ('normal control', {'employees': [[1144116, 183620, 'CA'], [913960, 129867, 'NY'], [604265, 205102, 'CT'], [1068658, 443383, 'TX']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 0}, [95735, 574, False]), ('normal control', {'employees': [[0, 229094, 'NY']], 'credit_reduction': {'CA': 90, 'NY': 60}, 'carry': 44833}, [229094, 2749, False])], [('regression', {'employees': [[526959, 328635, 'CT'], [319400, 23395, 'CT'], [700000, 350261, 'CT'], [700000, 458444, 'TX']], 'credit_reduction': {'CA': 90}, 'carry': 50000}, [196436, 1179, True]), ('regression', {'employees': [[600906, 231669, 'CA'], [0, 335471, 'CA'], [700000, 233980, 'CA'], [163691, 35969, 'CA'], [93071, 55837, 'TX']], 'credit_reduction': {}, 'carry': 50000}, [526371, 3158, True]), ('partial-repair probe', {'employees': [[1148812, 65672, 'TX'], [874881, 68496, 'TX'], [700000, 246758, 'CA'], [1529600, 133370, 'NY'], [0, 22316, 'TX']], 'credit_reduction': {}, 'carry': 0}, [22316, 134, False]), ('partial-repair probe', {'employees': [[150141, 484498, 'NY'], [700000, 187126, 'CT']], 'credit_reduction': {}, 'carry': 50000}, [484498, 2907, True]), ('boundary control', {'employees': [[0, 5000000, 'CA']], 'credit_reduction': {}, 'carry': 50000}, [700000, 4200, True]), ('boundary control', {'employees': [[0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 700000, 'TX'], [0, 1333334, 'TX']], 'credit_reduction': {}, 'carry': 0}, [4200000, 25200, False]), ('normal control', {'employees': [[0, 223552, 'TX']], 'credit_reduction': {}, 'carry': 50000}, [223552, 1341, True]), ('normal control', {'employees': [[757466, 156766, 'TX'], [700000, 33282, 'CT']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 0}, [0, 0, False]), ('normal control', {'employees': [[892995, 392688, 'CA']], 'credit_reduction': {}, 'carry': 0}, [0, 0, False]), ('normal control', {'employees': [[700000, 101649, 'TX'], [255245, 435415, 'NY'], [1060191, 58223, 'CA'], [700000, 244076, 'NY'], [767509, 385008, 'CA']], 'credit_reduction': {'CT': 30, 'CA': 120}, 'carry': 26061}, [435415, 2612, False])]]
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[112250, 674, False][112250, 674, False]Passed
regression 1[309760, 4220, False][309760, 4220, False]Passed
partial-repair probe 2[17305, 104, False][17305, 104, False]Passed
partial-repair probe 3[662933, 4455, True][662933, 4455, True]Passed
boundary control 4[700000, 4200, True][700000, 4200, True]Passed
boundary control 5[4200000, 25200, False][4200000, 25200, False]Passed
normal control 6[0, 0, False][0, 0, False]Passed
normal control 7[0, 0, False][0, 0, False]Passed
normal control 8[0, 0, False][0, 0, False]Passed
normal control 9[329204, 1975, True][329204, 1975, True]Passed

SHA-256 / ed3a8a1fd67d6b3b2e9e87c31c032b86baba23b5bd9600e29b63a77e2ca6292c

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

Case digest / 9852923f59ed0d59f4cf0d8f54cd064fe4c41207019052411d7df367e82140a1