FAILURE MAP
← Case archive

FA-62801 / Tax bracket computation / Open access

The surcharge takes the greater of the full rate and the gliding cap · case 01

High incomes pay 11.9% of the excess instead of 5.5% of the tax.

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

ROOT CAUSE

max() is used where the lesser of the two amounts is required.

VERIFIED REPAIR

Use min() of 5.5% of the tax and 11.9% of the excess.

Unsuccessful approach: Charging 5.5% of only the excess treats the exemption limit as an allowance.

Case contract

solve(income_tax, joint): stipulated surcharge on income tax, in integer cents. The exemption limit is 1813000 (doubled for joint assessment). At or below it the surcharge is 0; above it the surcharge is the lesser of 5.5% of the income tax and 11.9% of the excess over the limit (a gliding zone), rounded down to cents.

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(income_tax, joint):
    thr = 1813000 * (2 if joint else 1)
    if income_tax <= thr: return 0
    soli = max(income_tax * Fraction(55, 1000), (income_tax - thr) * Fraction(119, 1000))
    return int(soli)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression lesser-of 1', (5000000, False), 275000), ('regression lesser-of 2', (1900000, False), 10353),
  ('control: at limit', (1813000, False), 0), ('control: joint glide', (3700000, True), 8806),
  ('control: joint below', (3000000, True), 0), ('control: glide edge', (3300000, False), 176953)],
 [('regression lesser-of 1', (3700000, True), 8806), ('regression lesser-of 2', (3300000, False), 176953),
  ('control: joint below', (3000000, True), 0), ('control: at limit', (1813000, False), 0),
  ('control: gliding zone', (1900000, False), 10353), ('control: full rate', (5000000, False), 275000)],
 [('regression lesser-of 1', (3626001, False), 199430), ('regression lesser-of 2', (1813009, False), 1),
  ('control: at limit', (1813000, False), 0), ('control: gliding zone', (1900000, False), 10353),
  ('control: full rate', (5000000, False), 275000), ('control: joint glide', (3700000, True), 8806)],
 [('regression lesser-of 1', (1983210, False), 20254), ('regression lesser-of 2', (1813001, False), 0),
  ('partial repair guard 2', (4499538, True), 103951), ('control: joint glide', (3700000, True), 8806),
  ('control: joint below', (3000000, True), 0), ('control: glide edge', (3300000, False), 176953),
  ('control: at limit', (1813000, False), 0)],
 [('regression lesser-of 1', (3626001, True), 0), ('regression lesser-of 2', (4499538, True), 103951),
  ('partial repair guard 1', (3835420, False), 210948), ('partial repair guard 2', (3256603, False), 171788),
  ('control: at limit', (1813000, False), 0), ('control: gliding zone', (1900000, False), 10353),
  ('control: full rate', (5000000, False), 275000), ('control: joint glide', (3700000, True), 8806)]]
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 lesser-of 1379253275000Failed
regression lesser-of 210450010353Failed
control: at limit00Passed
control: joint glide2035008806Failed
control: joint below00Passed
control: glide edge181500176953Failed

