FAILURE MAP
← Case archive

FA-62586 / Tax bracket computation / Open access

Short accounting periods receive full-year limits · case 01

A six-month period enjoys the full annual small-profits limit.

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

ROOT CAUSE

The limits are not prorated by days/365.

VERIFIED REPAIR

Prorate both limits by days/365.

Unsuccessful approach: Prorating by rounded-up months instead of days misstates short periods.

Case contract

solve(profits, dividends, associates, days): stipulated small-profits relief. Limits L = 50000 and U = 250000 are divided by (associates + 1) and prorated by days/365 (exact fractions). Augmented profits A = profits + dividends decide the band: A <= L taxes profits N at 19%; A >= U at 25%; otherwise tax = 25% of N minus 3/200 * (U - A) * N / A. Return integer cents rounded 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(profits, dividends, associates, days):
    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))
    
    div = associates + 1
    L = Fraction(50000, div)
    U = Fraction(250000, div)
    A = profits + dividends
    N = Fraction(profits)
    if A <= L: tax = N * 19 / 100
    elif A >= U: tax = N * 25 / 100
    else: tax = N * 25 / 100 - Fraction(3, 200) * (U - A) * N / A
    return cents(tax)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression period-proration 1', (30000, 0, 0, 181), 609041),
  ('regression period-proration 2', (70000, 5000, 2, 200), 1750000),
  ('partial repair guard 2', (100000, 0, 0, 365), 2275000), ('control: small profits', (40000, 0, 0, 365), 760000),
  ('control: main rate', (300000, 0, 0, 365), 7500000), ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000)],
 [('regression period-proration 1', (100000, 5000, 0, 90), 2500000),
  ('regression period-proration 2', (100000, 5000, 0, 300), 2356458),
  ('partial repair guard 1', (60000, 0, 1, 365), 1402500), ('partial repair guard 2', (100000, 25000, 0, 365), 2350000),
  ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000),
  ('control: small profits', (40000, 0, 0, 365), 760000)],
 [('regression period-proration 1', (180000, 25000, 0, 181), 4500000),
  ('regression period-proration 2', (30000, 5000, 0, 200), 618875),
  ('partial repair guard 1', (200000, 60000, 0, 365), 5000000),
  ('partial repair guard 2', (100000, 5000, 1, 365), 2471429),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: small profits', (40000, 0, 0, 365), 760000), ('control: relief zone', (100000, 0, 0, 365), 2275000),
  ('control: main rate', (300000, 0, 0, 365), 7500000)],
 [('regression period-proration 1', (50000, 0, 2, 181), 1250000),
  ('regression period-proration 2', (50000, 60000, 0, 90), 1250000),
  ('partial repair guard 1', (50000, 25000, 0, 365), 1075000),
  ('partial repair guard 2', (100000, 5000, 0, 300), 2356458), ('control: relief zone', (100000, 0, 0, 365), 2275000),
  ('control: main rate', (300000, 0, 0, 365), 7500000), ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000)],
 [('regression period-proration 1', (50000, 0, 2, 90), 1250000),
  ('regression period-proration 2', (50000, 0, 1, 300), 1170890),
  ('partial repair guard 1', (50000, 60000, 0, 365), 1154545),
  ('partial repair guard 2', (30000, 5000, 0, 200), 618875),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000), ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000)]]
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 period-proration 1570000609041Failed
regression period-proration 217383331750000Failed
partial repair guard 222750002275000Passed
control: small profits760000760000Passed
control: main rate75000007500000Passed
control: associated company14025001402500Passed
control: with dividends23500002350000Passed

