FA-68816 / Toll and parking fee computation / Open access
Unpaid toll violation escalation: the cap includes the toll itself · case 01
Unpaid toll violation escalation returns a wrong result when the cap includes the toll itself.
ROOT CAUSE
Capping toll plus penalties forgives part of the toll.
VERIFIED REPAIR
Restore the penalty cap scope rule so that the step reads `x['toll'] + min(pen, x['cap'])`.
Unsuccessful approach: Reducing the penalty cap by the toll has the same effect.
Case contract
Input {toll, issued_day, paid_day (or null), today, first_fee, second_fee, stage1_days, stage2_days, cap, waiver_first}. Age is measured to the payment day if paid, else today. Age above stage1 adds first_fee; first-time offenders (waiver_first) who actually paid within stage2 have it waived. Age above stage2 adds second_fee. Penalties (not the toll) are capped at cap. Return amount due.
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):
ev = x['paid_day'] if x['paid_day'] is not None else x['today']
age = ev - x['issued_day']
pen = 0
if age > x['stage1_days']:
pen += x['first_fee']
if x['waiver_first'] and x['paid_day'] is not None and age <= x['stage2_days']:
pen -= x['first_fee']
if age > x['stage2_days']:
pen += x['second_fee']
return min(x['toll'] + pen, x['cap'])
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'toll': 400, 'issued_day': 66, 'paid_day': 126, 'today': 155, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 1400), ({'toll': 400, 'issued_day': 55, 'paid_day': None, 'today': 116, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 5400), ({'toll': 875, 'issued_day': 43, 'paid_day': None, 'today': 148, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 5875), ({'toll': 875, 'issued_day': 0, 'paid_day': None, 'today': 100, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3875), ({'toll': 400, 'issued_day': 10, 'paid_day': 40, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 250, 'issued_day': 52, 'paid_day': 82, 'today': 82, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 7500, 'waiver_first': False}, 250), ({'toll': 875, 'issued_day': 35, 'paid_day': 66, 'today': 66, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 1375), ({'toll': 400, 'issued_day': 0, 'paid_day': None, 'today': 45, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 1400)], [({'toll': 400, 'issued_day': 38, 'paid_day': None, 'today': 69, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 7500, 'waiver_first': True}, 900), ({'toll': 250, 'issued_day': 42, 'paid_day': 103, 'today': 103, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': True}, 3250), ({'toll': 400, 'issued_day': 91, 'paid_day': 152, 'today': 152, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3400), ({'toll': 400, 'issued_day': 0, 'paid_day': None, 'today': 45, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 1400), ({'toll': 400, 'issued_day': 10, 'paid_day': 70, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 400), ({'toll': 875, 'issued_day': 0, 'paid_day': None, 'today': 100, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3875), ({'toll': 400, 'issued_day': 93, 'paid_day': 124, 'today': 124, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 7500, 'waiver_first': True}, 400), ({'toll': 875, 'issued_day': 29, 'paid_day': None, 'today': 47, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 875)], [({'toll': 250, 'issued_day': 72, 'paid_day': 143, 'today': 186, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3250), ({'toll': 400, 'issued_day': 0, 'paid_day': 0, 'today': 45, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 250, 'issued_day': 53, 'paid_day': 93, 'today': 93, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 250), ({'toll': 400, 'issued_day': 10, 'paid_day': 70, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 400), ({'toll': 250, 'issued_day': 16, 'paid_day': None, 'today': 81, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 5250), ({'toll': 400, 'issued_day': 10, 'paid_day': 40, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 400, 'issued_day': 91, 'paid_day': 152, 'today': 152, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 5400), ({'toll': 875, 'issued_day': 31, 'paid_day': None, 'today': 61, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': True}, 875)], [({'toll': 875, 'issued_day': 28, 'paid_day': 59, 'today': 59, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 7500, 'waiver_first': False}, 1375), ({'toll': 875, 'issued_day': 61, 'paid_day': 92, 'today': 121, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 1375), ({'toll': 400, 'issued_day': 10, 'paid_day': 70, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 400), ({'toll': 400, 'issued_day': 65, 'paid_day': None, 'today': 179, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3400), ({'toll': 400, 'issued_day': 10, 'paid_day': 40, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 400, 'issued_day': 30, 'paid_day': 77, 'today': 90, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 7500, 'waiver_first': False}, 1400), ({'toll': 875, 'issued_day': 14, 'paid_day': None, 'today': 75, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 5875), ({'toll': 875, 'issued_day': 0, 'paid_day': None, 'today': 100, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3875)], [({'toll': 250, 'issued_day': 45, 'paid_day': 75, 'today': 76, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 250), ({'toll': 400, 'issued_day': 0, 'paid_day': 0, 'today': 45, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 400, 'issued_day': 33, 'paid_day': None, 'today': 94, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': True}, 3400), ({'toll': 875, 'issued_day': 96, 'paid_day': None, 'today': 165, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': True}, 3875), ({'toll': 400, 'issued_day': 10, 'paid_day': 40, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 250, 'issued_day': 10, 'paid_day': 40, 'today': 125, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 250), ({'toll': 400, 'issued_day': 82, 'paid_day': None, 'today': 143, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3400), ({'toll': 400, 'issued_day': 0, 'paid_day': None, 'today': 45, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 1400)]]
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 | 1400 | 1400 | Passed |
| fee oracle 1 | 5000 | 5400 | Failed |
| fee oracle 2 | 5000 | 5875 | Failed |
| fee oracle 3 | 3000 | 3875 | Failed |
| fee oracle 4 | 400 | 400 | Passed |
| fee oracle 5 | 250 | 250 | Passed |
| fee oracle 6 | 1375 | 1375 | Passed |
| fee oracle 7 | 1400 | 1400 | Passed |
SHA-256 / 23bbb99bba3237a9fa06bb8e6c3e102e8b2ae67819cad60651a3a3cc7b38cdd7
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
ev = x['paid_day'] if x['paid_day'] is not None else x['today']
age = ev - x['issued_day']
pen = 0
if age > x['stage1_days']:
pen += x['first_fee']
if x['waiver_first'] and x['paid_day'] is not None and age <= x['stage2_days']:
pen -= x['first_fee']
if age > x['stage2_days']:
pen += x['second_fee']
return x['toll'] + min(pen, x['cap'] - x['toll'])
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'toll': 400, 'issued_day': 66, 'paid_day': 126, 'today': 155, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 1400), ({'toll': 400, 'issued_day': 55, 'paid_day': None, 'today': 116, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 5400), ({'toll': 875, 'issued_day': 43, 'paid_day': None, 'today': 148, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 5875), ({'toll': 875, 'issued_day': 0, 'paid_day': None, 'today': 100, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3875), ({'toll': 400, 'issued_day': 10, 'paid_day': 40, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 250, 'issued_day': 52, 'paid_day': 82, 'today': 82, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 7500, 'waiver_first': False}, 250), ({'toll': 875, 'issued_day': 35, 'paid_day': 66, 'today': 66, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 1375), ({'toll': 400, 'issued_day': 0, 'paid_day': None, 'today': 45, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 1400)], [({'toll': 400, 'issued_day': 38, 'paid_day': None, 'today': 69, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 7500, 'waiver_first': True}, 900), ({'toll': 250, 'issued_day': 42, 'paid_day': 103, 'today': 103, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': True}, 3250), ({'toll': 400, 'issued_day': 91, 'paid_day': 152, 'today': 152, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3400), ({'toll': 400, 'issued_day': 0, 'paid_day': None, 'today': 45, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 1400), ({'toll': 400, 'issued_day': 10, 'paid_day': 70, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 400), ({'toll': 875, 'issued_day': 0, 'paid_day': None, 'today': 100, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3875), ({'toll': 400, 'issued_day': 93, 'paid_day': 124, 'today': 124, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 7500, 'waiver_first': True}, 400), ({'toll': 875, 'issued_day': 29, 'paid_day': None, 'today': 47, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 875)], [({'toll': 250, 'issued_day': 72, 'paid_day': 143, 'today': 186, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3250), ({'toll': 400, 'issued_day': 0, 'paid_day': 0, 'today': 45, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 250, 'issued_day': 53, 'paid_day': 93, 'today': 93, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 250), ({'toll': 400, 'issued_day': 10, 'paid_day': 70, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 400), ({'toll': 250, 'issued_day': 16, 'paid_day': None, 'today': 81, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 5250), ({'toll': 400, 'issued_day': 10, 'paid_day': 40, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 400, 'issued_day': 91, 'paid_day': 152, 'today': 152, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 5400), ({'toll': 875, 'issued_day': 31, 'paid_day': None, 'today': 61, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': True}, 875)], [({'toll': 875, 'issued_day': 28, 'paid_day': 59, 'today': 59, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 7500, 'waiver_first': False}, 1375), ({'toll': 875, 'issued_day': 61, 'paid_day': 92, 'today': 121, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 1375), ({'toll': 400, 'issued_day': 10, 'paid_day': 70, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 400), ({'toll': 400, 'issued_day': 65, 'paid_day': None, 'today': 179, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3400), ({'toll': 400, 'issued_day': 10, 'paid_day': 40, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 400, 'issued_day': 30, 'paid_day': 77, 'today': 90, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 7500, 'waiver_first': False}, 1400), ({'toll': 875, 'issued_day': 14, 'paid_day': None, 'today': 75, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 5875), ({'toll': 875, 'issued_day': 0, 'paid_day': None, 'today': 100, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3875)], [({'toll': 250, 'issued_day': 45, 'paid_day': 75, 'today': 76, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 250), ({'toll': 400, 'issued_day': 0, 'paid_day': 0, 'today': 45, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 400, 'issued_day': 33, 'paid_day': None, 'today': 94, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': True}, 3400), ({'toll': 875, 'issued_day': 96, 'paid_day': None, 'today': 165, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': True}, 3875), ({'toll': 400, 'issued_day': 10, 'paid_day': 40, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 250, 'issued_day': 10, 'paid_day': 40, 'today': 125, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 250), ({'toll': 400, 'issued_day': 82, 'paid_day': None, 'today': 143, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3400), ({'toll': 400, 'issued_day': 0, 'paid_day': None, 'today': 45, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 1400)]]
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 | 1400 | 1400 | Passed |
| fee oracle 1 | 5000 | 5400 | Failed |
| fee oracle 2 | 5000 | 5875 | Failed |
| fee oracle 3 | 3000 | 3875 | Failed |
| fee oracle 4 | 400 | 400 | Passed |
| fee oracle 5 | 250 | 250 | Passed |
| fee oracle 6 | 1375 | 1375 | Passed |
| fee oracle 7 | 1400 | 1400 | Passed |
SHA-256 / be87229ade7b00ef5682f15f259b2d36c97e3079c350b0467daa74df48292714
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
ev = x['paid_day'] if x['paid_day'] is not None else x['today']
age = ev - x['issued_day']
pen = 0
if age > x['stage1_days']:
pen += x['first_fee']
if x['waiver_first'] and x['paid_day'] is not None and age <= x['stage2_days']:
pen -= x['first_fee']
if age > x['stage2_days']:
pen += x['second_fee']
return x['toll'] + min(pen, x['cap'])
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'toll': 400, 'issued_day': 66, 'paid_day': 126, 'today': 155, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 1400), ({'toll': 400, 'issued_day': 55, 'paid_day': None, 'today': 116, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 5400), ({'toll': 875, 'issued_day': 43, 'paid_day': None, 'today': 148, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 5875), ({'toll': 875, 'issued_day': 0, 'paid_day': None, 'today': 100, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3875), ({'toll': 400, 'issued_day': 10, 'paid_day': 40, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 250, 'issued_day': 52, 'paid_day': 82, 'today': 82, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 7500, 'waiver_first': False}, 250), ({'toll': 875, 'issued_day': 35, 'paid_day': 66, 'today': 66, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 1375), ({'toll': 400, 'issued_day': 0, 'paid_day': None, 'today': 45, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 1400)], [({'toll': 400, 'issued_day': 38, 'paid_day': None, 'today': 69, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 7500, 'waiver_first': True}, 900), ({'toll': 250, 'issued_day': 42, 'paid_day': 103, 'today': 103, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': True}, 3250), ({'toll': 400, 'issued_day': 91, 'paid_day': 152, 'today': 152, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3400), ({'toll': 400, 'issued_day': 0, 'paid_day': None, 'today': 45, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 1400), ({'toll': 400, 'issued_day': 10, 'paid_day': 70, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 400), ({'toll': 875, 'issued_day': 0, 'paid_day': None, 'today': 100, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3875), ({'toll': 400, 'issued_day': 93, 'paid_day': 124, 'today': 124, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 7500, 'waiver_first': True}, 400), ({'toll': 875, 'issued_day': 29, 'paid_day': None, 'today': 47, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 875)], [({'toll': 250, 'issued_day': 72, 'paid_day': 143, 'today': 186, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3250), ({'toll': 400, 'issued_day': 0, 'paid_day': 0, 'today': 45, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 250, 'issued_day': 53, 'paid_day': 93, 'today': 93, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 250), ({'toll': 400, 'issued_day': 10, 'paid_day': 70, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 400), ({'toll': 250, 'issued_day': 16, 'paid_day': None, 'today': 81, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 5250), ({'toll': 400, 'issued_day': 10, 'paid_day': 40, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 400, 'issued_day': 91, 'paid_day': 152, 'today': 152, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 5400), ({'toll': 875, 'issued_day': 31, 'paid_day': None, 'today': 61, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': True}, 875)], [({'toll': 875, 'issued_day': 28, 'paid_day': 59, 'today': 59, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 7500, 'waiver_first': False}, 1375), ({'toll': 875, 'issued_day': 61, 'paid_day': 92, 'today': 121, 'first_fee': 500, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 1375), ({'toll': 400, 'issued_day': 10, 'paid_day': 70, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 400), ({'toll': 400, 'issued_day': 65, 'paid_day': None, 'today': 179, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3400), ({'toll': 400, 'issued_day': 10, 'paid_day': 40, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 400, 'issued_day': 30, 'paid_day': 77, 'today': 90, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 7500, 'waiver_first': False}, 1400), ({'toll': 875, 'issued_day': 14, 'paid_day': None, 'today': 75, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 5875), ({'toll': 875, 'issued_day': 0, 'paid_day': None, 'today': 100, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3875)], [({'toll': 250, 'issued_day': 45, 'paid_day': 75, 'today': 76, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 250), ({'toll': 400, 'issued_day': 0, 'paid_day': 0, 'today': 45, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 400, 'issued_day': 33, 'paid_day': None, 'today': 94, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': True}, 3400), ({'toll': 875, 'issued_day': 96, 'paid_day': None, 'today': 165, 'first_fee': 1000, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': True}, 3875), ({'toll': 400, 'issued_day': 10, 'paid_day': 40, 'today': 90, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': False}, 400), ({'toll': 250, 'issued_day': 10, 'paid_day': 40, 'today': 125, 'first_fee': 500, 'second_fee': 5000, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 250), ({'toll': 400, 'issued_day': 82, 'paid_day': None, 'today': 143, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 3000, 'waiver_first': False}, 3400), ({'toll': 400, 'issued_day': 0, 'paid_day': None, 'today': 45, 'first_fee': 1000, 'second_fee': 2500, 'stage1_days': 30, 'stage2_days': 60, 'cap': 5000, 'waiver_first': True}, 1400)]]
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 | 1400 | 1400 | Passed |
| fee oracle 1 | 5400 | 5400 | Passed |
| fee oracle 2 | 5875 | 5875 | Passed |
| fee oracle 3 | 3875 | 3875 | Passed |
| fee oracle 4 | 400 | 400 | Passed |
| fee oracle 5 | 250 | 250 | Passed |
| fee oracle 6 | 1375 | 1375 | Passed |
| fee oracle 7 | 1400 | 1400 | Passed |
SHA-256 / 061cdc4081414717d11eed91518121703a416992e5625672988f49c83bf8fc85
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.756290+00:00.
Case digest / 2d03d7f1e89cdf6a2c7e3c14afb4b5c0221c9d043c70322d8dfb94bb53e38814