FAILURE MAP
← Case archive

FA-62376 / Tax bracket computation / Open access

Taxable income goes negative when deductions exceed gross income · case 01

A low-income return shows negative taxable income that offsets other lines.

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

ROOT CAUSE

Taxable income is gross - deduction without a floor at zero.

VERIFIED REPAIR

Floor taxable income at zero.

Unsuccessful approach: Flooring gross income instead of the difference still leaves a negative result.

Case contract

solve(status, gross, earned, itemized, conditions, dependent, spouse_itemizes): stipulated deduction rules. Base standard deduction: single 14600, mfj 29200, mfs 14600, hoh 21900 (other statuses 'ERR:status'). A dependent's base is min(base, max(1300, earned + 450)). Then add 1950 per age/blindness condition for single or hoh, 1550 per condition for married statuses. If status is mfs and the spouse itemizes, the standard deduction is 0. The deduction is the larger of standard and itemized; taxable = max(0, gross - deduction). Return [deduction, taxable].

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

N = 1
observations = []
def solve(status, gross, earned, itemized, conditions, dependent, spouse_itemizes):
    std = {'single': 14600, 'mfj': 29200, 'mfs': 14600, 'hoh': 21900}
    if status not in std: return 'ERR:status'
    extra = 1950 if status in ('single', 'hoh') else 1550
    base = std[status]
    if dependent: base = min(base, max(1300, earned + 450))
    s = base + extra * conditions
    if status == 'mfs' and spouse_itemizes: s = 0
    d = max(s, itemized)
    return [d, gross - d]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression taxable-floor 1', ('mfj', 20000, 20000, 0, 2, False, False), [32300, 0]),
  ('regression taxable-floor 2', ('single', 9000, 20000, 0, 1, True, False), [16550, 0]),
  ('control: single standard', ('single', 50000, 50000, 0, 0, False, False), [14600, 35400]),
  ('control: hoh with age', ('hoh', 30000, 30000, 0, 1, False, False), [23850, 6150]),
  ('control: dependent', ('single', 5000, 2000, 0, 0, True, False), [2450, 2550]),
  ('control: mfs spouse itemizes', ('mfs', 40000, 40000, 3000, 2, False, True), [3000, 37000])],
 [('regression taxable-floor 1', ('mfj', 828, 2000, 15000, 0, False, True), [29200, 0]),
  ('regression taxable-floor 2', ('hoh', 8066, 20000, 0, 0, False, False), [21900, 0]),
  ('control: mfs spouse itemizes', ('mfs', 40000, 40000, 3000, 2, False, True), [3000, 37000]),
  ('control: mfj below deduction', ('mfj', 20000, 20000, 0, 2, False, False), [32300, 0]),
  ('control: high-earning dependent', ('single', 9000, 20000, 0, 1, True, False), [16550, 0]),
  ('control: itemizer', ('mfj', 120000, 120000, 35000, 0, False, False), [35000, 85000])],
 [('regression taxable-floor 1', ('mfj', 19816, 500, 25000, 0, False, False), [29200, 0]),
  ('regression taxable-floor 2', ('mfj', 22895, 900, 3000, 0, False, True), [29200, 0]),
  ('control: itemizer', ('mfj', 120000, 120000, 35000, 0, False, False), [35000, 85000]),
  ('control: bad status', ('widow', 1, 1, 0, 0, False, False), 'ERR:status'),
  ('control: dependent no earnings', ('single', 3000, 0, 0, 0, True, False), [1300, 1700]),
  ('control: single standard', ('single', 50000, 50000, 0, 0, False, False), [14600, 35400])],
 [('regression taxable-floor 1', ('mfs', 10207, 2000, 15000, 0, False, True), [15000, 0]),
  ('regression taxable-floor 2', ('single', 8621, 12617, 40000, 0, True, False), [40000, 0]),
  ('control: single standard', ('single', 50000, 50000, 0, 0, False, False), [14600, 35400]),
  ('control: hoh with age', ('hoh', 30000, 30000, 0, 1, False, False), [23850, 6150]),
  ('control: dependent', ('single', 5000, 2000, 0, 0, True, False), [2450, 2550]),
  ('control: mfs spouse itemizes', ('mfs', 40000, 40000, 3000, 2, False, True), [3000, 37000])],
 [('regression taxable-floor 1', ('hoh', 3413, 17479, 25000, 0, False, True), [25000, 0]),
  ('regression taxable-floor 2', ('single', 7394, 900, 40000, 0, False, False), [40000, 0]),
  ('control: mfs spouse itemizes', ('mfs', 40000, 40000, 3000, 2, False, True), [3000, 37000]),
  ('control: mfj below deduction', ('mfj', 20000, 20000, 0, 2, False, False), [32300, 0]),
  ('control: high-earning dependent', ('single', 9000, 20000, 0, 1, True, False), [16550, 0]),
  ('control: itemizer', ('mfj', 120000, 120000, 35000, 0, False, False), [35000, 85000])]]
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 taxable-floor 1[32300, -12300][32300, 0]Failed
regression taxable-floor 2[16550, -7550][16550, 0]Failed
control: single standard[14600, 35400][14600, 35400]Passed
control: hoh with age[23850, 6150][23850, 6150]Passed
control: dependent[2450, 2550][2450, 2550]Passed
control: mfs spouse itemizes[3000, 37000][3000, 37000]Passed

