FAILURE MAP
← Case archive

FA-62786 / Tax bracket computation / Open access

Three or more children receive the two-child parameters · case 01

Larger families get the two-child maximum credit.

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

ROOT CAUSE

Parameters are chosen with min(children, 2).

VERIFIED REPAIR

Use the three-child row for three or more children.

Unsuccessful approach: Using the three-child row only from four children still underpays families with exactly three.

Case contract

solve(earned, agi, children, mfj, invest): stipulated earned-income credit, whole dollars. Investment income above 11600 disqualifies (0). Parameters by min(children, 3): phase-in rate %, max credit, phase-out rate %, phase-out start (0: 7.65, 600, 7.65, 9800; 1: 34, 3995, 15.98, 21560; 2: 40, 6604, 21.06, 21560; 3+: 45, 7430, 21.06, 21560); joint filers add 6920 to the start. Credit = min(rate_in*earned, max) reduced by rate_out*(max(earned, agi) - start) when positive, floored at 0. Return integer cents half-up.

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(earned, agi, children, mfj, invest):
    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))
    
    P = {0: ['7.65', 7840, 600, '7.65', 9800], 1: ['34', 11750, 3995, '15.98', 21560], 2: ['40', 16510, 6604, '21.06', 21560], 3: ['45', 16510, 7430, '21.06', 21560]}
    if invest > 11600: return 0
    rin, cap, mx, rout, start = P[min(children, 2)]
    if mfj: start += 6920
    credit = min(Fraction(rin) * earned / 100, Fraction(mx))
    income = max(earned, agi)
    if income > start: credit -= Fraction(rout) * (income - start) / 100
    return cents(max(0, credit))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression children-cap 1', (15000, 15000, 4, False, 0), 675000),
  ('regression children-cap 2', (15000, 15000, 3, False, 0), 675000),
  ('partial repair guard 2', (15000, 15000, 3, True, 11600), 675000),
  ('control: plateau', (10000, 10000, 1, False, 0), 340000),
  ('control: phase-out two children', (30000, 30000, 2, False, 0), 482654),
  ('control: agi drives phase-out', (12000, 30000, 1, False, 0), 264629),
  ('control: investment limit', (20000, 20000, 1, False, 11601), 0)],
 [('regression children-cap 1', (15000, 15000, 3, True, 11600), 675000),
  ('regression children-cap 2', (10000, 30000, 5, False, 0), 272254),
  ('partial repair guard 1', (39928, 0, 3, False, 0), 356170),
  ('partial repair guard 2', (40000, 30000, 3, False, 11600), 354654),
  ('control: investment limit', (20000, 20000, 1, False, 11601), 0),
  ('control: no children', (5000, 5000, 0, False, 0), 38250), ('control: joint', (30000, 30000, 2, True, 0), 628389),
  ('control: four children', (15000, 15000, 4, False, 0), 675000)],
 [('regression children-cap 1', (30678, 10000, 5, False, 11600), 550975),
  ('regression children-cap 2', (40000, 10000, 5, True, 11600), 500389),
  ('partial repair guard 1', (31680, 0, 3, False, 11600), 529873),
  ('partial repair guard 2', (5000, 30000, 3, True, 0), 192989),
  ('control: four children', (15000, 15000, 4, False, 0), 675000),
  ('control: phased to zero', (60000, 60000, 1, False, 0), 0),
  ('control: investment at limit', (15000, 15000, 3, True, 11600), 675000),
  ('control: plateau', (10000, 10000, 1, False, 0), 340000)],
 [('regression children-cap 1', (10000, 30000, 5, False, 11600), 272254),
  ('regression children-cap 2', (5000, 10000, 4, True, 0), 225000),
  ('partial repair guard 1', (40000, 0, 3, True, 0), 500389),
  ('partial repair guard 2', (5000, 0, 3, False, 0), 225000), ('control: plateau', (10000, 10000, 1, False, 0), 340000),
  ('control: phase-out two children', (30000, 30000, 2, False, 0), 482654),
  ('control: agi drives phase-out', (12000, 30000, 1, False, 0), 264629),
  ('control: investment limit', (20000, 20000, 1, False, 11601), 0)],
 [('regression children-cap 1', (39928, 0, 3, False, 0), 356170),
  ('regression children-cap 2', (40000, 30000, 3, False, 11600), 354654),
  ('partial repair guard 1', (5000, 30000, 3, False, 0), 47254),
  ('partial repair guard 2', (40000, 17532, 3, False, 0), 354654),
  ('control: investment limit', (20000, 20000, 1, False, 11601), 0),
  ('control: no children', (5000, 5000, 0, False, 0), 38250), ('control: joint', (30000, 30000, 2, True, 0), 628389),
  ('control: four children', (15000, 15000, 4, False, 0), 675000)]]
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 children-cap 1600000675000Failed
regression children-cap 2600000675000Failed
partial repair guard 2600000675000Failed
control: plateau340000340000Passed
control: phase-out two children482654482654Passed
control: agi drives phase-out264629264629Passed
control: investment limit00Passed

