FA-68441 / Toll and parking fee computation / Open access
Time-band rate with calendar day cap: the daily maximum caps the whole stay once · case 01
Time-band rate with calendar day cap returns a wrong result when the daily maximum caps the whole stay once.
ROOT CAUSE
Multi-day stays are capped at a single daily maximum.
THE FAILURE
Multi-day stays are capped at a single daily maximum.
Unsuccessful approach: Removing the cap overcharges any day whose band charges exceed daily_max.
Case contract
Input {bands: [[start minute of day, cents per quarter hour]] sorted with first start 0, entry, exit (absolute minutes), daily_max}. Minutes of the stay are totalled per calendar day and band; each total is rounded up to whole quarter hours and priced at its band rate. Each calendar day's charge is capped at daily_max.
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):
bands = x['bands']
per = {}
t = x['entry']
while t < x['exit']:
day, tod = divmod(t, 1440)
i = max(k for k in range(len(bands)) if bands[k][0] <= tod)
nxt = bands[i + 1][0] if i + 1 < len(bands) else 1440
step = min(x['exit'] - t, nxt - tod)
key = (day, bands[i][1])
per[key] = per.get(key, 0) + step
t += step
days = {}
for (day, rate), m in per.items():
days[day] = days.get(day, 0) + -(-m // 15) * rate
return min(sum(days.values()), x['daily_max'])
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'bands': [[0, 25], [1290, 50]], 'entry': 895, 'exit': 2743, 'daily_max': 2500}, 3375), ({'bands': [[0, 25], [420, 100], [1080, 25]], 'entry': 350, 'exit': 1100, 'daily_max': 9000}, 4550), ({'bands': [[0, 50], [720, 100]], 'entry': 1400, 'exit': 1500, 'daily_max': 1500}, 500), ({'bands': [[0, 25], [420, 100], [1080, 50]], 'entry': 400, 'exit': 1100, 'daily_max': 4000}, 4000), ({'bands': [[0, 50], [60, 25], [900, 50], [1410, 50]], 'entry': 1980, 'exit': 2097, 'daily_max': 1500}, 200), ({'bands': [[0, 50], [390, 50], [810, 100]], 'entry': 261, 'exit': 1911, 'daily_max': 1500}, 3000), ({'bands': [[0, 25], [1410, 25]], 'entry': 43, 'exit': 1160, 'daily_max': 1500}, 1500), ({'bands': [[0, 25], [360, 100], [570, 50], [750, 25]], 'entry': 1882, 'exit': 4277, 'daily_max': 1500}, 3000)], [({'bands': [[0, 25], [1260, 100], [1410, 50]], 'entry': 202, 'exit': 2677, 'daily_max': 1500}, 3000), ({'bands': [[0, 25], [780, 50]], 'entry': 342, 'exit': 1611, 'daily_max': 1500}, 1800), ({'bands': [[0, 25], [1140, 50]], 'entry': 231, 'exit': 350, 'daily_max': 4000}, 200), ({'bands': [[0, 50], [270, 100], [570, 50], [1200, 25]], 'entry': 833, 'exit': 1582, 'daily_max': 2500}, 2150), ({'bands': [[0, 25], [750, 100]], 'entry': 788, 'exit': 1556, 'daily_max': 4000}, 4200), ({'bands': [[0, 25], [420, 100], [1080, 25]], 'entry': 350, 'exit': 1100, 'daily_max': 9000}, 4550), ({'bands': [[0, 25], [420, 100], [1080, 50]], 'entry': 400, 'exit': 1100, 'daily_max': 4000}, 4000), ({'bands': [[0, 50], [720, 100]], 'entry': 1400, 'exit': 1500, 'daily_max': 1500}, 500)], [({'bands': [[0, 25], [330, 100], [990, 100]], 'entry': 1845, 'exit': 1894, 'daily_max': 4000}, 400), ({'bands': [[0, 50], [750, 50], [1110, 25]], 'entry': 602, 'exit': 2580, 'daily_max': 1500}, 3000), ({'bands': [[0, 25], [420, 100], [1080, 50]], 'entry': 400, 'exit': 1100, 'daily_max': 4000}, 4000), ({'bands': [[0, 50], [720, 100]], 'entry': 1400, 'exit': 1500, 'daily_max': 1500}, 500), ({'bands': [[0, 50], [270, 25], [390, 50], [930, 100]], 'entry': 1006, 'exit': 2590, 'daily_max': 2500}, 5000), ({'bands': [[0, 25], [420, 100], [1080, 25]], 'entry': 350, 'exit': 1100, 'daily_max': 9000}, 4550), ({'bands': [[0, 50], [450, 50], [1050, 25]], 'entry': 1879, 'exit': 4090, 'daily_max': 2500}, 5000), ({'bands': [[0, 25], [90, 100], [1230, 100]], 'entry': 1447, 'exit': 1546, 'daily_max': 1500}, 350)], [({'bands': [[0, 25], [420, 100], [1080, 25]], 'entry': 350, 'exit': 1100, 'daily_max': 9000}, 4550), ({'bands': [[0, 50], [720, 100]], 'entry': 1400, 'exit': 1500, 'daily_max': 1500}, 500), ({'bands': [[0, 25], [150, 50], [300, 100], [1260, 100]], 'entry': 268, 'exit': 1452, 'daily_max': 4000}, 4025), ({'bands': [[0, 50], [210, 50], [840, 100], [1170, 50]], 'entry': 1552, 'exit': 4168, 'daily_max': 2500}, 5000), ({'bands': [[0, 25], [180, 25], [1260, 50]], 'entry': 1244, 'exit': 3629, 'daily_max': 4000}, 4600), ({'bands': [[0, 25], [420, 100], [1080, 50]], 'entry': 400, 'exit': 1100, 'daily_max': 4000}, 4000), ({'bands': [[0, 25], [780, 50]], 'entry': 1711, 'exit': 2270, 'daily_max': 4000}, 1050), ({'bands': [[0, 25], [420, 50]], 'entry': 1579, 'exit': 1614, 'daily_max': 1500}, 75)], [({'bands': [[0, 25], [420, 100], [1080, 50]], 'entry': 400, 'exit': 1100, 'daily_max': 4000}, 4000), ({'bands': [[0, 50], [720, 100]], 'entry': 1400, 'exit': 1500, 'daily_max': 1500}, 500), ({'bands': [[0, 25], [180, 25], [900, 50], [1230, 100]], 'entry': 310, 'exit': 2308, 'daily_max': 2500}, 3950), ({'bands': [[0, 25], [1170, 50]], 'entry': 263, 'exit': 547, 'daily_max': 1500}, 475), ({'bands': [[0, 25], [270, 25], [660, 50]], 'entry': 200, 'exit': 1095, 'daily_max': 2500}, 2225), ({'bands': [[0, 25], [1230, 100]], 'entry': 1750, 'exit': 4442, 'daily_max': 2500}, 5225), ({'bands': [[0, 25], [420, 100], [1080, 25]], 'entry': 350, 'exit': 1100, 'daily_max': 9000}, 4550), ({'bands': [[0, 25], [90, 50], [270, 50]], 'entry': 291, 'exit': 1639, 'daily_max': 1500}, 2050)]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fee oracle 0 | 2500 | 3375 | Failed |
| fee oracle 1 | 4550 | 4550 | Passed |
| fee oracle 2 | 500 | 500 | Passed |
| fee oracle 3 | 4000 | 4000 | Passed |
| fee oracle 4 | 200 | 200 | Passed |
| fee oracle 5 | 1500 | 3000 | Failed |
| fee oracle 6 | 1500 | 1500 | Passed |
| fee oracle 7 | 1500 | 3000 | Failed |
SHA-256 / 1c574f8715f8ef95fb6e2f218b6aa15d5e74d786c971d076c7d321c6f4905e72
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
bands = x['bands']
per = {}
t = x['entry']
while t < x['exit']:
day, tod = divmod(t, 1440)
i = max(k for k in range(len(bands)) if bands[k][0] <= tod)
nxt = bands[i + 1][0] if i + 1 < len(bands) else 1440
step = min(x['exit'] - t, nxt - tod)
key = (day, bands[i][1])
per[key] = per.get(key, 0) + step
t += step
days = {}
for (day, rate), m in per.items():
days[day] = days.get(day, 0) + -(-m // 15) * rate
return sum(days.values())
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'bands': [[0, 25], [1290, 50]], 'entry': 895, 'exit': 2743, 'daily_max': 2500}, 3375), ({'bands': [[0, 25], [420, 100], [1080, 25]], 'entry': 350, 'exit': 1100, 'daily_max': 9000}, 4550), ({'bands': [[0, 50], [720, 100]], 'entry': 1400, 'exit': 1500, 'daily_max': 1500}, 500), ({'bands': [[0, 25], [420, 100], [1080, 50]], 'entry': 400, 'exit': 1100, 'daily_max': 4000}, 4000), ({'bands': [[0, 50], [60, 25], [900, 50], [1410, 50]], 'entry': 1980, 'exit': 2097, 'daily_max': 1500}, 200), ({'bands': [[0, 50], [390, 50], [810, 100]], 'entry': 261, 'exit': 1911, 'daily_max': 1500}, 3000), ({'bands': [[0, 25], [1410, 25]], 'entry': 43, 'exit': 1160, 'daily_max': 1500}, 1500), ({'bands': [[0, 25], [360, 100], [570, 50], [750, 25]], 'entry': 1882, 'exit': 4277, 'daily_max': 1500}, 3000)], [({'bands': [[0, 25], [1260, 100], [1410, 50]], 'entry': 202, 'exit': 2677, 'daily_max': 1500}, 3000), ({'bands': [[0, 25], [780, 50]], 'entry': 342, 'exit': 1611, 'daily_max': 1500}, 1800), ({'bands': [[0, 25], [1140, 50]], 'entry': 231, 'exit': 350, 'daily_max': 4000}, 200), ({'bands': [[0, 50], [270, 100], [570, 50], [1200, 25]], 'entry': 833, 'exit': 1582, 'daily_max': 2500}, 2150), ({'bands': [[0, 25], [750, 100]], 'entry': 788, 'exit': 1556, 'daily_max': 4000}, 4200), ({'bands': [[0, 25], [420, 100], [1080, 25]], 'entry': 350, 'exit': 1100, 'daily_max': 9000}, 4550), ({'bands': [[0, 25], [420, 100], [1080, 50]], 'entry': 400, 'exit': 1100, 'daily_max': 4000}, 4000), ({'bands': [[0, 50], [720, 100]], 'entry': 1400, 'exit': 1500, 'daily_max': 1500}, 500)], [({'bands': [[0, 25], [330, 100], [990, 100]], 'entry': 1845, 'exit': 1894, 'daily_max': 4000}, 400), ({'bands': [[0, 50], [750, 50], [1110, 25]], 'entry': 602, 'exit': 2580, 'daily_max': 1500}, 3000), ({'bands': [[0, 25], [420, 100], [1080, 50]], 'entry': 400, 'exit': 1100, 'daily_max': 4000}, 4000), ({'bands': [[0, 50], [720, 100]], 'entry': 1400, 'exit': 1500, 'daily_max': 1500}, 500), ({'bands': [[0, 50], [270, 25], [390, 50], [930, 100]], 'entry': 1006, 'exit': 2590, 'daily_max': 2500}, 5000), ({'bands': [[0, 25], [420, 100], [1080, 25]], 'entry': 350, 'exit': 1100, 'daily_max': 9000}, 4550), ({'bands': [[0, 50], [450, 50], [1050, 25]], 'entry': 1879, 'exit': 4090, 'daily_max': 2500}, 5000), ({'bands': [[0, 25], [90, 100], [1230, 100]], 'entry': 1447, 'exit': 1546, 'daily_max': 1500}, 350)], [({'bands': [[0, 25], [420, 100], [1080, 25]], 'entry': 350, 'exit': 1100, 'daily_max': 9000}, 4550), ({'bands': [[0, 50], [720, 100]], 'entry': 1400, 'exit': 1500, 'daily_max': 1500}, 500), ({'bands': [[0, 25], [150, 50], [300, 100], [1260, 100]], 'entry': 268, 'exit': 1452, 'daily_max': 4000}, 4025), ({'bands': [[0, 50], [210, 50], [840, 100], [1170, 50]], 'entry': 1552, 'exit': 4168, 'daily_max': 2500}, 5000), ({'bands': [[0, 25], [180, 25], [1260, 50]], 'entry': 1244, 'exit': 3629, 'daily_max': 4000}, 4600), ({'bands': [[0, 25], [420, 100], [1080, 50]], 'entry': 400, 'exit': 1100, 'daily_max': 4000}, 4000), ({'bands': [[0, 25], [780, 50]], 'entry': 1711, 'exit': 2270, 'daily_max': 4000}, 1050), ({'bands': [[0, 25], [420, 50]], 'entry': 1579, 'exit': 1614, 'daily_max': 1500}, 75)], [({'bands': [[0, 25], [420, 100], [1080, 50]], 'entry': 400, 'exit': 1100, 'daily_max': 4000}, 4000), ({'bands': [[0, 50], [720, 100]], 'entry': 1400, 'exit': 1500, 'daily_max': 1500}, 500), ({'bands': [[0, 25], [180, 25], [900, 50], [1230, 100]], 'entry': 310, 'exit': 2308, 'daily_max': 2500}, 3950), ({'bands': [[0, 25], [1170, 50]], 'entry': 263, 'exit': 547, 'daily_max': 1500}, 475), ({'bands': [[0, 25], [270, 25], [660, 50]], 'entry': 200, 'exit': 1095, 'daily_max': 2500}, 2225), ({'bands': [[0, 25], [1230, 100]], 'entry': 1750, 'exit': 4442, 'daily_max': 2500}, 5225), ({'bands': [[0, 25], [420, 100], [1080, 25]], 'entry': 350, 'exit': 1100, 'daily_max': 9000}, 4550), ({'bands': [[0, 25], [90, 50], [270, 50]], 'entry': 291, 'exit': 1639, 'daily_max': 1500}, 2050)]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fee oracle 0 | 3375 | 3375 | Passed |
| fee oracle 1 | 4550 | 4550 | Passed |
| fee oracle 2 | 500 | 500 | Passed |
| fee oracle 3 | 4550 | 4000 | Failed |
| fee oracle 4 | 200 | 200 | Passed |
| fee oracle 5 | 7650 | 3000 | Failed |
| fee oracle 6 | 1875 | 1500 | Failed |
| fee oracle 7 | 6350 | 3000 | Failed |
SHA-256 / 40e56b14fac00158054b439515ef3a5e2fb87a4bb75527f22f19a5e36c20b6c6
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:02.216291+00:00.
Case digest / 00b925d13a4a28bcedd79bbc8712c8a865e6394ee4a590137dc714b898cf95f5