SHA-256 / 10ac9ecd77923053dc659d5d46e181d55d436069b4ac6e4aa5b3c1cb6977d156

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(status, gross, earned, itemized, conditions, dependent, spouse_itemizes):
    std = {'single': 14600, 'mfj': 29200, 'mfs': 14600, 'hoh': 21900}
    if status not in std: return 'ERR:status'
    extra = 1950 if status in ('single', 'hoh') else 1550
    base = std[status]
    if dependent: base = min(base, max(1300, earned + 450))
    s = base + extra * conditions
    if status == 'mfs' and spouse_itemizes: s = 0
    d = max(s, itemized)
    return [d, max(0, gross) - d]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression taxable-floor 1', ('mfj', 20000, 20000, 0, 2, False, False), [32300, 0]),
  ('regression taxable-floor 2', ('single', 9000, 20000, 0, 1, True, False), [16550, 0]),
  ('control: single standard', ('single', 50000, 50000, 0, 0, False, False), [14600, 35400]),
  ('control: hoh with age', ('hoh', 30000, 30000, 0, 1, False, False), [23850, 6150]),
  ('control: dependent', ('single', 5000, 2000, 0, 0, True, False), [2450, 2550]),
  ('control: mfs spouse itemizes', ('mfs', 40000, 40000, 3000, 2, False, True), [3000, 37000])],
 [('regression taxable-floor 1', ('mfj', 828, 2000, 15000, 0, False, True), [29200, 0]),
  ('regression taxable-floor 2', ('hoh', 8066, 20000, 0, 0, False, False), [21900, 0]),
  ('control: mfs spouse itemizes', ('mfs', 40000, 40000, 3000, 2, False, True), [3000, 37000]),
  ('control: mfj below deduction', ('mfj', 20000, 20000, 0, 2, False, False), [32300, 0]),
  ('control: high-earning dependent', ('single', 9000, 20000, 0, 1, True, False), [16550, 0]),
  ('control: itemizer', ('mfj', 120000, 120000, 35000, 0, False, False), [35000, 85000])],
 [('regression taxable-floor 1', ('mfj', 19816, 500, 25000, 0, False, False), [29200, 0]),
  ('regression taxable-floor 2', ('mfj', 22895, 900, 3000, 0, False, True), [29200, 0]),
  ('control: itemizer', ('mfj', 120000, 120000, 35000, 0, False, False), [35000, 85000]),
  ('control: bad status', ('widow', 1, 1, 0, 0, False, False), 'ERR:status'),
  ('control: dependent no earnings', ('single', 3000, 0, 0, 0, True, False), [1300, 1700]),
  ('control: single standard', ('single', 50000, 50000, 0, 0, False, False), [14600, 35400])],
 [('regression taxable-floor 1', ('mfs', 10207, 2000, 15000, 0, False, True), [15000, 0]),
  ('regression taxable-floor 2', ('single', 8621, 12617, 40000, 0, True, False), [40000, 0]),
  ('control: single standard', ('single', 50000, 50000, 0, 0, False, False), [14600, 35400]),
  ('control: hoh with age', ('hoh', 30000, 30000, 0, 1, False, False), [23850, 6150]),
  ('control: dependent', ('single', 5000, 2000, 0, 0, True, False), [2450, 2550]),
  ('control: mfs spouse itemizes', ('mfs', 40000, 40000, 3000, 2, False, True), [3000, 37000])],
 [('regression taxable-floor 1', ('hoh', 3413, 17479, 25000, 0, False, True), [25000, 0]),
  ('regression taxable-floor 2', ('single', 7394, 900, 40000, 0, False, False), [40000, 0]),
  ('control: mfs spouse itemizes', ('mfs', 40000, 40000, 3000, 2, False, True), [3000, 37000]),
  ('control: mfj below deduction', ('mfj', 20000, 20000, 0, 2, False, False), [32300, 0]),
  ('control: high-earning dependent', ('single', 9000, 20000, 0, 1, True, False), [16550, 0]),
  ('control: itemizer', ('mfj', 120000, 120000, 35000, 0, False, False), [35000, 85000])]]
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 taxable-floor 1[32300, -12300][32300, 0]Failed
regression taxable-floor 2[16550, -7550][16550, 0]Failed
control: single standard[14600, 35400][14600, 35400]Passed
control: hoh with age[23850, 6150][23850, 6150]Passed
control: dependent[2450, 2550][2450, 2550]Passed
control: mfs spouse itemizes[3000, 37000][3000, 37000]Passed

