FAILURE MAP
← Case archive

FA-62461 / Tax bracket computation / Open access

Rate bands are applied to total income instead of taxable income · case 01

The higher rate starts 12570 pounds too early.

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

ROOT CAUSE

Band limits are compared with ani rather than with income after the allowance.

VERIFIED REPAIR

Apply the 37700 and 125140 band limits to taxable income.

Unsuccessful approach: Moving only the basic band onto taxable income leaves the higher band measured on total income.

Case contract

solve(income, pension): stipulated allowance taper in whole pounds. Adjusted net income ani = income - pension. The personal allowance 12570 is reduced by 1 for every 2 whole pounds of ani above 100000 (floor of half the excess), never below 0. Taxable = max(0, ani - allowance). Taxable income is taxed 20% up to 37700, 40% from 37700 to 125140, 45% above 125140. Return tax in integer pence.

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(income, pension):
    ani = income - pension
    allow = 12570
    if ani > 100000: allow = max(0, allow - (ani - 100000) // 2)
    taxable = max(0, ani - allow)
    basic = max(0, min(ani, 37700) - allow)
    higher = max(0, min(ani, 125140) - max(37700, allow))
    additional = max(0, ani - max(125140, allow))
    return basic * 20 + higher * 40 + additional * 45
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression band-base 1', (50000, 0), 748600), ('regression band-base 2', (110001, 0), 3343240),
  ('control: pension restores allowance', (130000, 5000), 4243200), ('control: fully tapered', (200000, 0), 7620300),
  ('control: allowance exhausted exactly', (125140, 0), 4251600),
  ('control: just beyond exhaustion', (125143, 0), 4251735)],
 [('regression band-base 1', (130000, 5000), 4243200), ('regression band-base 2', (160000, 60000), 2743200),
  ('control: fully tapered', (200000, 0), 7620300), ('control: allowance exhausted exactly', (125140, 0), 4251600),
  ('control: just beyond exhaustion', (125143, 0), 4251735), ('control: below allowance', (9000, 0), 0)],
 [('regression band-base 1', (73848, 0), 1697120), ('regression band-base 2', (100003, 0), 2743360),
  ('control: below allowance', (9000, 0), 0), ('control: large pension', (160000, 60000), 2743200),
  ('control: mid taper', (140000, 0), 4920300), ('control: basic and higher', (50000, 0), 748600)],
 [('regression band-base 1', (77280, 0), 1834400), ('regression band-base 2', (100001, 5000), 2543240),
  ('control: basic and higher', (50000, 0), 748600), ('control: odd excess in taper', (110001, 0), 3343240),
  ('control: pension restores allowance', (130000, 5000), 4243200), ('control: fully tapered', (200000, 0), 7620300)],
 [('regression band-base 1', (112519, 0), 3494320), ('regression band-base 2', (125142, 20000), 3051720),
  ('control: fully tapered', (200000, 0), 7620300), ('control: allowance exhausted exactly', (125140, 0), 4251600),
  ('control: just beyond exhaustion', (125143, 0), 4251735), ('control: below allowance', (9000, 0), 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 band-base 1994600748600Failed
regression band-base 234946403343240Failed
control: pension restores allowance42446004243200Failed
control: fully tapered76203007620300Passed
control: allowance exhausted exactly42516004251600Passed
control: just beyond exhaustion42517354251735Passed

SHA-256 / 1e105ab354f4a2b07b4820bf7c3a54dc32fb24b3117c3e063fad41b2241dc380

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(income, pension):
    ani = income - pension
    allow = 12570
    if ani > 100000: allow = max(0, allow - (ani - 100000) // 2)
    taxable = max(0, ani - allow)
    basic = min(taxable, 37700)
    higher = max(0, min(ani, 125140) - max(37700, allow))
    additional = max(0, taxable - 125140)
    return basic * 20 + higher * 40 + additional * 45
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression band-base 1', (50000, 0), 748600), ('regression band-base 2', (110001, 0), 3343240),
  ('control: pension restores allowance', (130000, 5000), 4243200), ('control: fully tapered', (200000, 0), 7620300),
  ('control: allowance exhausted exactly', (125140, 0), 4251600),
  ('control: just beyond exhaustion', (125143, 0), 4251735)],
 [('regression band-base 1', (130000, 5000), 4243200), ('regression band-base 2', (160000, 60000), 2743200),
  ('control: fully tapered', (200000, 0), 7620300), ('control: allowance exhausted exactly', (125140, 0), 4251600),
  ('control: just beyond exhaustion', (125143, 0), 4251735), ('control: below allowance', (9000, 0), 0)],
 [('regression band-base 1', (73848, 0), 1697120), ('regression band-base 2', (100003, 0), 2743360),
  ('control: below allowance', (9000, 0), 0), ('control: large pension', (160000, 60000), 2743200),
  ('control: mid taper', (140000, 0), 4920300), ('control: basic and higher', (50000, 0), 748600)],
 [('regression band-base 1', (77280, 0), 1834400), ('regression band-base 2', (100001, 5000), 2543240),
  ('control: basic and higher', (50000, 0), 748600), ('control: odd excess in taper', (110001, 0), 3343240),
  ('control: pension restores allowance', (130000, 5000), 4243200), ('control: fully tapered', (200000, 0), 7620300)],
 [('regression band-base 1', (112519, 0), 3494320), ('regression band-base 2', (125142, 20000), 3051720),
  ('control: fully tapered', (200000, 0), 7620300), ('control: allowance exhausted exactly', (125140, 0), 4251600),
  ('control: just beyond exhaustion', (125143, 0), 4251735), ('control: below allowance', (9000, 0), 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 band-base 11240600748600Failed
regression band-base 236460403343240Failed
control: pension restores allowance42460004243200Failed
control: fully tapered76203007620300Passed
control: allowance exhausted exactly42516004251600Passed
control: just beyond exhaustion42517354251735Passed

SHA-256 / 53192dd4b968a7dd6cdabc1c4fc745dc18219d1a630d2a9d11246cd07b765d00

3 / The verified repair

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

N = 1
observations = []
def solve(income, pension):
    ani = income - pension
    allow = 12570
    if ani > 100000: allow = max(0, allow - (ani - 100000) // 2)
    taxable = max(0, ani - allow)
    basic = min(taxable, 37700)
    higher = max(0, min(taxable, 125140) - 37700)
    additional = max(0, taxable - 125140)
    return basic * 20 + higher * 40 + additional * 45
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression band-base 1', (50000, 0), 748600), ('regression band-base 2', (110001, 0), 3343240),
  ('control: pension restores allowance', (130000, 5000), 4243200), ('control: fully tapered', (200000, 0), 7620300),
  ('control: allowance exhausted exactly', (125140, 0), 4251600),
  ('control: just beyond exhaustion', (125143, 0), 4251735)],
 [('regression band-base 1', (130000, 5000), 4243200), ('regression band-base 2', (160000, 60000), 2743200),
  ('control: fully tapered', (200000, 0), 7620300), ('control: allowance exhausted exactly', (125140, 0), 4251600),
  ('control: just beyond exhaustion', (125143, 0), 4251735), ('control: below allowance', (9000, 0), 0)],
 [('regression band-base 1', (73848, 0), 1697120), ('regression band-base 2', (100003, 0), 2743360),
  ('control: below allowance', (9000, 0), 0), ('control: large pension', (160000, 60000), 2743200),
  ('control: mid taper', (140000, 0), 4920300), ('control: basic and higher', (50000, 0), 748600)],
 [('regression band-base 1', (77280, 0), 1834400), ('regression band-base 2', (100001, 5000), 2543240),
  ('control: basic and higher', (50000, 0), 748600), ('control: odd excess in taper', (110001, 0), 3343240),
  ('control: pension restores allowance', (130000, 5000), 4243200), ('control: fully tapered', (200000, 0), 7620300)],
 [('regression band-base 1', (112519, 0), 3494320), ('regression band-base 2', (125142, 20000), 3051720),
  ('control: fully tapered', (200000, 0), 7620300), ('control: allowance exhausted exactly', (125140, 0), 4251600),
  ('control: just beyond exhaustion', (125143, 0), 4251735), ('control: below allowance', (9000, 0), 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 band-base 1748600748600Passed
regression band-base 233432403343240Passed
control: pension restores allowance42432004243200Passed
control: fully tapered76203007620300Passed
control: allowance exhausted exactly42516004251600Passed
control: just beyond exhaustion42517354251735Passed

SHA-256 / 2b632617a0f05302ce444f72dfd46f8c6bc9475e82a87145980a5657e27ca54e

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

Case digest / 1cfabc9b256661580185ad55359b4c7e62b18fecaa63679ec926224b88d5bfd1