SHA-256 / b4c04221fa52a3f3d1c151431612268728480a752326a2a3878f659efb6b783d

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(earned, agi, children, mfj, invest):
    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))
    
    P = {0: ['7.65', 7840, 600, '7.65', 9800], 1: ['34', 11750, 3995, '15.98', 21560], 2: ['40', 16510, 6604, '21.06', 21560], 3: ['45', 16510, 7430, '21.06', 21560]}
    if invest > 11600: return 0
    rin, cap, mx, rout, start = (P[3] if children >= 4 else P[min(children, 2)])
    if mfj: start += 6920
    credit = min(Fraction(rin) * earned / 100, Fraction(mx))
    income = max(earned, agi)
    if income > start: credit -= Fraction(rout) * (income - start) / 100
    return cents(max(0, credit))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression children-cap 1', (15000, 15000, 4, False, 0), 675000),
  ('regression children-cap 2', (15000, 15000, 3, False, 0), 675000),
  ('partial repair guard 2', (15000, 15000, 3, True, 11600), 675000),
  ('control: plateau', (10000, 10000, 1, False, 0), 340000),
  ('control: phase-out two children', (30000, 30000, 2, False, 0), 482654),
  ('control: agi drives phase-out', (12000, 30000, 1, False, 0), 264629),
  ('control: investment limit', (20000, 20000, 1, False, 11601), 0)],
 [('regression children-cap 1', (15000, 15000, 3, True, 11600), 675000),
  ('regression children-cap 2', (10000, 30000, 5, False, 0), 272254),
  ('partial repair guard 1', (39928, 0, 3, False, 0), 356170),
  ('partial repair guard 2', (40000, 30000, 3, False, 11600), 354654),
  ('control: investment limit', (20000, 20000, 1, False, 11601), 0),
  ('control: no children', (5000, 5000, 0, False, 0), 38250), ('control: joint', (30000, 30000, 2, True, 0), 628389),
  ('control: four children', (15000, 15000, 4, False, 0), 675000)],
 [('regression children-cap 1', (30678, 10000, 5, False, 11600), 550975),
  ('regression children-cap 2', (40000, 10000, 5, True, 11600), 500389),
  ('partial repair guard 1', (31680, 0, 3, False, 11600), 529873),
  ('partial repair guard 2', (5000, 30000, 3, True, 0), 192989),
  ('control: four children', (15000, 15000, 4, False, 0), 675000),
  ('control: phased to zero', (60000, 60000, 1, False, 0), 0),
  ('control: investment at limit', (15000, 15000, 3, True, 11600), 675000),
  ('control: plateau', (10000, 10000, 1, False, 0), 340000)],
 [('regression children-cap 1', (10000, 30000, 5, False, 11600), 272254),
  ('regression children-cap 2', (5000, 10000, 4, True, 0), 225000),
  ('partial repair guard 1', (40000, 0, 3, True, 0), 500389),
  ('partial repair guard 2', (5000, 0, 3, False, 0), 225000), ('control: plateau', (10000, 10000, 1, False, 0), 340000),
  ('control: phase-out two children', (30000, 30000, 2, False, 0), 482654),
  ('control: agi drives phase-out', (12000, 30000, 1, False, 0), 264629),
  ('control: investment limit', (20000, 20000, 1, False, 11601), 0)],
 [('regression children-cap 1', (39928, 0, 3, False, 0), 356170),
  ('regression children-cap 2', (40000, 30000, 3, False, 11600), 354654),
  ('partial repair guard 1', (5000, 30000, 3, False, 0), 47254),
  ('partial repair guard 2', (40000, 17532, 3, False, 0), 354654),
  ('control: investment limit', (20000, 20000, 1, False, 11601), 0),
  ('control: no children', (5000, 5000, 0, False, 0), 38250), ('control: joint', (30000, 30000, 2, True, 0), 628389),
  ('control: four children', (15000, 15000, 4, False, 0), 675000)]]
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 children-cap 1675000675000Passed
regression children-cap 2600000675000Failed
partial repair guard 2600000675000Failed
control: plateau340000340000Passed
control: phase-out two children482654482654Passed
control: agi drives phase-out264629264629Passed
control: investment limit00Passed

