FAILURE MAP
← Case archive

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

Any detour triggers a refund · case 01

Riders get refunds for routes only slightly longer than optimal.

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

ROOT CAUSE

The tolerance of 20% is missing from the eligibility check.

THE FAILURE

The tolerance of 20% is missing from the eligibility check.

Unsuccessful approach: A strict comparison refunds routes exactly 20% longer.

Case contract

Refund for inefficient routes: only when actual distance is more than 20% longer than optimal (actual*5 > optimal*6). Refund the whole extra distance at per_km (half up); refunds under 200 cents are not issued; the refund never takes the charge below the minimum fare. Return refund 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(charged, actual_m, optimal_m, per_km, minimum):
    if actual_m <= optimal_m:
        return 0
    refund = ((actual_m - optimal_m) * per_km * 2 + 1000) // 2000
    if refund < 200:
        return 0
    return max(0, min(refund, charged - minimum))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: inefficiency threshold', [2500, 14401, 12001, 100, 700], 0),
  ('partial repair probe: inefficiency threshold', [2500, 12000, 10000, 150, 700], 0),
  ('second regression', [2500, 9600, 8000, 150, 700], 0),
  ('normal control 1', [1200, 12001, 10000, 100, 700], 200),
  ('normal control 2', [700, 6000, 5000, 150, 700], 0),
  ('normal control 3', [1200, 7500, 5000, 100, 700], 250),
  ('normal control 4', [2500, 7500, 5000, 100, 700], 250)],
 [('regression: inefficiency threshold', [4000, 14401, 12001, 100, 700], 0),
  ('partial repair probe: inefficiency threshold', [4000, 12000, 10000, 100, 700], 0),
  ('second regression', [4000, 9600, 8000, 150, 700], 0),
  ('normal control 1', [1200, 18001, 12001, 150, 700], 500),
  ('normal control 2', [1200, 5100, 5000, 150, 700], 0),
  ('normal control 3', [2500, 8100, 8000, 100, 700], 0),
  ('normal control 4', [2500, 8000, 8000, 100, 700], 0)],
 [('regression: inefficiency threshold', [4000, 9600, 8000, 150, 700], 0),
  ('partial repair probe: inefficiency threshold', [2500, 12000, 10000, 100, 700], 0),
  ('second regression', [2500, 14401, 12001, 150, 700], 0),
  ('normal control 1', [700, 5000, 5000, 100, 700], 0),
  ('normal control 2', [700, 10000, 10000, 150, 700], 0),
  ('normal control 3', [1200, 6001, 5000, 150, 700], 0),
  ('normal control 4', [700, 10000, 5000, 100, 700], 0)],
 [('regression: inefficiency threshold', [2500, 14401, 12001, 100, 700], 0),
  ('partial repair probe: inefficiency threshold', [1200, 9600, 8000, 150, 700], 0),
  ('second regression', [4000, 12000, 10000, 100, 700], 0),
  ('normal control 1', [1200, 20000, 10000, 100, 700], 500),
  ('normal control 2', [1200, 8100, 8000, 150, 700], 0),
  ('normal control 3', [2500, 5100, 5000, 150, 700], 0),
  ('normal control 4', [1200, 10000, 10000, 150, 700], 0)],
 [('regression: inefficiency threshold', [2500, 9600, 8000, 150, 700], 0),
  ('partial repair probe: inefficiency threshold', [2500, 12000, 10000, 100, 700], 0),
  ('second regression', [1200, 9600, 8000, 150, 700], 0),
  ('normal control 1', [4000, 12001, 10000, 100, 700], 200),
  ('normal control 2', [700, 9601, 8000, 150, 700], 0), ('normal control 3', [2500, 6000, 5000, 100, 700], 0),
  ('normal control 4', [2500, 10000, 5000, 150, 700], 750)]]
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: inefficiency threshold2400Failed
partial repair probe: inefficiency threshold3000Failed
second regression2400Failed
normal control 1200200Passed
normal control 200Passed
normal control 3250250Passed
normal control 4250250Passed

