FA-85726 / Ride-hailing fare and surge pricing / Open access
Conversion uses the inverted reverse rate · case 01
Converted fares are off by the bid/ask spread.
ROOT CAUSE
The reverse-direction pair is inverted instead of using the directed rate.
VERIFIED REPAIR
Use fx[FROM+TO] for conversion from the fare currency.
Unsuccessful approach: Using the reverse pair without inversion converts by the wrong rate entirely.
Case contract
Convert a fare to the payment currency with the directed rate fx[FROM+TO] = [num, den] (half up), then, for cash payments only, round half up to the payment currency cash step (CHF 5 centimes, SEK 100 ore, others 1). Card and wallet payments are not cash-rounded. Return the amount in minor units of the payment currency.
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(fare_cents, fare_ccy, pay_ccy, method, fx, cash_step):
amt = fare_cents
if pay_ccy != fare_ccy:
den, num = fx[pay_ccy + fare_ccy]
amt = (amt * num * 2 + den) // (2 * den)
if method == 'cash':
step = cash_step.get(pay_ccy, 1)
amt = (amt * 2 + step) // (2 * step) * step
return amt
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: fx pair direction',
[1999, 'SEK', 'EUR', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
180),
('partial repair probe: fx pair direction',
[1234, 'EUR', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
14154),
('second regression',
[1999, 'EUR', 'SEK', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
22929),
('normal control 1',
[2502, 'EUR', 'EUR', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
2502),
('normal control 2',
[1234, 'SEK', 'SEK', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1200),
('normal control 3',
[1234, 'SEK', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1234),
('normal control 4',
[2502, 'SEK', 'SEK', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
2500)],
[('regression: fx pair direction',
[1999, 'EUR', 'CHF', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1880),
('partial repair probe: fx pair direction',
[1003, 'CHF', 'EUR', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1043),
('second regression',
[1234, 'EUR', 'CHF', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1160),
('normal control 1',
[747, 'SEK', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
747),
('normal control 2',
[1234, 'SEK', 'SEK', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1234),
('normal control 3',
[1003, 'EUR', 'EUR', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003),
('normal control 4',
[1003, 'SEK', 'SEK', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003)],
[('regression: fx pair direction',
[1234, 'EUR', 'CHF', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1160),
('partial repair probe: fx pair direction',
[2502, 'EUR', 'SEK', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
28700),
('second regression',
[1003, 'EUR', 'SEK', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
11504),
('normal control 1',
[2502, 'EUR', 'EUR', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
2502),
('normal control 2',
[1234, 'SEK', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1234),
('normal control 3',
[1003, 'SEK', 'SEK', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003),
('normal control 4',
[1003, 'CHF', 'CHF', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003)],
[('regression: fx pair direction',
[1999, 'EUR', 'SEK', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
22900),
('partial repair probe: fx pair direction',
[1003, 'EUR', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
11504),
('second regression',
[1003, 'EUR', 'CHF', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
943),
('normal control 1',
[1003, 'CHF', 'CHF', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003),
('normal control 2',
[1234, 'EUR', 'EUR', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1234),
('normal control 3',
[1003, 'EUR', 'EUR', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003),
('normal control 4',
[1003, 'CHF', 'CHF', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1005)],
[('regression: fx pair direction',
[3496, 'EUR', 'CHF', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
3286),
('partial repair probe: fx pair direction',
[1999, 'EUR', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
22929),
('second regression',
[1003, 'EUR', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
11504),
('normal control 1',
[2502, 'EUR', 'EUR', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
2502),
('normal control 2',
[1999, 'EUR', 'EUR', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1999),
('normal control 3',
[1999, 'SEK', 'SEK', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
2000),
('normal control 4',
[1003, 'CHF', 'CHF', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003)]]
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: fx pair direction | 174 | 180 | Failed |
| partial repair probe: fx pair direction | 13711 | 14154 | Failed |
| second regression | 22211 | 22929 | Failed |
| normal control 1 | 2502 | 2502 | Passed |
| normal control 2 | 1200 | 1200 | Passed |
| normal control 3 | 1234 | 1234 | Passed |
| normal control 4 | 2500 | 2500 | Passed |
SHA-256 / 5f78d86c34b38a0cc87add5019c607646bd98c8d6a55b73c2913e70780ce68a4
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(fare_cents, fare_ccy, pay_ccy, method, fx, cash_step):
amt = fare_cents
if pay_ccy != fare_ccy:
num, den = fx[pay_ccy + fare_ccy]
amt = (amt * num * 2 + den) // (2 * den)
if method == 'cash':
step = cash_step.get(pay_ccy, 1)
amt = (amt * 2 + step) // (2 * step) * step
return amt
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: fx pair direction',
[1999, 'SEK', 'EUR', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
180),
('partial repair probe: fx pair direction',
[1234, 'EUR', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
14154),
('second regression',
[1999, 'EUR', 'SEK', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
22929),
('normal control 1',
[2502, 'EUR', 'EUR', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
2502),
('normal control 2',
[1234, 'SEK', 'SEK', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1200),
('normal control 3',
[1234, 'SEK', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1234),
('normal control 4',
[2502, 'SEK', 'SEK', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
2500)],
[('regression: fx pair direction',
[1999, 'EUR', 'CHF', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1880),
('partial repair probe: fx pair direction',
[1003, 'CHF', 'EUR', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1043),
('second regression',
[1234, 'EUR', 'CHF', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1160),
('normal control 1',
[747, 'SEK', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
747),
('normal control 2',
[1234, 'SEK', 'SEK', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1234),
('normal control 3',
[1003, 'EUR', 'EUR', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003),
('normal control 4',
[1003, 'SEK', 'SEK', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003)],
[('regression: fx pair direction',
[1234, 'EUR', 'CHF', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1160),
('partial repair probe: fx pair direction',
[2502, 'EUR', 'SEK', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
28700),
('second regression',
[1003, 'EUR', 'SEK', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
11504),
('normal control 1',
[2502, 'EUR', 'EUR', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
2502),
('normal control 2',
[1234, 'SEK', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1234),
('normal control 3',
[1003, 'SEK', 'SEK', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003),
('normal control 4',
[1003, 'CHF', 'CHF', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003)],
[('regression: fx pair direction',
[1999, 'EUR', 'SEK', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
22900),
('partial repair probe: fx pair direction',
[1003, 'EUR', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
11504),
('second regression',
[1003, 'EUR', 'CHF', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
943),
('normal control 1',
[1003, 'CHF', 'CHF', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003),
('normal control 2',
[1234, 'EUR', 'EUR', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1234),
('normal control 3',
[1003, 'EUR', 'EUR', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003),
('normal control 4',
[1003, 'CHF', 'CHF', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1005)],
[('regression: fx pair direction',
[3496, 'EUR', 'CHF', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
3286),
('partial repair probe: fx pair direction',
[1999, 'EUR', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
22929),
('second regression',
[1003, 'EUR', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
11504),
('normal control 1',
[2502, 'EUR', 'EUR', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
2502),
('normal control 2',
[1999, 'EUR', 'EUR', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1999),
('normal control 3',
[1999, 'SEK', 'SEK', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
2000),
('normal control 4',
[1003, 'CHF', 'CHF', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003)]]
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: fx pair direction | 22929 | 180 | Failed |
| partial repair probe: fx pair direction | 111 | 14154 | Failed |
| second regression | 180 | 22929 | Failed |
| normal control 1 | 2502 | 2502 | Passed |
| normal control 2 | 1200 | 1200 | Passed |
| normal control 3 | 1234 | 1234 | Passed |
| normal control 4 | 2500 | 2500 | Passed |
SHA-256 / da4565ef84d22ba71526c032e43f3486eae4ed6f7457e32ef3a30ef0ef97c1a1
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(fare_cents, fare_ccy, pay_ccy, method, fx, cash_step):
amt = fare_cents
if pay_ccy != fare_ccy:
num, den = fx[fare_ccy + pay_ccy]
amt = (amt * num * 2 + den) // (2 * den)
if method == 'cash':
step = cash_step.get(pay_ccy, 1)
amt = (amt * 2 + step) // (2 * step) * step
return amt
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: fx pair direction',
[1999, 'SEK', 'EUR', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
180),
('partial repair probe: fx pair direction',
[1234, 'EUR', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
14154),
('second regression',
[1999, 'EUR', 'SEK', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
22929),
('normal control 1',
[2502, 'EUR', 'EUR', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
2502),
('normal control 2',
[1234, 'SEK', 'SEK', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1200),
('normal control 3',
[1234, 'SEK', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1234),
('normal control 4',
[2502, 'SEK', 'SEK', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
2500)],
[('regression: fx pair direction',
[1999, 'EUR', 'CHF', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1880),
('partial repair probe: fx pair direction',
[1003, 'CHF', 'EUR', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1043),
('second regression',
[1234, 'EUR', 'CHF', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1160),
('normal control 1',
[747, 'SEK', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
747),
('normal control 2',
[1234, 'SEK', 'SEK', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1234),
('normal control 3',
[1003, 'EUR', 'EUR', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003),
('normal control 4',
[1003, 'SEK', 'SEK', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003)],
[('regression: fx pair direction',
[1234, 'EUR', 'CHF', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1160),
('partial repair probe: fx pair direction',
[2502, 'EUR', 'SEK', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
28700),
('second regression',
[1003, 'EUR', 'SEK', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
11504),
('normal control 1',
[2502, 'EUR', 'EUR', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
2502),
('normal control 2',
[1234, 'SEK', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1234),
('normal control 3',
[1003, 'SEK', 'SEK', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003),
('normal control 4',
[1003, 'CHF', 'CHF', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003)],
[('regression: fx pair direction',
[1999, 'EUR', 'SEK', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
22900),
('partial repair probe: fx pair direction',
[1003, 'EUR', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
11504),
('second regression',
[1003, 'EUR', 'CHF', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
943),
('normal control 1',
[1003, 'CHF', 'CHF', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003),
('normal control 2',
[1234, 'EUR', 'EUR', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1234),
('normal control 3',
[1003, 'EUR', 'EUR', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003),
('normal control 4',
[1003, 'CHF', 'CHF', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1005)],
[('regression: fx pair direction',
[3496, 'EUR', 'CHF', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
3286),
('partial repair probe: fx pair direction',
[1999, 'EUR', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
22929),
('second regression',
[1003, 'EUR', 'SEK', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
11504),
('normal control 1',
[2502, 'EUR', 'EUR', 'card',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
2502),
('normal control 2',
[1999, 'EUR', 'EUR', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1999),
('normal control 3',
[1999, 'SEK', 'SEK', 'cash',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
2000),
('normal control 4',
[1003, 'CHF', 'CHF', 'wallet',
{'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
{'CHF': 5, 'SEK': 100}],
1003)]]
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: fx pair direction | 180 | 180 | Passed |
| partial repair probe: fx pair direction | 14154 | 14154 | Passed |
| second regression | 22929 | 22929 | Passed |
| normal control 1 | 2502 | 2502 | Passed |
| normal control 2 | 1200 | 1200 | Passed |
| normal control 3 | 1234 | 1234 | Passed |
| normal control 4 | 2500 | 2500 | Passed |
SHA-256 / fb823203d4267887244e54de2ca1f8d1c1331d362d97e23ce5573c7e7c690560
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.091070+00:00.
Case digest / f315960773d2f4f363412ac36797bf2c9ae6c4ac0173aa9e6e73cc5292529611