SHA-256 / fd81db996dbbc19b9e006fb6e7d246975e3503e53b41a2a3597ce5cc82aa3ccc

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(status, gross, earned, itemized, conditions, dependent, spouse_itemizes):
    std = {'single': 14600, 'mfj': 29200, 'mfs': 14600, 'hoh': 21900}
    if status not in std: return 'ERR:status'
    extra = 1950 if status in ('single', 'hoh') else 1550
    base = std[status]
    if dependent: base = min(base, max(1300, earned + 450))
    s = base + extra * conditions
    if status == 'mfs' and spouse_itemizes: s = 0
    d = max(s, itemized)
    return [d, max(0, gross - d)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression taxable-floor 1', ('mfj', 20000, 20000, 0, 2, False, False), [32300, 0]),
  ('regression taxable-floor 2', ('single', 9000, 20000, 0, 1, True, False), [16550, 0]),
  ('control: single standard', ('single', 50000, 50000, 0, 0, False, False), [14600, 35400]),
  ('control: hoh with age', ('hoh', 30000, 30000, 0, 1, False, False), [23850, 6150]),
  ('control: dependent', ('single', 5000, 2000, 0, 0, True, False), [2450, 2550]),
  ('control: mfs spouse itemizes', ('mfs', 40000, 40000, 3000, 2, False, True), [3000, 37000])],
 [('regression taxable-floor 1', ('mfj', 828, 2000, 15000, 0, False, True), [29200, 0]),
  ('regression taxable-floor 2', ('hoh', 8066, 20000, 0, 0, False, False), [21900, 0]),
  ('control: mfs spouse itemizes', ('mfs', 40000, 40000, 3000, 2, False, True), [3000, 37000]),
  ('control: mfj below deduction', ('mfj', 20000, 20000, 0, 2, False, False), [32300, 0]),
  ('control: high-earning dependent', ('single', 9000, 20000, 0, 1, True, False), [16550, 0]),
  ('control: itemizer', ('mfj', 120000, 120000, 35000, 0, False, False), [35000, 85000])],
 [('regression taxable-floor 1', ('mfj', 19816, 500, 25000, 0, False, False), [29200, 0]),
  ('regression taxable-floor 2', ('mfj', 22895, 900, 3000, 0, False, True), [29200, 0]),
  ('control: itemizer', ('mfj', 120000, 120000, 35000, 0, False, False), [35000, 85000]),
  ('control: bad status', ('widow', 1, 1, 0, 0, False, False), 'ERR:status'),
  ('control: dependent no earnings', ('single', 3000, 0, 0, 0, True, False), [1300, 1700]),
  ('control: single standard', ('single', 50000, 50000, 0, 0, False, False), [14600, 35400])],
 [('regression taxable-floor 1', ('mfs', 10207, 2000, 15000, 0, False, True), [15000, 0]),
  ('regression taxable-floor 2', ('single', 8621, 12617, 40000, 0, True, False), [40000, 0]),
  ('control: single standard', ('single', 50000, 50000, 0, 0, False, False), [14600, 35400]),
  ('control: hoh with age', ('hoh', 30000, 30000, 0, 1, False, False), [23850, 6150]),
  ('control: dependent', ('single', 5000, 2000, 0, 0, True, False), [2450, 2550]),
  ('control: mfs spouse itemizes', ('mfs', 40000, 40000, 3000, 2, False, True), [3000, 37000])],
 [('regression taxable-floor 1', ('hoh', 3413, 17479, 25000, 0, False, True), [25000, 0]),
  ('regression taxable-floor 2', ('single', 7394, 900, 40000, 0, False, False), [40000, 0]),
  ('control: mfs spouse itemizes', ('mfs', 40000, 40000, 3000, 2, False, True), [3000, 37000]),
  ('control: mfj below deduction', ('mfj', 20000, 20000, 0, 2, False, False), [32300, 0]),
  ('control: high-earning dependent', ('single', 9000, 20000, 0, 1, True, False), [16550, 0]),
  ('control: itemizer', ('mfj', 120000, 120000, 35000, 0, False, False), [35000, 85000])]]
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 taxable-floor 1[32300, 0][32300, 0]Passed
regression taxable-floor 2[16550, 0][16550, 0]Passed
control: single standard[14600, 35400][14600, 35400]Passed
control: hoh with age[23850, 6150][23850, 6150]Passed
control: dependent[2450, 2550][2450, 2550]Passed
control: mfs spouse itemizes[3000, 37000][3000, 37000]Passed

SHA-256 / 193d4a4bc35d59c54ea8edfe73f21d92b3bef38de80a3070c488e916e033535d

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

Case digest / 2bca8cff70ba058796b7954cfad2c1bffa60da1ba879b21aca77f7d78b93c19a