FA-85521 / Ride-hailing fare and surge pricing / Open access
Pings billed in arrival order · case 01
Out-of-order uploads zigzag the trace and inflate or reject distance.
ROOT CAUSE
Pings are processed in the order they were received instead of by timestamp.
THE FAILURE
Pings are processed in the order they were received instead of by timestamp.
Unsuccessful approach: Reversing a descending sort reverses same-timestamp pings, so duplicates keep the last one.
Case contract
Billable distance from GPS pings [t seconds, x m, y m, accuracy m, paused]. Sort by time (stable); drop pings with accuracy worse than max_acc; among remaining pings with the same timestamp keep the first. Walk the kept pings with an anchor: segment length is the floored Euclidean distance (isqrt); if it implies a speed above max_speed m/s the ping is discarded and the anchor stays; otherwise the segment is billed unless either endpoint is paused, and the anchor moves. Return total meters.
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
import math
N = 1
observations = []
def solve(pings, max_acc, max_speed):
kept = []
seen = set()
for p in pings:
if p[3] > max_acc:
continue
if p[0] in seen:
continue
seen.add(p[0])
kept.append(p)
total = 0
anchor = None
for p in kept:
if anchor is None:
anchor = p
continue
d = math.isqrt((p[1] - anchor[1]) ** 2 + (p[2] - anchor[2]) ** 2)
dt = p[0] - anchor[0]
if d > max_speed * dt:
continue
if not (p[4] or anchor[4]):
total += d
anchor = p
return total
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: time ordering',
[[[40, 1100, 58, 20, False], [25, 270, 5, 20, False], [35, 300, 5, 5, True], [10, 90, 20, 20, False],
[10, 150, 20, 20, False], [35, 700, 38, 20, False], [15, 210, 5, 25, False], [5, 45, 0, 20, True]],
20, 30],
180),
('partial repair probe: time ordering',
[[[0, 45, 0, 10, False], [5, 75, 20, 5, False], [5, 75, 5, 5, True], [5, 105, 25, 10, False]], 20, 30],
36),
('second regression',
[[[5, 60, -15, 60, True], [15, 60, 5, 25, True], [20, 120, -10, 20, False], [20, 150, 10, 20, True],
[30, 150, -5, 20, False]],
20, 30],
30),
('normal control 1',
[[[5, 45, 20, 10, True], [5, 75, 53, 60, False], [15, 135, 73, 5, True], [20, 165, 73, 20, False],
[30, 565, 106, 5, True]],
20, 30],
0),
('normal control 2',
[[[5, 60, -15, 20, False], [10, 60, 5, 5, True], [15, 120, 25, 60, True], [25, 150, 10, 20, False]], 20,
30],
0),
('normal control 3',
[[[5, 60, -15, 60, True], [10, 60, 18, 20, True], [10, 460, 38, 60, False], [15, 490, 23, 20, False],
[20, 535, 8, 25, False], [20, 595, 41, 60, True], [25, 595, 74, 20, False], [35, 640, 74, 20, False]],
20, 30],
0),
('normal control 4',
[[[5, 400, 0, 25, True], [10, 445, 33, 60, False], [20, 445, 66, 25, False], [25, 490, 86, 10, False]], 20,
30],
0)],
[('regression: time ordering',
[[[20, 120, 20, 10, False], [30, 610, 53, 60, False], [20, 165, 20, 60, True], [10, 60, 20, 20, False],
[35, 670, 38, 20, True], [25, 210, 20, 60, False]],
20, 30],
60),
('partial repair probe: time ordering',
[[[10, 400, 0, 5, False], [20, 460, 20, 20, False], [20, 490, 5, 60, True], [20, 490, 25, 5, True],
[20, 490, 10, 20, False]],
20, 30],
63),
('second regression',
[[[15, 505, 38, 10, False], [5, 400, -15, 60, False], [20, 535, 23, 20, False], [10, 460, 18, 5, False]],
20, 30],
82),
('normal control 1',
[[[0, 60, 33, 20, False], [0, 90, 18, 20, False], [0, 135, 38, 20, False], [5, 535, 58, 20, False],
[5, 595, 58, 10, True]],
20, 30],
0),
('normal control 2',
[[[5, 400, -15, 10, False], [15, 400, -30, 10, False], [25, 430, -45, 20, False],
[35, 830, -60, 60, False], [35, 1230, -40, 20, False], [35, 1290, -40, 25, False]],
20, 30],
48),
('normal control 3',
[[[5, 0, 20, 60, False], [10, 400, 20, 5, False], [15, 430, 53, 20, False], [15, 430, 38, 60, False]], 20,
30],
44),
('normal control 4',
[[[5, 400, 20, 5, True], [15, 400, 20, 5, False], [25, 445, 5, 60, False], [35, 490, 5, 25, False],
[35, 520, 38, 60, True], [45, 550, 58, 20, False]],
20, 30],
154)],
[('regression: time ordering',
[[[20, 980, 113, 20, False], [5, 490, 73, 20, False], [20, 980, 113, 60, False], [0, 400, 20, 20, True],
[5, 430, 53, 20, False], [10, 535, 93, 20, False], [20, 935, 93, 5, False]],
20, 30],
49),
('partial repair probe: time ordering',
[[[5, 0, 0, 5, False], [15, 45, 20, 5, False], [20, 45, 5, 10, False], [20, 90, 38, 10, False],
[25, 490, 38, 20, False]],
20, 30],
64),
('second regression',
[[[10, 30, 33, 60, False], [20, 135, 33, 20, False], [15, 75, 33, 60, False], [35, 935, 73, 20, False],
[35, 980, 106, 20, True], [30, 535, 53, 5, False], [30, 135, 53, 20, False]],
20, 30],
0),
('normal control 1',
[[[10, 400, 0, 60, True], [15, 430, 20, 10, False], [15, 830, 40, 20, False], [25, 890, 73, 60, False]],
20, 30],
0),
('normal control 2',
[[[10, 400, -15, 5, False], [15, 460, -30, 10, True], [20, 520, 3, 10, True], [25, 550, 23, 20, True],
[30, 950, 8, 60, False]],
20, 30],
0),
('normal control 3',
[[[10, 60, 20, 20, False], [15, 60, 20, 60, False], [25, 460, 5, 60, False], [25, 490, 25, 25, True]], 20,
30],
0),
('normal control 4',
[[[10, 400, 0, 25, False], [10, 460, 0, 25, False], [15, 520, -15, 20, False], [15, 520, -15, 5, True]],
20, 30],
0)],
[('regression: time ordering',
[[[15, 860, 23, 5, True], [25, 1010, 23, 5, False], [20, 965, 23, 20, False], [10, 460, -10, 5, False],
[20, 905, 23, 5, False], [5, 400, 20, 5, False], [10, 430, 5, 5, True]],
20, 30],
67),
('partial repair probe: time ordering',
[[[15, 60, 20, 20, False], [25, 120, 58, 20, False], [25, 90, 25, 20, False], [15, 90, 40, 20, True],
[40, 165, 28, 60, False], [35, 165, 43, 20, False], [45, 195, 48, 5, False], [10, 0, 20, 20, True]],
20, 30],
148),
('second regression',
[[[35, 995, 38, 10, False], [20, 460, 20, 60, True], [35, 950, 53, 20, True], [40, 1055, 23, 20, False],
[10, 60, 20, 5, False], [25, 490, 20, 10, False], [15, 460, 20, 20, False], [35, 890, 53, 25, False]],
20, 30],
430),
('normal control 1',
[[[5, 60, 20, 5, False], [5, 90, 40, 5, False], [10, 150, 60, 60, False], [15, 195, 60, 20, True],
[25, 225, 93, 20, False], [30, 255, 93, 20, False]],
20, 30],
30),
('normal control 2',
[[[10, 445, -15, 20, False], [10, 400, 0, 25, True], [10, 490, -30, 5, False]], 20, 30], 0),
('normal control 3',
[[[10, 400, 20, 20, False], [10, 845, 38, 60, False], [15, 905, 38, 25, False], [10, 800, 20, 20, False],
[10, 845, 53, 20, True]],
20, 30],
0),
('normal control 4',
[[[5, 45, 20, 20, True], [15, 90, 20, 25, False], [20, 490, 53, 10, False], [20, 490, 86, 20, False]], 20,
30],
0)],
[('regression: time ordering',
[[[45, 1115, 153, 20, False], [15, 90, 20, 25, False], [20, 210, 60, 5, False], [15, 150, 40, 10, False],
[40, 1055, 133, 10, False], [35, 655, 113, 60, False], [10, 45, 20, 20, False],
[25, 255, 93, 25, False]],
20, 30],
169),
('partial repair probe: time ordering',
[[[40, 980, 3, 25, False], [10, 400, 0, 20, False], [15, 475, 18, 20, False], [10, 430, 33, 5, False],
[25, 905, 18, 10, True], [15, 875, 18, 20, False], [50, 980, 3, 25, True], [30, 935, 3, 5, False]],
20, 30],
77),
('second regression',
[[[10, 60, 53, 60, True], [25, 550, 139, 5, False], [15, 120, 86, 20, False], [5, 60, 33, 20, False],
[25, 150, 106, 10, True]],
20, 30],
80),
('normal control 1',
[[[15, 445, 40, 5, True], [15, 445, 20, 25, False], [15, 475, 25, 20, True], [10, 400, 20, 25, False]], 20,
30],
0),
('normal control 2',
[[[5, 45, 33, 20, False], [10, 90, 66, 25, True], [20, 520, 132, 20, False], [15, 120, 99, 10, False]], 20,
30],
99),
('normal control 3',
[[[5, 60, -15, 20, False], [5, 90, -15, 60, False], [15, 490, 18, 20, False], [15, 520, 18, 20, False],
[25, 565, 3, 20, False]],
20, 30],
505),
('normal control 4',
[[[5, 400, 0, 20, True], [15, 800, -15, 25, False], [15, 800, 18, 10, False], [25, 845, 51, 5, False]], 20,
30],
0)]]
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: time ordering | 0 | 180 | Failed |
| partial repair probe: time ordering | 36 | 36 | Passed |
| second regression | 30 | 30 | Passed |
| normal control 1 | 0 | 0 | Passed |
| normal control 2 | 0 | 0 | Passed |
| normal control 3 | 0 | 0 | Passed |
| normal control 4 | 0 | 0 | Passed |
SHA-256 / 3e4e3ccb580395eef4a4f4467578dd5a5535a5d4bf68f5816b593d804f10974c
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(pings, max_acc, max_speed):
kept = []
seen = set()
for p in sorted(pings, key=lambda p: -p[0])[::-1]:
if p[3] > max_acc:
continue
if p[0] in seen:
continue
seen.add(p[0])
kept.append(p)
total = 0
anchor = None
for p in kept:
if anchor is None:
anchor = p
continue
d = math.isqrt((p[1] - anchor[1]) ** 2 + (p[2] - anchor[2]) ** 2)
dt = p[0] - anchor[0]
if d > max_speed * dt:
continue
if not (p[4] or anchor[4]):
total += d
anchor = p
return total
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: time ordering',
[[[40, 1100, 58, 20, False], [25, 270, 5, 20, False], [35, 300, 5, 5, True], [10, 90, 20, 20, False],
[10, 150, 20, 20, False], [35, 700, 38, 20, False], [15, 210, 5, 25, False], [5, 45, 0, 20, True]],
20, 30],
180),
('partial repair probe: time ordering',
[[[0, 45, 0, 10, False], [5, 75, 20, 5, False], [5, 75, 5, 5, True], [5, 105, 25, 10, False]], 20, 30],
36),
('second regression',
[[[5, 60, -15, 60, True], [15, 60, 5, 25, True], [20, 120, -10, 20, False], [20, 150, 10, 20, True],
[30, 150, -5, 20, False]],
20, 30],
30),
('normal control 1',
[[[5, 45, 20, 10, True], [5, 75, 53, 60, False], [15, 135, 73, 5, True], [20, 165, 73, 20, False],
[30, 565, 106, 5, True]],
20, 30],
0),
('normal control 2',
[[[5, 60, -15, 20, False], [10, 60, 5, 5, True], [15, 120, 25, 60, True], [25, 150, 10, 20, False]], 20,
30],
0),
('normal control 3',
[[[5, 60, -15, 60, True], [10, 60, 18, 20, True], [10, 460, 38, 60, False], [15, 490, 23, 20, False],
[20, 535, 8, 25, False], [20, 595, 41, 60, True], [25, 595, 74, 20, False], [35, 640, 74, 20, False]],
20, 30],
0),
('normal control 4',
[[[5, 400, 0, 25, True], [10, 445, 33, 60, False], [20, 445, 66, 25, False], [25, 490, 86, 10, False]], 20,
30],
0)],
[('regression: time ordering',
[[[20, 120, 20, 10, False], [30, 610, 53, 60, False], [20, 165, 20, 60, True], [10, 60, 20, 20, False],
[35, 670, 38, 20, True], [25, 210, 20, 60, False]],
20, 30],
60),
('partial repair probe: time ordering',
[[[10, 400, 0, 5, False], [20, 460, 20, 20, False], [20, 490, 5, 60, True], [20, 490, 25, 5, True],
[20, 490, 10, 20, False]],
20, 30],
63),
('second regression',
[[[15, 505, 38, 10, False], [5, 400, -15, 60, False], [20, 535, 23, 20, False], [10, 460, 18, 5, False]],
20, 30],
82),
('normal control 1',
[[[0, 60, 33, 20, False], [0, 90, 18, 20, False], [0, 135, 38, 20, False], [5, 535, 58, 20, False],
[5, 595, 58, 10, True]],
20, 30],
0),
('normal control 2',
[[[5, 400, -15, 10, False], [15, 400, -30, 10, False], [25, 430, -45, 20, False],
[35, 830, -60, 60, False], [35, 1230, -40, 20, False], [35, 1290, -40, 25, False]],
20, 30],
48),
('normal control 3',
[[[5, 0, 20, 60, False], [10, 400, 20, 5, False], [15, 430, 53, 20, False], [15, 430, 38, 60, False]], 20,
30],
44),
('normal control 4',
[[[5, 400, 20, 5, True], [15, 400, 20, 5, False], [25, 445, 5, 60, False], [35, 490, 5, 25, False],
[35, 520, 38, 60, True], [45, 550, 58, 20, False]],
20, 30],
154)],
[('regression: time ordering',
[[[20, 980, 113, 20, False], [5, 490, 73, 20, False], [20, 980, 113, 60, False], [0, 400, 20, 20, True],
[5, 430, 53, 20, False], [10, 535, 93, 20, False], [20, 935, 93, 5, False]],
20, 30],
49),
('partial repair probe: time ordering',
[[[5, 0, 0, 5, False], [15, 45, 20, 5, False], [20, 45, 5, 10, False], [20, 90, 38, 10, False],
[25, 490, 38, 20, False]],
20, 30],
64),
('second regression',
[[[10, 30, 33, 60, False], [20, 135, 33, 20, False], [15, 75, 33, 60, False], [35, 935, 73, 20, False],
[35, 980, 106, 20, True], [30, 535, 53, 5, False], [30, 135, 53, 20, False]],
20, 30],
0),
('normal control 1',
[[[10, 400, 0, 60, True], [15, 430, 20, 10, False], [15, 830, 40, 20, False], [25, 890, 73, 60, False]],
20, 30],
0),
('normal control 2',
[[[10, 400, -15, 5, False], [15, 460, -30, 10, True], [20, 520, 3, 10, True], [25, 550, 23, 20, True],
[30, 950, 8, 60, False]],
20, 30],
0),
('normal control 3',
[[[10, 60, 20, 20, False], [15, 60, 20, 60, False], [25, 460, 5, 60, False], [25, 490, 25, 25, True]], 20,
30],
0),
('normal control 4',
[[[10, 400, 0, 25, False], [10, 460, 0, 25, False], [15, 520, -15, 20, False], [15, 520, -15, 5, True]],
20, 30],
0)],
[('regression: time ordering',
[[[15, 860, 23, 5, True], [25, 1010, 23, 5, False], [20, 965, 23, 20, False], [10, 460, -10, 5, False],
[20, 905, 23, 5, False], [5, 400, 20, 5, False], [10, 430, 5, 5, True]],
20, 30],
67),
('partial repair probe: time ordering',
[[[15, 60, 20, 20, False], [25, 120, 58, 20, False], [25, 90, 25, 20, False], [15, 90, 40, 20, True],
[40, 165, 28, 60, False], [35, 165, 43, 20, False], [45, 195, 48, 5, False], [10, 0, 20, 20, True]],
20, 30],
148),
('second regression',
[[[35, 995, 38, 10, False], [20, 460, 20, 60, True], [35, 950, 53, 20, True], [40, 1055, 23, 20, False],
[10, 60, 20, 5, False], [25, 490, 20, 10, False], [15, 460, 20, 20, False], [35, 890, 53, 25, False]],
20, 30],
430),
('normal control 1',
[[[5, 60, 20, 5, False], [5, 90, 40, 5, False], [10, 150, 60, 60, False], [15, 195, 60, 20, True],
[25, 225, 93, 20, False], [30, 255, 93, 20, False]],
20, 30],
30),
('normal control 2',
[[[10, 445, -15, 20, False], [10, 400, 0, 25, True], [10, 490, -30, 5, False]], 20, 30], 0),
('normal control 3',
[[[10, 400, 20, 20, False], [10, 845, 38, 60, False], [15, 905, 38, 25, False], [10, 800, 20, 20, False],
[10, 845, 53, 20, True]],
20, 30],
0),
('normal control 4',
[[[5, 45, 20, 20, True], [15, 90, 20, 25, False], [20, 490, 53, 10, False], [20, 490, 86, 20, False]], 20,
30],
0)],
[('regression: time ordering',
[[[45, 1115, 153, 20, False], [15, 90, 20, 25, False], [20, 210, 60, 5, False], [15, 150, 40, 10, False],
[40, 1055, 133, 10, False], [35, 655, 113, 60, False], [10, 45, 20, 20, False],
[25, 255, 93, 25, False]],
20, 30],
169),
('partial repair probe: time ordering',
[[[40, 980, 3, 25, False], [10, 400, 0, 20, False], [15, 475, 18, 20, False], [10, 430, 33, 5, False],
[25, 905, 18, 10, True], [15, 875, 18, 20, False], [50, 980, 3, 25, True], [30, 935, 3, 5, False]],
20, 30],
77),
('second regression',
[[[10, 60, 53, 60, True], [25, 550, 139, 5, False], [15, 120, 86, 20, False], [5, 60, 33, 20, False],
[25, 150, 106, 10, True]],
20, 30],
80),
('normal control 1',
[[[15, 445, 40, 5, True], [15, 445, 20, 25, False], [15, 475, 25, 20, True], [10, 400, 20, 25, False]], 20,
30],
0),
('normal control 2',
[[[5, 45, 33, 20, False], [10, 90, 66, 25, True], [20, 520, 132, 20, False], [15, 120, 99, 10, False]], 20,
30],
99),
('normal control 3',
[[[5, 60, -15, 20, False], [5, 90, -15, 60, False], [15, 490, 18, 20, False], [15, 520, 18, 20, False],
[25, 565, 3, 20, False]],
20, 30],
505),
('normal control 4',
[[[5, 400, 0, 20, True], [15, 800, -15, 25, False], [15, 800, 18, 10, False], [25, 845, 51, 5, False]], 20,
30],
0)]]
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: time ordering | 120 | 180 | Failed |
| partial repair probe: time ordering | 65 | 36 | Failed |
| second regression | 0 | 30 | Failed |
| normal control 1 | 0 | 0 | Passed |
| normal control 2 | 0 | 0 | Passed |
| normal control 3 | 0 | 0 | Passed |
| normal control 4 | 0 | 0 | Passed |
SHA-256 / e262e4212d13f95e489b69eb42cddfff378cd31b4cf88fcd3e312224f3f94df8
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:41.149608+00:00.
Case digest / 8476f8cf6c1c87c22d520de7756793aa0a21034fa04c97b64cbc2bbb290eb93b