FAILURE MAP
← Case archive

FA-62486 / Tax bracket computation / Open access

An unrecognised credit kind is silently ignored · case 01

A mistyped credit code disappears from the computation without an error.

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

ROOT CAUSE

Credits with unknown kinds are skipped.

THE FAILURE

Credits with unknown kinds are skipped.

Unsuccessful approach: Treating unknown kinds as nonrefundable credits still accepts invalid input.

Case contract

solve(tax, credits): tax is integer cents >= 0; credits is a list of [kind, cents] with kind 'nonref' (nonrefundable, unused part lost), 'carry' (nonrefundable, unused part carried forward) or 'ref' (refundable). Unknown kinds return 'ERR:kind'. Apply all nonref credits first (limited to the remaining tax), then carry credits (limited to what remains), then refundable credits in full (a negative result is a refund). Return [final_tax, carryforward].

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(tax, credits):
    tot = {'nonref': 0, 'carry': 0, 'ref': 0}
    for kind, amount in credits:
        if kind in tot: tot[kind] += amount
    n, c, r = tot['nonref'], tot['carry'], tot['ref']
    t = tax
    use_n = min(n, t)
    t -= use_n
    use_c = min(c, t)
    t -= use_c
    cf = c - use_c
    t -= r
    return [t, cf]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression unknown-credit-kind 1', (100, [['bonus', 5]]), 'ERR:kind'),
  ('regression unknown-credit-kind 2', (1000, [['other', 100]]), 'ERR:kind'),
  ('control: all kinds', (1000, [['nonref', 400], ['carry', 800], ['ref', 300]]), [-300, 200]),
  ('control: refund', (500, [['ref', 700]]), [-200, 0]), ('control: no tax carry', (0, [['carry', 50]]), [0, 50]),
  ('control: nonref exceeds tax', (300, [['nonref', 500], ['ref', 100]]), [-100, 0])],
 [('regression unknown-credit-kind 1', (0, [['carry', 1689], ['ref', 50], ['nonref', 50], ['other', 300]]), 'ERR:kind'),
  ('regression unknown-credit-kind 2', (1935, [['nonref', 100], ['ref', 0], ['ref', 0], ['other', 300]]), 'ERR:kind'),
  ('control: unknown kind', (100, [['bonus', 5]]), 'ERR:kind'),
  ('control: nonref exceeds tax', (300, [['nonref', 500], ['ref', 100]]), [-100, 0]),
  ('control: split carries', (900, [['carry', 400], ['nonref', 600], ['carry', 100]]), [0, 200]),
  ('control: empty', (1234, []), [1234, 0])],
 [('regression unknown-credit-kind 1', (0, [['other', 0], ['carry', 300], ['nonref', 50], ['ref', 1736]]), 'ERR:kind'),
  ('regression unknown-credit-kind 2', (100, [['other', 50], ['ref', 50], ['ref', 182], ['carry', 300]]), 'ERR:kind'),
  ('control: empty', (1234, []), [1234, 0]),
  ('control: all kinds', (1000, [['nonref', 400], ['carry', 800], ['ref', 300]]), [-300, 200]),
  ('control: refund', (500, [['ref', 700]]), [-200, 0]), ('control: no tax carry', (0, [['carry', 50]]), [0, 50])],
 [('regression unknown-credit-kind 1', (0, [['nonref', 300], ['nonref', 100], ['other', 300]]), 'ERR:kind'),
  ('regression unknown-credit-kind 2', (100, [['ref', 1350], ['other', 1002]]), 'ERR:kind'),
  ('control: no tax carry', (0, [['carry', 50]]), [0, 50]),
  ('control: unknown kind', (100, [['bonus', 5]]), 'ERR:kind'),
  ('control: nonref exceeds tax', (300, [['nonref', 500], ['ref', 100]]), [-100, 0]),
  ('control: split carries', (900, [['carry', 400], ['nonref', 600], ['carry', 100]]), [0, 200])],
 [('regression unknown-credit-kind 1', (832, [['nonref', 100], ['other', 50]]), 'ERR:kind'),
  ('regression unknown-credit-kind 2', (100, [['other', 50]]), 'ERR:kind'),
  ('control: split carries', (900, [['carry', 400], ['nonref', 600], ['carry', 100]]), [0, 200]),
  ('control: empty', (1234, []), [1234, 0]),
  ('control: all kinds', (1000, [['nonref', 400], ['carry', 800], ['ref', 300]]), [-300, 200]),
  ('control: refund', (500, [['ref', 700]]), [-200, 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 unknown-credit-kind 1[100, 0]ERR:kindFailed
regression unknown-credit-kind 2[1000, 0]ERR:kindFailed
control: all kinds[-300, 200][-300, 200]Passed
control: refund[-200, 0][-200, 0]Passed
control: no tax carry[0, 50][0, 50]Passed
control: nonref exceeds tax[-100, 0][-100, 0]Passed

SHA-256 / 5b00ad306e7ac041fa7b0bf241ad5deaf371a96ef192a0fec4f65930704aedb4

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(tax, credits):
    tot = {'nonref': 0, 'carry': 0, 'ref': 0}
    for kind, amount in credits:
        tot[kind if kind in tot else 'nonref'] += amount
    n, c, r = tot['nonref'], tot['carry'], tot['ref']
    t = tax
    use_n = min(n, t)
    t -= use_n
    use_c = min(c, t)
    t -= use_c
    cf = c - use_c
    t -= r
    return [t, cf]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression unknown-credit-kind 1', (100, [['bonus', 5]]), 'ERR:kind'),
  ('regression unknown-credit-kind 2', (1000, [['other', 100]]), 'ERR:kind'),
  ('control: all kinds', (1000, [['nonref', 400], ['carry', 800], ['ref', 300]]), [-300, 200]),
  ('control: refund', (500, [['ref', 700]]), [-200, 0]), ('control: no tax carry', (0, [['carry', 50]]), [0, 50]),
  ('control: nonref exceeds tax', (300, [['nonref', 500], ['ref', 100]]), [-100, 0])],
 [('regression unknown-credit-kind 1', (0, [['carry', 1689], ['ref', 50], ['nonref', 50], ['other', 300]]), 'ERR:kind'),
  ('regression unknown-credit-kind 2', (1935, [['nonref', 100], ['ref', 0], ['ref', 0], ['other', 300]]), 'ERR:kind'),
  ('control: unknown kind', (100, [['bonus', 5]]), 'ERR:kind'),
  ('control: nonref exceeds tax', (300, [['nonref', 500], ['ref', 100]]), [-100, 0]),
  ('control: split carries', (900, [['carry', 400], ['nonref', 600], ['carry', 100]]), [0, 200]),
  ('control: empty', (1234, []), [1234, 0])],
 [('regression unknown-credit-kind 1', (0, [['other', 0], ['carry', 300], ['nonref', 50], ['ref', 1736]]), 'ERR:kind'),
  ('regression unknown-credit-kind 2', (100, [['other', 50], ['ref', 50], ['ref', 182], ['carry', 300]]), 'ERR:kind'),
  ('control: empty', (1234, []), [1234, 0]),
  ('control: all kinds', (1000, [['nonref', 400], ['carry', 800], ['ref', 300]]), [-300, 200]),
  ('control: refund', (500, [['ref', 700]]), [-200, 0]), ('control: no tax carry', (0, [['carry', 50]]), [0, 50])],
 [('regression unknown-credit-kind 1', (0, [['nonref', 300], ['nonref', 100], ['other', 300]]), 'ERR:kind'),
  ('regression unknown-credit-kind 2', (100, [['ref', 1350], ['other', 1002]]), 'ERR:kind'),
  ('control: no tax carry', (0, [['carry', 50]]), [0, 50]),
  ('control: unknown kind', (100, [['bonus', 5]]), 'ERR:kind'),
  ('control: nonref exceeds tax', (300, [['nonref', 500], ['ref', 100]]), [-100, 0]),
  ('control: split carries', (900, [['carry', 400], ['nonref', 600], ['carry', 100]]), [0, 200])],
 [('regression unknown-credit-kind 1', (832, [['nonref', 100], ['other', 50]]), 'ERR:kind'),
  ('regression unknown-credit-kind 2', (100, [['other', 50]]), 'ERR:kind'),
  ('control: split carries', (900, [['carry', 400], ['nonref', 600], ['carry', 100]]), [0, 200]),
  ('control: empty', (1234, []), [1234, 0]),
  ('control: all kinds', (1000, [['nonref', 400], ['carry', 800], ['ref', 300]]), [-300, 200]),
  ('control: refund', (500, [['ref', 700]]), [-200, 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 unknown-credit-kind 1[95, 0]ERR:kindFailed
regression unknown-credit-kind 2[900, 0]ERR:kindFailed
control: all kinds[-300, 200][-300, 200]Passed
control: refund[-200, 0][-200, 0]Passed
control: no tax carry[0, 50][0, 50]Passed
control: nonref exceeds tax[-100, 0][-100, 0]Passed

SHA-256 / 56a7249361d831713dda6d54a268005848ff99aafb4ebf371c74188b2d709a23

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 6 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:05.143388+00:00.

Case digest / b17b7516e6be99f65e77224cfb7ea0fead05114ec1b497725de6b49e9e611768