FAILURE MAP
← Case archive

FA-68821 / Toll and parking fee computation / Open access

Parking tax and fee composition: tax is computed on the undiscounted price · case 01

Parking tax and fee composition returns a wrong result when tax is computed on the undiscounted price.

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

ROOT CAUSE

Residents are taxed on the price before their discount.

THE FAILURE

Residents are taxed on the price before their discount.

Unsuccessful approach: Including the untaxed surcharge in the tax base overtaxes every transaction.

Case contract

Input {base, resident, resident_pct, tax_bp (basis points), surcharge, app, app_fee}. Residents get resident_pct off (discount floored). Parking tax on the discounted base is rounded half up per transaction. The surcharge is untaxed. App payments add app_fee plus its own tax rounded half up. Return {base, tax, total}.

Why this case matters

Fee engines bill customers in integer cents; a wrong boundary, rounding stage or cap scope silently over- or under-charges.

1 / The failure

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

N = 1
observations = []
def solve(x):
    base = x['base']
    if x['resident']:
        base -= base * x['resident_pct'] // 100
    tax = (x['base'] * x['tax_bp'] + 5000) // 10000
    total = base + tax + x['surcharge']
    if x['app']:
        total += x['app_fee'] + (x['app_fee'] * x['tax_bp'] + 5000) // 10000
    return {'base': base, 'tax': tax, 'total': total}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'base': 2637, 'resident': False, 'resident_pct': 20, 'tax_bp': 625, 'surcharge': 0, 'app': True, 'app_fee': 45}, {'base': 2637, 'tax': 165, 'total': 2850}), ({'base': 1530, 'resident': False, 'resident_pct': 20, 'tax_bp': 2250, 'surcharge': 0, 'app': False, 'app_fee': 35}, {'base': 1530, 'tax': 344, 'total': 1874}), ({'base': 3784, 'resident': False, 'resident_pct': 25, 'tax_bp': 2250, 'surcharge': 0, 'app': False, 'app_fee': 25}, {'base': 3784, 'tax': 851, 'total': 4635}), ({'base': 1000, 'resident': True, 'resident_pct': 25, 'tax_bp': 1850, 'surcharge': 150, 'app': True, 'app_fee': 35}, {'base': 750, 'tax': 139, 'total': 1080}), ({'base': 2503, 'resident': True, 'resident_pct': 50, 'tax_bp': 1850, 'surcharge': 50, 'app': True, 'app_fee': 35}, {'base': 1252, 'tax': 232, 'total': 1575}), ({'base': 2025, 'resident': False, 'resident_pct': 25, 'tax_bp': 2250, 'surcharge': 0, 'app': True, 'app_fee': 25}, {'base': 2025, 'tax': 456, 'total': 2512}), ({'base': 2199, 'resident': True, 'resident_pct': 50, 'tax_bp': 1000, 'surcharge': 50, 'app': False, 'app_fee': 45}, {'base': 1100, 'tax': 110, 'total': 1260}), ({'base': 3824, 'resident': False, 'resident_pct': 50, 'tax_bp': 1850, 'surcharge': 50, 'app': True, 'app_fee': 45}, {'base': 3824, 'tax': 707, 'total': 4634})], [({'base': 1899, 'resident': False, 'resident_pct': 20, 'tax_bp': 2250, 'surcharge': 0, 'app': True, 'app_fee': 35}, {'base': 1899, 'tax': 427, 'total': 2369}), ({'base': 1080, 'resident': True, 'resident_pct': 25, 'tax_bp': 1850, 'surcharge': 150, 'app': False, 'app_fee': 35}, {'base': 810, 'tax': 150, 'total': 1110}), ({'base': 586, 'resident': False, 'resident_pct': 20, 'tax_bp': 2250, 'surcharge': 0, 'app': False, 'app_fee': 25}, {'base': 586, 'tax': 132, 'total': 718}), ({'base': 1000, 'resident': True, 'resident_pct': 25, 'tax_bp': 1850, 'surcharge': 150, 'app': True, 'app_fee': 35}, {'base': 750, 'tax': 139, 'total': 1080}), ({'base': 2094, 'resident': False, 'resident_pct': 25, 'tax_bp': 2250, 'surcharge': 150, 'app': True, 'app_fee': 45}, {'base': 2094, 'tax': 471, 'total': 2770}), ({'base': 2383, 'resident': True, 'resident_pct': 50, 'tax_bp': 1000, 'surcharge': 50, 'app': True, 'app_fee': 25}, {'base': 1192, 'tax': 119, 'total': 1389}), ({'base': 554, 'resident': False, 'resident_pct': 50, 'tax_bp': 1850, 'surcharge': 0, 'app': True, 'app_fee': 25}, {'base': 554, 'tax': 102, 'total': 686}), ({'base': 4806, 'resident': False, 'resident_pct': 20, 'tax_bp': 1000, 'surcharge': 0, 'app': True, 'app_fee': 25}, {'base': 4806, 'tax': 481, 'total': 5315})], [({'base': 2199, 'resident': False, 'resident_pct': 25, 'tax_bp': 1000, 'surcharge': 0, 'app': True, 'app_fee': 35}, {'base': 2199, 'tax': 220, 'total': 2458}), ({'base': 4132, 'resident': True, 'resident_pct': 50, 'tax_bp': 2250, 'surcharge': 150, 'app': False, 'app_fee': 35}, {'base': 2066, 'tax': 465, 'total': 2681}), ({'base': 2238, 'resident': False, 'resident_pct': 20, 'tax_bp': 1850, 'surcharge': 0, 'app': True, 'app_fee': 25}, {'base': 2238, 'tax': 414, 'total': 2682}), ({'base': 4457, 'resident': True, 'resident_pct': 25, 'tax_bp': 2250, 'surcharge': 50, 'app': True, 'app_fee': 35}, {'base': 3343, 'tax': 752, 'total': 4188}), ({'base': 4324, 'resident': False, 'resident_pct': 25, 'tax_bp': 1000, 'surcharge': 0, 'app': True, 'app_fee': 25}, {'base': 4324, 'tax': 432, 'total': 4784}), ({'base': 2603, 'resident': False, 'resident_pct': 20, 'tax_bp': 2250, 'surcharge': 0, 'app': False, 'app_fee': 35}, {'base': 2603, 'tax': 586, 'total': 3189}), ({'base': 985, 'resident': True, 'resident_pct': 25, 'tax_bp': 2250, 'surcharge': 150, 'app': True, 'app_fee': 25}, {'base': 739, 'tax': 166, 'total': 1086}), ({'base': 1000, 'resident': True, 'resident_pct': 25, 'tax_bp': 1850, 'surcharge': 150, 'app': True, 'app_fee': 35}, {'base': 750, 'tax': 139, 'total': 1080})], [({'base': 2930, 'resident': False, 'resident_pct': 50, 'tax_bp': 2250, 'surcharge': 150, 'app': True, 'app_fee': 25}, {'base': 2930, 'tax': 659, 'total': 3770}), ({'base': 1844, 'resident': False, 'resident_pct': 20, 'tax_bp': 1850, 'surcharge': 0, 'app': False, 'app_fee': 25}, {'base': 1844, 'tax': 341, 'total': 2185}), ({'base': 1000, 'resident': True, 'resident_pct': 25, 'tax_bp': 1850, 'surcharge': 150, 'app': True, 'app_fee': 35}, {'base': 750, 'tax': 139, 'total': 1080}), ({'base': 4678, 'resident': True, 'resident_pct': 25, 'tax_bp': 625, 'surcharge': 150, 'app': True, 'app_fee': 35}, {'base': 3509, 'tax': 219, 'total': 3915}), ({'base': 4200, 'resident': False, 'resident_pct': 20, 'tax_bp': 625, 'surcharge': 0, 'app': True, 'app_fee': 25}, {'base': 4200, 'tax': 263, 'total': 4490}), ({'base': 4301, 'resident': True, 'resident_pct': 25, 'tax_bp': 625, 'surcharge': 0, 'app': False, 'app_fee': 45}, {'base': 3226, 'tax': 202, 'total': 3428}), ({'base': 3641, 'resident': False, 'resident_pct': 20, 'tax_bp': 1850, 'surcharge': 0, 'app': True, 'app_fee': 35}, {'base': 3641, 'tax': 674, 'total': 4356}), ({'base': 1783, 'resident': False, 'resident_pct': 50, 'tax_bp': 1000, 'surcharge': 0, 'app': False, 'app_fee': 45}, {'base': 1783, 'tax': 178, 'total': 1961})], [({'base': 4884, 'resident': False, 'resident_pct': 20, 'tax_bp': 1000, 'surcharge': 150, 'app': True, 'app_fee': 35}, {'base': 4884, 'tax': 488, 'total': 5561}), ({'base': 1000, 'resident': True, 'resident_pct': 25, 'tax_bp': 1850, 'surcharge': 150, 'app': True, 'app_fee': 35}, {'base': 750, 'tax': 139, 'total': 1080}), ({'base': 2807, 'resident': True, 'resident_pct': 25, 'tax_bp': 1000, 'surcharge': 0, 'app': False, 'app_fee': 25}, {'base': 2106, 'tax': 211, 'total': 2317}), ({'base': 1234, 'resident': False, 'resident_pct': 20, 'tax_bp': 2250, 'surcharge': 0, 'app': False, 'app_fee': 35}, {'base': 1234, 'tax': 278, 'total': 1512}), ({'base': 398, 'resident': False, 'resident_pct': 20, 'tax_bp': 2250, 'surcharge': 0, 'app': False, 'app_fee': 45}, {'base': 398, 'tax': 90, 'total': 488}), ({'base': 1292, 'resident': True, 'resident_pct': 25, 'tax_bp': 2250, 'surcharge': 0, 'app': False, 'app_fee': 25}, {'base': 969, 'tax': 218, 'total': 1187}), ({'base': 3586, 'resident': False, 'resident_pct': 50, 'tax_bp': 1850, 'surcharge': 0, 'app': True, 'app_fee': 45}, {'base': 3586, 'tax': 663, 'total': 4302}), ({'base': 4846, 'resident': False, 'resident_pct': 50, 'tax_bp': 1000, 'surcharge': 0, 'app': False, 'app_fee': 25}, {'base': 4846, 'tax': 485, 'total': 5331})]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check('fee oracle' + ' %d' % i, 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
fee oracle 0{'base': 2637, 'tax': 165, 'total': 2850}{'base': 2637, 'tax': 165, 'total': 2850}Passed
fee oracle 1{'base': 1530, 'tax': 344, 'total': 1874}{'base': 1530, 'tax': 344, 'total': 1874}Passed
fee oracle 2{'base': 3784, 'tax': 851, 'total': 4635}{'base': 3784, 'tax': 851, 'total': 4635}Passed
fee oracle 3{'base': 750, 'tax': 185, 'total': 1126}{'base': 750, 'tax': 139, 'total': 1080}Failed
fee oracle 4{'base': 1252, 'tax': 463, 'total': 1806}{'base': 1252, 'tax': 232, 'total': 1575}Failed
fee oracle 5{'base': 2025, 'tax': 456, 'total': 2512}{'base': 2025, 'tax': 456, 'total': 2512}Passed
fee oracle 6{'base': 1100, 'tax': 220, 'total': 1370}{'base': 1100, 'tax': 110, 'total': 1260}Failed
fee oracle 7{'base': 3824, 'tax': 707, 'total': 4634}{'base': 3824, 'tax': 707, 'total': 4634}Passed

SHA-256 / eed9222880900c09248927b3eea9a1f97dea76124f234bc88c1dd4595981a428

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    base = x['base']
    if x['resident']:
        base -= base * x['resident_pct'] // 100
    tax = ((base + x['surcharge']) * x['tax_bp'] + 5000) // 10000
    total = base + tax + x['surcharge']
    if x['app']:
        total += x['app_fee'] + (x['app_fee'] * x['tax_bp'] + 5000) // 10000
    return {'base': base, 'tax': tax, 'total': total}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'base': 2637, 'resident': False, 'resident_pct': 20, 'tax_bp': 625, 'surcharge': 0, 'app': True, 'app_fee': 45}, {'base': 2637, 'tax': 165, 'total': 2850}), ({'base': 1530, 'resident': False, 'resident_pct': 20, 'tax_bp': 2250, 'surcharge': 0, 'app': False, 'app_fee': 35}, {'base': 1530, 'tax': 344, 'total': 1874}), ({'base': 3784, 'resident': False, 'resident_pct': 25, 'tax_bp': 2250, 'surcharge': 0, 'app': False, 'app_fee': 25}, {'base': 3784, 'tax': 851, 'total': 4635}), ({'base': 1000, 'resident': True, 'resident_pct': 25, 'tax_bp': 1850, 'surcharge': 150, 'app': True, 'app_fee': 35}, {'base': 750, 'tax': 139, 'total': 1080}), ({'base': 2503, 'resident': True, 'resident_pct': 50, 'tax_bp': 1850, 'surcharge': 50, 'app': True, 'app_fee': 35}, {'base': 1252, 'tax': 232, 'total': 1575}), ({'base': 2025, 'resident': False, 'resident_pct': 25, 'tax_bp': 2250, 'surcharge': 0, 'app': True, 'app_fee': 25}, {'base': 2025, 'tax': 456, 'total': 2512}), ({'base': 2199, 'resident': True, 'resident_pct': 50, 'tax_bp': 1000, 'surcharge': 50, 'app': False, 'app_fee': 45}, {'base': 1100, 'tax': 110, 'total': 1260}), ({'base': 3824, 'resident': False, 'resident_pct': 50, 'tax_bp': 1850, 'surcharge': 50, 'app': True, 'app_fee': 45}, {'base': 3824, 'tax': 707, 'total': 4634})], [({'base': 1899, 'resident': False, 'resident_pct': 20, 'tax_bp': 2250, 'surcharge': 0, 'app': True, 'app_fee': 35}, {'base': 1899, 'tax': 427, 'total': 2369}), ({'base': 1080, 'resident': True, 'resident_pct': 25, 'tax_bp': 1850, 'surcharge': 150, 'app': False, 'app_fee': 35}, {'base': 810, 'tax': 150, 'total': 1110}), ({'base': 586, 'resident': False, 'resident_pct': 20, 'tax_bp': 2250, 'surcharge': 0, 'app': False, 'app_fee': 25}, {'base': 586, 'tax': 132, 'total': 718}), ({'base': 1000, 'resident': True, 'resident_pct': 25, 'tax_bp': 1850, 'surcharge': 150, 'app': True, 'app_fee': 35}, {'base': 750, 'tax': 139, 'total': 1080}), ({'base': 2094, 'resident': False, 'resident_pct': 25, 'tax_bp': 2250, 'surcharge': 150, 'app': True, 'app_fee': 45}, {'base': 2094, 'tax': 471, 'total': 2770}), ({'base': 2383, 'resident': True, 'resident_pct': 50, 'tax_bp': 1000, 'surcharge': 50, 'app': True, 'app_fee': 25}, {'base': 1192, 'tax': 119, 'total': 1389}), ({'base': 554, 'resident': False, 'resident_pct': 50, 'tax_bp': 1850, 'surcharge': 0, 'app': True, 'app_fee': 25}, {'base': 554, 'tax': 102, 'total': 686}), ({'base': 4806, 'resident': False, 'resident_pct': 20, 'tax_bp': 1000, 'surcharge': 0, 'app': True, 'app_fee': 25}, {'base': 4806, 'tax': 481, 'total': 5315})], [({'base': 2199, 'resident': False, 'resident_pct': 25, 'tax_bp': 1000, 'surcharge': 0, 'app': True, 'app_fee': 35}, {'base': 2199, 'tax': 220, 'total': 2458}), ({'base': 4132, 'resident': True, 'resident_pct': 50, 'tax_bp': 2250, 'surcharge': 150, 'app': False, 'app_fee': 35}, {'base': 2066, 'tax': 465, 'total': 2681}), ({'base': 2238, 'resident': False, 'resident_pct': 20, 'tax_bp': 1850, 'surcharge': 0, 'app': True, 'app_fee': 25}, {'base': 2238, 'tax': 414, 'total': 2682}), ({'base': 4457, 'resident': True, 'resident_pct': 25, 'tax_bp': 2250, 'surcharge': 50, 'app': True, 'app_fee': 35}, {'base': 3343, 'tax': 752, 'total': 4188}), ({'base': 4324, 'resident': False, 'resident_pct': 25, 'tax_bp': 1000, 'surcharge': 0, 'app': True, 'app_fee': 25}, {'base': 4324, 'tax': 432, 'total': 4784}), ({'base': 2603, 'resident': False, 'resident_pct': 20, 'tax_bp': 2250, 'surcharge': 0, 'app': False, 'app_fee': 35}, {'base': 2603, 'tax': 586, 'total': 3189}), ({'base': 985, 'resident': True, 'resident_pct': 25, 'tax_bp': 2250, 'surcharge': 150, 'app': True, 'app_fee': 25}, {'base': 739, 'tax': 166, 'total': 1086}), ({'base': 1000, 'resident': True, 'resident_pct': 25, 'tax_bp': 1850, 'surcharge': 150, 'app': True, 'app_fee': 35}, {'base': 750, 'tax': 139, 'total': 1080})], [({'base': 2930, 'resident': False, 'resident_pct': 50, 'tax_bp': 2250, 'surcharge': 150, 'app': True, 'app_fee': 25}, {'base': 2930, 'tax': 659, 'total': 3770}), ({'base': 1844, 'resident': False, 'resident_pct': 20, 'tax_bp': 1850, 'surcharge': 0, 'app': False, 'app_fee': 25}, {'base': 1844, 'tax': 341, 'total': 2185}), ({'base': 1000, 'resident': True, 'resident_pct': 25, 'tax_bp': 1850, 'surcharge': 150, 'app': True, 'app_fee': 35}, {'base': 750, 'tax': 139, 'total': 1080}), ({'base': 4678, 'resident': True, 'resident_pct': 25, 'tax_bp': 625, 'surcharge': 150, 'app': True, 'app_fee': 35}, {'base': 3509, 'tax': 219, 'total': 3915}), ({'base': 4200, 'resident': False, 'resident_pct': 20, 'tax_bp': 625, 'surcharge': 0, 'app': True, 'app_fee': 25}, {'base': 4200, 'tax': 263, 'total': 4490}), ({'base': 4301, 'resident': True, 'resident_pct': 25, 'tax_bp': 625, 'surcharge': 0, 'app': False, 'app_fee': 45}, {'base': 3226, 'tax': 202, 'total': 3428}), ({'base': 3641, 'resident': False, 'resident_pct': 20, 'tax_bp': 1850, 'surcharge': 0, 'app': True, 'app_fee': 35}, {'base': 3641, 'tax': 674, 'total': 4356}), ({'base': 1783, 'resident': False, 'resident_pct': 50, 'tax_bp': 1000, 'surcharge': 0, 'app': False, 'app_fee': 45}, {'base': 1783, 'tax': 178, 'total': 1961})], [({'base': 4884, 'resident': False, 'resident_pct': 20, 'tax_bp': 1000, 'surcharge': 150, 'app': True, 'app_fee': 35}, {'base': 4884, 'tax': 488, 'total': 5561}), ({'base': 1000, 'resident': True, 'resident_pct': 25, 'tax_bp': 1850, 'surcharge': 150, 'app': True, 'app_fee': 35}, {'base': 750, 'tax': 139, 'total': 1080}), ({'base': 2807, 'resident': True, 'resident_pct': 25, 'tax_bp': 1000, 'surcharge': 0, 'app': False, 'app_fee': 25}, {'base': 2106, 'tax': 211, 'total': 2317}), ({'base': 1234, 'resident': False, 'resident_pct': 20, 'tax_bp': 2250, 'surcharge': 0, 'app': False, 'app_fee': 35}, {'base': 1234, 'tax': 278, 'total': 1512}), ({'base': 398, 'resident': False, 'resident_pct': 20, 'tax_bp': 2250, 'surcharge': 0, 'app': False, 'app_fee': 45}, {'base': 398, 'tax': 90, 'total': 488}), ({'base': 1292, 'resident': True, 'resident_pct': 25, 'tax_bp': 2250, 'surcharge': 0, 'app': False, 'app_fee': 25}, {'base': 969, 'tax': 218, 'total': 1187}), ({'base': 3586, 'resident': False, 'resident_pct': 50, 'tax_bp': 1850, 'surcharge': 0, 'app': True, 'app_fee': 45}, {'base': 3586, 'tax': 663, 'total': 4302}), ({'base': 4846, 'resident': False, 'resident_pct': 50, 'tax_bp': 1000, 'surcharge': 0, 'app': False, 'app_fee': 25}, {'base': 4846, 'tax': 485, 'total': 5331})]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check('fee oracle' + ' %d' % i, 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
fee oracle 0{'base': 2637, 'tax': 165, 'total': 2850}{'base': 2637, 'tax': 165, 'total': 2850}Passed
fee oracle 1{'base': 1530, 'tax': 344, 'total': 1874}{'base': 1530, 'tax': 344, 'total': 1874}Passed
fee oracle 2{'base': 3784, 'tax': 851, 'total': 4635}{'base': 3784, 'tax': 851, 'total': 4635}Passed
fee oracle 3{'base': 750, 'tax': 167, 'total': 1108}{'base': 750, 'tax': 139, 'total': 1080}Failed
fee oracle 4{'base': 1252, 'tax': 241, 'total': 1584}{'base': 1252, 'tax': 232, 'total': 1575}Failed
fee oracle 5{'base': 2025, 'tax': 456, 'total': 2512}{'base': 2025, 'tax': 456, 'total': 2512}Passed
fee oracle 6{'base': 1100, 'tax': 115, 'total': 1265}{'base': 1100, 'tax': 110, 'total': 1260}Failed
fee oracle 7{'base': 3824, 'tax': 717, 'total': 4644}{'base': 3824, 'tax': 707, 'total': 4634}Failed

SHA-256 / a5826653d576ddaf4db7980494067a8db91ec61ae341e5ffe26c334a99056fde

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 8 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 toy model with a stipulated contract; it makes no claim of conformance to any agency manual or standard. 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:48:05.799649+00:00.

Case digest / 3d3fc0d7230bc156fd4d555c750526c7abfb6140cfc2c4b412c111cc70800f4f