FA-59206 / Payroll withholding rules / Open access
Multi-state wage allocation by work days: leftover distribution · case 01
All leftover cents land in a single state.
ROOT CAUSE
The entire remainder is given to the top-ranked state instead of one cent each.
VERIFIED REPAIR
Restore the contract rule at the leftover distribution step: use `for s in rema[:left]: alloc[s] += 1`.
Unsuccessful approach: The attempt lumps the remainder onto the state with most days.
Case contract
Input {wage, days: {state: work days}, resident}. With zero total days all wages go to the resident state. Otherwise each state gets floor(wage*days/total); leftover cents go one each to states ranked by largest fractional remainder, ties by the base order (days descending, then state name). States allocated 0 cents are omitted. Return {state: cents}.
Why this case matters
State wage allocation must sum exactly to the paycheck with a deterministic remainder rule.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
days = x['days']
total = sum(days.values())
if total == 0:
return {x['resident']: x['wage']}
order = sorted(days, key=lambda s: (-days[s], s))
alloc = {s: x['wage'] * days[s] // total for s in order}
rema = sorted(order, key=lambda s: (-(x['wage'] * days[s] % total), order.index(s)))
left = x['wage'] - sum(alloc.values())
for s in rema[:1]:
alloc[s] += left
return {s: v for s, v in alloc.items() if v}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'wage': 525270, 'days': {'MA': 2, 'PA': 11, 'NJ': 22}, 'resident': 'NJ'}, {'NJ': 330170, 'PA': 165085, 'MA': 30015}), ('regression', {'wage': 2, 'days': {'NJ': 2, 'PA': 2, 'NY': 0, 'MA': 1}, 'resident': 'CT'}, {'NJ': 1, 'PA': 1}), ('partial-repair probe', {'wage': 17, 'days': {'NJ': 1, 'PA': 3, 'NY': 3}, 'resident': 'NY'}, {'NY': 7, 'PA': 7, 'NJ': 3}), ('partial-repair probe', {'wage': 179374, 'days': {'PA': 20, 'NJ': 2, 'MA': 0}, 'resident': 'NY'}, {'PA': 163067, 'NJ': 16307}), ('boundary control', {'wage': 100, 'days': {'NY': 1, 'NJ': 1, 'CT': 1}, 'resident': 'NJ'}, {'CT': 34, 'NJ': 33, 'NY': 33}), ('boundary control', {'wage': 5000, 'days': {'NY': 0, 'NJ': 0}, 'resident': 'NJ'}, {'NJ': 5000}), ('normal control', {'wage': 410311, 'days': {'PA': 10}, 'resident': 'CT'}, {'PA': 410311}), ('normal control', {'wage': 9, 'days': {'PA': 1, 'CT': 8}, 'resident': 'NY'}, {'CT': 8, 'PA': 1}), ('normal control', {'wage': 61318, 'days': {'CT': 0, 'MA': 0, 'PA': 12, 'NJ': 19}, 'resident': 'NY'}, {'NJ': 37582, 'PA': 23736}), ('normal control', {'wage': 22, 'days': {'CT': 0}, 'resident': 'NY'}, {'NY': 22})], [('regression', {'wage': 2, 'days': {'NJ': 2, 'PA': 2, 'NY': 0, 'MA': 1}, 'resident': 'CT'}, {'NJ': 1, 'PA': 1}), ('regression', {'wage': 254323, 'days': {'NY': 1, 'PA': 8, 'NJ': 15, 'MA': 0}, 'resident': 'NY'}, {'NJ': 158952, 'PA': 84774, 'NY': 10597}), ('partial-repair probe', {'wage': 172162, 'days': {'MA': 6, 'CT': 3, 'PA': 11}, 'resident': 'NJ'}, {'PA': 94689, 'MA': 51649, 'CT': 25824}), ('partial-repair probe', {'wage': 525270, 'days': {'MA': 2, 'PA': 11, 'NJ': 22}, 'resident': 'NJ'}, {'NJ': 330170, 'PA': 165085, 'MA': 30015}), ('boundary control', {'wage': 100, 'days': {'NY': 1, 'NJ': 1, 'CT': 1}, 'resident': 'NJ'}, {'CT': 34, 'NJ': 33, 'NY': 33}), ('boundary control', {'wage': 5000, 'days': {'NY': 0, 'NJ': 0}, 'resident': 'NJ'}, {'NJ': 5000}), ('normal control', {'wage': 231015, 'days': {'PA': 0}, 'resident': 'CT'}, {'CT': 231015}), ('normal control', {'wage': 874754, 'days': {'PA': 19}, 'resident': 'CT'}, {'PA': 874754}), ('normal control', {'wage': 315271, 'days': {'PA': 2, 'NY': 3, 'CT': 1}, 'resident': 'NJ'}, {'NY': 157636, 'PA': 105090, 'CT': 52545}), ('normal control', {'wage': 761711, 'days': {'MA': 0}, 'resident': 'NJ'}, {'NJ': 761711})], [('regression', {'wage': 254323, 'days': {'NY': 1, 'PA': 8, 'NJ': 15, 'MA': 0}, 'resident': 'NY'}, {'NJ': 158952, 'PA': 84774, 'NY': 10597}), ('regression', {'wage': 646558, 'days': {'NY': 15, 'CT': 3, 'MA': 3, 'NJ': 2}, 'resident': 'NJ'}, {'NY': 421668, 'CT': 84334, 'MA': 84334, 'NJ': 56222}), ('partial-repair probe', {'wage': 2, 'days': {'NJ': 2, 'PA': 2, 'NY': 0, 'MA': 1}, 'resident': 'CT'}, {'NJ': 1, 'PA': 1}), ('partial-repair probe', {'wage': 802876, 'days': {'NJ': 10, 'MA': 0, 'NY': 0, 'PA': 1}, 'resident': 'CT'}, {'NJ': 729887, 'PA': 72989}), ('boundary control', {'wage': 100, 'days': {'NY': 1, 'NJ': 1, 'CT': 1}, 'resident': 'NJ'}, {'CT': 34, 'NJ': 33, 'NY': 33}), ('boundary control', {'wage': 5000, 'days': {'NY': 0, 'NJ': 0}, 'resident': 'NJ'}, {'NJ': 5000}), ('normal control', {'wage': 273177, 'days': {'PA': 0, 'NY': 1, 'NJ': 3}, 'resident': 'NJ'}, {'NJ': 204883, 'NY': 68294}), ('normal control', {'wage': 1, 'days': {'NJ': 15}, 'resident': 'NY'}, {'NJ': 1}), ('normal control', {'wage': 399573, 'days': {'CT': 0}, 'resident': 'CT'}, {'CT': 399573}), ('normal control', {'wage': 424602, 'days': {'PA': 2, 'CT': 0, 'NJ': 7, 'NY': 0}, 'resident': 'CT'}, {'NJ': 330246, 'PA': 94356})], [('regression', {'wage': 646558, 'days': {'NY': 15, 'CT': 3, 'MA': 3, 'NJ': 2}, 'resident': 'NJ'}, {'NY': 421668, 'CT': 84334, 'MA': 84334, 'NJ': 56222}), ('regression', {'wage': 15, 'days': {'NY': 2, 'MA': 0, 'PA': 2, 'NJ': 13}, 'resident': 'CT'}, {'NJ': 11, 'NY': 2, 'PA': 2}), ('partial-repair probe', {'wage': 5, 'days': {'MA': 17, 'NY': 2, 'PA': 9}, 'resident': 'NJ'}, {'MA': 3, 'PA': 2}), ('partial-repair probe', {'wage': 254323, 'days': {'NY': 1, 'PA': 8, 'NJ': 15, 'MA': 0}, 'resident': 'NY'}, {'NJ': 158952, 'PA': 84774, 'NY': 10597}), ('boundary control', {'wage': 100, 'days': {'NY': 1, 'NJ': 1, 'CT': 1}, 'resident': 'NJ'}, {'CT': 34, 'NJ': 33, 'NY': 33}), ('boundary control', {'wage': 5000, 'days': {'NY': 0, 'NJ': 0}, 'resident': 'NJ'}, {'NJ': 5000}), ('normal control', {'wage': 2, 'days': {'NJ': 0}, 'resident': 'NJ'}, {'NJ': 2}), ('normal control', {'wage': 14, 'days': {'PA': 0, 'MA': 2}, 'resident': 'CT'}, {'MA': 14}), ('normal control', {'wage': 16, 'days': {'CT': 3, 'PA': 1}, 'resident': 'CT'}, {'CT': 12, 'PA': 4}), ('normal control', {'wage': 10, 'days': {'CT': 19, 'MA': 0}, 'resident': 'NJ'}, {'CT': 10})], [('regression', {'wage': 15, 'days': {'NY': 2, 'MA': 0, 'PA': 2, 'NJ': 13}, 'resident': 'CT'}, {'NJ': 11, 'NY': 2, 'PA': 2}), ('regression', {'wage': 4, 'days': {'NJ': 3, 'CT': 1, 'MA': 3}, 'resident': 'CT'}, {'MA': 2, 'NJ': 2}), ('partial-repair probe', {'wage': 646558, 'days': {'NY': 15, 'CT': 3, 'MA': 3, 'NJ': 2}, 'resident': 'NJ'}, {'NY': 421668, 'CT': 84334, 'MA': 84334, 'NJ': 56222}), ('partial-repair probe', {'wage': 22, 'days': {'PA': 0, 'CT': 1, 'MA': 2, 'NJ': 1}, 'resident': 'NY'}, {'MA': 11, 'CT': 6, 'NJ': 5}), ('boundary control', {'wage': 100, 'days': {'NY': 1, 'NJ': 1, 'CT': 1}, 'resident': 'NJ'}, {'CT': 34, 'NJ': 33, 'NY': 33}), ('boundary control', {'wage': 5000, 'days': {'NY': 0, 'NJ': 0}, 'resident': 'NJ'}, {'NJ': 5000}), ('normal control', {'wage': 200160, 'days': {'CT': 0, 'NJ': 3, 'NY': 17, 'PA': 0}, 'resident': 'CT'}, {'NY': 170136, 'NJ': 30024}), ('normal control', {'wage': 27, 'days': {'NY': 0}, 'resident': 'NY'}, {'NY': 27}), ('normal control', {'wage': 29, 'days': {'PA': 2}, 'resident': 'NJ'}, {'PA': 29}), ('normal control', {'wage': 455522, 'days': {'MA': 0, 'CT': 0}, 'resident': 'NY'}, {'NY': 455522})]]
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 | {'MA': 30015, 'NJ': 330169, 'PA': 165086} | {'MA': 30015, 'NJ': 330170, 'PA': 165085} | Failed |
| regression 1 | {'NJ': 2} | {'NJ': 1, 'PA': 1} | Failed |
| partial-repair probe 2 | {'NJ': 3, 'NY': 7, 'PA': 7} | {'NJ': 3, 'NY': 7, 'PA': 7} | Passed |
| partial-repair probe 3 | {'NJ': 16307, 'PA': 163067} | {'NJ': 16307, 'PA': 163067} | Passed |
| boundary control 4 | {'CT': 34, 'NJ': 33, 'NY': 33} | {'CT': 34, 'NJ': 33, 'NY': 33} | Passed |
| boundary control 5 | {'NJ': 5000} | {'NJ': 5000} | Passed |
| normal control 6 | {'PA': 410311} | {'PA': 410311} | Passed |
| normal control 7 | {'CT': 8, 'PA': 1} | {'CT': 8, 'PA': 1} | Passed |
| normal control 8 | {'NJ': 37582, 'PA': 23736} | {'NJ': 37582, 'PA': 23736} | Passed |
| normal control 9 | {'NY': 22} | {'NY': 22} | Passed |
SHA-256 / cf437b8c7eaad7e7800fc410eb09d5e47f3f52ac24b8d3e9a318e88a76478282
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
days = x['days']
total = sum(days.values())
if total == 0:
return {x['resident']: x['wage']}
order = sorted(days, key=lambda s: (-days[s], s))
alloc = {s: x['wage'] * days[s] // total for s in order}
rema = sorted(order, key=lambda s: (-(x['wage'] * days[s] % total), order.index(s)))
left = x['wage'] - sum(alloc.values())
for s in order[:1]:
alloc[s] += left
return {s: v for s, v in alloc.items() if v}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'wage': 525270, 'days': {'MA': 2, 'PA': 11, 'NJ': 22}, 'resident': 'NJ'}, {'NJ': 330170, 'PA': 165085, 'MA': 30015}), ('regression', {'wage': 2, 'days': {'NJ': 2, 'PA': 2, 'NY': 0, 'MA': 1}, 'resident': 'CT'}, {'NJ': 1, 'PA': 1}), ('partial-repair probe', {'wage': 17, 'days': {'NJ': 1, 'PA': 3, 'NY': 3}, 'resident': 'NY'}, {'NY': 7, 'PA': 7, 'NJ': 3}), ('partial-repair probe', {'wage': 179374, 'days': {'PA': 20, 'NJ': 2, 'MA': 0}, 'resident': 'NY'}, {'PA': 163067, 'NJ': 16307}), ('boundary control', {'wage': 100, 'days': {'NY': 1, 'NJ': 1, 'CT': 1}, 'resident': 'NJ'}, {'CT': 34, 'NJ': 33, 'NY': 33}), ('boundary control', {'wage': 5000, 'days': {'NY': 0, 'NJ': 0}, 'resident': 'NJ'}, {'NJ': 5000}), ('normal control', {'wage': 410311, 'days': {'PA': 10}, 'resident': 'CT'}, {'PA': 410311}), ('normal control', {'wage': 9, 'days': {'PA': 1, 'CT': 8}, 'resident': 'NY'}, {'CT': 8, 'PA': 1}), ('normal control', {'wage': 61318, 'days': {'CT': 0, 'MA': 0, 'PA': 12, 'NJ': 19}, 'resident': 'NY'}, {'NJ': 37582, 'PA': 23736}), ('normal control', {'wage': 22, 'days': {'CT': 0}, 'resident': 'NY'}, {'NY': 22})], [('regression', {'wage': 2, 'days': {'NJ': 2, 'PA': 2, 'NY': 0, 'MA': 1}, 'resident': 'CT'}, {'NJ': 1, 'PA': 1}), ('regression', {'wage': 254323, 'days': {'NY': 1, 'PA': 8, 'NJ': 15, 'MA': 0}, 'resident': 'NY'}, {'NJ': 158952, 'PA': 84774, 'NY': 10597}), ('partial-repair probe', {'wage': 172162, 'days': {'MA': 6, 'CT': 3, 'PA': 11}, 'resident': 'NJ'}, {'PA': 94689, 'MA': 51649, 'CT': 25824}), ('partial-repair probe', {'wage': 525270, 'days': {'MA': 2, 'PA': 11, 'NJ': 22}, 'resident': 'NJ'}, {'NJ': 330170, 'PA': 165085, 'MA': 30015}), ('boundary control', {'wage': 100, 'days': {'NY': 1, 'NJ': 1, 'CT': 1}, 'resident': 'NJ'}, {'CT': 34, 'NJ': 33, 'NY': 33}), ('boundary control', {'wage': 5000, 'days': {'NY': 0, 'NJ': 0}, 'resident': 'NJ'}, {'NJ': 5000}), ('normal control', {'wage': 231015, 'days': {'PA': 0}, 'resident': 'CT'}, {'CT': 231015}), ('normal control', {'wage': 874754, 'days': {'PA': 19}, 'resident': 'CT'}, {'PA': 874754}), ('normal control', {'wage': 315271, 'days': {'PA': 2, 'NY': 3, 'CT': 1}, 'resident': 'NJ'}, {'NY': 157636, 'PA': 105090, 'CT': 52545}), ('normal control', {'wage': 761711, 'days': {'MA': 0}, 'resident': 'NJ'}, {'NJ': 761711})], [('regression', {'wage': 254323, 'days': {'NY': 1, 'PA': 8, 'NJ': 15, 'MA': 0}, 'resident': 'NY'}, {'NJ': 158952, 'PA': 84774, 'NY': 10597}), ('regression', {'wage': 646558, 'days': {'NY': 15, 'CT': 3, 'MA': 3, 'NJ': 2}, 'resident': 'NJ'}, {'NY': 421668, 'CT': 84334, 'MA': 84334, 'NJ': 56222}), ('partial-repair probe', {'wage': 2, 'days': {'NJ': 2, 'PA': 2, 'NY': 0, 'MA': 1}, 'resident': 'CT'}, {'NJ': 1, 'PA': 1}), ('partial-repair probe', {'wage': 802876, 'days': {'NJ': 10, 'MA': 0, 'NY': 0, 'PA': 1}, 'resident': 'CT'}, {'NJ': 729887, 'PA': 72989}), ('boundary control', {'wage': 100, 'days': {'NY': 1, 'NJ': 1, 'CT': 1}, 'resident': 'NJ'}, {'CT': 34, 'NJ': 33, 'NY': 33}), ('boundary control', {'wage': 5000, 'days': {'NY': 0, 'NJ': 0}, 'resident': 'NJ'}, {'NJ': 5000}), ('normal control', {'wage': 273177, 'days': {'PA': 0, 'NY': 1, 'NJ': 3}, 'resident': 'NJ'}, {'NJ': 204883, 'NY': 68294}), ('normal control', {'wage': 1, 'days': {'NJ': 15}, 'resident': 'NY'}, {'NJ': 1}), ('normal control', {'wage': 399573, 'days': {'CT': 0}, 'resident': 'CT'}, {'CT': 399573}), ('normal control', {'wage': 424602, 'days': {'PA': 2, 'CT': 0, 'NJ': 7, 'NY': 0}, 'resident': 'CT'}, {'NJ': 330246, 'PA': 94356})], [('regression', {'wage': 646558, 'days': {'NY': 15, 'CT': 3, 'MA': 3, 'NJ': 2}, 'resident': 'NJ'}, {'NY': 421668, 'CT': 84334, 'MA': 84334, 'NJ': 56222}), ('regression', {'wage': 15, 'days': {'NY': 2, 'MA': 0, 'PA': 2, 'NJ': 13}, 'resident': 'CT'}, {'NJ': 11, 'NY': 2, 'PA': 2}), ('partial-repair probe', {'wage': 5, 'days': {'MA': 17, 'NY': 2, 'PA': 9}, 'resident': 'NJ'}, {'MA': 3, 'PA': 2}), ('partial-repair probe', {'wage': 254323, 'days': {'NY': 1, 'PA': 8, 'NJ': 15, 'MA': 0}, 'resident': 'NY'}, {'NJ': 158952, 'PA': 84774, 'NY': 10597}), ('boundary control', {'wage': 100, 'days': {'NY': 1, 'NJ': 1, 'CT': 1}, 'resident': 'NJ'}, {'CT': 34, 'NJ': 33, 'NY': 33}), ('boundary control', {'wage': 5000, 'days': {'NY': 0, 'NJ': 0}, 'resident': 'NJ'}, {'NJ': 5000}), ('normal control', {'wage': 2, 'days': {'NJ': 0}, 'resident': 'NJ'}, {'NJ': 2}), ('normal control', {'wage': 14, 'days': {'PA': 0, 'MA': 2}, 'resident': 'CT'}, {'MA': 14}), ('normal control', {'wage': 16, 'days': {'CT': 3, 'PA': 1}, 'resident': 'CT'}, {'CT': 12, 'PA': 4}), ('normal control', {'wage': 10, 'days': {'CT': 19, 'MA': 0}, 'resident': 'NJ'}, {'CT': 10})], [('regression', {'wage': 15, 'days': {'NY': 2, 'MA': 0, 'PA': 2, 'NJ': 13}, 'resident': 'CT'}, {'NJ': 11, 'NY': 2, 'PA': 2}), ('regression', {'wage': 4, 'days': {'NJ': 3, 'CT': 1, 'MA': 3}, 'resident': 'CT'}, {'MA': 2, 'NJ': 2}), ('partial-repair probe', {'wage': 646558, 'days': {'NY': 15, 'CT': 3, 'MA': 3, 'NJ': 2}, 'resident': 'NJ'}, {'NY': 421668, 'CT': 84334, 'MA': 84334, 'NJ': 56222}), ('partial-repair probe', {'wage': 22, 'days': {'PA': 0, 'CT': 1, 'MA': 2, 'NJ': 1}, 'resident': 'NY'}, {'MA': 11, 'CT': 6, 'NJ': 5}), ('boundary control', {'wage': 100, 'days': {'NY': 1, 'NJ': 1, 'CT': 1}, 'resident': 'NJ'}, {'CT': 34, 'NJ': 33, 'NY': 33}), ('boundary control', {'wage': 5000, 'days': {'NY': 0, 'NJ': 0}, 'resident': 'NJ'}, {'NJ': 5000}), ('normal control', {'wage': 200160, 'days': {'CT': 0, 'NJ': 3, 'NY': 17, 'PA': 0}, 'resident': 'CT'}, {'NY': 170136, 'NJ': 30024}), ('normal control', {'wage': 27, 'days': {'NY': 0}, 'resident': 'NY'}, {'NY': 27}), ('normal control', {'wage': 29, 'days': {'PA': 2}, 'resident': 'NJ'}, {'PA': 29}), ('normal control', {'wage': 455522, 'days': {'MA': 0, 'CT': 0}, 'resident': 'NY'}, {'NY': 455522})]]
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 | {'MA': 30015, 'NJ': 330171, 'PA': 165084} | {'MA': 30015, 'NJ': 330170, 'PA': 165085} | Failed |
| regression 1 | {'NJ': 2} | {'NJ': 1, 'PA': 1} | Failed |
| partial-repair probe 2 | {'NJ': 2, 'NY': 8, 'PA': 7} | {'NJ': 3, 'NY': 7, 'PA': 7} | Failed |
| partial-repair probe 3 | {'NJ': 16306, 'PA': 163068} | {'NJ': 16307, 'PA': 163067} | Failed |
| boundary control 4 | {'CT': 34, 'NJ': 33, 'NY': 33} | {'CT': 34, 'NJ': 33, 'NY': 33} | Passed |
| boundary control 5 | {'NJ': 5000} | {'NJ': 5000} | Passed |
| normal control 6 | {'PA': 410311} | {'PA': 410311} | Passed |
| normal control 7 | {'CT': 8, 'PA': 1} | {'CT': 8, 'PA': 1} | Passed |
| normal control 8 | {'NJ': 37582, 'PA': 23736} | {'NJ': 37582, 'PA': 23736} | Passed |
| normal control 9 | {'NY': 22} | {'NY': 22} | Passed |
SHA-256 / 3a10e97e868d0d4e7f71448c4ee742f4d46d0ddee839439ee4db91452046a888
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
days = x['days']
total = sum(days.values())
if total == 0:
return {x['resident']: x['wage']}
order = sorted(days, key=lambda s: (-days[s], s))
alloc = {s: x['wage'] * days[s] // total for s in order}
rema = sorted(order, key=lambda s: (-(x['wage'] * days[s] % total), order.index(s)))
left = x['wage'] - sum(alloc.values())
for s in rema[:left]:
alloc[s] += 1
return {s: v for s, v in alloc.items() if v}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'wage': 525270, 'days': {'MA': 2, 'PA': 11, 'NJ': 22}, 'resident': 'NJ'}, {'NJ': 330170, 'PA': 165085, 'MA': 30015}), ('regression', {'wage': 2, 'days': {'NJ': 2, 'PA': 2, 'NY': 0, 'MA': 1}, 'resident': 'CT'}, {'NJ': 1, 'PA': 1}), ('partial-repair probe', {'wage': 17, 'days': {'NJ': 1, 'PA': 3, 'NY': 3}, 'resident': 'NY'}, {'NY': 7, 'PA': 7, 'NJ': 3}), ('partial-repair probe', {'wage': 179374, 'days': {'PA': 20, 'NJ': 2, 'MA': 0}, 'resident': 'NY'}, {'PA': 163067, 'NJ': 16307}), ('boundary control', {'wage': 100, 'days': {'NY': 1, 'NJ': 1, 'CT': 1}, 'resident': 'NJ'}, {'CT': 34, 'NJ': 33, 'NY': 33}), ('boundary control', {'wage': 5000, 'days': {'NY': 0, 'NJ': 0}, 'resident': 'NJ'}, {'NJ': 5000}), ('normal control', {'wage': 410311, 'days': {'PA': 10}, 'resident': 'CT'}, {'PA': 410311}), ('normal control', {'wage': 9, 'days': {'PA': 1, 'CT': 8}, 'resident': 'NY'}, {'CT': 8, 'PA': 1}), ('normal control', {'wage': 61318, 'days': {'CT': 0, 'MA': 0, 'PA': 12, 'NJ': 19}, 'resident': 'NY'}, {'NJ': 37582, 'PA': 23736}), ('normal control', {'wage': 22, 'days': {'CT': 0}, 'resident': 'NY'}, {'NY': 22})], [('regression', {'wage': 2, 'days': {'NJ': 2, 'PA': 2, 'NY': 0, 'MA': 1}, 'resident': 'CT'}, {'NJ': 1, 'PA': 1}), ('regression', {'wage': 254323, 'days': {'NY': 1, 'PA': 8, 'NJ': 15, 'MA': 0}, 'resident': 'NY'}, {'NJ': 158952, 'PA': 84774, 'NY': 10597}), ('partial-repair probe', {'wage': 172162, 'days': {'MA': 6, 'CT': 3, 'PA': 11}, 'resident': 'NJ'}, {'PA': 94689, 'MA': 51649, 'CT': 25824}), ('partial-repair probe', {'wage': 525270, 'days': {'MA': 2, 'PA': 11, 'NJ': 22}, 'resident': 'NJ'}, {'NJ': 330170, 'PA': 165085, 'MA': 30015}), ('boundary control', {'wage': 100, 'days': {'NY': 1, 'NJ': 1, 'CT': 1}, 'resident': 'NJ'}, {'CT': 34, 'NJ': 33, 'NY': 33}), ('boundary control', {'wage': 5000, 'days': {'NY': 0, 'NJ': 0}, 'resident': 'NJ'}, {'NJ': 5000}), ('normal control', {'wage': 231015, 'days': {'PA': 0}, 'resident': 'CT'}, {'CT': 231015}), ('normal control', {'wage': 874754, 'days': {'PA': 19}, 'resident': 'CT'}, {'PA': 874754}), ('normal control', {'wage': 315271, 'days': {'PA': 2, 'NY': 3, 'CT': 1}, 'resident': 'NJ'}, {'NY': 157636, 'PA': 105090, 'CT': 52545}), ('normal control', {'wage': 761711, 'days': {'MA': 0}, 'resident': 'NJ'}, {'NJ': 761711})], [('regression', {'wage': 254323, 'days': {'NY': 1, 'PA': 8, 'NJ': 15, 'MA': 0}, 'resident': 'NY'}, {'NJ': 158952, 'PA': 84774, 'NY': 10597}), ('regression', {'wage': 646558, 'days': {'NY': 15, 'CT': 3, 'MA': 3, 'NJ': 2}, 'resident': 'NJ'}, {'NY': 421668, 'CT': 84334, 'MA': 84334, 'NJ': 56222}), ('partial-repair probe', {'wage': 2, 'days': {'NJ': 2, 'PA': 2, 'NY': 0, 'MA': 1}, 'resident': 'CT'}, {'NJ': 1, 'PA': 1}), ('partial-repair probe', {'wage': 802876, 'days': {'NJ': 10, 'MA': 0, 'NY': 0, 'PA': 1}, 'resident': 'CT'}, {'NJ': 729887, 'PA': 72989}), ('boundary control', {'wage': 100, 'days': {'NY': 1, 'NJ': 1, 'CT': 1}, 'resident': 'NJ'}, {'CT': 34, 'NJ': 33, 'NY': 33}), ('boundary control', {'wage': 5000, 'days': {'NY': 0, 'NJ': 0}, 'resident': 'NJ'}, {'NJ': 5000}), ('normal control', {'wage': 273177, 'days': {'PA': 0, 'NY': 1, 'NJ': 3}, 'resident': 'NJ'}, {'NJ': 204883, 'NY': 68294}), ('normal control', {'wage': 1, 'days': {'NJ': 15}, 'resident': 'NY'}, {'NJ': 1}), ('normal control', {'wage': 399573, 'days': {'CT': 0}, 'resident': 'CT'}, {'CT': 399573}), ('normal control', {'wage': 424602, 'days': {'PA': 2, 'CT': 0, 'NJ': 7, 'NY': 0}, 'resident': 'CT'}, {'NJ': 330246, 'PA': 94356})], [('regression', {'wage': 646558, 'days': {'NY': 15, 'CT': 3, 'MA': 3, 'NJ': 2}, 'resident': 'NJ'}, {'NY': 421668, 'CT': 84334, 'MA': 84334, 'NJ': 56222}), ('regression', {'wage': 15, 'days': {'NY': 2, 'MA': 0, 'PA': 2, 'NJ': 13}, 'resident': 'CT'}, {'NJ': 11, 'NY': 2, 'PA': 2}), ('partial-repair probe', {'wage': 5, 'days': {'MA': 17, 'NY': 2, 'PA': 9}, 'resident': 'NJ'}, {'MA': 3, 'PA': 2}), ('partial-repair probe', {'wage': 254323, 'days': {'NY': 1, 'PA': 8, 'NJ': 15, 'MA': 0}, 'resident': 'NY'}, {'NJ': 158952, 'PA': 84774, 'NY': 10597}), ('boundary control', {'wage': 100, 'days': {'NY': 1, 'NJ': 1, 'CT': 1}, 'resident': 'NJ'}, {'CT': 34, 'NJ': 33, 'NY': 33}), ('boundary control', {'wage': 5000, 'days': {'NY': 0, 'NJ': 0}, 'resident': 'NJ'}, {'NJ': 5000}), ('normal control', {'wage': 2, 'days': {'NJ': 0}, 'resident': 'NJ'}, {'NJ': 2}), ('normal control', {'wage': 14, 'days': {'PA': 0, 'MA': 2}, 'resident': 'CT'}, {'MA': 14}), ('normal control', {'wage': 16, 'days': {'CT': 3, 'PA': 1}, 'resident': 'CT'}, {'CT': 12, 'PA': 4}), ('normal control', {'wage': 10, 'days': {'CT': 19, 'MA': 0}, 'resident': 'NJ'}, {'CT': 10})], [('regression', {'wage': 15, 'days': {'NY': 2, 'MA': 0, 'PA': 2, 'NJ': 13}, 'resident': 'CT'}, {'NJ': 11, 'NY': 2, 'PA': 2}), ('regression', {'wage': 4, 'days': {'NJ': 3, 'CT': 1, 'MA': 3}, 'resident': 'CT'}, {'MA': 2, 'NJ': 2}), ('partial-repair probe', {'wage': 646558, 'days': {'NY': 15, 'CT': 3, 'MA': 3, 'NJ': 2}, 'resident': 'NJ'}, {'NY': 421668, 'CT': 84334, 'MA': 84334, 'NJ': 56222}), ('partial-repair probe', {'wage': 22, 'days': {'PA': 0, 'CT': 1, 'MA': 2, 'NJ': 1}, 'resident': 'NY'}, {'MA': 11, 'CT': 6, 'NJ': 5}), ('boundary control', {'wage': 100, 'days': {'NY': 1, 'NJ': 1, 'CT': 1}, 'resident': 'NJ'}, {'CT': 34, 'NJ': 33, 'NY': 33}), ('boundary control', {'wage': 5000, 'days': {'NY': 0, 'NJ': 0}, 'resident': 'NJ'}, {'NJ': 5000}), ('normal control', {'wage': 200160, 'days': {'CT': 0, 'NJ': 3, 'NY': 17, 'PA': 0}, 'resident': 'CT'}, {'NY': 170136, 'NJ': 30024}), ('normal control', {'wage': 27, 'days': {'NY': 0}, 'resident': 'NY'}, {'NY': 27}), ('normal control', {'wage': 29, 'days': {'PA': 2}, 'resident': 'NJ'}, {'PA': 29}), ('normal control', {'wage': 455522, 'days': {'MA': 0, 'CT': 0}, 'resident': 'NY'}, {'NY': 455522})]]
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 | {'MA': 30015, 'NJ': 330170, 'PA': 165085} | {'MA': 30015, 'NJ': 330170, 'PA': 165085} | Passed |
| regression 1 | {'NJ': 1, 'PA': 1} | {'NJ': 1, 'PA': 1} | Passed |
| partial-repair probe 2 | {'NJ': 3, 'NY': 7, 'PA': 7} | {'NJ': 3, 'NY': 7, 'PA': 7} | Passed |
| partial-repair probe 3 | {'NJ': 16307, 'PA': 163067} | {'NJ': 16307, 'PA': 163067} | Passed |
| boundary control 4 | {'CT': 34, 'NJ': 33, 'NY': 33} | {'CT': 34, 'NJ': 33, 'NY': 33} | Passed |
| boundary control 5 | {'NJ': 5000} | {'NJ': 5000} | Passed |
| normal control 6 | {'PA': 410311} | {'PA': 410311} | Passed |
| normal control 7 | {'CT': 8, 'PA': 1} | {'CT': 8, 'PA': 1} | Passed |
| normal control 8 | {'NJ': 37582, 'PA': 23736} | {'NJ': 37582, 'PA': 23736} | Passed |
| normal control 9 | {'NY': 22} | {'NY': 22} | Passed |
SHA-256 / 07dacd2d4ef1c73f35a91009c11124ce63e464c0e8b7c8fef74853c5b97de441
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.125496+00:00.
Case digest / d91144e9df34e35637d02b19ce0c644bca32ef3cfb6a9213271019b7dd941bc3