FAILURE MAP
← Case archive

FA-62701 / Tax bracket computation / Open access

Refundable credits are limited to the combined tax · case 01

Filers entitled to a refund receive zero.

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

ROOT CAUSE

The total after refundable credits is floored at zero.

VERIFIED REPAIR

Apply refundable credits in full.

Unsuccessful approach: Letting refundable credits offset only the state portion still denies refunds against the surtax.

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 = max(0, state - nonref)
    local = int(after * Fraction(pct) / 100 + Fraction(1, 2))
    return [local, max(0, after + local - ref)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression refundable-order 1', (5000, 1000, 9000, '12.5'), [500, -4500]),
  ('regression refundable-order 2', (1000, 3000, 500, '20'), [0, -500]),
  ('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000]),
  ('control: rounding', (333, 0, 0, '1.5'), [5, 338]), ('control: half cent', (1001, 0, 0, '50'), [501, 1502]),
  ('control: no surtax', (4200, 100, 0, '0'), [0, 4100])],
 [('regression refundable-order 1', (18157, 72365, 10702, '3.25'), [0, -10702]),
  ('regression refundable-order 2', (60634, 89812, 9000, '12.5'), [0, -9000]),
  ('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 refundable-order 1', (7099, 20000, 500, '20'), [0, -500]),
  ('regression refundable-order 2', (27020, 20000, 9000, '3.25'), [228, -1752]),
  ('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 refundable-order 1', (4316, 0, 9000, '17.5'), [755, -3929]),
  ('regression refundable-order 2', (63135, 85065, 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 refundable-order 1', (5225, 20000, 9000, '8'), [0, -9000]),
  ('regression refundable-order 2', (18855, 20000, 500, '50'), [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])]]
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 fixtureActualExpectedOutcome
regression refundable-order 1[500, 0][500, -4500]Failed
regression refundable-order 2[0, 0][0, -500]Failed
control: typical[14000, 89000][14000, 89000]Passed
control: rounding[5, 338][5, 338]Passed
control: half cent[501, 1502][501, 1502]Passed
control: no surtax[0, 4100][0, 4100]Passed

SHA-256 / d2cd39bd4acab32fb9a4dceb801a6c9a58dcb5d27222a5f116daec0b05339f50

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 = max(0, state - nonref)
    local = int(after * Fraction(pct) / 100 + Fraction(1, 2))
    return [local, max(0, after - ref) + local]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression refundable-order 1', (5000, 1000, 9000, '12.5'), [500, -4500]),
  ('regression refundable-order 2', (1000, 3000, 500, '20'), [0, -500]),
  ('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000]),
  ('control: rounding', (333, 0, 0, '1.5'), [5, 338]), ('control: half cent', (1001, 0, 0, '50'), [501, 1502]),
  ('control: no surtax', (4200, 100, 0, '0'), [0, 4100])],
 [('regression refundable-order 1', (18157, 72365, 10702, '3.25'), [0, -10702]),
  ('regression refundable-order 2', (60634, 89812, 9000, '12.5'), [0, -9000]),
  ('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 refundable-order 1', (7099, 20000, 500, '20'), [0, -500]),
  ('regression refundable-order 2', (27020, 20000, 9000, '3.25'), [228, -1752]),
  ('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 refundable-order 1', (4316, 0, 9000, '17.5'), [755, -3929]),
  ('regression refundable-order 2', (63135, 85065, 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 refundable-order 1', (5225, 20000, 9000, '8'), [0, -9000]),
  ('regression refundable-order 2', (18855, 20000, 500, '50'), [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])]]
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 fixtureActualExpectedOutcome
regression refundable-order 1[500, 500][500, -4500]Failed
regression refundable-order 2[0, 0][0, -500]Failed
control: typical[14000, 89000][14000, 89000]Passed
control: rounding[5, 338][5, 338]Passed
control: half cent[501, 1502][501, 1502]Passed
control: no surtax[0, 4100][0, 4100]Passed

SHA-256 / ddcfafbac2640bd9f0fccaf6dc86fe06b0cfbfd569607f59830ff99329a74182

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 refundable-order 1', (5000, 1000, 9000, '12.5'), [500, -4500]),
  ('regression refundable-order 2', (1000, 3000, 500, '20'), [0, -500]),
  ('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000]),
  ('control: rounding', (333, 0, 0, '1.5'), [5, 338]), ('control: half cent', (1001, 0, 0, '50'), [501, 1502]),
  ('control: no surtax', (4200, 100, 0, '0'), [0, 4100])],
 [('regression refundable-order 1', (18157, 72365, 10702, '3.25'), [0, -10702]),
  ('regression refundable-order 2', (60634, 89812, 9000, '12.5'), [0, -9000]),
  ('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 refundable-order 1', (7099, 20000, 500, '20'), [0, -500]),
  ('regression refundable-order 2', (27020, 20000, 9000, '3.25'), [228, -1752]),
  ('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 refundable-order 1', (4316, 0, 9000, '17.5'), [755, -3929]),
  ('regression refundable-order 2', (63135, 85065, 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 refundable-order 1', (5225, 20000, 9000, '8'), [0, -9000]),
  ('regression refundable-order 2', (18855, 20000, 500, '50'), [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])]]
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 fixtureActualExpectedOutcome
regression refundable-order 1[500, -4500][500, -4500]Passed
regression refundable-order 2[0, -500][0, -500]Passed
control: typical[14000, 89000][14000, 89000]Passed
control: rounding[5, 338][5, 338]Passed
control: half cent[501, 1502][501, 1502]Passed
control: no surtax[0, 4100][0, 4100]Passed

SHA-256 / 002c8f821f42b6db947a7b6270b7c29c064abe9b11a8ddc7e3d5931875af77ae

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

Case digest / b6637ca895920bce3aa0bcbf886b95cc28ba9c40a857965bc3b72f4630685b68