FAILURE MAP
← Case archive

FA-62696 / Tax bracket computation / Open access

The local surtax is truncated to cents · case 01

Half-cent surtax amounts are dropped.

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

ROOT CAUSE

The surtax is truncated instead of rounded half-up.

VERIFIED REPAIR

Round half-up to cents.

Unsuccessful approach: Rounding half-to-even still drops half-cents that follow an even cent.

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)
    return [local, after + local - ref]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression surtax-rounding 1', (333, 0, 0, '1.5'), [5, 338]),
  ('regression surtax-rounding 2', (1001, 0, 0, '50'), [501, 1502]),
  ('partial repair guard 2', (30452, 0, 24792, '12.5'), [3807, 9467]),
  ('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000]),
  ('control: credits exceed tax', (1000, 3000, 500, '20'), [0, -500]),
  ('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500]),
  ('control: no surtax', (4200, 100, 0, '0'), [0, 4100])],
 [('regression surtax-rounding 1', (1003, 0, 0, '50'), [502, 1505]),
  ('regression surtax-rounding 2', (133783, 45064, 0, '17.5'), [15526, 104245]),
  ('partial repair guard 1', (52009, 0, 500, '50'), [26005, 77514]),
  ('partial repair guard 2', (196677, 0, 9000, '50'), [98339, 286016]),
  ('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 surtax-rounding 1', (86323, 79662, 500, '12.5'), [833, 6994]),
  ('regression surtax-rounding 2', (44678, 28763, 500, '50'), [7958, 23373]),
  ('partial repair guard 1', (61555, 4786, 9000, '50'), [28385, 76154]),
  ('partial repair guard 2', (122180, 1000, 13173, '17.5'), [21207, 129214]),
  ('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 surtax-rounding 1', (176644, 20000, 500, '8'), [12532, 168676]),
  ('regression surtax-rounding 2', (96269, 20000, 9000, '8'), [6102, 73371]),
  ('partial repair guard 1', (80433, 0, 9000, '50'), [40217, 111650]),
  ('partial repair guard 2', (139853, 20000, 0, '50'), [59927, 179780]),
  ('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 surtax-rounding 1', (197930, 2867, 500, '12.5'), [24383, 218946]),
  ('regression surtax-rounding 2', (39524, 0, 0, '8'), [3162, 42686]),
  ('partial repair guard 1', (199421, 104, 500, '50'), [99659, 298476]),
  ('partial repair guard 2', (57505, 1000, 0, '50'), [28253, 84758]),
  ('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 surtax-rounding 1[4, 337][5, 338]Failed
regression surtax-rounding 2[500, 1501][501, 1502]Failed
partial repair guard 2[3806, 9466][3807, 9467]Failed
control: typical[14000, 89000][14000, 89000]Passed
control: credits exceed tax[0, -500][0, -500]Passed
control: large refund[500, -4500][500, -4500]Passed
control: no surtax[0, 4100][0, 4100]Passed

SHA-256 / 0bfdab531828ef9fc1c7cbd8a19151e7183522b0edf58db179a3d85730c04f49

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 = round(after * Fraction(pct) / 100)
    return [local, after + local - ref]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression surtax-rounding 1', (333, 0, 0, '1.5'), [5, 338]),
  ('regression surtax-rounding 2', (1001, 0, 0, '50'), [501, 1502]),
  ('partial repair guard 2', (30452, 0, 24792, '12.5'), [3807, 9467]),
  ('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000]),
  ('control: credits exceed tax', (1000, 3000, 500, '20'), [0, -500]),
  ('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500]),
  ('control: no surtax', (4200, 100, 0, '0'), [0, 4100])],
 [('regression surtax-rounding 1', (1003, 0, 0, '50'), [502, 1505]),
  ('regression surtax-rounding 2', (133783, 45064, 0, '17.5'), [15526, 104245]),
  ('partial repair guard 1', (52009, 0, 500, '50'), [26005, 77514]),
  ('partial repair guard 2', (196677, 0, 9000, '50'), [98339, 286016]),
  ('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 surtax-rounding 1', (86323, 79662, 500, '12.5'), [833, 6994]),
  ('regression surtax-rounding 2', (44678, 28763, 500, '50'), [7958, 23373]),
  ('partial repair guard 1', (61555, 4786, 9000, '50'), [28385, 76154]),
  ('partial repair guard 2', (122180, 1000, 13173, '17.5'), [21207, 129214]),
  ('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 surtax-rounding 1', (176644, 20000, 500, '8'), [12532, 168676]),
  ('regression surtax-rounding 2', (96269, 20000, 9000, '8'), [6102, 73371]),
  ('partial repair guard 1', (80433, 0, 9000, '50'), [40217, 111650]),
  ('partial repair guard 2', (139853, 20000, 0, '50'), [59927, 179780]),
  ('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 surtax-rounding 1', (197930, 2867, 500, '12.5'), [24383, 218946]),
  ('regression surtax-rounding 2', (39524, 0, 0, '8'), [3162, 42686]),
  ('partial repair guard 1', (199421, 104, 500, '50'), [99659, 298476]),
  ('partial repair guard 2', (57505, 1000, 0, '50'), [28253, 84758]),
  ('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 surtax-rounding 1[5, 338][5, 338]Passed
regression surtax-rounding 2[500, 1501][501, 1502]Failed
partial repair guard 2[3806, 9466][3807, 9467]Failed
control: typical[14000, 89000][14000, 89000]Passed
control: credits exceed tax[0, -500][0, -500]Passed
control: large refund[500, -4500][500, -4500]Passed
control: no surtax[0, 4100][0, 4100]Passed

SHA-256 / 4f2ca36609ce7266ef4372f931784d8ad5b5d50e12d6d8cd7414543d3d081ce4

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 surtax-rounding 1', (333, 0, 0, '1.5'), [5, 338]),
  ('regression surtax-rounding 2', (1001, 0, 0, '50'), [501, 1502]),
  ('partial repair guard 2', (30452, 0, 24792, '12.5'), [3807, 9467]),
  ('control: typical', (100000, 20000, 5000, '17.5'), [14000, 89000]),
  ('control: credits exceed tax', (1000, 3000, 500, '20'), [0, -500]),
  ('control: large refund', (5000, 1000, 9000, '12.5'), [500, -4500]),
  ('control: no surtax', (4200, 100, 0, '0'), [0, 4100])],
 [('regression surtax-rounding 1', (1003, 0, 0, '50'), [502, 1505]),
  ('regression surtax-rounding 2', (133783, 45064, 0, '17.5'), [15526, 104245]),
  ('partial repair guard 1', (52009, 0, 500, '50'), [26005, 77514]),
  ('partial repair guard 2', (196677, 0, 9000, '50'), [98339, 286016]),
  ('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 surtax-rounding 1', (86323, 79662, 500, '12.5'), [833, 6994]),
  ('regression surtax-rounding 2', (44678, 28763, 500, '50'), [7958, 23373]),
  ('partial repair guard 1', (61555, 4786, 9000, '50'), [28385, 76154]),
  ('partial repair guard 2', (122180, 1000, 13173, '17.5'), [21207, 129214]),
  ('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 surtax-rounding 1', (176644, 20000, 500, '8'), [12532, 168676]),
  ('regression surtax-rounding 2', (96269, 20000, 9000, '8'), [6102, 73371]),
  ('partial repair guard 1', (80433, 0, 9000, '50'), [40217, 111650]),
  ('partial repair guard 2', (139853, 20000, 0, '50'), [59927, 179780]),
  ('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 surtax-rounding 1', (197930, 2867, 500, '12.5'), [24383, 218946]),
  ('regression surtax-rounding 2', (39524, 0, 0, '8'), [3162, 42686]),
  ('partial repair guard 1', (199421, 104, 500, '50'), [99659, 298476]),
  ('partial repair guard 2', (57505, 1000, 0, '50'), [28253, 84758]),
  ('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 surtax-rounding 1[5, 338][5, 338]Passed
regression surtax-rounding 2[501, 1502][501, 1502]Passed
partial repair guard 2[3807, 9467][3807, 9467]Passed
control: typical[14000, 89000][14000, 89000]Passed
control: credits exceed tax[0, -500][0, -500]Passed
control: large refund[500, -4500][500, -4500]Passed
control: no surtax[0, 4100][0, 4100]Passed

SHA-256 / f14efcd883afc20724ab376efed40d8f8cb3fe1f9cc024c652e8d6464cd94562

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

Case digest / dfe32cf4259efb0587842b3777b2866404b9562e16ecb65b1bdc95a81ddec518