FA-62691 / Tax bracket computation / Open access
Excess nonrefundable credits make the surtax negative · case 01
Credits larger than the state tax produce a negative local surtax and an extra refund.
ROOT CAUSE
State tax after nonrefundable credits is not floored at zero.
VERIFIED REPAIR
Floor state tax after nonrefundable credits at zero.
Unsuccessful approach: Flooring only the local surtax still lets the negative credited state tax create a refund.
Case contract
solve(state, nonref, ref, pct): amounts in integer cents; pct a decimal percentage string. State tax after nonrefundable credits is max(0, state - nonref). The local surtax is pct% of that amount, rounded half-up to cents. Refundable credits then apply to the combined total in full (a negative total is a refund). Return [local, total].
Why this case matters
Tax computations hinge on which slice, threshold, ordering and rounding rule applies at each step; a misplaced boundary silently misstates liabilities.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(state, nonref, ref, pct):
after = state - nonref
local = int(after * Fraction(pct) / 100 + Fraction(1, 2))
return [local, after + local - ref]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression credited-floor 1', (1000, 3000, 500, '20'), [0, -500]),
('regression credited-floor 2', (18157, 72365, 10702, '3.25'), [0, -10702]),
('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000]),
('control: rounding', (333, 0, 0, '1.5'), [5, 338]),
('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500]),
('control: half cent', (1001, 0, 0, '50'), [501, 1502])],
[('regression credited-floor 1', (60634, 89812, 9000, '12.5'), [0, -9000]),
('regression credited-floor 2', (7099, 20000, 500, '20'), [0, -500]),
('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500]),
('control: half cent', (1001, 0, 0, '50'), [501, 1502]), ('control: no surtax', (4200, 100, 0, '0'), [0, 4100]),
('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000])],
[('regression credited-floor 1', (44659, 45143, 0, '1.5'), [0, 0]),
('regression credited-floor 2', (63135, 85065, 500, '20'), [0, -500]),
('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000]),
('control: credits exceed tax', (1000, 3000, 500, '20'), [0, -500]),
('control: rounding', (333, 0, 0, '1.5'), [5, 338]),
('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500])],
[('regression credited-floor 1', (5225, 20000, 9000, '8'), [0, -9000]),
('regression credited-floor 2', (18855, 20000, 500, '50'), [0, -500]),
('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500]),
('control: half cent', (1001, 0, 0, '50'), [501, 1502]), ('control: no surtax', (4200, 100, 0, '0'), [0, 4100]),
('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000])],
[('regression credited-floor 1', (56595, 97017, 0, '1.5'), [0, 0]),
('regression credited-floor 2', (27017, 95158, 26974, '20'), [0, -26974]),
('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000]),
('control: credits exceed tax', (1000, 3000, 500, '20'), [0, -500]),
('control: rounding', (333, 0, 0, '1.5'), [5, 338]),
('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500])]]
for label, args, expected in cases[N - 1]:
check(label, 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 credited-floor 1 | [-399, -2899] | [0, -500] | Failed |
| regression credited-floor 2 | [-1761, -66671] | [0, -10702] | Failed |
| control: typical | [14000, 89000] | [14000, 89000] | Passed |
| control: rounding | [5, 338] | [5, 338] | Passed |
| control: large refund | [500, -4500] | [500, -4500] | Passed |
| control: half cent | [501, 1502] | [501, 1502] | Passed |
SHA-256 / bed80bf8c6334e8bccf345cc17eb9a519c3ac3f28c02ddd4eab9f6ea188554cc
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(state, nonref, ref, pct):
after = state - nonref
local = max(0, int(after * Fraction(pct) / 100 + Fraction(1, 2)))
return [local, after + local - ref]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression credited-floor 1', (1000, 3000, 500, '20'), [0, -500]),
('regression credited-floor 2', (18157, 72365, 10702, '3.25'), [0, -10702]),
('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000]),
('control: rounding', (333, 0, 0, '1.5'), [5, 338]),
('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500]),
('control: half cent', (1001, 0, 0, '50'), [501, 1502])],
[('regression credited-floor 1', (60634, 89812, 9000, '12.5'), [0, -9000]),
('regression credited-floor 2', (7099, 20000, 500, '20'), [0, -500]),
('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500]),
('control: half cent', (1001, 0, 0, '50'), [501, 1502]), ('control: no surtax', (4200, 100, 0, '0'), [0, 4100]),
('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000])],
[('regression credited-floor 1', (44659, 45143, 0, '1.5'), [0, 0]),
('regression credited-floor 2', (63135, 85065, 500, '20'), [0, -500]),
('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000]),
('control: credits exceed tax', (1000, 3000, 500, '20'), [0, -500]),
('control: rounding', (333, 0, 0, '1.5'), [5, 338]),
('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500])],
[('regression credited-floor 1', (5225, 20000, 9000, '8'), [0, -9000]),
('regression credited-floor 2', (18855, 20000, 500, '50'), [0, -500]),
('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500]),
('control: half cent', (1001, 0, 0, '50'), [501, 1502]), ('control: no surtax', (4200, 100, 0, '0'), [0, 4100]),
('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000])],
[('regression credited-floor 1', (56595, 97017, 0, '1.5'), [0, 0]),
('regression credited-floor 2', (27017, 95158, 26974, '20'), [0, -26974]),
('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000]),
('control: credits exceed tax', (1000, 3000, 500, '20'), [0, -500]),
('control: rounding', (333, 0, 0, '1.5'), [5, 338]),
('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500])]]
for label, args, expected in cases[N - 1]:
check(label, 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 credited-floor 1 | [0, -2500] | [0, -500] | Failed |
| regression credited-floor 2 | [0, -64910] | [0, -10702] | Failed |
| control: typical | [14000, 89000] | [14000, 89000] | Passed |
| control: rounding | [5, 338] | [5, 338] | Passed |
| control: large refund | [500, -4500] | [500, -4500] | Passed |
| control: half cent | [501, 1502] | [501, 1502] | Passed |
SHA-256 / eec3b473cc7465a887be8389418aff425502de433dce89dc023efd788a338a07
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(state, nonref, ref, pct):
after = max(0, state - nonref)
local = int(after * Fraction(pct) / 100 + Fraction(1, 2))
return [local, after + local - ref]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression credited-floor 1', (1000, 3000, 500, '20'), [0, -500]),
('regression credited-floor 2', (18157, 72365, 10702, '3.25'), [0, -10702]),
('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000]),
('control: rounding', (333, 0, 0, '1.5'), [5, 338]),
('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500]),
('control: half cent', (1001, 0, 0, '50'), [501, 1502])],
[('regression credited-floor 1', (60634, 89812, 9000, '12.5'), [0, -9000]),
('regression credited-floor 2', (7099, 20000, 500, '20'), [0, -500]),
('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500]),
('control: half cent', (1001, 0, 0, '50'), [501, 1502]), ('control: no surtax', (4200, 100, 0, '0'), [0, 4100]),
('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000])],
[('regression credited-floor 1', (44659, 45143, 0, '1.5'), [0, 0]),
('regression credited-floor 2', (63135, 85065, 500, '20'), [0, -500]),
('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000]),
('control: credits exceed tax', (1000, 3000, 500, '20'), [0, -500]),
('control: rounding', (333, 0, 0, '1.5'), [5, 338]),
('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500])],
[('regression credited-floor 1', (5225, 20000, 9000, '8'), [0, -9000]),
('regression credited-floor 2', (18855, 20000, 500, '50'), [0, -500]),
('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500]),
('control: half cent', (1001, 0, 0, '50'), [501, 1502]), ('control: no surtax', (4200, 100, 0, '0'), [0, 4100]),
('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000])],
[('regression credited-floor 1', (56595, 97017, 0, '1.5'), [0, 0]),
('regression credited-floor 2', (27017, 95158, 26974, '20'), [0, -26974]),
('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000]),
('control: credits exceed tax', (1000, 3000, 500, '20'), [0, -500]),
('control: rounding', (333, 0, 0, '1.5'), [5, 338]),
('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500])]]
for label, args, expected in cases[N - 1]:
check(label, 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 credited-floor 1 | [0, -500] | [0, -500] | Passed |
| regression credited-floor 2 | [0, -10702] | [0, -10702] | Passed |
| control: typical | [14000, 89000] | [14000, 89000] | Passed |
| control: rounding | [5, 338] | [5, 338] | Passed |
| control: large refund | [500, -4500] | [500, -4500] | Passed |
| control: half cent | [501, 1502] | [501, 1502] | Passed |
SHA-256 / 9255baa640452bacfd33fabc7cbb3086be4314fb3f532c5617f835b70abfe115
Verification & scope
A deterministic, bounded teaching model with a stipulated toy contract; it makes no claim of conformance to any real regulation, standard, or institution's rules. 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:47:07.032365+00:00.
Case digest / e30101493eb445e662c037347ddef922244a24824878cd9b5281fc8791a8f064