FAILURE MAP
← Case archive

FA-62761 / Tax bracket computation / Open access

First-tier inclusion is not limited to half the benefits · case 01

Small benefits are included beyond half their amount between the base amounts.

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

ROOT CAUSE

The middle tier uses (PI - b1)/2 without min(benefits/2, ...).

THE FAILURE

The middle tier uses (PI - b1)/2 without min(benefits/2, ...).

Unsuccessful approach: Capping at the full benefit instead of half still over-includes.

Case contract

solve(agi, exempt_interest, benefits, status): stipulated benefit inclusion. Provisional income PI = agi + exempt_interest + benefits/2. Base amounts (b1, b2): single (25000, 34000), mfj (32000, 44000), mfs (0, 0). If PI <= b1 nothing is included; if PI <= b2, include min(benefits/2, (PI - b1)/2); otherwise include min(0.85*benefits, 0.85*(PI - b2) + min(benefits/2, (b2 - b1)/2)). Return the included amount rounded down to whole dollars.

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(agi, exempt_interest, benefits, status):
    b1, b2 = {'single': (25000, 34000), 'mfj': (32000, 44000), 'mfs': (0, 0)}[status]
    B = Fraction(benefits)
    pi = agi + exempt_interest + B / 2
    if pi <= b1: t = Fraction(0)
    elif pi <= b2: t = (pi - b1) / 2
    else: t = min(B * 85 / 100, (pi - b2) * 85 / 100 + min(B / 2, Fraction(b2 - b1, 2)))
    return int(t)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression first-tier-cap 1', (28000, 0, 2000, 'single'), 1000),
  ('regression first-tier-cap 2', (30000, 0, 1000, 'single'), 500),
  ('control: first tier', (20000, 0, 12000, 'single'), 500),
  ('control: second tier', (40000, 0, 20000, 'single'), 17000), ('control: below base', (10000, 0, 10000, 'single'), 0),
  ('control: joint with exempt interest', (30000, 1000, 20000, 'mfj'), 4500)],
 [('regression first-tier-cap 1', (30000, 0, 2000, 'single'), 1000),
  ('regression first-tier-cap 2', (30000, 5000, 0, 'mfj'), 0),
  ('partial repair guard 2', (30000, 1000, 2000, 'single'), 1000),
  ('control: joint with exempt interest', (30000, 1000, 20000, 'mfj'), 4500),
  ('control: separate filer', (5000, 0, 8000, 'mfs'), 6800),
  ('control: small benefit first tier', (28000, 0, 2000, 'single'), 1000),
  ('control: large income', (150000, 5000, 40000, 'mfj'), 34000)],
 [('regression first-tier-cap 1', (30000, 0, 0, 'single'), 0),
  ('regression first-tier-cap 2', (30000, 1000, 0, 'single'), 0),
  ('partial repair guard 1', (30000, 0, 8000, 'single'), 4000),
  ('partial repair guard 2', (30000, 0, 1687, 'single'), 843),
  ('control: large income', (150000, 5000, 40000, 'mfj'), 34000),
  ('control: first tier', (20000, 0, 12000, 'single'), 500),
  ('control: second tier', (40000, 0, 20000, 'single'), 17000),
  ('control: below base', (10000, 0, 10000, 'single'), 0)],
 [('regression first-tier-cap 1', (30000, 1000, 2000, 'single'), 1000),
  ('regression first-tier-cap 2', (30000, 0, 8000, 'single'), 4000),
  ('partial repair guard 1', (28000, 0, 2000, 'single'), 1000),
  ('partial repair guard 2', (30000, 0, 1000, 'single'), 500), ('control: below base', (10000, 0, 10000, 'single'), 0),
  ('control: joint with exempt interest', (30000, 1000, 20000, 'mfj'), 4500),
  ('control: separate filer', (5000, 0, 8000, 'mfs'), 6800),
  ('control: large income', (150000, 5000, 40000, 'mfj'), 34000)],
 [('regression first-tier-cap 1', (30000, 0, 1687, 'single'), 843),
  ('regression first-tier-cap 2', (28000, 0, 2000, 'single'), 1000),
  ('partial repair guard 1', (30000, 0, 2000, 'single'), 1000),
  ('partial repair guard 2', (30000, 1000, 2000, 'single'), 1000),
  ('control: large income', (150000, 5000, 40000, 'mfj'), 34000),
  ('control: first tier', (20000, 0, 12000, 'single'), 500),
  ('control: second tier', (40000, 0, 20000, 'single'), 17000),
  ('control: below base', (10000, 0, 10000, 'single'), 0)]]
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 first-tier-cap 120001000Failed
regression first-tier-cap 22750500Failed
control: first tier500500Passed
control: second tier1700017000Passed
control: below base00Passed
control: joint with exempt interest45004500Passed

