FAILURE MAP
← Case archive

FA-62716 / Tax bracket computation / Open access

Excess dividend credit is paid out as a refund · case 01

A retiree living on eligible dividends gets a negative tax.

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

ROOT CAUSE

The tax after the dividend credit is not floored at zero.

THE FAILURE

The tax after the dividend credit is not floored at zero.

Unsuccessful approach: Limiting the credit to the tax attributable to dividends still over-taxes when other income could absorb it.

Case contract

solve(other, elig, nonelig): stipulated dividend integration, whole dollars. Eligible dividends are grossed up by 38% and non-eligible by 15%; taxable income is other income plus both grossed-up amounts, taxed with slices 15% to 55867, 20.5% to 111733, 26% to 173205, 29% to 246752, 33% above. The nonrefundable dividend credit is 15.0198% of the grossed-up eligible amount plus 9.0301% of the grossed-up non-eligible amount. Tax = max(0, slice tax - credit), returned in 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(other, elig, nonelig):
    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))
    
    br = [[55867, '15'], [111733, '20.5'], [173205, '26'], [246752, '29'], [None, '33']]
    g_e = elig * Fraction(138, 100)
    g_n = nonelig * Fraction(115, 100)
    taxable = other + g_e + g_n
    credit = g_e * Fraction(150198, 1000000) + g_n * Fraction(90301, 1000000)
    return cents(prog(taxable, br) - credit)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression nonrefundable-floor 1', (0, 10000, 0), 0), ('regression nonrefundable-floor 2', (0, 1000, 0), 0),
  ('partial repair guard 1', (50000, 3936, 0), 749892), ('partial repair guard 2', (20000, 10000, 0), 299727),
  ('control: wages only', (50000, 0, 0), 750000), ('control: mixed', (100000, 10000, 0), 1829727),
  ('control: non-eligible dividends', (40000, 0, 20000), 776539),
  ('control: both kinds', (80000, 15000, 15000), 1678221)],
 [('regression nonrefundable-floor 1', (0, 32901, 0), 0), ('regression nonrefundable-floor 2', (0, 10000, 0), 0),
  ('partial repair guard 1', (50000, 1000, 0), 749973), ('partial repair guard 2', (20000, 20801, 0), 299432),
  ('control: non-eligible dividends', (40000, 0, 20000), 776539),
  ('control: both kinds', (80000, 15000, 15000), 1678221), ('control: high income', (250000, 50000, 10000), 7337865),
  ('control: wages only', (50000, 0, 0), 750000)],
 [('regression nonrefundable-floor 1', (0, 1000, 0), 0), ('regression nonrefundable-floor 2', (0, 32901, 0), 0),
  ('partial repair guard 1', (20000, 1000, 0), 299973), ('partial repair guard 2', (11723, 1000, 0), 175818),
  ('control: wages only', (50000, 0, 0), 750000), ('control: eligible dividends only', (0, 10000, 0), 0),
  ('control: mixed', (100000, 10000, 0), 1829727), ('control: non-eligible dividends', (40000, 0, 20000), 776539)],
 [('regression nonrefundable-floor 1', (0, 10000, 0), 0), ('regression nonrefundable-floor 2', (0, 1000, 0), 0),
  ('partial repair guard 1', (20000, 1961, 0), 299946), ('partial repair guard 2', (33705, 10000, 0), 505302),
  ('control: non-eligible dividends', (40000, 0, 20000), 776539),
  ('control: both kinds', (80000, 15000, 15000), 1678221), ('control: high income', (250000, 50000, 10000), 7337865),
  ('control: wages only', (50000, 0, 0), 750000)],
 [('regression nonrefundable-floor 1', (0, 32901, 0), 0), ('regression nonrefundable-floor 2', (0, 10000, 0), 0),
  ('partial repair guard 1', (50000, 951, 0), 749974), ('partial repair guard 2', (50000, 3936, 0), 749892),
  ('control: wages only', (50000, 0, 0), 750000), ('control: mixed', (100000, 10000, 0), 1829727),
  ('control: non-eligible dividends', (40000, 0, 20000), 776539),
  ('control: both kinds', (80000, 15000, 15000), 1678221)]]
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 nonrefundable-floor 1-2730Failed
regression nonrefundable-floor 2-270Failed
partial repair guard 1749892749892Passed
partial repair guard 2299727299727Passed
control: wages only750000750000Passed
control: mixed18297271829727Passed
control: non-eligible dividends776539776539Passed
control: both kinds16782211678221Passed