SHA-256 / 4e42a68242778f06eb6851bcf93c65b588e2e61ea8fd809c715fd6133ef55d95

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(income_tax, joint):
    thr = 1813000 * (2 if joint else 1)
    if income_tax <= thr: return 0
    soli = (income_tax - thr) * Fraction(55, 1000)
    return int(soli)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression lesser-of 1', (5000000, False), 275000), ('regression lesser-of 2', (1900000, False), 10353),
  ('control: at limit', (1813000, False), 0), ('control: joint glide', (3700000, True), 8806),
  ('control: joint below', (3000000, True), 0), ('control: glide edge', (3300000, False), 176953)],
 [('regression lesser-of 1', (3700000, True), 8806), ('regression lesser-of 2', (3300000, False), 176953),
  ('control: joint below', (3000000, True), 0), ('control: at limit', (1813000, False), 0),
  ('control: gliding zone', (1900000, False), 10353), ('control: full rate', (5000000, False), 275000)],
 [('regression lesser-of 1', (3626001, False), 199430), ('regression lesser-of 2', (1813009, False), 1),
  ('control: at limit', (1813000, False), 0), ('control: gliding zone', (1900000, False), 10353),
  ('control: full rate', (5000000, False), 275000), ('control: joint glide', (3700000, True), 8806)],
 [('regression lesser-of 1', (1983210, False), 20254), ('regression lesser-of 2', (1813001, False), 0),
  ('partial repair guard 2', (4499538, True), 103951), ('control: joint glide', (3700000, True), 8806),
  ('control: joint below', (3000000, True), 0), ('control: glide edge', (3300000, False), 176953),
  ('control: at limit', (1813000, False), 0)],
 [('regression lesser-of 1', (3626001, True), 0), ('regression lesser-of 2', (4499538, True), 103951),
  ('partial repair guard 1', (3835420, False), 210948), ('partial repair guard 2', (3256603, False), 171788),
  ('control: at limit', (1813000, False), 0), ('control: gliding zone', (1900000, False), 10353),
  ('control: full rate', (5000000, False), 275000), ('control: joint glide', (3700000, True), 8806)]]
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 lesser-of 1175285275000Failed
regression lesser-of 2478510353Failed
control: at limit00Passed
control: joint glide40708806Failed
control: joint below00Passed
control: glide edge81785176953Failed

SHA-256 / 4c5d533eb7e17cb2a028a096caea4b5e499f0d1b4c258b56ea9e3ca2c7de5c95

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(income_tax, joint):
    thr = 1813000 * (2 if joint else 1)
    if income_tax <= thr: return 0
    soli = min(income_tax * Fraction(55, 1000), (income_tax - thr) * Fraction(119, 1000))
    return int(soli)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression lesser-of 1', (5000000, False), 275000), ('regression lesser-of 2', (1900000, False), 10353),
  ('control: at limit', (1813000, False), 0), ('control: joint glide', (3700000, True), 8806),
  ('control: joint below', (3000000, True), 0), ('control: glide edge', (3300000, False), 176953)],
 [('regression lesser-of 1', (3700000, True), 8806), ('regression lesser-of 2', (3300000, False), 176953),
  ('control: joint below', (3000000, True), 0), ('control: at limit', (1813000, False), 0),
  ('control: gliding zone', (1900000, False), 10353), ('control: full rate', (5000000, False), 275000)],
 [('regression lesser-of 1', (3626001, False), 199430), ('regression lesser-of 2', (1813009, False), 1),
  ('control: at limit', (1813000, False), 0), ('control: gliding zone', (1900000, False), 10353),
  ('control: full rate', (5000000, False), 275000), ('control: joint glide', (3700000, True), 8806)],
 [('regression lesser-of 1', (1983210, False), 20254), ('regression lesser-of 2', (1813001, False), 0),
  ('partial repair guard 2', (4499538, True), 103951), ('control: joint glide', (3700000, True), 8806),
  ('control: joint below', (3000000, True), 0), ('control: glide edge', (3300000, False), 176953),
  ('control: at limit', (1813000, False), 0)],
 [('regression lesser-of 1', (3626001, True), 0), ('regression lesser-of 2', (4499538, True), 103951),
  ('partial repair guard 1', (3835420, False), 210948), ('partial repair guard 2', (3256603, False), 171788),
  ('control: at limit', (1813000, False), 0), ('control: gliding zone', (1900000, False), 10353),
  ('control: full rate', (5000000, False), 275000), ('control: joint glide', (3700000, True), 8806)]]
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 lesser-of 1275000275000Passed
regression lesser-of 21035310353Passed
control: at limit00Passed
control: joint glide88068806Passed
control: joint below00Passed
control: glide edge176953176953Passed

SHA-256 / fd894cbae7078c8209dea06daf261773002dd346028d091858af0cbab296efe3

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

Case digest / c0bd9904c248fa46b32d41261ba812734416ac9f19ea3a602c73f9ea3d50f1d9