FAILURE MAP
← Case archive

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

Refund of exactly two dollars suppressed · case 01

A computed 2.00 refund is never issued.

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

ROOT CAUSE

The small-refund filter uses <=.

THE FAILURE

The small-refund filter uses <=.

Unsuccessful approach: Comparing against 2 treats the dollar threshold as cents.

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 * 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: small refund suppression', [1200, 12001, 10000, 100, 700], 200),
  ('partial repair probe: small refund suppression', [2500, 9601, 8000, 100, 700], 0),
  ('second regression', [4000, 9601, 8000, 100, 700], 0),
  ('normal control 1', [700, 6000, 5000, 100, 700], 0),
  ('normal control 2', [1200, 12000, 10000, 150, 700], 0),
  ('normal control 3', [4000, 5000, 5000, 150, 700], 0),
  ('normal control 4', [4000, 12001, 12001, 100, 700], 0)],
 [('regression: small refund suppression', [1200, 12001, 10000, 100, 700], 200),
  ('partial repair probe: small refund suppression', [2500, 9601, 8000, 100, 700], 0),
  ('second regression', [4000, 6001, 5000, 100, 700], 0),
  ('normal control 1', [2500, 18001, 12001, 150, 700], 900),
  ('normal control 2', [4000, 14401, 12001, 100, 700], 0),
  ('normal control 3', [700, 12000, 8000, 100, 700], 0),
  ('normal control 4', [700, 16000, 8000, 150, 700], 0)],
 [('regression: small refund suppression', [2500, 12001, 10000, 100, 700], 200),
  ('partial repair probe: small refund suppression', [2500, 6001, 5000, 150, 700], 0),
  ('second regression', [4000, 6001, 5000, 150, 700], 0),
  ('normal control 1', [1200, 5100, 5000, 150, 700], 0),
  ('normal control 2', [2500, 7500, 5000, 150, 700], 375),
  ('normal control 3', [700, 12001, 12001, 150, 700], 0),
  ('normal control 4', [2500, 16000, 8000, 150, 700], 1200)],
 [('regression: small refund suppression', [1200, 12001, 10000, 100, 700], 200),
  ('partial repair probe: small refund suppression', [4000, 6001, 5000, 100, 700], 0),
  ('second regression', [2500, 6001, 5000, 150, 700], 0),
  ('normal control 1', [1200, 9600, 8000, 100, 700], 0),
  ('normal control 2', [4000, 15000, 10000, 100, 700], 500),
  ('normal control 3', [2500, 12101, 12001, 150, 700], 0),
  ('normal control 4', [2500, 9601, 8000, 150, 700], 240)],
 [('regression: small refund suppression', [2500, 12001, 10000, 100, 700], 200),
  ('partial repair probe: small refund suppression', [4000, 6001, 5000, 150, 700], 0),
  ('second regression', [1200, 6001, 5000, 150, 700], 0),
  ('normal control 1', [2500, 12000, 10000, 150, 700], 0),
  ('normal control 2', [4000, 9600, 8000, 150, 700], 0),
  ('normal control 3', [4000, 18001, 12001, 100, 700], 600),
  ('normal control 4', [700, 8100, 8000, 150, 700], 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 fixtureActualExpectedOutcome
regression: small refund suppression0200Failed
partial repair probe: small refund suppression00Passed
second regression00Passed
normal control 100Passed
normal control 200Passed
normal control 300Passed
normal control 400Passed

SHA-256 / b16f7ceb3300bd4f832de2465169e9fae721a8476a9115ae7ee8f2066b9a0249

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 < 2:
        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: small refund suppression', [1200, 12001, 10000, 100, 700], 200),
  ('partial repair probe: small refund suppression', [2500, 9601, 8000, 100, 700], 0),
  ('second regression', [4000, 9601, 8000, 100, 700], 0),
  ('normal control 1', [700, 6000, 5000, 100, 700], 0),
  ('normal control 2', [1200, 12000, 10000, 150, 700], 0),
  ('normal control 3', [4000, 5000, 5000, 150, 700], 0),
  ('normal control 4', [4000, 12001, 12001, 100, 700], 0)],
 [('regression: small refund suppression', [1200, 12001, 10000, 100, 700], 200),
  ('partial repair probe: small refund suppression', [2500, 9601, 8000, 100, 700], 0),
  ('second regression', [4000, 6001, 5000, 100, 700], 0),
  ('normal control 1', [2500, 18001, 12001, 150, 700], 900),
  ('normal control 2', [4000, 14401, 12001, 100, 700], 0),
  ('normal control 3', [700, 12000, 8000, 100, 700], 0),
  ('normal control 4', [700, 16000, 8000, 150, 700], 0)],
 [('regression: small refund suppression', [2500, 12001, 10000, 100, 700], 200),
  ('partial repair probe: small refund suppression', [2500, 6001, 5000, 150, 700], 0),
  ('second regression', [4000, 6001, 5000, 150, 700], 0),
  ('normal control 1', [1200, 5100, 5000, 150, 700], 0),
  ('normal control 2', [2500, 7500, 5000, 150, 700], 375),
  ('normal control 3', [700, 12001, 12001, 150, 700], 0),
  ('normal control 4', [2500, 16000, 8000, 150, 700], 1200)],
 [('regression: small refund suppression', [1200, 12001, 10000, 100, 700], 200),
  ('partial repair probe: small refund suppression', [4000, 6001, 5000, 100, 700], 0),
  ('second regression', [2500, 6001, 5000, 150, 700], 0),
  ('normal control 1', [1200, 9600, 8000, 100, 700], 0),
  ('normal control 2', [4000, 15000, 10000, 100, 700], 500),
  ('normal control 3', [2500, 12101, 12001, 150, 700], 0),
  ('normal control 4', [2500, 9601, 8000, 150, 700], 240)],
 [('regression: small refund suppression', [2500, 12001, 10000, 100, 700], 200),
  ('partial repair probe: small refund suppression', [4000, 6001, 5000, 150, 700], 0),
  ('second regression', [1200, 6001, 5000, 150, 700], 0),
  ('normal control 1', [2500, 12000, 10000, 150, 700], 0),
  ('normal control 2', [4000, 9600, 8000, 150, 700], 0),
  ('normal control 3', [4000, 18001, 12001, 100, 700], 600),
  ('normal control 4', [700, 8100, 8000, 150, 700], 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 fixtureActualExpectedOutcome
regression: small refund suppression200200Passed
partial repair probe: small refund suppression1600Failed
second regression1600Failed
normal control 100Passed
normal control 200Passed
normal control 300Passed
normal control 400Passed

SHA-256 / 0c8b12f5e791d543065bacf95f77e4c074d6f9b0ac35ab762104b5628ff8b552

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

Case digest / 3504b8c1c26978b984fe3668dfb44dc13a363a4bb2ad2b361b482247270907b9