FAILURE MAP
← Case archive

FA-62616 / Tax bracket computation / Open access

Only the larger surcharge applies to a non-resident additional dwelling · case 01

Non-resident second-home buyers pay 3 surcharge points instead of 5.

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

ROOT CAUSE

The surcharges are combined with max() instead of being added.

VERIFIED REPAIR

Add the additional-dwelling and non-resident surcharges.

Unsuccessful approach: Adding them but applying the 40000 floor to the non-resident surcharge exempts cheap non-resident purchases.

Case contract

solve(price, ftb, additional, nonresident): stipulated property transfer tax in whole pounds. Normal slices: 0% to 250000, 5% to 925000, 10% to 1500000, 12% above. First-time-buyer slices (0% to 425000, 5% to 625000) apply only when ftb is true, the purchase is not an additional dwelling, and price <= 625000; otherwise normal slices. Surcharges add percentage points to every slice including 0% slices: +3 for an additional dwelling when price >= 40000, +2 for a non-resident buyer; they stack. Return the tax rounded down to whole pounds.

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(price, ftb, additional, nonresident):
    normal = [(250000, 0), (925000, 5), (1500000, 10), (None, 12)]
    first = [(425000, 0), (625000, 5)]
    use_ftb = ftb and not additional and price <= 625000
    bands = first if use_ftb else normal
    sur = max(3 if additional and price >= 40000 else 0, 2 if nonresident else 0)
    tax, lower = 0, 0
    for upper, rate in bands:
        top = price if upper is None else min(price, upper)
        if top > lower: tax += (top - lower) * (rate + sur)
        if upper is None or price <= upper: break
        lower = upper
    return tax // 100
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression surcharge-stacking 1', (300000, False, True, True), 17500),
  ('regression surcharge-stacking 2', (625000, False, True, True), 50000),
  ('partial repair guard 1', (39999, False, False, True), 799),
  ('partial repair guard 2', (39999, False, True, True), 799), ('control: normal', (300000, False, False, False), 2500),
  ('control: first-time buyer', (500000, True, False, False), 3750),
  ('control: ftb at cap', (625000, True, False, False), 10000),
  ('control: ftb over cap', (625001, True, False, False), 18750)],
 [('regression surcharge-stacking 1', (628677, True, True, True), 50367),
  ('regression surcharge-stacking 2', (250001, False, True, True), 12500),
  ('partial repair guard 1', (39999, True, True, True), 799),
  ('partial repair guard 2', (39999, True, False, True), 799),
  ('control: ftb over cap', (625001, True, False, False), 18750),
  ('control: additional dwelling', (300000, False, True, False), 11500),
  ('control: additional nonresident', (300000, False, True, True), 17500),
  ('control: below surcharge floor', (39999, False, True, False), 0)],
 [('regression surcharge-stacking 1', (625001, True, True, True), 50000),
  ('regression surcharge-stacking 2', (1103643, False, True, True), 106796),
  ('partial repair guard 1', (39999, False, False, True), 799),
  ('partial repair guard 2', (39999, False, True, True), 799),
  ('control: below surcharge floor', (39999, False, True, False), 0),
  ('control: ftb additional', (400000, True, True, False), 19500),
  ('control: expensive', (2000000, False, False, False), 151250),
  ('control: odd pounds', (250013, False, False, False), 0)],
 [('regression surcharge-stacking 1', (925000, False, True, True), 80000),
  ('regression surcharge-stacking 2', (745541, True, True, True), 62054),
  ('partial repair guard 1', (39999, True, True, True), 799),
  ('partial repair guard 2', (39999, True, False, True), 799),
  ('control: expensive', (2000000, False, False, False), 151250),
  ('control: odd pounds', (250013, False, False, False), 0), ('control: normal', (300000, False, False, False), 2500),
  ('control: first-time buyer', (500000, True, False, False), 3750)],
 [('regression surcharge-stacking 1', (625000, True, True, True), 50000),
  ('regression surcharge-stacking 2', (458948, False, True, True), 33394),
  ('partial repair guard 1', (39999, False, False, True), 799),
  ('partial repair guard 2', (39999, False, True, True), 799),
  ('control: first-time buyer', (500000, True, False, False), 3750),
  ('control: ftb at cap', (625000, True, False, False), 10000),
  ('control: ftb over cap', (625001, True, False, False), 18750),
  ('control: additional dwelling', (300000, False, True, False), 11500)]]
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 surcharge-stacking 11150017500Failed
regression surcharge-stacking 23750050000Failed
partial repair guard 1799799Passed
partial repair guard 2799799Passed
control: normal25002500Passed
control: first-time buyer37503750Passed
control: ftb at cap1000010000Passed
control: ftb over cap1875018750Passed

