FA-62721 / Tax bracket computation / Open access
Cash dividends rather than grossed-up dividends are included in taxable income · case 01
Taxable income is understated while the credit is still based on the gross-up.
ROOT CAUSE
Taxable income adds actual dividends.
VERIFIED REPAIR
Include the grossed-up dividends in taxable income.
Unsuccessful approach: Grossing up only the eligible dividends in taxable income still understates non-eligible income.
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 + elig + nonelig
credit = g_e * Fraction(150198, 1000000) + g_n * Fraction(90301, 1000000)
return cents(max(0, prog(taxable, br) - credit))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression taxable-inclusion 1', (40000, 0, 20000), 776539),
('regression taxable-inclusion 2', (100000, 10000, 0), 1829727),
('partial repair guard 2', (80000, 15000, 15000), 1678221), ('control: wages only', (50000, 0, 0), 750000),
('control: eligible dividends only', (0, 10000, 0), 0), ('control: high income', (250000, 50000, 10000), 7337865)],
[('regression taxable-inclusion 1', (80000, 15000, 15000), 1678221),
('regression taxable-inclusion 2', (250000, 50000, 10000), 7337865),
('partial repair guard 2', (20000, 78584, 5000), 886535),
('control: non-eligible dividends', (40000, 0, 20000), 776539), ('control: wages only', (50000, 0, 0), 750000),
('control: eligible dividends only', (0, 10000, 0), 0), ('control: mixed', (100000, 10000, 0), 1829727)],
[('regression taxable-inclusion 1', (50000, 3936, 0), 749892),
('regression taxable-inclusion 2', (0, 50000, 0), 70865), ('partial repair guard 1', (0, 0, 16293), 111858),
('partial repair guard 2', (100000, 0, 5000), 1808683), ('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 taxable-inclusion 1', (100000, 997, 0), 1750271),
('regression taxable-inclusion 2', (20000, 78584, 5000), 886535), ('partial repair guard 1', (0, 10000, 5000), 34054),
('partial repair guard 2', (0, 50000, 49145), 794917), ('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 taxable-inclusion 1', (0, 0, 16293), 111858),
('regression taxable-inclusion 2', (100000, 0, 5000), 1808683),
('partial repair guard 1', (20000, 1000, 5000), 334300), ('partial repair guard 2', (10606, 50000, 20000), 552096),
('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)]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression taxable-inclusion 1 | 715039 | 776539 | Failed |
| regression taxable-inclusion 2 | 1740458 | 1829727 | Failed |
| partial repair guard 2 | 1481052 | 1678221 | Failed |
| control: wages only | 750000 | 750000 | Passed |
| control: eligible dividends only | 0 | 0 | Passed |
| control: high income | 6661365 | 7337865 | Failed |
SHA-256 / 8c914a53046d3384f1b35a01184c2763fa7622850602139d43a13ca9c997b045
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 + nonelig
credit = g_e * Fraction(150198, 1000000) + g_n * Fraction(90301, 1000000)
return cents(max(0, prog(taxable, br) - credit))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression taxable-inclusion 1', (40000, 0, 20000), 776539),
('regression taxable-inclusion 2', (100000, 10000, 0), 1829727),
('partial repair guard 2', (80000, 15000, 15000), 1678221), ('control: wages only', (50000, 0, 0), 750000),
('control: eligible dividends only', (0, 10000, 0), 0), ('control: high income', (250000, 50000, 10000), 7337865)],
[('regression taxable-inclusion 1', (80000, 15000, 15000), 1678221),
('regression taxable-inclusion 2', (250000, 50000, 10000), 7337865),
('partial repair guard 2', (20000, 78584, 5000), 886535),
('control: non-eligible dividends', (40000, 0, 20000), 776539), ('control: wages only', (50000, 0, 0), 750000),
('control: eligible dividends only', (0, 10000, 0), 0), ('control: mixed', (100000, 10000, 0), 1829727)],
[('regression taxable-inclusion 1', (50000, 3936, 0), 749892),
('regression taxable-inclusion 2', (0, 50000, 0), 70865), ('partial repair guard 1', (0, 0, 16293), 111858),
('partial repair guard 2', (100000, 0, 5000), 1808683), ('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 taxable-inclusion 1', (100000, 997, 0), 1750271),
('regression taxable-inclusion 2', (20000, 78584, 5000), 886535), ('partial repair guard 1', (0, 10000, 5000), 34054),
('partial repair guard 2', (0, 50000, 49145), 794917), ('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 taxable-inclusion 1', (0, 0, 16293), 111858),
('regression taxable-inclusion 2', (100000, 0, 5000), 1808683),
('partial repair guard 1', (20000, 1000, 5000), 334300), ('partial repair guard 2', (10606, 50000, 20000), 552096),
('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)]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression taxable-inclusion 1 | 715039 | 776539 | Failed |
| regression taxable-inclusion 2 | 1829727 | 1829727 | Passed |
| partial repair guard 2 | 1619721 | 1678221 | Failed |
| control: wages only | 750000 | 750000 | Passed |
| control: eligible dividends only | 0 | 0 | Passed |
| control: high income | 7288365 | 7337865 | Failed |
SHA-256 / 03db49530ad6669577aaf36a640292501940ac23b9512717654954cab9ed4042
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(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(max(0, prog(taxable, br) - credit))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression taxable-inclusion 1', (40000, 0, 20000), 776539),
('regression taxable-inclusion 2', (100000, 10000, 0), 1829727),
('partial repair guard 2', (80000, 15000, 15000), 1678221), ('control: wages only', (50000, 0, 0), 750000),
('control: eligible dividends only', (0, 10000, 0), 0), ('control: high income', (250000, 50000, 10000), 7337865)],
[('regression taxable-inclusion 1', (80000, 15000, 15000), 1678221),
('regression taxable-inclusion 2', (250000, 50000, 10000), 7337865),
('partial repair guard 2', (20000, 78584, 5000), 886535),
('control: non-eligible dividends', (40000, 0, 20000), 776539), ('control: wages only', (50000, 0, 0), 750000),
('control: eligible dividends only', (0, 10000, 0), 0), ('control: mixed', (100000, 10000, 0), 1829727)],
[('regression taxable-inclusion 1', (50000, 3936, 0), 749892),
('regression taxable-inclusion 2', (0, 50000, 0), 70865), ('partial repair guard 1', (0, 0, 16293), 111858),
('partial repair guard 2', (100000, 0, 5000), 1808683), ('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 taxable-inclusion 1', (100000, 997, 0), 1750271),
('regression taxable-inclusion 2', (20000, 78584, 5000), 886535), ('partial repair guard 1', (0, 10000, 5000), 34054),
('partial repair guard 2', (0, 50000, 49145), 794917), ('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 taxable-inclusion 1', (0, 0, 16293), 111858),
('regression taxable-inclusion 2', (100000, 0, 5000), 1808683),
('partial repair guard 1', (20000, 1000, 5000), 334300), ('partial repair guard 2', (10606, 50000, 20000), 552096),
('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)]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression taxable-inclusion 1 | 776539 | 776539 | Passed |
| regression taxable-inclusion 2 | 1829727 | 1829727 | Passed |
| partial repair guard 2 | 1678221 | 1678221 | Passed |
| control: wages only | 750000 | 750000 | Passed |
| control: eligible dividends only | 0 | 0 | Passed |
| control: high income | 7337865 | 7337865 | Passed |
SHA-256 / 4528eab673794ccb4e0d975a37074ab726c34a0bd6c4d1d494cbd2f49ad5688e
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.328689+00:00.
Case digest / 2dec50ad6e438f98de811e23c04add26c1885b6ffefb1cc25e03062df03937e5