SHA-256 / b0d14fc249cdc0ab3302807e2091dcf39322a1517dbfe7e62781c11e367074fb

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(charged, actual_m, optimal_m, per_km, minimum):
    if actual_m * 5 < optimal_m * 6:
        return 0
    refund = ((actual_m - optimal_m) * per_km * 2 + 1000) // 2000
    if refund < 200:
        return 0
    return max(0, min(refund, charged - minimum))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: inefficiency threshold', [2500, 14401, 12001, 100, 700], 0),
  ('partial repair probe: inefficiency threshold', [2500, 12000, 10000, 150, 700], 0),
  ('second regression', [2500, 9600, 8000, 150, 700], 0),
  ('normal control 1', [1200, 12001, 10000, 100, 700], 200),
  ('normal control 2', [700, 6000, 5000, 150, 700], 0),
  ('normal control 3', [1200, 7500, 5000, 100, 700], 250),
  ('normal control 4', [2500, 7500, 5000, 100, 700], 250)],
 [('regression: inefficiency threshold', [4000, 14401, 12001, 100, 700], 0),
  ('partial repair probe: inefficiency threshold', [4000, 12000, 10000, 100, 700], 0),
  ('second regression', [4000, 9600, 8000, 150, 700], 0),
  ('normal control 1', [1200, 18001, 12001, 150, 700], 500),
  ('normal control 2', [1200, 5100, 5000, 150, 700], 0),
  ('normal control 3', [2500, 8100, 8000, 100, 700], 0),
  ('normal control 4', [2500, 8000, 8000, 100, 700], 0)],
 [('regression: inefficiency threshold', [4000, 9600, 8000, 150, 700], 0),
  ('partial repair probe: inefficiency threshold', [2500, 12000, 10000, 100, 700], 0),
  ('second regression', [2500, 14401, 12001, 150, 700], 0),
  ('normal control 1', [700, 5000, 5000, 100, 700], 0),
  ('normal control 2', [700, 10000, 10000, 150, 700], 0),
  ('normal control 3', [1200, 6001, 5000, 150, 700], 0),
  ('normal control 4', [700, 10000, 5000, 100, 700], 0)],
 [('regression: inefficiency threshold', [2500, 14401, 12001, 100, 700], 0),
  ('partial repair probe: inefficiency threshold', [1200, 9600, 8000, 150, 700], 0),
  ('second regression', [4000, 12000, 10000, 100, 700], 0),
  ('normal control 1', [1200, 20000, 10000, 100, 700], 500),
  ('normal control 2', [1200, 8100, 8000, 150, 700], 0),
  ('normal control 3', [2500, 5100, 5000, 150, 700], 0),
  ('normal control 4', [1200, 10000, 10000, 150, 700], 0)],
 [('regression: inefficiency threshold', [2500, 9600, 8000, 150, 700], 0),
  ('partial repair probe: inefficiency threshold', [2500, 12000, 10000, 100, 700], 0),
  ('second regression', [1200, 9600, 8000, 150, 700], 0),
  ('normal control 1', [4000, 12001, 10000, 100, 700], 200),
  ('normal control 2', [700, 9601, 8000, 150, 700], 0), ('normal control 3', [2500, 6000, 5000, 100, 700], 0),
  ('normal control 4', [2500, 10000, 5000, 150, 700], 750)]]
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: inefficiency threshold00Passed
partial repair probe: inefficiency threshold3000Failed
second regression2400Failed
normal control 1200200Passed
normal control 200Passed
normal control 3250250Passed
normal control 4250250Passed

SHA-256 / fc238a59d15c173cc11bf0c73a6734f03a3a1ffaef405b579454cd970fd8af50

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

Case digest / ff858d64b00d710ee4fdf26abf63efcd1643f58ad4819b9faa39055720aa2b96