SHA-256 / f9ea5f56875fb823e5a8077ce572e54cb7cdb5b715528f6679d994234b898bd6

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(price, ftb, additional, nonresident):
    normal = [(250000, 0), (925000, 5), (1500000, 10), (None, 12)]
    first = [(425000, 0), (625000, 5)]
    use_ftb = ftb and not additional and price <= 625000
    bands = first if use_ftb else normal
    sur = ((3 if additional else 0) + (2 if nonresident else 0)) if price >= 40000 else 0
    tax, lower = 0, 0
    for upper, rate in bands:
        top = price if upper is None else min(price, upper)
        if top > lower: tax += (top - lower) * (rate + sur)
        if upper is None or price <= upper: break
        lower = upper
    return tax // 100
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression surcharge-stacking 1', (300000, False, True, True), 17500),
  ('regression surcharge-stacking 2', (625000, False, True, True), 50000),
  ('partial repair guard 1', (39999, False, False, True), 799),
  ('partial repair guard 2', (39999, False, True, True), 799), ('control: normal', (300000, False, False, False), 2500),
  ('control: first-time buyer', (500000, True, False, False), 3750),
  ('control: ftb at cap', (625000, True, False, False), 10000),
  ('control: ftb over cap', (625001, True, False, False), 18750)],
 [('regression surcharge-stacking 1', (628677, True, True, True), 50367),
  ('regression surcharge-stacking 2', (250001, False, True, True), 12500),
  ('partial repair guard 1', (39999, True, True, True), 799),
  ('partial repair guard 2', (39999, True, False, True), 799),
  ('control: ftb over cap', (625001, True, False, False), 18750),
  ('control: additional dwelling', (300000, False, True, False), 11500),
  ('control: additional nonresident', (300000, False, True, True), 17500),
  ('control: below surcharge floor', (39999, False, True, False), 0)],
 [('regression surcharge-stacking 1', (625001, True, True, True), 50000),
  ('regression surcharge-stacking 2', (1103643, False, True, True), 106796),
  ('partial repair guard 1', (39999, False, False, True), 799),
  ('partial repair guard 2', (39999, False, True, True), 799),
  ('control: below surcharge floor', (39999, False, True, False), 0),
  ('control: ftb additional', (400000, True, True, False), 19500),
  ('control: expensive', (2000000, False, False, False), 151250),
  ('control: odd pounds', (250013, False, False, False), 0)],
 [('regression surcharge-stacking 1', (925000, False, True, True), 80000),
  ('regression surcharge-stacking 2', (745541, True, True, True), 62054),
  ('partial repair guard 1', (39999, True, True, True), 799),
  ('partial repair guard 2', (39999, True, False, True), 799),
  ('control: expensive', (2000000, False, False, False), 151250),
  ('control: odd pounds', (250013, False, False, False), 0), ('control: normal', (300000, False, False, False), 2500),
  ('control: first-time buyer', (500000, True, False, False), 3750)],
 [('regression surcharge-stacking 1', (625000, True, True, True), 50000),
  ('regression surcharge-stacking 2', (458948, False, True, True), 33394),
  ('partial repair guard 1', (39999, False, False, True), 799),
  ('partial repair guard 2', (39999, False, True, True), 799),
  ('control: first-time buyer', (500000, True, False, False), 3750),
  ('control: ftb at cap', (625000, True, False, False), 10000),
  ('control: ftb over cap', (625001, True, False, False), 18750),
  ('control: additional dwelling', (300000, False, True, False), 11500)]]
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 surcharge-stacking 11750017500Passed
regression surcharge-stacking 25000050000Passed
partial repair guard 10799Failed
partial repair guard 20799Failed
control: normal25002500Passed
control: first-time buyer37503750Passed
control: ftb at cap1000010000Passed
control: ftb over cap1875018750Passed