SHA-256 / 01590c7c9330234f55dda5e5147c4f399085e8588b916f6b733cbc8358e98216

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(agi, exempt_interest, benefits, status):
    b1, b2 = {'single': (25000, 34000), 'mfj': (32000, 44000), 'mfs': (0, 0)}[status]
    B = Fraction(benefits)
    pi = agi + exempt_interest + B / 2
    if pi <= b1: t = Fraction(0)
    elif pi <= b2: t = min(B, (pi - b1) / 2)
    else: t = min(B * 85 / 100, (pi - b2) * 85 / 100 + min(B / 2, Fraction(b2 - b1, 2)))
    return int(t)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression first-tier-cap 1', (28000, 0, 2000, 'single'), 1000),
  ('regression first-tier-cap 2', (30000, 0, 1000, 'single'), 500),
  ('control: first tier', (20000, 0, 12000, 'single'), 500),
  ('control: second tier', (40000, 0, 20000, 'single'), 17000), ('control: below base', (10000, 0, 10000, 'single'), 0),
  ('control: joint with exempt interest', (30000, 1000, 20000, 'mfj'), 4500)],
 [('regression first-tier-cap 1', (30000, 0, 2000, 'single'), 1000),
  ('regression first-tier-cap 2', (30000, 5000, 0, 'mfj'), 0),
  ('partial repair guard 2', (30000, 1000, 2000, 'single'), 1000),
  ('control: joint with exempt interest', (30000, 1000, 20000, 'mfj'), 4500),
  ('control: separate filer', (5000, 0, 8000, 'mfs'), 6800),
  ('control: small benefit first tier', (28000, 0, 2000, 'single'), 1000),
  ('control: large income', (150000, 5000, 40000, 'mfj'), 34000)],
 [('regression first-tier-cap 1', (30000, 0, 0, 'single'), 0),
  ('regression first-tier-cap 2', (30000, 1000, 0, 'single'), 0),
  ('partial repair guard 1', (30000, 0, 8000, 'single'), 4000),
  ('partial repair guard 2', (30000, 0, 1687, 'single'), 843),
  ('control: large income', (150000, 5000, 40000, 'mfj'), 34000),
  ('control: first tier', (20000, 0, 12000, 'single'), 500),
  ('control: second tier', (40000, 0, 20000, 'single'), 17000),
  ('control: below base', (10000, 0, 10000, 'single'), 0)],
 [('regression first-tier-cap 1', (30000, 1000, 2000, 'single'), 1000),
  ('regression first-tier-cap 2', (30000, 0, 8000, 'single'), 4000),
  ('partial repair guard 1', (28000, 0, 2000, 'single'), 1000),
  ('partial repair guard 2', (30000, 0, 1000, 'single'), 500), ('control: below base', (10000, 0, 10000, 'single'), 0),
  ('control: joint with exempt interest', (30000, 1000, 20000, 'mfj'), 4500),
  ('control: separate filer', (5000, 0, 8000, 'mfs'), 6800),
  ('control: large income', (150000, 5000, 40000, 'mfj'), 34000)],
 [('regression first-tier-cap 1', (30000, 0, 1687, 'single'), 843),
  ('regression first-tier-cap 2', (28000, 0, 2000, 'single'), 1000),
  ('partial repair guard 1', (30000, 0, 2000, 'single'), 1000),
  ('partial repair guard 2', (30000, 1000, 2000, 'single'), 1000),
  ('control: large income', (150000, 5000, 40000, 'mfj'), 34000),
  ('control: first tier', (20000, 0, 12000, 'single'), 500),
  ('control: second tier', (40000, 0, 20000, 'single'), 17000),
  ('control: below base', (10000, 0, 10000, 'single'), 0)]]
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 first-tier-cap 120001000Failed
regression first-tier-cap 21000500Failed
control: first tier500500Passed
control: second tier1700017000Passed
control: below base00Passed
control: joint with exempt interest45004500Passed

SHA-256 / 5ce34975f075c75df2445624cc43869d5be6d47aa4a4215d4aa8dca6a1243070

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 6 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 1ffeb6b20392fe70941ee0efe6eac4bfe28eae7d9b6a2897e6ad2cc282cf6c8e