FA-85771 / Ride-hailing fare and surge pricing / Open access
Segments exactly at the switch speed billed by time · case 01
Traffic moving at exactly 5 m/s is billed on the clock.
ROOT CAUSE
The mode test is strict.
THE FAILURE
The mode test is strict.
Unsuccessful approach: Excluding zero-duration segments bills their distance as zero time.
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)
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: switch speed boundary', [[[10, 50]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}],
402),
('partial repair probe: switch speed boundary',
[[[0, 7], [10, 20], [1, 7]], {'flag': 390, 'per_hour': 3600, 'per_km': 245, 'v': 5}], 403),
('second regression',
[[[30, 60], [0, 3], [0, 0], [10, 0], [10, 53], [30, 7]],
{'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}],
390),
('normal control 1',
[[[10, 49], [10, 0], [5, 24], [10, 53], [0, 0]], {'flag': 300, 'per_hour': 3600, 'per_km': 245, 'v': 5}],
338),
('normal control 2',
[[[1, 11], [30, 330], [0, 0], [30, 149]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 413),
('normal control 3', [[[1, 7], [10, 49]], {'flag': 390, 'per_hour': 3900, 'per_km': 230, 'v': 5}], 402),
('normal control 4', [[[1, 8]], {'flag': 390, 'per_hour': 4150, 'per_km': 245, 'v': 5}], 392)],
[('regression: switch speed boundary',
[[[0, 0], [5, 24], [1, 8], [1, 11], [10, 50]], {'flag': 300, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
321),
('partial repair probe: switch speed boundary',
[[[30, 150], [10, 0], [30, 153], [0, 7]], {'flag': 390, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 463),
('second regression',
[[[30, 7], [30, 149], [10, 50], [10, 49], [5, 7]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}],
484),
('normal control 1', [[[0, 0]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 390),
('normal control 2', [[[30, 149], [10, 53]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 435),
('normal control 3', [[[1, 0], [10, 0]], {'flag': 300, 'per_hour': 3900, 'per_km': 230, 'v': 5}], 312),
('normal control 4', [[[1, 5], [10, 110], [5, 24]], {'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}],
418)],
[('regression: switch speed boundary',
[[[10, 110], [1, 5], [0, 3], [5, 55]], {'flag': 390, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 424),
('partial repair probe: switch speed boundary',
[[[30, 7], [10, 0], [0, 0], [30, 153], [30, 0], [0, 7]],
{'flag': 300, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
407),
('second regression',
[[[0, 3], [5, 25], [10, 0], [0, 7], [1, 7]], {'flag': 300, 'per_hour': 3600, 'per_km': 245, 'v': 5}],
320),
('normal control 1', [[[30, 149], [0, 0]], {'flag': 390, 'per_hour': 3600, 'per_km': 245, 'v': 5}], 420),
('normal control 2', [[[10, 110], [10, 7]], {'flag': 300, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 332),
('normal control 3', [[[30, 60], [1, 7], [0, 0]], {'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}],
424),
('normal control 4', [[[5, 0], [5, 0], [1, 2]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}],
403)],
[('regression: switch speed boundary',
[[[10, 0], [30, 0], [10, 50], [30, 60], [5, 55], [5, 24]],
{'flag': 390, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
489),
('partial repair probe: switch speed boundary',
[[[0, 7], [30, 149], [10, 7], [30, 60], [0, 0], [30, 149]],
{'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}],
491),
('second regression',
[[[10, 20], [1, 11], [5, 10], [30, 7], [0, 0], [0, 7]],
{'flag': 390, 'per_hour': 4150, 'per_km': 245, 'v': 5}],
446),
('normal control 1',
[[[1, 5], [1, 8], [5, 25], [5, 10], [0, 0], [10, 20]],
{'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}],
414),
('normal control 2',
[[[10, 53], [30, 7], [10, 20]], {'flag': 300, 'per_hour': 3600, 'per_km': 245, 'v': 5}], 353),
('normal control 3', [[[10, 0], [30, 0]], {'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}], 433),
('normal control 4',
[[[1, 4], [1, 5], [30, 7], [10, 110]], {'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 444)],
[('regression: switch speed boundary',
[[[1, 5], [10, 110], [10, 50], [1, 7]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 334),
('partial repair probe: switch speed boundary',
[[[0, 7]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 392),
('second regression',
[[[10, 20], [5, 0], [10, 110], [10, 49], [5, 25]], {'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}],
360),
('normal control 1', [[[10, 53]], {'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 401),
('normal control 2', [[[0, 0], [1, 8], [5, 24]], {'flag': 300, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
307),
('normal control 3', [[[10, 110]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 322),
('normal control 4', [[[1, 4], [1, 5]], {'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 302)]]
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: switch speed boundary | 401 | 402 | Failed |
| partial repair probe: switch speed boundary | 403 | 403 | Passed |
| second regression | 390 | 390 | Passed |
| normal control 1 | 338 | 338 | Passed |
| normal control 2 | 413 | 413 | Passed |
| normal control 3 | 402 | 402 | Passed |
| normal control 4 | 392 | 392 | Passed |
SHA-256 / 6153f72e95a37b851a1e588666affeca9d596d8616a3d0c804d8f6af992d0a83
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:
if dm >= rate['v'] * dt and dt > 0:
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: switch speed boundary', [[[10, 50]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}],
402),
('partial repair probe: switch speed boundary',
[[[0, 7], [10, 20], [1, 7]], {'flag': 390, 'per_hour': 3600, 'per_km': 245, 'v': 5}], 403),
('second regression',
[[[30, 60], [0, 3], [0, 0], [10, 0], [10, 53], [30, 7]],
{'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}],
390),
('normal control 1',
[[[10, 49], [10, 0], [5, 24], [10, 53], [0, 0]], {'flag': 300, 'per_hour': 3600, 'per_km': 245, 'v': 5}],
338),
('normal control 2',
[[[1, 11], [30, 330], [0, 0], [30, 149]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 413),
('normal control 3', [[[1, 7], [10, 49]], {'flag': 390, 'per_hour': 3900, 'per_km': 230, 'v': 5}], 402),
('normal control 4', [[[1, 8]], {'flag': 390, 'per_hour': 4150, 'per_km': 245, 'v': 5}], 392)],
[('regression: switch speed boundary',
[[[0, 0], [5, 24], [1, 8], [1, 11], [10, 50]], {'flag': 300, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
321),
('partial repair probe: switch speed boundary',
[[[30, 150], [10, 0], [30, 153], [0, 7]], {'flag': 390, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 463),
('second regression',
[[[30, 7], [30, 149], [10, 50], [10, 49], [5, 7]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}],
484),
('normal control 1', [[[0, 0]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 390),
('normal control 2', [[[30, 149], [10, 53]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 435),
('normal control 3', [[[1, 0], [10, 0]], {'flag': 300, 'per_hour': 3900, 'per_km': 230, 'v': 5}], 312),
('normal control 4', [[[1, 5], [10, 110], [5, 24]], {'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}],
418)],
[('regression: switch speed boundary',
[[[10, 110], [1, 5], [0, 3], [5, 55]], {'flag': 390, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 424),
('partial repair probe: switch speed boundary',
[[[30, 7], [10, 0], [0, 0], [30, 153], [30, 0], [0, 7]],
{'flag': 300, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
407),
('second regression',
[[[0, 3], [5, 25], [10, 0], [0, 7], [1, 7]], {'flag': 300, 'per_hour': 3600, 'per_km': 245, 'v': 5}],
320),
('normal control 1', [[[30, 149], [0, 0]], {'flag': 390, 'per_hour': 3600, 'per_km': 245, 'v': 5}], 420),
('normal control 2', [[[10, 110], [10, 7]], {'flag': 300, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 332),
('normal control 3', [[[30, 60], [1, 7], [0, 0]], {'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}],
424),
('normal control 4', [[[5, 0], [5, 0], [1, 2]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}],
403)],
[('regression: switch speed boundary',
[[[10, 0], [30, 0], [10, 50], [30, 60], [5, 55], [5, 24]],
{'flag': 390, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
489),
('partial repair probe: switch speed boundary',
[[[0, 7], [30, 149], [10, 7], [30, 60], [0, 0], [30, 149]],
{'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}],
491),
('second regression',
[[[10, 20], [1, 11], [5, 10], [30, 7], [0, 0], [0, 7]],
{'flag': 390, 'per_hour': 4150, 'per_km': 245, 'v': 5}],
446),
('normal control 1',
[[[1, 5], [1, 8], [5, 25], [5, 10], [0, 0], [10, 20]],
{'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}],
414),
('normal control 2',
[[[10, 53], [30, 7], [10, 20]], {'flag': 300, 'per_hour': 3600, 'per_km': 245, 'v': 5}], 353),
('normal control 3', [[[10, 0], [30, 0]], {'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}], 433),
('normal control 4',
[[[1, 4], [1, 5], [30, 7], [10, 110]], {'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 444)],
[('regression: switch speed boundary',
[[[1, 5], [10, 110], [10, 50], [1, 7]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 334),
('partial repair probe: switch speed boundary',
[[[0, 7]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 392),
('second regression',
[[[10, 20], [5, 0], [10, 110], [10, 49], [5, 25]], {'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}],
360),
('normal control 1', [[[10, 53]], {'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 401),
('normal control 2', [[[0, 0], [1, 8], [5, 24]], {'flag': 300, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
307),
('normal control 3', [[[10, 110]], {'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}], 322),
('normal control 4', [[[1, 4], [1, 5]], {'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 302)]]
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: switch speed boundary | 402 | 402 | Passed |
| partial repair probe: switch speed boundary | 402 | 403 | Failed |
| second regression | 389 | 390 | Failed |
| normal control 1 | 338 | 338 | Passed |
| normal control 2 | 413 | 413 | Passed |
| normal control 3 | 402 | 402 | Passed |
| normal control 4 | 392 | 392 | Passed |
SHA-256 / d7b5cb3fe11eb71b574c28b9ed13ebadddb80e6e937fb1d1f98addbbad45f61a
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 7 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 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.510105+00:00.
Case digest / 8ff2ee142893bc59679de811643f7dc2e47805c014e6c8b40f3709da8f22feca