FA-59131 / Payroll withholding rules / Open access
W-4 exempt claim expiration: expiry day inclusion · case 01
Paychecks dated exactly February 15 lose exempt status one day early.
ROOT CAUSE
The expiry comparison is exclusive of February 15.
VERIFIED REPAIR
Restore the contract rule at the expiry day inclusion step: use `return 'exempt' if pay <= expiry else 'single-default'`.
Unsuccessful approach: The attempt compares only year and month, keeping exemption through the end of February.
Case contract
Input {claims: [[[y,m,d], exempt]], pay_date [y,m,d]}. The active claim is the latest-dated claim on or before the pay date (claims processed by date; equal dates keep input order, last wins). No claim -> 'single-default'. Non-exempt claim -> 'per-form'. Exempt claim is honored through February 15 of the year after it was filed, inclusive; afterwards 'single-default'.
Why this case matters
Exempt status must lapse on a fixed date, reverting to default withholding until a new form arrives.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
pay = tuple(x['pay_date'])
active = None
for date, exempt in sorted(x['claims'], key=lambda c: tuple(c[0])):
if tuple(date) <= pay:
active = (tuple(date), exempt)
if active is None:
return 'single-default'
if not active[1]:
return 'per-form'
expiry = (active[0][0] + 1, 2, 15)
return 'exempt' if pay < expiry else 'single-default'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'claims': [[[2022, 7, 16], True], [[2024, 7, 18], True]], 'pay_date': [2025, 2, 15]}, 'exempt'), ('regression', {'claims': [[[2024, 2, 8], True]], 'pay_date': [2025, 2, 15]}, 'exempt'), ('partial-repair probe', {'claims': [[[2024, 6, 18], True], [[2024, 1, 24], True], [[2024, 8, 3], True]], 'pay_date': [2025, 2, 16]}, 'single-default'), ('partial-repair probe', {'claims': [[[2022, 3, 17], True]], 'pay_date': [2023, 2, 17]}, 'single-default'), ('normal control', {'claims': [[[2022, 2, 13], True], [[2023, 3, 1], False], [[2022, 3, 22], False]], 'pay_date': [2024, 2, 27]}, 'per-form'), ('normal control', {'claims': [[[2023, 2, 25], False]], 'pay_date': [2025, 12, 24]}, 'per-form'), ('normal control', {'claims': [[[2023, 9, 19], True], [[2023, 8, 5], True], [[2022, 3, 16], False]], 'pay_date': [2023, 9, 19]}, 'exempt'), ('normal control', {'claims': [], 'pay_date': [2025, 2, 4]}, 'single-default')], [('regression', {'claims': [[[2024, 2, 8], True]], 'pay_date': [2025, 2, 15]}, 'exempt'), ('regression', {'claims': [[[2023, 9, 9], True], [[2022, 3, 23], True]], 'pay_date': [2024, 2, 15]}, 'exempt'), ('partial-repair probe', {'claims': [[[2022, 7, 11], True], [[2024, 11, 28], True]], 'pay_date': [2023, 2, 25]}, 'single-default'), ('partial-repair probe', {'claims': [[[2023, 5, 16], True], [[2024, 10, 25], True]], 'pay_date': [2025, 2, 16]}, 'single-default'), ('normal control', {'claims': [[[2023, 7, 12], False], [[2023, 2, 5], False], [[2024, 5, 28], False]], 'pay_date': [2024, 2, 16]}, 'per-form'), ('normal control', {'claims': [[[2022, 7, 27], False], [[2022, 1, 5], True], [[2022, 8, 16], True]], 'pay_date': [2024, 5, 27]}, 'single-default'), ('normal control', {'claims': [[[2023, 4, 5], True]], 'pay_date': [2024, 11, 6]}, 'single-default'), ('normal control', {'claims': [[[2023, 10, 8], True], [[2024, 3, 27], True]], 'pay_date': [2023, 10, 8]}, 'exempt')], [('regression', {'claims': [[[2023, 9, 9], True], [[2022, 3, 23], True]], 'pay_date': [2024, 2, 15]}, 'exempt'), ('regression', {'claims': [[[2022, 5, 3], True]], 'pay_date': [2023, 2, 15]}, 'exempt'), ('partial-repair probe', {'claims': [[[2024, 9, 20], True], [[2022, 9, 28], False]], 'pay_date': [2025, 2, 23]}, 'single-default'), ('partial-repair probe', {'claims': [[[2023, 1, 4], True]], 'pay_date': [2024, 2, 16]}, 'single-default'), ('normal control', {'claims': [], 'pay_date': [2023, 2, 16]}, 'single-default'), ('normal control', {'claims': [], 'pay_date': [2023, 2, 15]}, 'single-default'), ('normal control', {'claims': [[[2024, 1, 17], False]], 'pay_date': [2025, 2, 16]}, 'per-form'), ('normal control', {'claims': [[[2022, 1, 6], False], [[2024, 2, 7], False]], 'pay_date': [2024, 2, 12]}, 'per-form')], [('regression', {'claims': [[[2022, 5, 3], True]], 'pay_date': [2023, 2, 15]}, 'exempt'), ('regression', {'claims': [[[2022, 6, 21], True]], 'pay_date': [2023, 2, 15]}, 'exempt'), ('partial-repair probe', {'claims': [[[2022, 9, 2], True], [[2024, 9, 25], False], [[2023, 4, 4], True]], 'pay_date': [2024, 2, 26]}, 'single-default'), ('partial-repair probe', {'claims': [[[2024, 5, 13], True], [[2024, 1, 6], False]], 'pay_date': [2025, 2, 16]}, 'single-default'), ('normal control', {'claims': [[[2023, 2, 6], True]], 'pay_date': [2024, 2, 13]}, 'exempt'), ('normal control', {'claims': [[[2023, 4, 9], False], [[2024, 8, 26], False], [[2022, 5, 3], False]], 'pay_date': [2024, 7, 21]}, 'per-form'), ('normal control', {'claims': [], 'pay_date': [2023, 2, 27]}, 'single-default'), ('normal control', {'claims': [[[2023, 9, 14], False], [[2024, 8, 7], True], [[2024, 1, 1], True]], 'pay_date': [2023, 9, 14]}, 'per-form')], [('regression', {'claims': [[[2022, 6, 21], True]], 'pay_date': [2023, 2, 15]}, 'exempt'), ('regression', {'claims': [[[2023, 10, 18], True], [[2024, 9, 28], True]], 'pay_date': [2024, 2, 15]}, 'exempt'), ('partial-repair probe', {'claims': [[[2022, 3, 7], True], [[2023, 1, 28], True], [[2022, 12, 8], False]], 'pay_date': [2024, 2, 16]}, 'single-default'), ('partial-repair probe', {'claims': [[[2022, 4, 14], True], [[2023, 9, 6], False], [[2023, 3, 2], True]], 'pay_date': [2023, 2, 16]}, 'single-default'), ('normal control', {'claims': [[[2023, 9, 6], True], [[2023, 1, 17], False], [[2022, 11, 5], True]], 'pay_date': [2025, 2, 16]}, 'single-default'), ('normal control', {'claims': [[[2022, 5, 10], True]], 'pay_date': [2022, 5, 10]}, 'exempt'), ('normal control', {'claims': [[[2023, 10, 8], False], [[2024, 8, 1], False]], 'pay_date': [2023, 2, 16]}, 'single-default'), ('normal control', {'claims': [[[2024, 12, 15], False], [[2023, 9, 28], False]], 'pay_date': [2025, 2, 3]}, 'per-form')]]
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 | single-default | exempt | Failed |
| regression 1 | single-default | exempt | Failed |
| partial-repair probe 2 | single-default | single-default | Passed |
| partial-repair probe 3 | single-default | single-default | Passed |
| normal control 4 | per-form | per-form | Passed |
| normal control 5 | per-form | per-form | Passed |
| normal control 6 | exempt | exempt | Passed |
| normal control 7 | single-default | single-default | Passed |
SHA-256 / a430f8a59d042141ae56e99bc1c52172e70ada937c36e3093d766471bbc3a0f2
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
pay = tuple(x['pay_date'])
active = None
for date, exempt in sorted(x['claims'], key=lambda c: tuple(c[0])):
if tuple(date) <= pay:
active = (tuple(date), exempt)
if active is None:
return 'single-default'
if not active[1]:
return 'per-form'
expiry = (active[0][0] + 1, 2, 15)
return 'exempt' if pay[:2] <= expiry[:2] else 'single-default'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'claims': [[[2022, 7, 16], True], [[2024, 7, 18], True]], 'pay_date': [2025, 2, 15]}, 'exempt'), ('regression', {'claims': [[[2024, 2, 8], True]], 'pay_date': [2025, 2, 15]}, 'exempt'), ('partial-repair probe', {'claims': [[[2024, 6, 18], True], [[2024, 1, 24], True], [[2024, 8, 3], True]], 'pay_date': [2025, 2, 16]}, 'single-default'), ('partial-repair probe', {'claims': [[[2022, 3, 17], True]], 'pay_date': [2023, 2, 17]}, 'single-default'), ('normal control', {'claims': [[[2022, 2, 13], True], [[2023, 3, 1], False], [[2022, 3, 22], False]], 'pay_date': [2024, 2, 27]}, 'per-form'), ('normal control', {'claims': [[[2023, 2, 25], False]], 'pay_date': [2025, 12, 24]}, 'per-form'), ('normal control', {'claims': [[[2023, 9, 19], True], [[2023, 8, 5], True], [[2022, 3, 16], False]], 'pay_date': [2023, 9, 19]}, 'exempt'), ('normal control', {'claims': [], 'pay_date': [2025, 2, 4]}, 'single-default')], [('regression', {'claims': [[[2024, 2, 8], True]], 'pay_date': [2025, 2, 15]}, 'exempt'), ('regression', {'claims': [[[2023, 9, 9], True], [[2022, 3, 23], True]], 'pay_date': [2024, 2, 15]}, 'exempt'), ('partial-repair probe', {'claims': [[[2022, 7, 11], True], [[2024, 11, 28], True]], 'pay_date': [2023, 2, 25]}, 'single-default'), ('partial-repair probe', {'claims': [[[2023, 5, 16], True], [[2024, 10, 25], True]], 'pay_date': [2025, 2, 16]}, 'single-default'), ('normal control', {'claims': [[[2023, 7, 12], False], [[2023, 2, 5], False], [[2024, 5, 28], False]], 'pay_date': [2024, 2, 16]}, 'per-form'), ('normal control', {'claims': [[[2022, 7, 27], False], [[2022, 1, 5], True], [[2022, 8, 16], True]], 'pay_date': [2024, 5, 27]}, 'single-default'), ('normal control', {'claims': [[[2023, 4, 5], True]], 'pay_date': [2024, 11, 6]}, 'single-default'), ('normal control', {'claims': [[[2023, 10, 8], True], [[2024, 3, 27], True]], 'pay_date': [2023, 10, 8]}, 'exempt')], [('regression', {'claims': [[[2023, 9, 9], True], [[2022, 3, 23], True]], 'pay_date': [2024, 2, 15]}, 'exempt'), ('regression', {'claims': [[[2022, 5, 3], True]], 'pay_date': [2023, 2, 15]}, 'exempt'), ('partial-repair probe', {'claims': [[[2024, 9, 20], True], [[2022, 9, 28], False]], 'pay_date': [2025, 2, 23]}, 'single-default'), ('partial-repair probe', {'claims': [[[2023, 1, 4], True]], 'pay_date': [2024, 2, 16]}, 'single-default'), ('normal control', {'claims': [], 'pay_date': [2023, 2, 16]}, 'single-default'), ('normal control', {'claims': [], 'pay_date': [2023, 2, 15]}, 'single-default'), ('normal control', {'claims': [[[2024, 1, 17], False]], 'pay_date': [2025, 2, 16]}, 'per-form'), ('normal control', {'claims': [[[2022, 1, 6], False], [[2024, 2, 7], False]], 'pay_date': [2024, 2, 12]}, 'per-form')], [('regression', {'claims': [[[2022, 5, 3], True]], 'pay_date': [2023, 2, 15]}, 'exempt'), ('regression', {'claims': [[[2022, 6, 21], True]], 'pay_date': [2023, 2, 15]}, 'exempt'), ('partial-repair probe', {'claims': [[[2022, 9, 2], True], [[2024, 9, 25], False], [[2023, 4, 4], True]], 'pay_date': [2024, 2, 26]}, 'single-default'), ('partial-repair probe', {'claims': [[[2024, 5, 13], True], [[2024, 1, 6], False]], 'pay_date': [2025, 2, 16]}, 'single-default'), ('normal control', {'claims': [[[2023, 2, 6], True]], 'pay_date': [2024, 2, 13]}, 'exempt'), ('normal control', {'claims': [[[2023, 4, 9], False], [[2024, 8, 26], False], [[2022, 5, 3], False]], 'pay_date': [2024, 7, 21]}, 'per-form'), ('normal control', {'claims': [], 'pay_date': [2023, 2, 27]}, 'single-default'), ('normal control', {'claims': [[[2023, 9, 14], False], [[2024, 8, 7], True], [[2024, 1, 1], True]], 'pay_date': [2023, 9, 14]}, 'per-form')], [('regression', {'claims': [[[2022, 6, 21], True]], 'pay_date': [2023, 2, 15]}, 'exempt'), ('regression', {'claims': [[[2023, 10, 18], True], [[2024, 9, 28], True]], 'pay_date': [2024, 2, 15]}, 'exempt'), ('partial-repair probe', {'claims': [[[2022, 3, 7], True], [[2023, 1, 28], True], [[2022, 12, 8], False]], 'pay_date': [2024, 2, 16]}, 'single-default'), ('partial-repair probe', {'claims': [[[2022, 4, 14], True], [[2023, 9, 6], False], [[2023, 3, 2], True]], 'pay_date': [2023, 2, 16]}, 'single-default'), ('normal control', {'claims': [[[2023, 9, 6], True], [[2023, 1, 17], False], [[2022, 11, 5], True]], 'pay_date': [2025, 2, 16]}, 'single-default'), ('normal control', {'claims': [[[2022, 5, 10], True]], 'pay_date': [2022, 5, 10]}, 'exempt'), ('normal control', {'claims': [[[2023, 10, 8], False], [[2024, 8, 1], False]], 'pay_date': [2023, 2, 16]}, 'single-default'), ('normal control', {'claims': [[[2024, 12, 15], False], [[2023, 9, 28], False]], 'pay_date': [2025, 2, 3]}, 'per-form')]]
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 | exempt | exempt | Passed |
| regression 1 | exempt | exempt | Passed |
| partial-repair probe 2 | exempt | single-default | Failed |
| partial-repair probe 3 | exempt | single-default | Failed |
| normal control 4 | per-form | per-form | Passed |
| normal control 5 | per-form | per-form | Passed |
| normal control 6 | exempt | exempt | Passed |
| normal control 7 | single-default | single-default | Passed |
SHA-256 / b53c8b76f77dc7496af447a545b4adc90e8afe807ebee26e9d4dfa8e91ab8e40
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
pay = tuple(x['pay_date'])
active = None
for date, exempt in sorted(x['claims'], key=lambda c: tuple(c[0])):
if tuple(date) <= pay:
active = (tuple(date), exempt)
if active is None:
return 'single-default'
if not active[1]:
return 'per-form'
expiry = (active[0][0] + 1, 2, 15)
return 'exempt' if pay <= expiry else 'single-default'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'claims': [[[2022, 7, 16], True], [[2024, 7, 18], True]], 'pay_date': [2025, 2, 15]}, 'exempt'), ('regression', {'claims': [[[2024, 2, 8], True]], 'pay_date': [2025, 2, 15]}, 'exempt'), ('partial-repair probe', {'claims': [[[2024, 6, 18], True], [[2024, 1, 24], True], [[2024, 8, 3], True]], 'pay_date': [2025, 2, 16]}, 'single-default'), ('partial-repair probe', {'claims': [[[2022, 3, 17], True]], 'pay_date': [2023, 2, 17]}, 'single-default'), ('normal control', {'claims': [[[2022, 2, 13], True], [[2023, 3, 1], False], [[2022, 3, 22], False]], 'pay_date': [2024, 2, 27]}, 'per-form'), ('normal control', {'claims': [[[2023, 2, 25], False]], 'pay_date': [2025, 12, 24]}, 'per-form'), ('normal control', {'claims': [[[2023, 9, 19], True], [[2023, 8, 5], True], [[2022, 3, 16], False]], 'pay_date': [2023, 9, 19]}, 'exempt'), ('normal control', {'claims': [], 'pay_date': [2025, 2, 4]}, 'single-default')], [('regression', {'claims': [[[2024, 2, 8], True]], 'pay_date': [2025, 2, 15]}, 'exempt'), ('regression', {'claims': [[[2023, 9, 9], True], [[2022, 3, 23], True]], 'pay_date': [2024, 2, 15]}, 'exempt'), ('partial-repair probe', {'claims': [[[2022, 7, 11], True], [[2024, 11, 28], True]], 'pay_date': [2023, 2, 25]}, 'single-default'), ('partial-repair probe', {'claims': [[[2023, 5, 16], True], [[2024, 10, 25], True]], 'pay_date': [2025, 2, 16]}, 'single-default'), ('normal control', {'claims': [[[2023, 7, 12], False], [[2023, 2, 5], False], [[2024, 5, 28], False]], 'pay_date': [2024, 2, 16]}, 'per-form'), ('normal control', {'claims': [[[2022, 7, 27], False], [[2022, 1, 5], True], [[2022, 8, 16], True]], 'pay_date': [2024, 5, 27]}, 'single-default'), ('normal control', {'claims': [[[2023, 4, 5], True]], 'pay_date': [2024, 11, 6]}, 'single-default'), ('normal control', {'claims': [[[2023, 10, 8], True], [[2024, 3, 27], True]], 'pay_date': [2023, 10, 8]}, 'exempt')], [('regression', {'claims': [[[2023, 9, 9], True], [[2022, 3, 23], True]], 'pay_date': [2024, 2, 15]}, 'exempt'), ('regression', {'claims': [[[2022, 5, 3], True]], 'pay_date': [2023, 2, 15]}, 'exempt'), ('partial-repair probe', {'claims': [[[2024, 9, 20], True], [[2022, 9, 28], False]], 'pay_date': [2025, 2, 23]}, 'single-default'), ('partial-repair probe', {'claims': [[[2023, 1, 4], True]], 'pay_date': [2024, 2, 16]}, 'single-default'), ('normal control', {'claims': [], 'pay_date': [2023, 2, 16]}, 'single-default'), ('normal control', {'claims': [], 'pay_date': [2023, 2, 15]}, 'single-default'), ('normal control', {'claims': [[[2024, 1, 17], False]], 'pay_date': [2025, 2, 16]}, 'per-form'), ('normal control', {'claims': [[[2022, 1, 6], False], [[2024, 2, 7], False]], 'pay_date': [2024, 2, 12]}, 'per-form')], [('regression', {'claims': [[[2022, 5, 3], True]], 'pay_date': [2023, 2, 15]}, 'exempt'), ('regression', {'claims': [[[2022, 6, 21], True]], 'pay_date': [2023, 2, 15]}, 'exempt'), ('partial-repair probe', {'claims': [[[2022, 9, 2], True], [[2024, 9, 25], False], [[2023, 4, 4], True]], 'pay_date': [2024, 2, 26]}, 'single-default'), ('partial-repair probe', {'claims': [[[2024, 5, 13], True], [[2024, 1, 6], False]], 'pay_date': [2025, 2, 16]}, 'single-default'), ('normal control', {'claims': [[[2023, 2, 6], True]], 'pay_date': [2024, 2, 13]}, 'exempt'), ('normal control', {'claims': [[[2023, 4, 9], False], [[2024, 8, 26], False], [[2022, 5, 3], False]], 'pay_date': [2024, 7, 21]}, 'per-form'), ('normal control', {'claims': [], 'pay_date': [2023, 2, 27]}, 'single-default'), ('normal control', {'claims': [[[2023, 9, 14], False], [[2024, 8, 7], True], [[2024, 1, 1], True]], 'pay_date': [2023, 9, 14]}, 'per-form')], [('regression', {'claims': [[[2022, 6, 21], True]], 'pay_date': [2023, 2, 15]}, 'exempt'), ('regression', {'claims': [[[2023, 10, 18], True], [[2024, 9, 28], True]], 'pay_date': [2024, 2, 15]}, 'exempt'), ('partial-repair probe', {'claims': [[[2022, 3, 7], True], [[2023, 1, 28], True], [[2022, 12, 8], False]], 'pay_date': [2024, 2, 16]}, 'single-default'), ('partial-repair probe', {'claims': [[[2022, 4, 14], True], [[2023, 9, 6], False], [[2023, 3, 2], True]], 'pay_date': [2023, 2, 16]}, 'single-default'), ('normal control', {'claims': [[[2023, 9, 6], True], [[2023, 1, 17], False], [[2022, 11, 5], True]], 'pay_date': [2025, 2, 16]}, 'single-default'), ('normal control', {'claims': [[[2022, 5, 10], True]], 'pay_date': [2022, 5, 10]}, 'exempt'), ('normal control', {'claims': [[[2023, 10, 8], False], [[2024, 8, 1], False]], 'pay_date': [2023, 2, 16]}, 'single-default'), ('normal control', {'claims': [[[2024, 12, 15], False], [[2023, 9, 28], False]], 'pay_date': [2025, 2, 3]}, 'per-form')]]
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 | exempt | exempt | Passed |
| regression 1 | exempt | exempt | Passed |
| partial-repair probe 2 | single-default | single-default | Passed |
| partial-repair probe 3 | single-default | single-default | Passed |
| normal control 4 | per-form | per-form | Passed |
| normal control 5 | per-form | per-form | Passed |
| normal control 6 | exempt | exempt | Passed |
| normal control 7 | single-default | single-default | Passed |
SHA-256 / a42e3db24e8f6092a496378e800ec467a51b9ec30c0586a8d7f272fd81099e7c
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.409640+00:00.
Case digest / 879c4ec18107a31142abc7ffd335b1bb148deb9176dc3ba39874a0a5b309acd7