SHA-256 / e21605f4973c6963ed07ae937e1086e669a423bca617ba0b770818a096c8e31f

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(other, elig, nonelig):
    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))
    
    br = [[55867, '15'], [111733, '20.5'], [173205, '26'], [246752, '29'], [None, '33']]
    g_e = elig * Fraction(138, 100)
    g_n = nonelig * Fraction(115, 100)
    taxable = other + g_e + g_n
    credit = g_e * Fraction(150198, 1000000) + g_n * Fraction(90301, 1000000)
    return cents(prog(taxable, br) - min(credit, prog(taxable, br) - prog(other, br)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression nonrefundable-floor 1', (0, 10000, 0), 0), ('regression nonrefundable-floor 2', (0, 1000, 0), 0),
  ('partial repair guard 1', (50000, 3936, 0), 749892), ('partial repair guard 2', (20000, 10000, 0), 299727),
  ('control: wages only', (50000, 0, 0), 750000), ('control: mixed', (100000, 10000, 0), 1829727),
  ('control: non-eligible dividends', (40000, 0, 20000), 776539),
  ('control: both kinds', (80000, 15000, 15000), 1678221)],
 [('regression nonrefundable-floor 1', (0, 32901, 0), 0), ('regression nonrefundable-floor 2', (0, 10000, 0), 0),
  ('partial repair guard 1', (50000, 1000, 0), 749973), ('partial repair guard 2', (20000, 20801, 0), 299432),
  ('control: non-eligible dividends', (40000, 0, 20000), 776539),
  ('control: both kinds', (80000, 15000, 15000), 1678221), ('control: high income', (250000, 50000, 10000), 7337865),
  ('control: wages only', (50000, 0, 0), 750000)],
 [('regression nonrefundable-floor 1', (0, 1000, 0), 0), ('regression nonrefundable-floor 2', (0, 32901, 0), 0),
  ('partial repair guard 1', (20000, 1000, 0), 299973), ('partial repair guard 2', (11723, 1000, 0), 175818),
  ('control: wages only', (50000, 0, 0), 750000), ('control: eligible dividends only', (0, 10000, 0), 0),
  ('control: mixed', (100000, 10000, 0), 1829727), ('control: non-eligible dividends', (40000, 0, 20000), 776539)],
 [('regression nonrefundable-floor 1', (0, 10000, 0), 0), ('regression nonrefundable-floor 2', (0, 1000, 0), 0),
  ('partial repair guard 1', (20000, 1961, 0), 299946), ('partial repair guard 2', (33705, 10000, 0), 505302),
  ('control: non-eligible dividends', (40000, 0, 20000), 776539),
  ('control: both kinds', (80000, 15000, 15000), 1678221), ('control: high income', (250000, 50000, 10000), 7337865),
  ('control: wages only', (50000, 0, 0), 750000)],
 [('regression nonrefundable-floor 1', (0, 32901, 0), 0), ('regression nonrefundable-floor 2', (0, 10000, 0), 0),
  ('partial repair guard 1', (50000, 951, 0), 749974), ('partial repair guard 2', (50000, 3936, 0), 749892),
  ('control: wages only', (50000, 0, 0), 750000), ('control: mixed', (100000, 10000, 0), 1829727),
  ('control: non-eligible dividends', (40000, 0, 20000), 776539),
  ('control: both kinds', (80000, 15000, 15000), 1678221)]]
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 nonrefundable-floor 100Passed
regression nonrefundable-floor 200Passed
partial repair guard 1750000749892Failed
partial repair guard 2300000299727Failed
control: wages only750000750000Passed
control: mixed18297271829727Passed
control: non-eligible dividends776539776539Passed
control: both kinds16782211678221Passed

SHA-256 / 815c1d3a8a09e2f0b4a7295983ac910b40ca4047dfde1e35e8fcc2331d524b9e

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 8 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.322461+00:00.

Case digest / c1b491494813081716109d75b16f5da5b2045e3fbb9089aa610d16b0ea646ace