SHA-256 / 8f1e7d65699504fac4d4f42400b3ed4c0902946f81695b4ded8c2d3f6882563e

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(profits, dividends, associates, days):
    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))
    
    div = associates + 1
    L = Fraction(50000 * ((days + 29) // 30), 12 * div)
    U = Fraction(250000 * ((days + 29) // 30), 12 * div)
    A = profits + dividends
    N = Fraction(profits)
    if A <= L: tax = N * 19 / 100
    elif A >= U: tax = N * 25 / 100
    else: tax = N * 25 / 100 - Fraction(3, 200) * (U - A) * N / A
    return cents(tax)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression period-proration 1', (30000, 0, 0, 181), 609041),
  ('regression period-proration 2', (70000, 5000, 2, 200), 1750000),
  ('partial repair guard 2', (100000, 0, 0, 365), 2275000), ('control: small profits', (40000, 0, 0, 365), 760000),
  ('control: main rate', (300000, 0, 0, 365), 7500000), ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000)],
 [('regression period-proration 1', (100000, 5000, 0, 90), 2500000),
  ('regression period-proration 2', (100000, 5000, 0, 300), 2356458),
  ('partial repair guard 1', (60000, 0, 1, 365), 1402500), ('partial repair guard 2', (100000, 25000, 0, 365), 2350000),
  ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000),
  ('control: small profits', (40000, 0, 0, 365), 760000)],
 [('regression period-proration 1', (180000, 25000, 0, 181), 4500000),
  ('regression period-proration 2', (30000, 5000, 0, 200), 618875),
  ('partial repair guard 1', (200000, 60000, 0, 365), 5000000),
  ('partial repair guard 2', (100000, 5000, 1, 365), 2471429),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: small profits', (40000, 0, 0, 365), 760000), ('control: relief zone', (100000, 0, 0, 365), 2275000),
  ('control: main rate', (300000, 0, 0, 365), 7500000)],
 [('regression period-proration 1', (50000, 0, 2, 181), 1250000),
  ('regression period-proration 2', (50000, 60000, 0, 90), 1250000),
  ('partial repair guard 1', (50000, 25000, 0, 365), 1075000),
  ('partial repair guard 2', (100000, 5000, 0, 300), 2356458), ('control: relief zone', (100000, 0, 0, 365), 2275000),
  ('control: main rate', (300000, 0, 0, 365), 7500000), ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000)],
 [('regression period-proration 1', (50000, 0, 2, 90), 1250000),
  ('regression period-proration 2', (50000, 0, 1, 300), 1170890),
  ('partial repair guard 1', (50000, 60000, 0, 365), 1154545),
  ('partial repair guard 2', (30000, 5000, 0, 200), 618875),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000), ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000)]]
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 period-proration 1576250609041Failed
regression period-proration 217500001750000Passed
partial repair guard 222437502275000Failed
control: small profits760000760000Passed
control: main rate75000007500000Passed
control: associated company13868751402500Failed
control: with dividends23250002350000Failed

SHA-256 / 041a4747ba988716f9f25ee1d8d6de0dba2bbbdff36ed147e37765b628333c8a

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(profits, dividends, associates, days):
    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))
    
    div = associates + 1
    L = Fraction(50000 * days, 365 * div)
    U = Fraction(250000 * days, 365 * div)
    A = profits + dividends
    N = Fraction(profits)
    if A <= L: tax = N * 19 / 100
    elif A >= U: tax = N * 25 / 100
    else: tax = N * 25 / 100 - Fraction(3, 200) * (U - A) * N / A
    return cents(tax)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression period-proration 1', (30000, 0, 0, 181), 609041),
  ('regression period-proration 2', (70000, 5000, 2, 200), 1750000),
  ('partial repair guard 2', (100000, 0, 0, 365), 2275000), ('control: small profits', (40000, 0, 0, 365), 760000),
  ('control: main rate', (300000, 0, 0, 365), 7500000), ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000)],
 [('regression period-proration 1', (100000, 5000, 0, 90), 2500000),
  ('regression period-proration 2', (100000, 5000, 0, 300), 2356458),
  ('partial repair guard 1', (60000, 0, 1, 365), 1402500), ('partial repair guard 2', (100000, 25000, 0, 365), 2350000),
  ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000),
  ('control: small profits', (40000, 0, 0, 365), 760000)],
 [('regression period-proration 1', (180000, 25000, 0, 181), 4500000),
  ('regression period-proration 2', (30000, 5000, 0, 200), 618875),
  ('partial repair guard 1', (200000, 60000, 0, 365), 5000000),
  ('partial repair guard 2', (100000, 5000, 1, 365), 2471429),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: small profits', (40000, 0, 0, 365), 760000), ('control: relief zone', (100000, 0, 0, 365), 2275000),
  ('control: main rate', (300000, 0, 0, 365), 7500000)],
 [('regression period-proration 1', (50000, 0, 2, 181), 1250000),
  ('regression period-proration 2', (50000, 60000, 0, 90), 1250000),
  ('partial repair guard 1', (50000, 25000, 0, 365), 1075000),
  ('partial repair guard 2', (100000, 5000, 0, 300), 2356458), ('control: relief zone', (100000, 0, 0, 365), 2275000),
  ('control: main rate', (300000, 0, 0, 365), 7500000), ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000)],
 [('regression period-proration 1', (50000, 0, 2, 90), 1250000),
  ('regression period-proration 2', (50000, 0, 1, 300), 1170890),
  ('partial repair guard 1', (50000, 60000, 0, 365), 1154545),
  ('partial repair guard 2', (30000, 5000, 0, 200), 618875),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000), ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000)]]
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 period-proration 1609041609041Passed
regression period-proration 217500001750000Passed
partial repair guard 222750002275000Passed
control: small profits760000760000Passed
control: main rate75000007500000Passed
control: associated company14025001402500Passed
control: with dividends23500002350000Passed

SHA-256 / e73659e601bfc64bfc7857b90c76fda8343bc9234d4d294d8dbc618d4fccebcc

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

Case digest / 1e16b5c3544d255980539a86cf4abc98b10dce93f706f90315e52e1f7cbc540a