FA-85766 / Ride-hailing fare and surge pricing / Open access
Fast segments billed for distance and time · case 01
Highway segments are charged twice.
ROOT CAUSE
The time charge is added unconditionally, not only below the switch speed.
VERIFIED REPAIR
Bill exactly one of distance or time per segment.
Unsuccessful approach: Charging the larger of the two is the double-tariff rule, not the single tariff.
Case contract
A single-tariff taximeter bills each segment [seconds, meters] by distance when its speed is at least v m/s (meters >= v*seconds, so a zero-duration movement bills distance) and by time otherwise, never both. Charges accumulate exactly (per_km per 1000 m, per_hour per 3600 s) and the total is rounded half up to a cent once, then the flag fall is added.
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
from fractions import Fraction
N = 1
observations = []
def solve(segments, rate):
acc = Fraction(0)
for dt, dm in segments:
if dm >= rate['v'] * dt:
acc += Fraction(dm * rate['per_km'], 1000)
acc += Fraction(dt * rate['per_hour'], 3600)
cents = int(acc * 2 + 1) // 2
return rate['flag'] + cents
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: single tariff exclusivity',
[[[0, 3], [0, 3], [30, 330]], {'flag': 300, 'per_hour': 3600, 'per_km': 245, 'v': 5}], 382),
('partial repair probe: single tariff exclusivity',
[[[5, 0], [10, 20], [10, 50], [10, 110], [10, 53]],
{'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}],
449),
('second regression',
[[[30, 150], [1, 0], [5, 10], [10, 7]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 353),
('normal control 1', [[[0, 0], [0, 7]], {'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 302),
('normal control 2',
[[[0, 7], [0, 0], [0, 0], [0, 0], [10, 7]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 313),
('normal control 3', [[[1, 0], [0, 7]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 303),
('normal control 4', [[[10, 0]], {'flag': 390, 'per_hour': 3600, 'per_km': 230, 'v': 5}], 400)],
[('regression: single tariff exclusivity',
[[[0, 0], [5, 0], [10, 50], [10, 110]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 435),
('partial repair probe: single tariff exclusivity',
[[[5, 55], [10, 49], [10, 7], [30, 153], [1, 4], [0, 3]],
{'flag': 390, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
460),
('second regression',
[[[30, 7], [0, 7], [1, 8], [10, 0], [5, 7]], {'flag': 390, 'per_hour': 3600, 'per_km': 245, 'v': 5}],
439),
('normal control 1', [[[1, 4], [10, 7]], {'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}], 402),
('normal control 2', [[[5, 0]], {'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 395),
('normal control 3', [[[10, 7]], {'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 400),
('normal control 4', [[[1, 4]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 301)],
[('regression: single tariff exclusivity',
[[[5, 25]], {'flag': 390, 'per_hour': 3600, 'per_km': 230, 'v': 5}], 396),
('partial repair probe: single tariff exclusivity',
[[[1, 7], [5, 28], [10, 50], [5, 24], [10, 20]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}],
427),
('second regression',
[[[0, 7], [0, 0], [0, 7], [10, 53], [0, 0], [10, 50]],
{'flag': 300, 'per_hour': 3900, 'per_km': 230, 'v': 5}],
327),
('normal control 1', [[[10, 7], [0, 0], [1, 0]], {'flag': 300, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
311),
('normal control 2',
[[[0, 7], [30, 7], [0, 0], [5, 0], [1, 4]], {'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 341),
('normal control 3',
[[[5, 7], [10, 20], [10, 49], [30, 0]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 363),
('normal control 4', [[[5, 7], [1, 2]], {'flag': 300, 'per_hour': 3900, 'per_km': 199, 'v': 5}], 307)],
[('regression: single tariff exclusivity',
[[[10, 0], [5, 24], [1, 2], [0, 0], [10, 0], [5, 55]],
{'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}],
429),
('partial repair probe: single tariff exclusivity',
[[[30, 149], [10, 7], [1, 8], [30, 0], [30, 330]], {'flag': 300, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
448),
('second regression',
[[[10, 110], [10, 49], [10, 7]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 438),
('normal control 1',
[[[30, 60], [5, 24], [1, 0], [30, 0]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 376),
('normal control 2', [[[5, 0], [0, 3], [1, 4]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}],
308),
('normal control 3', [[[0, 0]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 300),
('normal control 4', [[[10, 20]], {'flag': 300, 'per_hour': 3600, 'per_km': 230, 'v': 5}], 310)],
[('regression: single tariff exclusivity',
[[[10, 50], [10, 50], [10, 7], [30, 149], [5, 7]], {'flag': 300, 'per_hour': 4150, 'per_km': 245, 'v': 5}],
376),
('partial repair probe: single tariff exclusivity',
[[[5, 55], [30, 149], [5, 0], [0, 0]], {'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 351),
('second regression', [[[0, 0], [5, 0], [10, 53]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}],
408),
('normal control 1', [[[30, 7]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 425),
('normal control 2', [[[0, 3], [0, 0]], {'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 301),
('normal control 3', [[[10, 0]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 401),
('normal control 4', [[[0, 0], [0, 7]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 392)]]
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: single tariff exclusivity | 412 | 382 | Failed |
| partial repair probe: single tariff exclusivity | 481 | 449 | Failed |
| second regression | 388 | 353 | Failed |
| normal control 1 | 302 | 302 | Passed |
| normal control 2 | 313 | 313 | Passed |
| normal control 3 | 303 | 303 | Passed |
| normal control 4 | 400 | 400 | Passed |
SHA-256 / 80fa470b0f418fc9a38a87378e759bc661815f6702aef3dc12e6dad8d84621fb
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(segments, rate):
acc = Fraction(0)
for dt, dm in segments:
acc += max(Fraction(dm * rate['per_km'], 1000), Fraction(dt * rate['per_hour'], 3600))
cents = int(acc * 2 + 1) // 2
return rate['flag'] + cents
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: single tariff exclusivity',
[[[0, 3], [0, 3], [30, 330]], {'flag': 300, 'per_hour': 3600, 'per_km': 245, 'v': 5}], 382),
('partial repair probe: single tariff exclusivity',
[[[5, 0], [10, 20], [10, 50], [10, 110], [10, 53]],
{'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}],
449),
('second regression',
[[[30, 150], [1, 0], [5, 10], [10, 7]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 353),
('normal control 1', [[[0, 0], [0, 7]], {'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 302),
('normal control 2',
[[[0, 7], [0, 0], [0, 0], [0, 0], [10, 7]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 313),
('normal control 3', [[[1, 0], [0, 7]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 303),
('normal control 4', [[[10, 0]], {'flag': 390, 'per_hour': 3600, 'per_km': 230, 'v': 5}], 400)],
[('regression: single tariff exclusivity',
[[[0, 0], [5, 0], [10, 50], [10, 110]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 435),
('partial repair probe: single tariff exclusivity',
[[[5, 55], [10, 49], [10, 7], [30, 153], [1, 4], [0, 3]],
{'flag': 390, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
460),
('second regression',
[[[30, 7], [0, 7], [1, 8], [10, 0], [5, 7]], {'flag': 390, 'per_hour': 3600, 'per_km': 245, 'v': 5}],
439),
('normal control 1', [[[1, 4], [10, 7]], {'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}], 402),
('normal control 2', [[[5, 0]], {'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 395),
('normal control 3', [[[10, 7]], {'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 400),
('normal control 4', [[[1, 4]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 301)],
[('regression: single tariff exclusivity',
[[[5, 25]], {'flag': 390, 'per_hour': 3600, 'per_km': 230, 'v': 5}], 396),
('partial repair probe: single tariff exclusivity',
[[[1, 7], [5, 28], [10, 50], [5, 24], [10, 20]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}],
427),
('second regression',
[[[0, 7], [0, 0], [0, 7], [10, 53], [0, 0], [10, 50]],
{'flag': 300, 'per_hour': 3900, 'per_km': 230, 'v': 5}],
327),
('normal control 1', [[[10, 7], [0, 0], [1, 0]], {'flag': 300, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
311),
('normal control 2',
[[[0, 7], [30, 7], [0, 0], [5, 0], [1, 4]], {'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 341),
('normal control 3',
[[[5, 7], [10, 20], [10, 49], [30, 0]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 363),
('normal control 4', [[[5, 7], [1, 2]], {'flag': 300, 'per_hour': 3900, 'per_km': 199, 'v': 5}], 307)],
[('regression: single tariff exclusivity',
[[[10, 0], [5, 24], [1, 2], [0, 0], [10, 0], [5, 55]],
{'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}],
429),
('partial repair probe: single tariff exclusivity',
[[[30, 149], [10, 7], [1, 8], [30, 0], [30, 330]], {'flag': 300, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
448),
('second regression',
[[[10, 110], [10, 49], [10, 7]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 438),
('normal control 1',
[[[30, 60], [5, 24], [1, 0], [30, 0]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 376),
('normal control 2', [[[5, 0], [0, 3], [1, 4]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}],
308),
('normal control 3', [[[0, 0]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 300),
('normal control 4', [[[10, 20]], {'flag': 300, 'per_hour': 3600, 'per_km': 230, 'v': 5}], 310)],
[('regression: single tariff exclusivity',
[[[10, 50], [10, 50], [10, 7], [30, 149], [5, 7]], {'flag': 300, 'per_hour': 4150, 'per_km': 245, 'v': 5}],
376),
('partial repair probe: single tariff exclusivity',
[[[5, 55], [30, 149], [5, 0], [0, 0]], {'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 351),
('second regression', [[[0, 0], [5, 0], [10, 53]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}],
408),
('normal control 1', [[[30, 7]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 425),
('normal control 2', [[[0, 3], [0, 0]], {'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 301),
('normal control 3', [[[10, 0]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 401),
('normal control 4', [[[0, 0], [0, 7]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 392)]]
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: single tariff exclusivity | 382 | 382 | Passed |
| partial repair probe: single tariff exclusivity | 450 | 449 | Failed |
| second regression | 353 | 353 | Passed |
| normal control 1 | 302 | 302 | Passed |
| normal control 2 | 313 | 313 | Passed |
| normal control 3 | 303 | 303 | Passed |
| normal control 4 | 400 | 400 | Passed |
SHA-256 / 337073f79e80ab76567cb86f61354423ed8ebef1935ee01711d83b56d1dbbd29
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(segments, rate):
acc = Fraction(0)
for dt, dm in segments:
if dm >= rate['v'] * dt:
acc += Fraction(dm * rate['per_km'], 1000)
else:
acc += Fraction(dt * rate['per_hour'], 3600)
cents = int(acc * 2 + 1) // 2
return rate['flag'] + cents
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: single tariff exclusivity',
[[[0, 3], [0, 3], [30, 330]], {'flag': 300, 'per_hour': 3600, 'per_km': 245, 'v': 5}], 382),
('partial repair probe: single tariff exclusivity',
[[[5, 0], [10, 20], [10, 50], [10, 110], [10, 53]],
{'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}],
449),
('second regression',
[[[30, 150], [1, 0], [5, 10], [10, 7]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 353),
('normal control 1', [[[0, 0], [0, 7]], {'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 302),
('normal control 2',
[[[0, 7], [0, 0], [0, 0], [0, 0], [10, 7]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 313),
('normal control 3', [[[1, 0], [0, 7]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 303),
('normal control 4', [[[10, 0]], {'flag': 390, 'per_hour': 3600, 'per_km': 230, 'v': 5}], 400)],
[('regression: single tariff exclusivity',
[[[0, 0], [5, 0], [10, 50], [10, 110]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 435),
('partial repair probe: single tariff exclusivity',
[[[5, 55], [10, 49], [10, 7], [30, 153], [1, 4], [0, 3]],
{'flag': 390, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
460),
('second regression',
[[[30, 7], [0, 7], [1, 8], [10, 0], [5, 7]], {'flag': 390, 'per_hour': 3600, 'per_km': 245, 'v': 5}],
439),
('normal control 1', [[[1, 4], [10, 7]], {'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}], 402),
('normal control 2', [[[5, 0]], {'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 395),
('normal control 3', [[[10, 7]], {'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 400),
('normal control 4', [[[1, 4]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 301)],
[('regression: single tariff exclusivity',
[[[5, 25]], {'flag': 390, 'per_hour': 3600, 'per_km': 230, 'v': 5}], 396),
('partial repair probe: single tariff exclusivity',
[[[1, 7], [5, 28], [10, 50], [5, 24], [10, 20]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}],
427),
('second regression',
[[[0, 7], [0, 0], [0, 7], [10, 53], [0, 0], [10, 50]],
{'flag': 300, 'per_hour': 3900, 'per_km': 230, 'v': 5}],
327),
('normal control 1', [[[10, 7], [0, 0], [1, 0]], {'flag': 300, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
311),
('normal control 2',
[[[0, 7], [30, 7], [0, 0], [5, 0], [1, 4]], {'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 341),
('normal control 3',
[[[5, 7], [10, 20], [10, 49], [30, 0]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 363),
('normal control 4', [[[5, 7], [1, 2]], {'flag': 300, 'per_hour': 3900, 'per_km': 199, 'v': 5}], 307)],
[('regression: single tariff exclusivity',
[[[10, 0], [5, 24], [1, 2], [0, 0], [10, 0], [5, 55]],
{'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}],
429),
('partial repair probe: single tariff exclusivity',
[[[30, 149], [10, 7], [1, 8], [30, 0], [30, 330]], {'flag': 300, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
448),
('second regression',
[[[10, 110], [10, 49], [10, 7]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 438),
('normal control 1',
[[[30, 60], [5, 24], [1, 0], [30, 0]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 376),
('normal control 2', [[[5, 0], [0, 3], [1, 4]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}],
308),
('normal control 3', [[[0, 0]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 300),
('normal control 4', [[[10, 20]], {'flag': 300, 'per_hour': 3600, 'per_km': 230, 'v': 5}], 310)],
[('regression: single tariff exclusivity',
[[[10, 50], [10, 50], [10, 7], [30, 149], [5, 7]], {'flag': 300, 'per_hour': 4150, 'per_km': 245, 'v': 5}],
376),
('partial repair probe: single tariff exclusivity',
[[[5, 55], [30, 149], [5, 0], [0, 0]], {'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 351),
('second regression', [[[0, 0], [5, 0], [10, 53]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}],
408),
('normal control 1', [[[30, 7]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 425),
('normal control 2', [[[0, 3], [0, 0]], {'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 301),
('normal control 3', [[[10, 0]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 401),
('normal control 4', [[[0, 0], [0, 7]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 392)]]
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: single tariff exclusivity | 382 | 382 | Passed |
| partial repair probe: single tariff exclusivity | 449 | 449 | Passed |
| second regression | 353 | 353 | Passed |
| normal control 1 | 302 | 302 | Passed |
| normal control 2 | 313 | 313 | Passed |
| normal control 3 | 303 | 303 | Passed |
| normal control 4 | 400 | 400 | Passed |
SHA-256 / 5e3f6730ca1ec5a987c1176653faf978db0d55a29beca13f740d54ac235fda47
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:43.474822+00:00.
Case digest / ccdc054a3be0c946bb28bb8e6685924d506a2e5bdff7989a509ffa69f9684373