SHA-256 / 8e323095a93d7a3e7a51e196317633e36ef08dc0f8fbeabfb098d00cf53d82a5

3 / The verified repair

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

N = 1
observations = []
def solve(price, ftb, additional, nonresident):
    normal = [(250000, 0), (925000, 5), (1500000, 10), (None, 12)]
    first = [(425000, 0), (625000, 5)]
    use_ftb = ftb and not additional and price <= 625000
    bands = first if use_ftb else normal
    sur = (3 if additional and price >= 40000 else 0) + (2 if nonresident else 0)
    tax, lower = 0, 0
    for upper, rate in bands:
        top = price if upper is None else min(price, upper)
        if top > lower: tax += (top - lower) * (rate + sur)
        if upper is None or price <= upper: break
        lower = upper
    return tax // 100
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression surcharge-stacking 1', (300000, False, True, True), 17500),
  ('regression surcharge-stacking 2', (625000, False, True, True), 50000),
  ('partial repair guard 1', (39999, False, False, True), 799),
  ('partial repair guard 2', (39999, False, True, True), 799), ('control: normal', (300000, False, False, False), 2500),
  ('control: first-time buyer', (500000, True, False, False), 3750),
  ('control: ftb at cap', (625000, True, False, False), 10000),
  ('control: ftb over cap', (625001, True, False, False), 18750)],
 [('regression surcharge-stacking 1', (628677, True, True, True), 50367),
  ('regression surcharge-stacking 2', (250001, False, True, True), 12500),
  ('partial repair guard 1', (39999, True, True, True), 799),
  ('partial repair guard 2', (39999, True, False, True), 799),
  ('control: ftb over cap', (625001, True, False, False), 18750),
  ('control: additional dwelling', (300000, False, True, False), 11500),
  ('control: additional nonresident', (300000, False, True, True), 17500),
  ('control: below surcharge floor', (39999, False, True, False), 0)],
 [('regression surcharge-stacking 1', (625001, True, True, True), 50000),
  ('regression surcharge-stacking 2', (1103643, False, True, True), 106796),
  ('partial repair guard 1', (39999, False, False, True), 799),
  ('partial repair guard 2', (39999, False, True, True), 799),
  ('control: below surcharge floor', (39999, False, True, False), 0),
  ('control: ftb additional', (400000, True, True, False), 19500),
  ('control: expensive', (2000000, False, False, False), 151250),
  ('control: odd pounds', (250013, False, False, False), 0)],
 [('regression surcharge-stacking 1', (925000, False, True, True), 80000),
  ('regression surcharge-stacking 2', (745541, True, True, True), 62054),
  ('partial repair guard 1', (39999, True, True, True), 799),
  ('partial repair guard 2', (39999, True, False, True), 799),
  ('control: expensive', (2000000, False, False, False), 151250),
  ('control: odd pounds', (250013, False, False, False), 0), ('control: normal', (300000, False, False, False), 2500),
  ('control: first-time buyer', (500000, True, False, False), 3750)],
 [('regression surcharge-stacking 1', (625000, True, True, True), 50000),
  ('regression surcharge-stacking 2', (458948, False, True, True), 33394),
  ('partial repair guard 1', (39999, False, False, True), 799),
  ('partial repair guard 2', (39999, False, True, True), 799),
  ('control: first-time buyer', (500000, True, False, False), 3750),
  ('control: ftb at cap', (625000, True, False, False), 10000),
  ('control: ftb over cap', (625001, True, False, False), 18750),
  ('control: additional dwelling', (300000, False, True, False), 11500)]]
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 surcharge-stacking 11750017500Passed
regression surcharge-stacking 25000050000Passed
partial repair guard 1799799Passed
partial repair guard 2799799Passed
control: normal25002500Passed
control: first-time buyer37503750Passed
control: ftb at cap1000010000Passed
control: ftb over cap1875018750Passed

SHA-256 / 88c8ff0d0c644f0eed8e15bbb29f845dc838fedffdeb94a364d09b1af6bc26c9

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

Case digest / b5988d11a3159f88612d74c493a2cfcf90203d91ecdf7a3bc55bc7b49c4229c3