SHA-256 / 385344358cb11687d7d01d69f27df3acc097714f8aa58d9873f0ea0b657455ac

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(earned, agi, children, mfj, invest):
    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))
    
    P = {0: ['7.65', 7840, 600, '7.65', 9800], 1: ['34', 11750, 3995, '15.98', 21560], 2: ['40', 16510, 6604, '21.06', 21560], 3: ['45', 16510, 7430, '21.06', 21560]}
    if invest > 11600: return 0
    rin, cap, mx, rout, start = P[min(children, 3)]
    if mfj: start += 6920
    credit = min(Fraction(rin) * earned / 100, Fraction(mx))
    income = max(earned, agi)
    if income > start: credit -= Fraction(rout) * (income - start) / 100
    return cents(max(0, credit))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression children-cap 1', (15000, 15000, 4, False, 0), 675000),
  ('regression children-cap 2', (15000, 15000, 3, False, 0), 675000),
  ('partial repair guard 2', (15000, 15000, 3, True, 11600), 675000),
  ('control: plateau', (10000, 10000, 1, False, 0), 340000),
  ('control: phase-out two children', (30000, 30000, 2, False, 0), 482654),
  ('control: agi drives phase-out', (12000, 30000, 1, False, 0), 264629),
  ('control: investment limit', (20000, 20000, 1, False, 11601), 0)],
 [('regression children-cap 1', (15000, 15000, 3, True, 11600), 675000),
  ('regression children-cap 2', (10000, 30000, 5, False, 0), 272254),
  ('partial repair guard 1', (39928, 0, 3, False, 0), 356170),
  ('partial repair guard 2', (40000, 30000, 3, False, 11600), 354654),
  ('control: investment limit', (20000, 20000, 1, False, 11601), 0),
  ('control: no children', (5000, 5000, 0, False, 0), 38250), ('control: joint', (30000, 30000, 2, True, 0), 628389),
  ('control: four children', (15000, 15000, 4, False, 0), 675000)],
 [('regression children-cap 1', (30678, 10000, 5, False, 11600), 550975),
  ('regression children-cap 2', (40000, 10000, 5, True, 11600), 500389),
  ('partial repair guard 1', (31680, 0, 3, False, 11600), 529873),
  ('partial repair guard 2', (5000, 30000, 3, True, 0), 192989),
  ('control: four children', (15000, 15000, 4, False, 0), 675000),
  ('control: phased to zero', (60000, 60000, 1, False, 0), 0),
  ('control: investment at limit', (15000, 15000, 3, True, 11600), 675000),
  ('control: plateau', (10000, 10000, 1, False, 0), 340000)],
 [('regression children-cap 1', (10000, 30000, 5, False, 11600), 272254),
  ('regression children-cap 2', (5000, 10000, 4, True, 0), 225000),
  ('partial repair guard 1', (40000, 0, 3, True, 0), 500389),
  ('partial repair guard 2', (5000, 0, 3, False, 0), 225000), ('control: plateau', (10000, 10000, 1, False, 0), 340000),
  ('control: phase-out two children', (30000, 30000, 2, False, 0), 482654),
  ('control: agi drives phase-out', (12000, 30000, 1, False, 0), 264629),
  ('control: investment limit', (20000, 20000, 1, False, 11601), 0)],
 [('regression children-cap 1', (39928, 0, 3, False, 0), 356170),
  ('regression children-cap 2', (40000, 30000, 3, False, 11600), 354654),
  ('partial repair guard 1', (5000, 30000, 3, False, 0), 47254),
  ('partial repair guard 2', (40000, 17532, 3, False, 0), 354654),
  ('control: investment limit', (20000, 20000, 1, False, 11601), 0),
  ('control: no children', (5000, 5000, 0, False, 0), 38250), ('control: joint', (30000, 30000, 2, True, 0), 628389),
  ('control: four children', (15000, 15000, 4, False, 0), 675000)]]
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 children-cap 1675000675000Passed
regression children-cap 2675000675000Passed
partial repair guard 2675000675000Passed
control: plateau340000340000Passed
control: phase-out two children482654482654Passed
control: agi drives phase-out264629264629Passed
control: investment limit00Passed

SHA-256 / da58a75a574ed98b69ddb03ddb743ad924f8a451c37748d2888ab3c6820b359e

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

Case digest / f62d490e4b0cba5806d966cecba2a9bd2d090c05185229a3fbdc4044d3eaecb7