FA-85776 / Ride-hailing fare and surge pricing / Open access
Meter rounds every segment to a cent · case 01
Trips with many short segments drift from the exact tariff.
ROOT CAUSE
Each segment charge is rounded before accumulation.
THE FAILURE
Each segment charge is rounded before accumulation.
Unsuccessful approach: Rounding only distance segments still accumulates rounding drift.
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 += (dm * rate['per_km'] * 2 + 1000) // 2000
else:
acc += (dt * rate['per_hour'] * 2 + 3600) // 7200
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: per-segment rounding',
[[[10, 7], [5, 10]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 317),
('partial repair probe: per-segment rounding',
[[[0, 3], [5, 25], [10, 53], [10, 110]], {'flag': 300, 'per_hour': 3900, 'per_km': 199, 'v': 5}], 338),
('second regression', [[[1, 8], [10, 49]], {'flag': 390, 'per_hour': 4150, 'per_km': 245, 'v': 5}], 403),
('normal control 1', [[[10, 20]], {'flag': 300, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 310),
('normal control 2', [[[30, 330], [10, 0], [5, 0]], {'flag': 300, 'per_hour': 3600, 'per_km': 199, 'v': 5}],
381),
('normal control 3', [[[10, 0], [0, 0], [1, 7]], {'flag': 390, 'per_hour': 4150, 'per_km': 199, 'v': 5}],
403),
('normal control 4', [[[0, 0], [10, 110]], {'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}], 412)],
[('regression: per-segment rounding',
[[[10, 7], [10, 50], [1, 0], [5, 7], [10, 110]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}],
355),
('partial repair probe: per-segment rounding',
[[[1, 7], [1, 7], [30, 149]], {'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 423),
('second regression',
[[[0, 0], [10, 49], [10, 53], [30, 60], [30, 150]],
{'flag': 390, 'per_hour': 4150, 'per_km': 245, 'v': 5}],
486),
('normal control 1', [[[0, 0], [5, 10], [0, 0]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}],
396),
('normal control 2',
[[[10, 0], [0, 3], [1, 11], [10, 7]], {'flag': 300, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 323),
('normal control 3', [[[0, 0], [0, 0]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 300),
('normal control 4', [[[1, 5], [10, 49]], {'flag': 300, 'per_hour': 3600, 'per_km': 245, 'v': 5}], 311)],
[('regression: per-segment rounding',
[[[30, 149], [1, 8], [30, 150], [30, 7], [30, 149]],
{'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}],
435),
('partial repair probe: per-segment rounding',
[[[10, 20], [1, 2], [30, 149], [10, 110]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 463),
('second regression',
[[[0, 7], [5, 0], [10, 49], [5, 7], [5, 24]], {'flag': 390, 'per_hour': 4150, 'per_km': 245, 'v': 5}],
421),
('normal control 1',
[[[30, 150], [0, 0], [30, 0], [5, 7], [30, 149], [10, 0]],
{'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}],
495),
('normal control 2', [[[30, 0], [10, 49]], {'flag': 390, 'per_hour': 3600, 'per_km': 245, 'v': 5}], 430),
('normal control 3', [[[1, 7], [1, 8], [1, 4]], {'flag': 300, 'per_hour': 3900, 'per_km': 230, 'v': 5}],
305),
('normal control 4', [[[10, 49]], {'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}], 401)],
[('regression: per-segment rounding',
[[[5, 10], [10, 49], [10, 50], [1, 0], [30, 7], [1, 5]],
{'flag': 300, 'per_hour': 3900, 'per_km': 230, 'v': 5}],
362),
('partial repair probe: per-segment rounding',
[[[1, 8], [0, 0], [10, 50], [1, 7]], {'flag': 390, 'per_hour': 3900, 'per_km': 230, 'v': 5}], 405),
('second regression',
[[[10, 7], [1, 4], [0, 7], [10, 50], [5, 24]], {'flag': 390, 'per_hour': 3900, 'per_km': 230, 'v': 5}],
420),
('normal control 1', [[[30, 60], [10, 0], [10, 7]], {'flag': 390, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
440),
('normal control 2', [[[10, 7]], {'flag': 390, 'per_hour': 3600, 'per_km': 230, 'v': 5}], 400),
('normal control 3',
[[[10, 20], [30, 7], [0, 0], [30, 330], [1, 4]], {'flag': 390, 'per_hour': 3600, 'per_km': 245, 'v': 5}],
512),
('normal control 4',
[[[10, 0], [10, 53], [1, 0], [1, 2], [0, 0]], {'flag': 390, 'per_hour': 3600, 'per_km': 245, 'v': 5}],
415)],
[('regression: per-segment rounding',
[[[1, 5], [30, 330], [5, 7], [1, 4], [5, 28], [30, 0]],
{'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}],
498),
('partial repair probe: per-segment rounding',
[[[1, 11], [30, 149], [5, 25], [0, 0], [10, 110]], {'flag': 390, 'per_hour': 3900, 'per_km': 230, 'v': 5}],
456),
('second regression',
[[[10, 0], [30, 7], [30, 60], [30, 330]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 457),
('normal control 1', [[[1, 8]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 392),
('normal control 2', [[[10, 0], [0, 0]], {'flag': 390, 'per_hour': 3600, 'per_km': 245, 'v': 5}], 400),
('normal control 3', [[[10, 20]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 402),
('normal control 4',
[[[0, 0], [10, 53], [30, 149], [10, 50], [10, 50], [1, 7]],
{'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}],
372)]]
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: per-segment rounding | 318 | 317 | Failed |
| partial repair probe: per-segment rounding | 339 | 338 | Failed |
| second regression | 404 | 403 | Failed |
| normal control 1 | 310 | 310 | Passed |
| normal control 2 | 381 | 381 | Passed |
| normal control 3 | 403 | 403 | Passed |
| normal control 4 | 412 | 412 | Passed |
SHA-256 / 1b3ec7d6d1880638f7d3354507f9e1177680a19954438c4b80b835cb1d094e4e
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:
acc += (dm * rate['per_km'] * 2 + 1000) // 2000
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: per-segment rounding',
[[[10, 7], [5, 10]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 317),
('partial repair probe: per-segment rounding',
[[[0, 3], [5, 25], [10, 53], [10, 110]], {'flag': 300, 'per_hour': 3900, 'per_km': 199, 'v': 5}], 338),
('second regression', [[[1, 8], [10, 49]], {'flag': 390, 'per_hour': 4150, 'per_km': 245, 'v': 5}], 403),
('normal control 1', [[[10, 20]], {'flag': 300, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 310),
('normal control 2', [[[30, 330], [10, 0], [5, 0]], {'flag': 300, 'per_hour': 3600, 'per_km': 199, 'v': 5}],
381),
('normal control 3', [[[10, 0], [0, 0], [1, 7]], {'flag': 390, 'per_hour': 4150, 'per_km': 199, 'v': 5}],
403),
('normal control 4', [[[0, 0], [10, 110]], {'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}], 412)],
[('regression: per-segment rounding',
[[[10, 7], [10, 50], [1, 0], [5, 7], [10, 110]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}],
355),
('partial repair probe: per-segment rounding',
[[[1, 7], [1, 7], [30, 149]], {'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 423),
('second regression',
[[[0, 0], [10, 49], [10, 53], [30, 60], [30, 150]],
{'flag': 390, 'per_hour': 4150, 'per_km': 245, 'v': 5}],
486),
('normal control 1', [[[0, 0], [5, 10], [0, 0]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}],
396),
('normal control 2',
[[[10, 0], [0, 3], [1, 11], [10, 7]], {'flag': 300, 'per_hour': 3600, 'per_km': 199, 'v': 5}], 323),
('normal control 3', [[[0, 0], [0, 0]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 300),
('normal control 4', [[[1, 5], [10, 49]], {'flag': 300, 'per_hour': 3600, 'per_km': 245, 'v': 5}], 311)],
[('regression: per-segment rounding',
[[[30, 149], [1, 8], [30, 150], [30, 7], [30, 149]],
{'flag': 300, 'per_hour': 4150, 'per_km': 199, 'v': 5}],
435),
('partial repair probe: per-segment rounding',
[[[10, 20], [1, 2], [30, 149], [10, 110]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 463),
('second regression',
[[[0, 7], [5, 0], [10, 49], [5, 7], [5, 24]], {'flag': 390, 'per_hour': 4150, 'per_km': 245, 'v': 5}],
421),
('normal control 1',
[[[30, 150], [0, 0], [30, 0], [5, 7], [30, 149], [10, 0]],
{'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}],
495),
('normal control 2', [[[30, 0], [10, 49]], {'flag': 390, 'per_hour': 3600, 'per_km': 245, 'v': 5}], 430),
('normal control 3', [[[1, 7], [1, 8], [1, 4]], {'flag': 300, 'per_hour': 3900, 'per_km': 230, 'v': 5}],
305),
('normal control 4', [[[10, 49]], {'flag': 390, 'per_hour': 3900, 'per_km': 199, 'v': 5}], 401)],
[('regression: per-segment rounding',
[[[5, 10], [10, 49], [10, 50], [1, 0], [30, 7], [1, 5]],
{'flag': 300, 'per_hour': 3900, 'per_km': 230, 'v': 5}],
362),
('partial repair probe: per-segment rounding',
[[[1, 8], [0, 0], [10, 50], [1, 7]], {'flag': 390, 'per_hour': 3900, 'per_km': 230, 'v': 5}], 405),
('second regression',
[[[10, 7], [1, 4], [0, 7], [10, 50], [5, 24]], {'flag': 390, 'per_hour': 3900, 'per_km': 230, 'v': 5}],
420),
('normal control 1', [[[30, 60], [10, 0], [10, 7]], {'flag': 390, 'per_hour': 3600, 'per_km': 230, 'v': 5}],
440),
('normal control 2', [[[10, 7]], {'flag': 390, 'per_hour': 3600, 'per_km': 230, 'v': 5}], 400),
('normal control 3',
[[[10, 20], [30, 7], [0, 0], [30, 330], [1, 4]], {'flag': 390, 'per_hour': 3600, 'per_km': 245, 'v': 5}],
512),
('normal control 4',
[[[10, 0], [10, 53], [1, 0], [1, 2], [0, 0]], {'flag': 390, 'per_hour': 3600, 'per_km': 245, 'v': 5}],
415)],
[('regression: per-segment rounding',
[[[1, 5], [30, 330], [5, 7], [1, 4], [5, 28], [30, 0]],
{'flag': 390, 'per_hour': 3600, 'per_km': 199, 'v': 5}],
498),
('partial repair probe: per-segment rounding',
[[[1, 11], [30, 149], [5, 25], [0, 0], [10, 110]], {'flag': 390, 'per_hour': 3900, 'per_km': 230, 'v': 5}],
456),
('second regression',
[[[10, 0], [30, 7], [30, 60], [30, 330]], {'flag': 300, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 457),
('normal control 1', [[[1, 8]], {'flag': 390, 'per_hour': 3900, 'per_km': 245, 'v': 5}], 392),
('normal control 2', [[[10, 0], [0, 0]], {'flag': 390, 'per_hour': 3600, 'per_km': 245, 'v': 5}], 400),
('normal control 3', [[[10, 20]], {'flag': 390, 'per_hour': 4150, 'per_km': 230, 'v': 5}], 402),
('normal control 4',
[[[0, 0], [10, 53], [30, 149], [10, 50], [10, 50], [1, 7]],
{'flag': 300, 'per_hour': 3900, 'per_km': 245, 'v': 5}],
372)]]
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: per-segment rounding | 317 | 317 | Passed |
| partial repair probe: per-segment rounding | 339 | 338 | Failed |
| second regression | 404 | 403 | Failed |
| normal control 1 | 310 | 310 | Passed |
| normal control 2 | 381 | 381 | Passed |
| normal control 3 | 403 | 403 | Passed |
| normal control 4 | 412 | 412 | Passed |
SHA-256 / d72d68ccc4c29fbba44bedfdb376bb14530051142dcca5b081f1874a65009779
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.518971+00:00.
Case digest / 09b2cc5783dce5e4437fdb37b6fd6b21c6e1cc858ea4d242d81c7e86a32e2529