FAILURE MAP
← Case archive

FA-85666 / Ride-hailing fare and surge pricing / Open access

Whole pickup distance billed once past the threshold · case 01

A 6 km pickup is charged for all 6 km instead of the 1.2 km beyond the threshold.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The distance part uses total pickup meters once the threshold is exceeded.

THE FAILURE

The distance part uses total pickup meters once the threshold is exceeded.

Unsuccessful approach: Requiring the time threshold as well drops the distance part on fast long pickups.

Case contract

A long-pickup fee compensates drivers for pickups beyond thr_m meters and thr_s seconds. The distance part is per_km on meters beyond thr_m (prorated, half up); the time part is per_min on each started minute beyond thr_s; each part uses only its own positive excess. The total is capped at cap cents.

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(pickup_m, pickup_s, policy):
    ex_m = pickup_m if pickup_m > policy['thr_m'] else 0
    ex_s = max(0, pickup_s - policy['thr_s'])
    fee = (ex_m * policy['per_km'] * 2 + 1000) // 2000 + -(-ex_s // 60) * policy['per_min']
    return min(fee, policy['cap'])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: excess distance only',
   [6000, 660, {'cap': 900, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}], 153),
  ('partial repair probe: excess distance only',
   [12000, 300, {'cap': 600, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}], 600),
  ('second regression', [4801, 900, {'cap': 900, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   225),
  ('normal control 1', [4800, 900, {'cap': 900, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   225),
  ('normal control 2', [3000, 660, {'cap': 600, 'per_km': 90, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   30),
  ('normal control 3', [2000, 900, {'cap': 900, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   225),
  ('normal control 4', [3000, 300, {'cap': 600, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   0)],
 [('regression: excess distance only',
   [4801, 400, {'cap': 600, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}], 0),
  ('partial repair probe: excess distance only',
   [12000, 300, {'cap': 600, 'per_km': 90, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}], 600),
  ('second regression', [6000, 601, {'cap': 900, 'per_km': 90, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   138),
  ('normal control 1', [3000, 601, {'cap': 600, 'per_km': 90, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   30),
  ('normal control 2', [4800, 900, {'cap': 600, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   225),
  ('normal control 3', [4800, 900, {'cap': 900, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   225),
  ('normal control 4', [4800, 400, {'cap': 900, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   0)],
 [('regression: excess distance only',
   [12000, 900, {'cap': 600, 'per_km': 60, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}], 582),
  ('partial repair probe: excess distance only',
   [12000, 300, {'cap': 600, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}], 432),
  ('second regression', [4801, 400, {'cap': 600, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   0),
  ('normal control 1', [3000, 300, {'cap': 600, 'per_km': 60, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   0),
  ('normal control 2', [3000, 660, {'cap': 600, 'per_km': 90, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   30),
  ('normal control 3', [2000, 601, {'cap': 600, 'per_km': 60, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   30),
  ('normal control 4', [4800, 660, {'cap': 600, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   45)],
 [('regression: excess distance only',
   [6000, 900, {'cap': 900, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}], 333),
  ('partial repair probe: excess distance only',
   [6000, 300, {'cap': 900, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}], 72),
  ('second regression', [4801, 300, {'cap': 600, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   0),
  ('normal control 1', [2000, 601, {'cap': 900, 'per_km': 60, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   30),
  ('normal control 2', [2000, 300, {'cap': 600, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   0),
  ('normal control 3', [2000, 400, {'cap': 900, 'per_km': 60, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   0),
  ('normal control 4', [4800, 601, {'cap': 900, 'per_km': 90, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   30)],
 [('regression: excess distance only',
   [4801, 601, {'cap': 600, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}], 45),
  ('partial repair probe: excess distance only',
   [12000, 600, {'cap': 900, 'per_km': 90, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}], 648),
  ('second regression', [12000, 601, {'cap': 600, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   477),
  ('normal control 1', [2000, 600, {'cap': 900, 'per_km': 60, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   0),
  ('normal control 2', [3000, 300, {'cap': 900, 'per_km': 60, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   0),
  ('normal control 3', [4800, 900, {'cap': 600, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   225),
  ('normal control 4', [2000, 601, {'cap': 600, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   45)]]
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 fixtureActualExpectedOutcome
regression: excess distance only585153Failed
partial repair probe: excess distance only600600Passed
second regression513225Failed
normal control 1225225Passed
normal control 23030Passed
normal control 3225225Passed
normal control 400Passed

SHA-256 / 345b12ea78bcf2660d6fa471ffc1e12f8112cd0736a64729f3b2bb0298688a6c

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(pickup_m, pickup_s, policy):
    ex_m = max(0, pickup_m - policy['thr_m']) if pickup_s > policy['thr_s'] else 0
    ex_s = max(0, pickup_s - policy['thr_s'])
    fee = (ex_m * policy['per_km'] * 2 + 1000) // 2000 + -(-ex_s // 60) * policy['per_min']
    return min(fee, policy['cap'])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: excess distance only',
   [6000, 660, {'cap': 900, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}], 153),
  ('partial repair probe: excess distance only',
   [12000, 300, {'cap': 600, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}], 600),
  ('second regression', [4801, 900, {'cap': 900, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   225),
  ('normal control 1', [4800, 900, {'cap': 900, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   225),
  ('normal control 2', [3000, 660, {'cap': 600, 'per_km': 90, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   30),
  ('normal control 3', [2000, 900, {'cap': 900, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   225),
  ('normal control 4', [3000, 300, {'cap': 600, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   0)],
 [('regression: excess distance only',
   [4801, 400, {'cap': 600, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}], 0),
  ('partial repair probe: excess distance only',
   [12000, 300, {'cap': 600, 'per_km': 90, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}], 600),
  ('second regression', [6000, 601, {'cap': 900, 'per_km': 90, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   138),
  ('normal control 1', [3000, 601, {'cap': 600, 'per_km': 90, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   30),
  ('normal control 2', [4800, 900, {'cap': 600, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   225),
  ('normal control 3', [4800, 900, {'cap': 900, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   225),
  ('normal control 4', [4800, 400, {'cap': 900, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   0)],
 [('regression: excess distance only',
   [12000, 900, {'cap': 600, 'per_km': 60, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}], 582),
  ('partial repair probe: excess distance only',
   [12000, 300, {'cap': 600, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}], 432),
  ('second regression', [4801, 400, {'cap': 600, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   0),
  ('normal control 1', [3000, 300, {'cap': 600, 'per_km': 60, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   0),
  ('normal control 2', [3000, 660, {'cap': 600, 'per_km': 90, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   30),
  ('normal control 3', [2000, 601, {'cap': 600, 'per_km': 60, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   30),
  ('normal control 4', [4800, 660, {'cap': 600, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   45)],
 [('regression: excess distance only',
   [6000, 900, {'cap': 900, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}], 333),
  ('partial repair probe: excess distance only',
   [6000, 300, {'cap': 900, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}], 72),
  ('second regression', [4801, 300, {'cap': 600, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   0),
  ('normal control 1', [2000, 601, {'cap': 900, 'per_km': 60, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   30),
  ('normal control 2', [2000, 300, {'cap': 600, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   0),
  ('normal control 3', [2000, 400, {'cap': 900, 'per_km': 60, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   0),
  ('normal control 4', [4800, 601, {'cap': 900, 'per_km': 90, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   30)],
 [('regression: excess distance only',
   [4801, 601, {'cap': 600, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}], 45),
  ('partial repair probe: excess distance only',
   [12000, 600, {'cap': 900, 'per_km': 90, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}], 648),
  ('second regression', [12000, 601, {'cap': 600, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   477),
  ('normal control 1', [2000, 600, {'cap': 900, 'per_km': 60, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   0),
  ('normal control 2', [3000, 300, {'cap': 900, 'per_km': 60, 'per_min': 30, 'thr_m': 4800, 'thr_s': 600}],
   0),
  ('normal control 3', [4800, 900, {'cap': 600, 'per_km': 90, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   225),
  ('normal control 4', [2000, 601, {'cap': 600, 'per_km': 60, 'per_min': 45, 'thr_m': 4800, 'thr_s': 600}],
   45)]]
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 fixtureActualExpectedOutcome
regression: excess distance only153153Passed
partial repair probe: excess distance only0600Failed
second regression225225Passed
normal control 1225225Passed
normal control 23030Passed
normal control 3225225Passed
normal control 400Passed

SHA-256 / 2591712d5a3d7bb0c2d007bb2ca651390313083525ca38ff108d05c7e30d8b8b

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:42.474445+00:00.

Case digest / 2d417624365f61fa1949827663a6c3452c15961f2a5ca15ce67d3ed15e3b1e9c