FA-85396 / Ride-hailing fare and surge pricing / Open access
Sales tax charged on tolls and airport fees · case 01
Airport trips show tax on the pass-through fees.
ROOT CAUSE
The tax base includes pass-through tolls and airport fees.
VERIFIED REPAIR
Tax only the fare portion after discount plus booking fee.
Unsuccessful approach: Excluding tolls but keeping airport fees in the base still over-taxes airport trips.
Case contract
Cents throughout. Surge (tenths) multiplies only base+distance+time, rounded half up. A percentage promo discounts the surged amount (floor), capped at promo cap cents. The booking fee is added after the discount. Tax (basis points, rounded half up) applies to surged - discount + booking fee; tolls and airport fees are passed through untaxed and unsurged.
Why this case matters
Ride-hailing prices are computed per trip at scale; ordering, unit and boundary slips become systematic over- or under-charging.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(parts, surge, promo, tax_bp):
def half_up(num, den):
return (num * 2 + den) // (den * 2)
core = parts['base'] + parts['distance'] + parts['time']
surged = half_up(core * surge, 10)
disc = 0
if promo:
disc = min(surged * promo['pct'] // 100, promo['cap'])
sub = surged - disc + parts['booking_fee']
tax = half_up((sub + parts['tolls'] + parts['airport_fee']) * tax_bp, 10000)
total = sub + tax + parts['tolls'] + parts['airport_fee']
return {'surged': surged, 'discount': disc, 'tax': tax, 'total': total}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: tax base pass-throughs',
[{'airport_fee': 500, 'base': 150, 'booking_fee': 245, 'distance': 2406, 'time': 539, 'tolls': 375}, 17,
{'cap': 1000, 'pct': 50}, 825],
{'discount': 1000, 'surged': 5262, 'tax': 372, 'total': 5754}),
('partial repair probe: tax base pass-throughs',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 0, 'distance': 469, 'time': 618, 'tolls': 690}, 17,
{'cap': 5, 'pct': 15}, 625],
{'discount': 5, 'surged': 2273, 'tax': 142, 'total': 3600}),
('second regression',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 1550, 'time': 85, 'tolls': 375}, 15,
{'cap': 1000, 'pct': 50}, 825],
{'discount': 1000, 'surged': 2678, 'tax': 153, 'total': 2381}),
('normal control 1',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2734, 'time': 279, 'tolls': 0}, 25,
{'cap': 500, 'pct': 20}, 1000],
{'discount': 500, 'surged': 8158, 'tax': 766, 'total': 8424}),
('normal control 2',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 2248, 'time': 508, 'tolls': 0}, 17,
{'cap': 500, 'pct': 20}, 1000],
{'discount': 500, 'surged': 5110, 'tax': 479, 'total': 5264}),
('normal control 3',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2650, 'time': 202, 'tolls': 0}, 10,
{'cap': 5, 'pct': 15}, 1000],
{'discount': 5, 'surged': 3102, 'tax': 310, 'total': 3407}),
('normal control 4',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 2389, 'time': 840, 'tolls': 0}, 12, None,
1000],
{'discount': 0, 'surged': 4055, 'tax': 406, 'total': 4461})],
[('regression: tax base pass-throughs',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 2245, 'time': 503, 'tolls': 375}, 17,
{'cap': 1000, 'pct': 50}, 825],
{'discount': 1000, 'surged': 5097, 'tax': 358, 'total': 5075}),
('partial repair probe: tax base pass-throughs',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 245, 'distance': 2032, 'time': 137, 'tolls': 0}, 15,
{'cap': 1000, 'pct': 50}, 625],
{'discount': 1000, 'surged': 3629, 'tax': 180, 'total': 3554}),
('second regression',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 0, 'distance': 493, 'time': 689, 'tolls': 690}, 15,
{'cap': 1000, 'pct': 50}, 1000],
{'discount': 1000, 'surged': 2148, 'tax': 115, 'total': 2453}),
('normal control 1',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 2242, 'time': 356, 'tolls': 0}, 25, None,
1000],
{'discount': 0, 'surged': 6870, 'tax': 705, 'total': 7750}),
('normal control 2',
[{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 2484, 'time': 239, 'tolls': 375}, 10,
{'cap': 500, 'pct': 20}, 0],
{'discount': 500, 'surged': 2873, 'tax': 0, 'total': 3423}),
('normal control 3',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 1450, 'time': 685, 'tolls': 690}, 10, None,
0],
{'discount': 0, 'surged': 2385, 'tax': 0, 'total': 3075}),
('normal control 4',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 1384, 'time': 605, 'tolls': 375}, 25,
{'cap': 1000, 'pct': 50}, 0],
{'discount': 1000, 'surged': 5598, 'tax': 0, 'total': 5218})],
[('regression: tax base pass-throughs',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 245, 'distance': 2864, 'time': 693, 'tolls': 690}, 25,
None, 1000],
{'discount': 0, 'surged': 9518, 'tax': 976, 'total': 11929}),
('partial repair probe: tax base pass-throughs',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 0, 'distance': 2979, 'time': 350, 'tolls': 375}, 10,
None, 625],
{'discount': 0, 'surged': 3579, 'tax': 224, 'total': 4678}),
('second regression',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 1097, 'time': 564, 'tolls': 375}, 25, None,
625],
{'discount': 0, 'surged': 4528, 'tax': 283, 'total': 5186}),
('normal control 1',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 766, 'time': 97, 'tolls': 0}, 17,
{'cap': 5, 'pct': 15}, 0],
{'discount': 5, 'surged': 1722, 'tax': 0, 'total': 1717}),
('normal control 2',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 153, 'time': 253, 'tolls': 0}, 10,
{'cap': 1000, 'pct': 50}, 0],
{'discount': 328, 'surged': 656, 'tax': 0, 'total': 328}),
('normal control 3',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2516, 'time': 255, 'tolls': 0}, 17,
{'cap': 5, 'pct': 15}, 825],
{'discount': 5, 'surged': 5136, 'tax': 423, 'total': 5554}),
('normal control 4',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 2401, 'time': 633, 'tolls': 0}, 12,
{'cap': 1000, 'pct': 50}, 1000],
{'discount': 1000, 'surged': 3821, 'tax': 300, 'total': 3296})],
[('regression: tax base pass-throughs',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 1429, 'time': 711, 'tolls': 375}, 12,
{'cap': 5, 'pct': 15}, 825],
{'discount': 5, 'surged': 2868, 'tax': 256, 'total': 3739}),
('partial repair probe: tax base pass-throughs',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 245, 'distance': 1495, 'time': 630, 'tolls': 375}, 25,
{'cap': 1000, 'pct': 50}, 1000],
{'discount': 1000, 'surged': 5938, 'tax': 518, 'total': 6576}),
('second regression',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2410, 'time': 738, 'tolls': 375}, 17, None,
1000],
{'discount': 0, 'surged': 5777, 'tax': 578, 'total': 6730}),
('normal control 1',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 245, 'distance': 715, 'time': 669, 'tolls': 0}, 17, None,
625],
{'discount': 0, 'surged': 2608, 'tax': 178, 'total': 3031}),
('normal control 2',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 2721, 'time': 80, 'tolls': 0}, 10,
{'cap': 500, 'pct': 20}, 625],
{'discount': 500, 'surged': 2951, 'tax': 164, 'total': 2790}),
('normal control 3',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 2525, 'time': 270, 'tolls': 0}, 10, None,
0],
{'discount': 0, 'surged': 3045, 'tax': 0, 'total': 3220}),
('normal control 4',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 1654, 'time': 354, 'tolls': 0}, 12,
{'cap': 5, 'pct': 15}, 825],
{'discount': 5, 'surged': 2710, 'tax': 223, 'total': 2928})],
[('regression: tax base pass-throughs',
[{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 334, 'time': 196, 'tolls': 0}, 12,
{'cap': 1000, 'pct': 50}, 825],
{'discount': 408, 'surged': 816, 'tax': 48, 'total': 1131}),
('partial repair probe: tax base pass-throughs',
[{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 2268, 'time': 551, 'tolls': 0}, 10,
None, 625],
{'discount': 0, 'surged': 2969, 'tax': 197, 'total': 3841}),
('second regression',
[{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 2751, 'time': 391, 'tolls': 690}, 12,
{'cap': 500, 'pct': 20}, 625],
{'discount': 500, 'surged': 3950, 'tax': 227, 'total': 5042}),
('normal control 1',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 1613, 'time': 249, 'tolls': 375}, 25,
{'cap': 5, 'pct': 15}, 0],
{'discount': 5, 'surged': 5030, 'tax': 0, 'total': 5400}),
('normal control 2',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 1014, 'time': 577, 'tolls': 0}, 15, None,
825],
{'discount': 0, 'surged': 2762, 'tax': 242, 'total': 3179}),
('normal control 3',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 175, 'distance': 1130, 'time': 733, 'tolls': 0}, 25,
{'cap': 5, 'pct': 15}, 0],
{'discount': 5, 'surged': 5283, 'tax': 0, 'total': 5953}),
('normal control 4',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 1904, 'time': 392, 'tolls': 0}, 15,
{'cap': 5, 'pct': 15}, 0],
{'discount': 5, 'surged': 3819, 'tax': 0, 'total': 3989})]]
for label, args, expected in fixtures[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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: tax base pass-throughs | {'discount': 1000, 'surged': 5262, 'tax': 444, 'total': 5826} | {'discount': 1000, 'surged': 5262, 'tax': 372, 'total': 5754} | Failed |
| partial repair probe: tax base pass-throughs | {'discount': 5, 'surged': 2273, 'tax': 216, 'total': 3674} | {'discount': 5, 'surged': 2273, 'tax': 142, 'total': 3600} | Failed |
| second regression | {'discount': 1000, 'surged': 2678, 'tax': 184, 'total': 2412} | {'discount': 1000, 'surged': 2678, 'tax': 153, 'total': 2381} | Failed |
| normal control 1 | {'discount': 500, 'surged': 8158, 'tax': 766, 'total': 8424} | {'discount': 500, 'surged': 8158, 'tax': 766, 'total': 8424} | Passed |
| normal control 2 | {'discount': 500, 'surged': 5110, 'tax': 479, 'total': 5264} | {'discount': 500, 'surged': 5110, 'tax': 479, 'total': 5264} | Passed |
| normal control 3 | {'discount': 5, 'surged': 3102, 'tax': 310, 'total': 3407} | {'discount': 5, 'surged': 3102, 'tax': 310, 'total': 3407} | Passed |
| normal control 4 | {'discount': 0, 'surged': 4055, 'tax': 406, 'total': 4461} | {'discount': 0, 'surged': 4055, 'tax': 406, 'total': 4461} | Passed |
SHA-256 / d8ea86fcf85d253fb1104992b970e401e9157c1aeb8521a7684e355bd56d4b06
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(parts, surge, promo, tax_bp):
def half_up(num, den):
return (num * 2 + den) // (den * 2)
core = parts['base'] + parts['distance'] + parts['time']
surged = half_up(core * surge, 10)
disc = 0
if promo:
disc = min(surged * promo['pct'] // 100, promo['cap'])
sub = surged - disc + parts['booking_fee']
tax = half_up((sub + parts['airport_fee']) * tax_bp, 10000)
total = sub + tax + parts['tolls'] + parts['airport_fee']
return {'surged': surged, 'discount': disc, 'tax': tax, 'total': total}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: tax base pass-throughs',
[{'airport_fee': 500, 'base': 150, 'booking_fee': 245, 'distance': 2406, 'time': 539, 'tolls': 375}, 17,
{'cap': 1000, 'pct': 50}, 825],
{'discount': 1000, 'surged': 5262, 'tax': 372, 'total': 5754}),
('partial repair probe: tax base pass-throughs',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 0, 'distance': 469, 'time': 618, 'tolls': 690}, 17,
{'cap': 5, 'pct': 15}, 625],
{'discount': 5, 'surged': 2273, 'tax': 142, 'total': 3600}),
('second regression',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 1550, 'time': 85, 'tolls': 375}, 15,
{'cap': 1000, 'pct': 50}, 825],
{'discount': 1000, 'surged': 2678, 'tax': 153, 'total': 2381}),
('normal control 1',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2734, 'time': 279, 'tolls': 0}, 25,
{'cap': 500, 'pct': 20}, 1000],
{'discount': 500, 'surged': 8158, 'tax': 766, 'total': 8424}),
('normal control 2',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 2248, 'time': 508, 'tolls': 0}, 17,
{'cap': 500, 'pct': 20}, 1000],
{'discount': 500, 'surged': 5110, 'tax': 479, 'total': 5264}),
('normal control 3',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2650, 'time': 202, 'tolls': 0}, 10,
{'cap': 5, 'pct': 15}, 1000],
{'discount': 5, 'surged': 3102, 'tax': 310, 'total': 3407}),
('normal control 4',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 2389, 'time': 840, 'tolls': 0}, 12, None,
1000],
{'discount': 0, 'surged': 4055, 'tax': 406, 'total': 4461})],
[('regression: tax base pass-throughs',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 2245, 'time': 503, 'tolls': 375}, 17,
{'cap': 1000, 'pct': 50}, 825],
{'discount': 1000, 'surged': 5097, 'tax': 358, 'total': 5075}),
('partial repair probe: tax base pass-throughs',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 245, 'distance': 2032, 'time': 137, 'tolls': 0}, 15,
{'cap': 1000, 'pct': 50}, 625],
{'discount': 1000, 'surged': 3629, 'tax': 180, 'total': 3554}),
('second regression',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 0, 'distance': 493, 'time': 689, 'tolls': 690}, 15,
{'cap': 1000, 'pct': 50}, 1000],
{'discount': 1000, 'surged': 2148, 'tax': 115, 'total': 2453}),
('normal control 1',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 2242, 'time': 356, 'tolls': 0}, 25, None,
1000],
{'discount': 0, 'surged': 6870, 'tax': 705, 'total': 7750}),
('normal control 2',
[{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 2484, 'time': 239, 'tolls': 375}, 10,
{'cap': 500, 'pct': 20}, 0],
{'discount': 500, 'surged': 2873, 'tax': 0, 'total': 3423}),
('normal control 3',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 1450, 'time': 685, 'tolls': 690}, 10, None,
0],
{'discount': 0, 'surged': 2385, 'tax': 0, 'total': 3075}),
('normal control 4',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 1384, 'time': 605, 'tolls': 375}, 25,
{'cap': 1000, 'pct': 50}, 0],
{'discount': 1000, 'surged': 5598, 'tax': 0, 'total': 5218})],
[('regression: tax base pass-throughs',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 245, 'distance': 2864, 'time': 693, 'tolls': 690}, 25,
None, 1000],
{'discount': 0, 'surged': 9518, 'tax': 976, 'total': 11929}),
('partial repair probe: tax base pass-throughs',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 0, 'distance': 2979, 'time': 350, 'tolls': 375}, 10,
None, 625],
{'discount': 0, 'surged': 3579, 'tax': 224, 'total': 4678}),
('second regression',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 1097, 'time': 564, 'tolls': 375}, 25, None,
625],
{'discount': 0, 'surged': 4528, 'tax': 283, 'total': 5186}),
('normal control 1',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 766, 'time': 97, 'tolls': 0}, 17,
{'cap': 5, 'pct': 15}, 0],
{'discount': 5, 'surged': 1722, 'tax': 0, 'total': 1717}),
('normal control 2',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 153, 'time': 253, 'tolls': 0}, 10,
{'cap': 1000, 'pct': 50}, 0],
{'discount': 328, 'surged': 656, 'tax': 0, 'total': 328}),
('normal control 3',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2516, 'time': 255, 'tolls': 0}, 17,
{'cap': 5, 'pct': 15}, 825],
{'discount': 5, 'surged': 5136, 'tax': 423, 'total': 5554}),
('normal control 4',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 2401, 'time': 633, 'tolls': 0}, 12,
{'cap': 1000, 'pct': 50}, 1000],
{'discount': 1000, 'surged': 3821, 'tax': 300, 'total': 3296})],
[('regression: tax base pass-throughs',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 1429, 'time': 711, 'tolls': 375}, 12,
{'cap': 5, 'pct': 15}, 825],
{'discount': 5, 'surged': 2868, 'tax': 256, 'total': 3739}),
('partial repair probe: tax base pass-throughs',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 245, 'distance': 1495, 'time': 630, 'tolls': 375}, 25,
{'cap': 1000, 'pct': 50}, 1000],
{'discount': 1000, 'surged': 5938, 'tax': 518, 'total': 6576}),
('second regression',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2410, 'time': 738, 'tolls': 375}, 17, None,
1000],
{'discount': 0, 'surged': 5777, 'tax': 578, 'total': 6730}),
('normal control 1',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 245, 'distance': 715, 'time': 669, 'tolls': 0}, 17, None,
625],
{'discount': 0, 'surged': 2608, 'tax': 178, 'total': 3031}),
('normal control 2',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 2721, 'time': 80, 'tolls': 0}, 10,
{'cap': 500, 'pct': 20}, 625],
{'discount': 500, 'surged': 2951, 'tax': 164, 'total': 2790}),
('normal control 3',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 2525, 'time': 270, 'tolls': 0}, 10, None,
0],
{'discount': 0, 'surged': 3045, 'tax': 0, 'total': 3220}),
('normal control 4',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 1654, 'time': 354, 'tolls': 0}, 12,
{'cap': 5, 'pct': 15}, 825],
{'discount': 5, 'surged': 2710, 'tax': 223, 'total': 2928})],
[('regression: tax base pass-throughs',
[{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 334, 'time': 196, 'tolls': 0}, 12,
{'cap': 1000, 'pct': 50}, 825],
{'discount': 408, 'surged': 816, 'tax': 48, 'total': 1131}),
('partial repair probe: tax base pass-throughs',
[{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 2268, 'time': 551, 'tolls': 0}, 10,
None, 625],
{'discount': 0, 'surged': 2969, 'tax': 197, 'total': 3841}),
('second regression',
[{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 2751, 'time': 391, 'tolls': 690}, 12,
{'cap': 500, 'pct': 20}, 625],
{'discount': 500, 'surged': 3950, 'tax': 227, 'total': 5042}),
('normal control 1',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 1613, 'time': 249, 'tolls': 375}, 25,
{'cap': 5, 'pct': 15}, 0],
{'discount': 5, 'surged': 5030, 'tax': 0, 'total': 5400}),
('normal control 2',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 1014, 'time': 577, 'tolls': 0}, 15, None,
825],
{'discount': 0, 'surged': 2762, 'tax': 242, 'total': 3179}),
('normal control 3',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 175, 'distance': 1130, 'time': 733, 'tolls': 0}, 25,
{'cap': 5, 'pct': 15}, 0],
{'discount': 5, 'surged': 5283, 'tax': 0, 'total': 5953}),
('normal control 4',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 1904, 'time': 392, 'tolls': 0}, 15,
{'cap': 5, 'pct': 15}, 0],
{'discount': 5, 'surged': 3819, 'tax': 0, 'total': 3989})]]
for label, args, expected in fixtures[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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: tax base pass-throughs | {'discount': 1000, 'surged': 5262, 'tax': 413, 'total': 5795} | {'discount': 1000, 'surged': 5262, 'tax': 372, 'total': 5754} | Failed |
| partial repair probe: tax base pass-throughs | {'discount': 5, 'surged': 2273, 'tax': 173, 'total': 3631} | {'discount': 5, 'surged': 2273, 'tax': 142, 'total': 3600} | Failed |
| second regression | {'discount': 1000, 'surged': 2678, 'tax': 153, 'total': 2381} | {'discount': 1000, 'surged': 2678, 'tax': 153, 'total': 2381} | Passed |
| normal control 1 | {'discount': 500, 'surged': 8158, 'tax': 766, 'total': 8424} | {'discount': 500, 'surged': 8158, 'tax': 766, 'total': 8424} | Passed |
| normal control 2 | {'discount': 500, 'surged': 5110, 'tax': 479, 'total': 5264} | {'discount': 500, 'surged': 5110, 'tax': 479, 'total': 5264} | Passed |
| normal control 3 | {'discount': 5, 'surged': 3102, 'tax': 310, 'total': 3407} | {'discount': 5, 'surged': 3102, 'tax': 310, 'total': 3407} | Passed |
| normal control 4 | {'discount': 0, 'surged': 4055, 'tax': 406, 'total': 4461} | {'discount': 0, 'surged': 4055, 'tax': 406, 'total': 4461} | Passed |
SHA-256 / 0a048e8bec0107d45fc04ce1a6b8446cbe6f3a50a25568ea7fe084ea8b2c2423
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(parts, surge, promo, tax_bp):
def half_up(num, den):
return (num * 2 + den) // (den * 2)
core = parts['base'] + parts['distance'] + parts['time']
surged = half_up(core * surge, 10)
disc = 0
if promo:
disc = min(surged * promo['pct'] // 100, promo['cap'])
sub = surged - disc + parts['booking_fee']
tax = half_up(sub * tax_bp, 10000)
total = sub + tax + parts['tolls'] + parts['airport_fee']
return {'surged': surged, 'discount': disc, 'tax': tax, 'total': total}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: tax base pass-throughs',
[{'airport_fee': 500, 'base': 150, 'booking_fee': 245, 'distance': 2406, 'time': 539, 'tolls': 375}, 17,
{'cap': 1000, 'pct': 50}, 825],
{'discount': 1000, 'surged': 5262, 'tax': 372, 'total': 5754}),
('partial repair probe: tax base pass-throughs',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 0, 'distance': 469, 'time': 618, 'tolls': 690}, 17,
{'cap': 5, 'pct': 15}, 625],
{'discount': 5, 'surged': 2273, 'tax': 142, 'total': 3600}),
('second regression',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 1550, 'time': 85, 'tolls': 375}, 15,
{'cap': 1000, 'pct': 50}, 825],
{'discount': 1000, 'surged': 2678, 'tax': 153, 'total': 2381}),
('normal control 1',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2734, 'time': 279, 'tolls': 0}, 25,
{'cap': 500, 'pct': 20}, 1000],
{'discount': 500, 'surged': 8158, 'tax': 766, 'total': 8424}),
('normal control 2',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 2248, 'time': 508, 'tolls': 0}, 17,
{'cap': 500, 'pct': 20}, 1000],
{'discount': 500, 'surged': 5110, 'tax': 479, 'total': 5264}),
('normal control 3',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2650, 'time': 202, 'tolls': 0}, 10,
{'cap': 5, 'pct': 15}, 1000],
{'discount': 5, 'surged': 3102, 'tax': 310, 'total': 3407}),
('normal control 4',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 2389, 'time': 840, 'tolls': 0}, 12, None,
1000],
{'discount': 0, 'surged': 4055, 'tax': 406, 'total': 4461})],
[('regression: tax base pass-throughs',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 2245, 'time': 503, 'tolls': 375}, 17,
{'cap': 1000, 'pct': 50}, 825],
{'discount': 1000, 'surged': 5097, 'tax': 358, 'total': 5075}),
('partial repair probe: tax base pass-throughs',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 245, 'distance': 2032, 'time': 137, 'tolls': 0}, 15,
{'cap': 1000, 'pct': 50}, 625],
{'discount': 1000, 'surged': 3629, 'tax': 180, 'total': 3554}),
('second regression',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 0, 'distance': 493, 'time': 689, 'tolls': 690}, 15,
{'cap': 1000, 'pct': 50}, 1000],
{'discount': 1000, 'surged': 2148, 'tax': 115, 'total': 2453}),
('normal control 1',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 2242, 'time': 356, 'tolls': 0}, 25, None,
1000],
{'discount': 0, 'surged': 6870, 'tax': 705, 'total': 7750}),
('normal control 2',
[{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 2484, 'time': 239, 'tolls': 375}, 10,
{'cap': 500, 'pct': 20}, 0],
{'discount': 500, 'surged': 2873, 'tax': 0, 'total': 3423}),
('normal control 3',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 1450, 'time': 685, 'tolls': 690}, 10, None,
0],
{'discount': 0, 'surged': 2385, 'tax': 0, 'total': 3075}),
('normal control 4',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 1384, 'time': 605, 'tolls': 375}, 25,
{'cap': 1000, 'pct': 50}, 0],
{'discount': 1000, 'surged': 5598, 'tax': 0, 'total': 5218})],
[('regression: tax base pass-throughs',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 245, 'distance': 2864, 'time': 693, 'tolls': 690}, 25,
None, 1000],
{'discount': 0, 'surged': 9518, 'tax': 976, 'total': 11929}),
('partial repair probe: tax base pass-throughs',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 0, 'distance': 2979, 'time': 350, 'tolls': 375}, 10,
None, 625],
{'discount': 0, 'surged': 3579, 'tax': 224, 'total': 4678}),
('second regression',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 1097, 'time': 564, 'tolls': 375}, 25, None,
625],
{'discount': 0, 'surged': 4528, 'tax': 283, 'total': 5186}),
('normal control 1',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 766, 'time': 97, 'tolls': 0}, 17,
{'cap': 5, 'pct': 15}, 0],
{'discount': 5, 'surged': 1722, 'tax': 0, 'total': 1717}),
('normal control 2',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 153, 'time': 253, 'tolls': 0}, 10,
{'cap': 1000, 'pct': 50}, 0],
{'discount': 328, 'surged': 656, 'tax': 0, 'total': 328}),
('normal control 3',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2516, 'time': 255, 'tolls': 0}, 17,
{'cap': 5, 'pct': 15}, 825],
{'discount': 5, 'surged': 5136, 'tax': 423, 'total': 5554}),
('normal control 4',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 2401, 'time': 633, 'tolls': 0}, 12,
{'cap': 1000, 'pct': 50}, 1000],
{'discount': 1000, 'surged': 3821, 'tax': 300, 'total': 3296})],
[('regression: tax base pass-throughs',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 1429, 'time': 711, 'tolls': 375}, 12,
{'cap': 5, 'pct': 15}, 825],
{'discount': 5, 'surged': 2868, 'tax': 256, 'total': 3739}),
('partial repair probe: tax base pass-throughs',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 245, 'distance': 1495, 'time': 630, 'tolls': 375}, 25,
{'cap': 1000, 'pct': 50}, 1000],
{'discount': 1000, 'surged': 5938, 'tax': 518, 'total': 6576}),
('second regression',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2410, 'time': 738, 'tolls': 375}, 17, None,
1000],
{'discount': 0, 'surged': 5777, 'tax': 578, 'total': 6730}),
('normal control 1',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 245, 'distance': 715, 'time': 669, 'tolls': 0}, 17, None,
625],
{'discount': 0, 'surged': 2608, 'tax': 178, 'total': 3031}),
('normal control 2',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 2721, 'time': 80, 'tolls': 0}, 10,
{'cap': 500, 'pct': 20}, 625],
{'discount': 500, 'surged': 2951, 'tax': 164, 'total': 2790}),
('normal control 3',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 2525, 'time': 270, 'tolls': 0}, 10, None,
0],
{'discount': 0, 'surged': 3045, 'tax': 0, 'total': 3220}),
('normal control 4',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 1654, 'time': 354, 'tolls': 0}, 12,
{'cap': 5, 'pct': 15}, 825],
{'discount': 5, 'surged': 2710, 'tax': 223, 'total': 2928})],
[('regression: tax base pass-throughs',
[{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 334, 'time': 196, 'tolls': 0}, 12,
{'cap': 1000, 'pct': 50}, 825],
{'discount': 408, 'surged': 816, 'tax': 48, 'total': 1131}),
('partial repair probe: tax base pass-throughs',
[{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 2268, 'time': 551, 'tolls': 0}, 10,
None, 625],
{'discount': 0, 'surged': 2969, 'tax': 197, 'total': 3841}),
('second regression',
[{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 2751, 'time': 391, 'tolls': 690}, 12,
{'cap': 500, 'pct': 20}, 625],
{'discount': 500, 'surged': 3950, 'tax': 227, 'total': 5042}),
('normal control 1',
[{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 1613, 'time': 249, 'tolls': 375}, 25,
{'cap': 5, 'pct': 15}, 0],
{'discount': 5, 'surged': 5030, 'tax': 0, 'total': 5400}),
('normal control 2',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 1014, 'time': 577, 'tolls': 0}, 15, None,
825],
{'discount': 0, 'surged': 2762, 'tax': 242, 'total': 3179}),
('normal control 3',
[{'airport_fee': 500, 'base': 250, 'booking_fee': 175, 'distance': 1130, 'time': 733, 'tolls': 0}, 25,
{'cap': 5, 'pct': 15}, 0],
{'discount': 5, 'surged': 5283, 'tax': 0, 'total': 5953}),
('normal control 4',
[{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 1904, 'time': 392, 'tolls': 0}, 15,
{'cap': 5, 'pct': 15}, 0],
{'discount': 5, 'surged': 3819, 'tax': 0, 'total': 3989})]]
for label, args, expected in fixtures[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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: tax base pass-throughs | {'discount': 1000, 'surged': 5262, 'tax': 372, 'total': 5754} | {'discount': 1000, 'surged': 5262, 'tax': 372, 'total': 5754} | Passed |
| partial repair probe: tax base pass-throughs | {'discount': 5, 'surged': 2273, 'tax': 142, 'total': 3600} | {'discount': 5, 'surged': 2273, 'tax': 142, 'total': 3600} | Passed |
| second regression | {'discount': 1000, 'surged': 2678, 'tax': 153, 'total': 2381} | {'discount': 1000, 'surged': 2678, 'tax': 153, 'total': 2381} | Passed |
| normal control 1 | {'discount': 500, 'surged': 8158, 'tax': 766, 'total': 8424} | {'discount': 500, 'surged': 8158, 'tax': 766, 'total': 8424} | Passed |
| normal control 2 | {'discount': 500, 'surged': 5110, 'tax': 479, 'total': 5264} | {'discount': 500, 'surged': 5110, 'tax': 479, 'total': 5264} | Passed |
| normal control 3 | {'discount': 5, 'surged': 3102, 'tax': 310, 'total': 3407} | {'discount': 5, 'surged': 3102, 'tax': 310, 'total': 3407} | Passed |
| normal control 4 | {'discount': 0, 'surged': 4055, 'tax': 406, 'total': 4461} | {'discount': 0, 'surged': 4055, 'tax': 406, 'total': 4461} | Passed |
SHA-256 / b45bd97dc1671404f41562e4e137666d5ff2cd7314a2498bcd14c018fcdc8688
Verification & scope
A deterministic toy pricing contract stipulated for this example; it does not reproduce the pricing of any real ride-hailing operator or regulator. 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:50:39.935370+00:00.
Case digest / 63f876d4c95a2c913dcb570e42ee18fc159c0389ae34415824a54232c883865d