FA-85376 / Ride-hailing fare and surge pricing / Open access
Demand ratio truncated to a whole number · case 01
A 1.9 ratio is treated as 1.0 and no surge is published.
ROOT CAUSE
The ratio uses integer division before comparison.
VERIFIED REPAIR
Compare requests x 10 against threshold x drivers exactly.
Unsuccessful approach: Rounding the ratio to one decimal promotes ratios just below a threshold.
Case contract
Each interval gives [open requests, idle drivers]. The raw multiplier (tenths) is 30 when the exact ratio requests/drivers >= 3, 20 when >= 2, 15 when >= 1.5, 12 when >= 1.2, else 10; with zero drivers it is 30 if any request is open, else 10. The published multiplier rises immediately to the raw value but falls by at most 2 tenths per interval, starting from prev. Return the published multiplier per interval.
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(obs, prev):
tiers = [(30, 30), (20, 20), (15, 15), (12, 12)]
cur = prev
out = []
for req, drv in obs:
raw = 10
if drv == 0:
raw = 30 if req > 0 else 10
else:
for th, mult in tiers:
if req // drv * 10 >= th:
raw = mult
break
cur = raw if raw >= cur else max(raw, cur - 2)
out.append(cur)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: integer ratio', [[[12, 20], [18, 10], [24, 20], [5, 5], [24, 20]], 12], [10, 15, 13, 11, 12]),
('partial repair probe: integer ratio', [[[59, 20], [0, 0], [33, 0], [3, 7], [25, 10], [38, 20]], 12],
[20, 18, 30, 28, 26, 24]),
('second regression', [[[17, 10], [38, 20], [8, 0], [34, 20], [34, 20]], 12], [15, 15, 30, 28, 26]),
('normal control 1', [[[0, 0], [2, 10], [1, 7], [26, 5], [30, 20]], 15], [13, 11, 10, 30, 28]),
('normal control 2', [[[39, 10], [0, 0], [5, 5]], 12], [30, 28, 26]),
('normal control 3', [[[22, 20], [7, 7], [7, 7], [-1, 0], [37, 10], [23, 10]], 20],
[18, 16, 14, 12, 30, 28]),
('normal control 4', [[[26, 10], [7, 10]], 12], [20, 18])],
[('regression: integer ratio', [[[0, 10], [19, 10], [34, 0], [10, 7], [19, 10]], 15], [13, 15, 30, 28, 26]),
('partial repair probe: integer ratio', [[[0, 0], [0, 0], [10, 20], [59, 20], [23, 20], [1, 7]], 12],
[10, 10, 10, 20, 18, 16]),
('second regression', [[[38, 20], [5, 10], [0, 0], [37, 7], [28, 10]], 10], [15, 13, 11, 30, 28]),
('normal control 1', [[[5, 5], [28, 20]], 20], [18, 16]),
('normal control 2', [[[0, 0], [19, 10], [10, 10]], 20], [18, 16, 14]),
('normal control 3', [[[23, 20], [7, 7], [19, 5]], 10], [10, 10, 30]),
('normal control 4', [[[0, 0], [32, 10], [19, 10], [23, 10], [0, 0]], 20], [18, 30, 28, 26, 24])],
[('regression: integer ratio', [[[10, 20], [-1, 0], [29, 20]], 10], [10, 10, 12]),
('partial repair probe: integer ratio', [[[32, 10], [24, 10], [19, 10], [14, 10], [9, 5], [59, 20]], 10],
[30, 28, 26, 24, 22, 20]),
('second regression', [[[20, 7], [24, 20], [6, 7], [12, 10], [7, 7], [7, 5]], 12],
[20, 18, 16, 14, 12, 12]),
('normal control 1', [[[22, 10], [1, 5], [27, 5], [0, 0]], 15], [20, 18, 30, 28]),
('normal control 2', [[[1, 7], [35, 10], [25, 5]], 15], [13, 30, 30]),
('normal control 3', [[[4, 10], [38, 0]], 15], [13, 30]),
('normal control 4', [[[22, 20], [39, 10]], 20], [18, 30])],
[('regression: integer ratio', [[[9, 7], [32, 20], [0, 7], [23, 20], [38, 20]], 12], [12, 15, 13, 11, 15]),
('partial repair probe: integer ratio', [[[59, 20], [5, 10]], 10], [20, 18]),
('second regression', [[[-1, 0], [38, 20], [7, 5], [60, 20]], 10], [10, 15, 13, 30]),
('normal control 1', [[[14, 0], [10, 10], [1, 5], [-1, 0], [15, 10], [0, 0]], 30],
[30, 28, 26, 24, 22, 20]),
('normal control 2', [[[10, 10], [8, 7], [10, 0], [20, 7]], 30], [28, 26, 30, 28]),
('normal control 3', [[[17, 7], [5, 10]], 30], [28, 26]),
('normal control 4', [[[7, 7], [10, 10]], 30], [28, 26])],
[('regression: integer ratio', [[[40, 20], [5, 5], [4, 7], [30, 20], [10, 20], [9, 10]], 15],
[20, 18, 16, 15, 13, 11]),
('partial repair probe: integer ratio', [[[22, 5], [25, 5], [8, 10], [59, 20]], 15], [30, 30, 28, 26]),
('second regression', [[[5, 5], [6, 5]], 12], [10, 12]),
('normal control 1', [[[18, 5], [9, 10], [33, 10], [4, 10]], 30], [30, 28, 30, 28]),
('normal control 2', [[[7, 7], [34, 10], [0, 0]], 12], [10, 30, 28]),
('normal control 3', [[[-1, 0], [12, 7], [5, 20]], 30], [28, 26, 24]),
('normal control 4', [[[10, 0], [-1, 0], [0, 0], [24, 10], [7, 7]], 20], [30, 28, 26, 24, 22])]]
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: integer ratio | [10, 10, 10, 10, 10] | [10, 15, 13, 11, 12] | Failed |
| partial repair probe: integer ratio | [20, 18, 30, 28, 26, 24] | [20, 18, 30, 28, 26, 24] | Passed |
| second regression | [10, 10, 30, 28, 26] | [15, 15, 30, 28, 26] | Failed |
| normal control 1 | [13, 11, 10, 30, 28] | [13, 11, 10, 30, 28] | Passed |
| normal control 2 | [30, 28, 26] | [30, 28, 26] | Passed |
| normal control 3 | [18, 16, 14, 12, 30, 28] | [18, 16, 14, 12, 30, 28] | Passed |
| normal control 4 | [20, 18] | [20, 18] | Passed |
SHA-256 / d4629aa73f2d584924135c5a9b4adb3eb08eb77fc8b623b9fbec3b7dd9e2d2bd
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(obs, prev):
tiers = [(30, 30), (20, 20), (15, 15), (12, 12)]
cur = prev
out = []
for req, drv in obs:
raw = 10
if drv == 0:
raw = 30 if req > 0 else 10
else:
for th, mult in tiers:
if round(req / drv, 1) * 10 >= th:
raw = mult
break
cur = raw if raw >= cur else max(raw, cur - 2)
out.append(cur)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: integer ratio', [[[12, 20], [18, 10], [24, 20], [5, 5], [24, 20]], 12], [10, 15, 13, 11, 12]),
('partial repair probe: integer ratio', [[[59, 20], [0, 0], [33, 0], [3, 7], [25, 10], [38, 20]], 12],
[20, 18, 30, 28, 26, 24]),
('second regression', [[[17, 10], [38, 20], [8, 0], [34, 20], [34, 20]], 12], [15, 15, 30, 28, 26]),
('normal control 1', [[[0, 0], [2, 10], [1, 7], [26, 5], [30, 20]], 15], [13, 11, 10, 30, 28]),
('normal control 2', [[[39, 10], [0, 0], [5, 5]], 12], [30, 28, 26]),
('normal control 3', [[[22, 20], [7, 7], [7, 7], [-1, 0], [37, 10], [23, 10]], 20],
[18, 16, 14, 12, 30, 28]),
('normal control 4', [[[26, 10], [7, 10]], 12], [20, 18])],
[('regression: integer ratio', [[[0, 10], [19, 10], [34, 0], [10, 7], [19, 10]], 15], [13, 15, 30, 28, 26]),
('partial repair probe: integer ratio', [[[0, 0], [0, 0], [10, 20], [59, 20], [23, 20], [1, 7]], 12],
[10, 10, 10, 20, 18, 16]),
('second regression', [[[38, 20], [5, 10], [0, 0], [37, 7], [28, 10]], 10], [15, 13, 11, 30, 28]),
('normal control 1', [[[5, 5], [28, 20]], 20], [18, 16]),
('normal control 2', [[[0, 0], [19, 10], [10, 10]], 20], [18, 16, 14]),
('normal control 3', [[[23, 20], [7, 7], [19, 5]], 10], [10, 10, 30]),
('normal control 4', [[[0, 0], [32, 10], [19, 10], [23, 10], [0, 0]], 20], [18, 30, 28, 26, 24])],
[('regression: integer ratio', [[[10, 20], [-1, 0], [29, 20]], 10], [10, 10, 12]),
('partial repair probe: integer ratio', [[[32, 10], [24, 10], [19, 10], [14, 10], [9, 5], [59, 20]], 10],
[30, 28, 26, 24, 22, 20]),
('second regression', [[[20, 7], [24, 20], [6, 7], [12, 10], [7, 7], [7, 5]], 12],
[20, 18, 16, 14, 12, 12]),
('normal control 1', [[[22, 10], [1, 5], [27, 5], [0, 0]], 15], [20, 18, 30, 28]),
('normal control 2', [[[1, 7], [35, 10], [25, 5]], 15], [13, 30, 30]),
('normal control 3', [[[4, 10], [38, 0]], 15], [13, 30]),
('normal control 4', [[[22, 20], [39, 10]], 20], [18, 30])],
[('regression: integer ratio', [[[9, 7], [32, 20], [0, 7], [23, 20], [38, 20]], 12], [12, 15, 13, 11, 15]),
('partial repair probe: integer ratio', [[[59, 20], [5, 10]], 10], [20, 18]),
('second regression', [[[-1, 0], [38, 20], [7, 5], [60, 20]], 10], [10, 15, 13, 30]),
('normal control 1', [[[14, 0], [10, 10], [1, 5], [-1, 0], [15, 10], [0, 0]], 30],
[30, 28, 26, 24, 22, 20]),
('normal control 2', [[[10, 10], [8, 7], [10, 0], [20, 7]], 30], [28, 26, 30, 28]),
('normal control 3', [[[17, 7], [5, 10]], 30], [28, 26]),
('normal control 4', [[[7, 7], [10, 10]], 30], [28, 26])],
[('regression: integer ratio', [[[40, 20], [5, 5], [4, 7], [30, 20], [10, 20], [9, 10]], 15],
[20, 18, 16, 15, 13, 11]),
('partial repair probe: integer ratio', [[[22, 5], [25, 5], [8, 10], [59, 20]], 15], [30, 30, 28, 26]),
('second regression', [[[5, 5], [6, 5]], 12], [10, 12]),
('normal control 1', [[[18, 5], [9, 10], [33, 10], [4, 10]], 30], [30, 28, 30, 28]),
('normal control 2', [[[7, 7], [34, 10], [0, 0]], 12], [10, 30, 28]),
('normal control 3', [[[-1, 0], [12, 7], [5, 20]], 30], [28, 26, 24]),
('normal control 4', [[[10, 0], [-1, 0], [0, 0], [24, 10], [7, 7]], 20], [30, 28, 26, 24, 22])]]
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: integer ratio | [10, 15, 13, 11, 12] | [10, 15, 13, 11, 12] | Passed |
| partial repair probe: integer ratio | [30, 28, 30, 28, 26, 24] | [20, 18, 30, 28, 26, 24] | Failed |
| second regression | [15, 15, 30, 28, 26] | [15, 15, 30, 28, 26] | Passed |
| normal control 1 | [13, 11, 10, 30, 28] | [13, 11, 10, 30, 28] | Passed |
| normal control 2 | [30, 28, 26] | [30, 28, 26] | Passed |
| normal control 3 | [18, 16, 14, 12, 30, 28] | [18, 16, 14, 12, 30, 28] | Passed |
| normal control 4 | [20, 18] | [20, 18] | Passed |
SHA-256 / b68de87d0ecb064814021a13ccb78863d5bfa30e48ca102ee2fcc502e69a3fbc
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(obs, prev):
tiers = [(30, 30), (20, 20), (15, 15), (12, 12)]
cur = prev
out = []
for req, drv in obs:
raw = 10
if drv == 0:
raw = 30 if req > 0 else 10
else:
for th, mult in tiers:
if req * 10 >= th * drv:
raw = mult
break
cur = raw if raw >= cur else max(raw, cur - 2)
out.append(cur)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: integer ratio', [[[12, 20], [18, 10], [24, 20], [5, 5], [24, 20]], 12], [10, 15, 13, 11, 12]),
('partial repair probe: integer ratio', [[[59, 20], [0, 0], [33, 0], [3, 7], [25, 10], [38, 20]], 12],
[20, 18, 30, 28, 26, 24]),
('second regression', [[[17, 10], [38, 20], [8, 0], [34, 20], [34, 20]], 12], [15, 15, 30, 28, 26]),
('normal control 1', [[[0, 0], [2, 10], [1, 7], [26, 5], [30, 20]], 15], [13, 11, 10, 30, 28]),
('normal control 2', [[[39, 10], [0, 0], [5, 5]], 12], [30, 28, 26]),
('normal control 3', [[[22, 20], [7, 7], [7, 7], [-1, 0], [37, 10], [23, 10]], 20],
[18, 16, 14, 12, 30, 28]),
('normal control 4', [[[26, 10], [7, 10]], 12], [20, 18])],
[('regression: integer ratio', [[[0, 10], [19, 10], [34, 0], [10, 7], [19, 10]], 15], [13, 15, 30, 28, 26]),
('partial repair probe: integer ratio', [[[0, 0], [0, 0], [10, 20], [59, 20], [23, 20], [1, 7]], 12],
[10, 10, 10, 20, 18, 16]),
('second regression', [[[38, 20], [5, 10], [0, 0], [37, 7], [28, 10]], 10], [15, 13, 11, 30, 28]),
('normal control 1', [[[5, 5], [28, 20]], 20], [18, 16]),
('normal control 2', [[[0, 0], [19, 10], [10, 10]], 20], [18, 16, 14]),
('normal control 3', [[[23, 20], [7, 7], [19, 5]], 10], [10, 10, 30]),
('normal control 4', [[[0, 0], [32, 10], [19, 10], [23, 10], [0, 0]], 20], [18, 30, 28, 26, 24])],
[('regression: integer ratio', [[[10, 20], [-1, 0], [29, 20]], 10], [10, 10, 12]),
('partial repair probe: integer ratio', [[[32, 10], [24, 10], [19, 10], [14, 10], [9, 5], [59, 20]], 10],
[30, 28, 26, 24, 22, 20]),
('second regression', [[[20, 7], [24, 20], [6, 7], [12, 10], [7, 7], [7, 5]], 12],
[20, 18, 16, 14, 12, 12]),
('normal control 1', [[[22, 10], [1, 5], [27, 5], [0, 0]], 15], [20, 18, 30, 28]),
('normal control 2', [[[1, 7], [35, 10], [25, 5]], 15], [13, 30, 30]),
('normal control 3', [[[4, 10], [38, 0]], 15], [13, 30]),
('normal control 4', [[[22, 20], [39, 10]], 20], [18, 30])],
[('regression: integer ratio', [[[9, 7], [32, 20], [0, 7], [23, 20], [38, 20]], 12], [12, 15, 13, 11, 15]),
('partial repair probe: integer ratio', [[[59, 20], [5, 10]], 10], [20, 18]),
('second regression', [[[-1, 0], [38, 20], [7, 5], [60, 20]], 10], [10, 15, 13, 30]),
('normal control 1', [[[14, 0], [10, 10], [1, 5], [-1, 0], [15, 10], [0, 0]], 30],
[30, 28, 26, 24, 22, 20]),
('normal control 2', [[[10, 10], [8, 7], [10, 0], [20, 7]], 30], [28, 26, 30, 28]),
('normal control 3', [[[17, 7], [5, 10]], 30], [28, 26]),
('normal control 4', [[[7, 7], [10, 10]], 30], [28, 26])],
[('regression: integer ratio', [[[40, 20], [5, 5], [4, 7], [30, 20], [10, 20], [9, 10]], 15],
[20, 18, 16, 15, 13, 11]),
('partial repair probe: integer ratio', [[[22, 5], [25, 5], [8, 10], [59, 20]], 15], [30, 30, 28, 26]),
('second regression', [[[5, 5], [6, 5]], 12], [10, 12]),
('normal control 1', [[[18, 5], [9, 10], [33, 10], [4, 10]], 30], [30, 28, 30, 28]),
('normal control 2', [[[7, 7], [34, 10], [0, 0]], 12], [10, 30, 28]),
('normal control 3', [[[-1, 0], [12, 7], [5, 20]], 30], [28, 26, 24]),
('normal control 4', [[[10, 0], [-1, 0], [0, 0], [24, 10], [7, 7]], 20], [30, 28, 26, 24, 22])]]
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: integer ratio | [10, 15, 13, 11, 12] | [10, 15, 13, 11, 12] | Passed |
| partial repair probe: integer ratio | [20, 18, 30, 28, 26, 24] | [20, 18, 30, 28, 26, 24] | Passed |
| second regression | [15, 15, 30, 28, 26] | [15, 15, 30, 28, 26] | Passed |
| normal control 1 | [13, 11, 10, 30, 28] | [13, 11, 10, 30, 28] | Passed |
| normal control 2 | [30, 28, 26] | [30, 28, 26] | Passed |
| normal control 3 | [18, 16, 14, 12, 30, 28] | [18, 16, 14, 12, 30, 28] | Passed |
| normal control 4 | [20, 18] | [20, 18] | Passed |
SHA-256 / b2e9920acb573dd03c182afad324c410dc54d66272b90f847807a8942a5f57bc
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:39.846313+00:00.
Case digest / 09283e7fff59eb895be441a70dfe823e9f83c8fd9ad2dd15894134ec3ca9a0a8