FAILURE MAP
← Case archive

FA-62516 / Tax bracket computation / Open access

Every table band is 50 dollars wide · case 01

Low incomes are looked up in 50-dollar bands.

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

ROOT CAUSE

The 25-dollar bands below 3000 are not implemented.

VERIFIED REPAIR

Use 25-wide bands below 3000 and 50-wide bands from 3000.

Unsuccessful approach: Switching at income <= 3000 puts exactly 3000 into a 25-wide band.

Case contract

solve(income, brackets): stipulated tax-table lookup. income < 0 returns 0 and incomes below 5 have zero tax. For income < 100000 the tax is the progressive tax on the midpoint of the income's band, rounded half-up to whole dollars: bands are 25 wide below 3000 ([0,25), [25,50), ...) and 50 wide from 3000 ([3000,3050), ...). Incomes of 100000 or more use the exact progressive tax rounded half-up to cents. Return integer 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, brackets):
    def prog(x, br):
        tax, lower = Fraction(0), 0
        for upper, rate in br:
            top = x if upper is None else min(x, upper)
            if top > lower: tax += (top - lower) * Fraction(rate) / 100
            if upper is None or x <= upper: break
            lower = upper
        return tax
    def cents(v):
        v = v * 100
        return int(v + Fraction(1, 2)) if v >= 0 else -int(-v + Fraction(1, 2))
    
    if income < 5: return 0
    if income >= 100000: return cents(prog(income, brackets))
    w = 50
    lo = income // w * w
    mid = lo + Fraction(w, 2)
    return int(prog(mid, brackets) + Fraction(1, 2)) * 100
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression band-width-switch 1', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900),
  ('regression band-width-switch 2', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
  ('partial repair guard 1', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
  ('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   30300),
  ('control: ordinary', (12345, [[10000, '10'], [40000, '12'], [None, '22']]), 127900),
  ('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
  ('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
  ('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   1739400)],
 [('regression band-width-switch 1', (576, [[10000, '10'], [40000, '12'], [None, '22']]), 5900),
  ('regression band-width-switch 2', (603, [[10000, '10'], [40000, '12'], [None, '22']]), 6100),
  ('partial repair guard 1', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
  ('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   30300),
  ('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
  ('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
  ('control: small', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
  ('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   1739400)],
 [('regression band-width-switch 1', (5, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   100),
  ('regression band-width-switch 2',
   (2999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]), 29900),
  ('partial repair guard 1', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
  ('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   30300),
  ('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   1739400),
  ('control: above cutoff', (100001, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   1740024),
  ('control: band edge', (40050, [[10000, '10'], [40000, '12'], [None, '22']]), 461700),
  ('control: last narrow band', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900)],
 [('regression band-width-switch 1', (1821, [[10000, '10'], [40000, '12'], [None, '22']]), 18100),
  ('regression band-width-switch 2', (1428, [[10000, '10'], [40000, '12'], [None, '22']]), 14400),
  ('partial repair guard 1', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
  ('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   30300),
  ('control: last narrow band', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900),
  ('control: ordinary', (12345, [[10000, '10'], [40000, '12'], [None, '22']]), 127900),
  ('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
  ('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0)],
 [('regression band-width-switch 1', (12, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
  ('regression band-width-switch 2', (1103, [[10000, '10'], [40000, '12'], [None, '22']]), 11100),
  ('partial repair guard 1', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
  ('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   30300),
  ('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
  ('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
  ('control: small', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
  ('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   1739400)]]
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 band-width-switch 12980029900Failed
regression band-width-switch 2300100Failed
partial repair guard 13030030300Passed
partial repair guard 23030030300Passed
control: ordinary127900127900Passed
control: table cutoff17800001780000Passed
control: tiny00Passed
control: just under cutoff17394001739400Passed

SHA-256 / f1d5edb97e4ef3e4cba8eb57c0455a32b0edda8305fbd720d088b0b4cd342822

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, brackets):
    def prog(x, br):
        tax, lower = Fraction(0), 0
        for upper, rate in br:
            top = x if upper is None else min(x, upper)
            if top > lower: tax += (top - lower) * Fraction(rate) / 100
            if upper is None or x <= upper: break
            lower = upper
        return tax
    def cents(v):
        v = v * 100
        return int(v + Fraction(1, 2)) if v >= 0 else -int(-v + Fraction(1, 2))
    
    if income < 5: return 0
    if income >= 100000: return cents(prog(income, brackets))
    w = 25 if income <= 3000 else 50
    lo = income // w * w
    mid = lo + Fraction(w, 2)
    return int(prog(mid, brackets) + Fraction(1, 2)) * 100
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression band-width-switch 1', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900),
  ('regression band-width-switch 2', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
  ('partial repair guard 1', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
  ('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   30300),
  ('control: ordinary', (12345, [[10000, '10'], [40000, '12'], [None, '22']]), 127900),
  ('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
  ('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
  ('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   1739400)],
 [('regression band-width-switch 1', (576, [[10000, '10'], [40000, '12'], [None, '22']]), 5900),
  ('regression band-width-switch 2', (603, [[10000, '10'], [40000, '12'], [None, '22']]), 6100),
  ('partial repair guard 1', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
  ('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   30300),
  ('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
  ('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
  ('control: small', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
  ('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   1739400)],
 [('regression band-width-switch 1', (5, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   100),
  ('regression band-width-switch 2',
   (2999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]), 29900),
  ('partial repair guard 1', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
  ('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   30300),
  ('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   1739400),
  ('control: above cutoff', (100001, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   1740024),
  ('control: band edge', (40050, [[10000, '10'], [40000, '12'], [None, '22']]), 461700),
  ('control: last narrow band', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900)],
 [('regression band-width-switch 1', (1821, [[10000, '10'], [40000, '12'], [None, '22']]), 18100),
  ('regression band-width-switch 2', (1428, [[10000, '10'], [40000, '12'], [None, '22']]), 14400),
  ('partial repair guard 1', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
  ('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   30300),
  ('control: last narrow band', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900),
  ('control: ordinary', (12345, [[10000, '10'], [40000, '12'], [None, '22']]), 127900),
  ('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
  ('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0)],
 [('regression band-width-switch 1', (12, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
  ('regression band-width-switch 2', (1103, [[10000, '10'], [40000, '12'], [None, '22']]), 11100),
  ('partial repair guard 1', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
  ('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   30300),
  ('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
  ('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
  ('control: small', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
  ('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   1739400)]]
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 band-width-switch 12990029900Passed
regression band-width-switch 2100100Passed
partial repair guard 13010030300Failed
partial repair guard 23010030300Failed
control: ordinary127900127900Passed
control: table cutoff17800001780000Passed
control: tiny00Passed
control: just under cutoff17394001739400Passed

SHA-256 / c2c798db8f7877d3c67c0935008a8e6bb52d3b42146f97e27937f168dbfd2934

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, brackets):
    def prog(x, br):
        tax, lower = Fraction(0), 0
        for upper, rate in br:
            top = x if upper is None else min(x, upper)
            if top > lower: tax += (top - lower) * Fraction(rate) / 100
            if upper is None or x <= upper: break
            lower = upper
        return tax
    def cents(v):
        v = v * 100
        return int(v + Fraction(1, 2)) if v >= 0 else -int(-v + Fraction(1, 2))
    
    if income < 5: return 0
    if income >= 100000: return cents(prog(income, brackets))
    w = 25 if income < 3000 else 50
    lo = income // w * w
    mid = lo + Fraction(w, 2)
    return int(prog(mid, brackets) + Fraction(1, 2)) * 100
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression band-width-switch 1', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900),
  ('regression band-width-switch 2', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
  ('partial repair guard 1', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
  ('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   30300),
  ('control: ordinary', (12345, [[10000, '10'], [40000, '12'], [None, '22']]), 127900),
  ('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
  ('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
  ('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   1739400)],
 [('regression band-width-switch 1', (576, [[10000, '10'], [40000, '12'], [None, '22']]), 5900),
  ('regression band-width-switch 2', (603, [[10000, '10'], [40000, '12'], [None, '22']]), 6100),
  ('partial repair guard 1', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
  ('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   30300),
  ('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
  ('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
  ('control: small', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
  ('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   1739400)],
 [('regression band-width-switch 1', (5, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   100),
  ('regression band-width-switch 2',
   (2999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]), 29900),
  ('partial repair guard 1', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
  ('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   30300),
  ('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   1739400),
  ('control: above cutoff', (100001, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   1740024),
  ('control: band edge', (40050, [[10000, '10'], [40000, '12'], [None, '22']]), 461700),
  ('control: last narrow band', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900)],
 [('regression band-width-switch 1', (1821, [[10000, '10'], [40000, '12'], [None, '22']]), 18100),
  ('regression band-width-switch 2', (1428, [[10000, '10'], [40000, '12'], [None, '22']]), 14400),
  ('partial repair guard 1', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
  ('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   30300),
  ('control: last narrow band', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900),
  ('control: ordinary', (12345, [[10000, '10'], [40000, '12'], [None, '22']]), 127900),
  ('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
  ('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0)],
 [('regression band-width-switch 1', (12, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
  ('regression band-width-switch 2', (1103, [[10000, '10'], [40000, '12'], [None, '22']]), 11100),
  ('partial repair guard 1', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
  ('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   30300),
  ('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
  ('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
  ('control: small', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
  ('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
   1739400)]]
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 band-width-switch 12990029900Passed
regression band-width-switch 2100100Passed
partial repair guard 13030030300Passed
partial repair guard 23030030300Passed
control: ordinary127900127900Passed
control: table cutoff17800001780000Passed
control: tiny00Passed
control: just under cutoff17394001739400Passed

SHA-256 / 5eff5ffef06637fb910c6648cc9733fa4715ac041afb5da057ea71f201972459

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

Case digest / dfe50a7bbaea0b9304d01cf592ac05bd2ebc718153e2493003056088a98b7112