FAILURE MAP
← Case archive

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

Cash step taken from the fare currency · case 01

A CHF fare paid in euro cash is rounded to 5 cents.

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

ROOT CAUSE

The cash step is looked up by the fare currency.

VERIFIED REPAIR

Look up the cash step for the payment currency.

Unsuccessful approach: Defaulting unknown currencies to a 5-unit step rounds euro cash.

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:
        num, den = fx[fare_ccy + pay_ccy]
        amt = (amt * num * 2 + den) // (2 * den)
    if method == 'cash':
        step = cash_step.get(fare_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: cash step currency',
   [2502, 'SEK', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   225),
  ('partial repair probe: cash step currency',
   [1234, 'EUR', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1234),
  ('second regression',
   [1003, 'SEK', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   90),
  ('normal control 1',
   [1234, 'SEK', 'EUR', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   111),
  ('normal control 2',
   [1003, 'CHF', 'CHF', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1003),
  ('normal control 3',
   [4194, 'EUR', 'EUR', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   4194),
  ('normal control 4',
   [1999, 'EUR', 'EUR', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1999)],
 [('regression: cash step currency',
   [1003, 'CHF', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1043),
  ('partial repair probe: cash step currency',
   [2502, 'EUR', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2502),
  ('second regression',
   [1003, 'EUR', 'SEK', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   11500),
  ('normal control 1',
   [3395, 'EUR', 'SEK', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   38941),
  ('normal control 2',
   [2795, 'EUR', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2795),
  ('normal control 3',
   [1234, 'CHF', 'EUR', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1283),
  ('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: cash step currency',
   [2387, 'CHF', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2482),
  ('partial repair probe: cash step currency',
   [1003, 'CHF', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1043),
  ('second regression',
   [2017, 'EUR', 'SEK', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   23100),
  ('normal control 1',
   [873, 'EUR', 'EUR', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   873),
  ('normal control 2',
   [1003, 'SEK', 'SEK', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1003),
  ('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',
   [1234, 'CHF', 'EUR', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1283)],
 [('regression: cash step currency',
   [2502, 'EUR', 'SEK', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   28700),
  ('partial repair probe: cash step currency',
   [1234, 'CHF', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1283),
  ('second regression',
   [2502, 'SEK', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   225),
  ('normal control 1',
   [2110, 'EUR', 'SEK', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   24202),
  ('normal control 2',
   [1999, 'CHF', 'EUR', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2079),
  ('normal control 3',
   [1999, 'EUR', 'SEK', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   22929),
  ('normal control 4',
   [852, 'EUR', 'SEK', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   9772)],
 [('regression: cash step currency',
   [2502, 'EUR', 'SEK', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   28700),
  ('partial repair probe: cash step currency',
   [1234, 'EUR', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1234),
  ('second regression',
   [2502, 'EUR', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2502),
  ('normal control 1',
   [1234, 'EUR', 'EUR', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1234),
  ('normal control 2',
   [1999, 'CHF', 'EUR', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2079),
  ('normal control 3',
   [2203, 'EUR', 'EUR', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2203),
  ('normal control 4',
   [1999, 'SEK', 'SEK', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2000)]]
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: cash step currency200225Failed
partial repair probe: cash step currency12341234Passed
second regression10090Failed
normal control 1111111Passed
normal control 210031003Passed
normal control 341944194Passed
normal control 419991999Passed

SHA-256 / 7578b48018930064dfaa30e6c2d37d3ec5ea1e7d81099202d6864e1b59b43ea0

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[fare_ccy + pay_ccy]
        amt = (amt * num * 2 + den) // (2 * den)
    if method == 'cash':
        step = cash_step.get(pay_ccy, 5)
        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: cash step currency',
   [2502, 'SEK', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   225),
  ('partial repair probe: cash step currency',
   [1234, 'EUR', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1234),
  ('second regression',
   [1003, 'SEK', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   90),
  ('normal control 1',
   [1234, 'SEK', 'EUR', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   111),
  ('normal control 2',
   [1003, 'CHF', 'CHF', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1003),
  ('normal control 3',
   [4194, 'EUR', 'EUR', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   4194),
  ('normal control 4',
   [1999, 'EUR', 'EUR', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1999)],
 [('regression: cash step currency',
   [1003, 'CHF', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1043),
  ('partial repair probe: cash step currency',
   [2502, 'EUR', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2502),
  ('second regression',
   [1003, 'EUR', 'SEK', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   11500),
  ('normal control 1',
   [3395, 'EUR', 'SEK', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   38941),
  ('normal control 2',
   [2795, 'EUR', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2795),
  ('normal control 3',
   [1234, 'CHF', 'EUR', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1283),
  ('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: cash step currency',
   [2387, 'CHF', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2482),
  ('partial repair probe: cash step currency',
   [1003, 'CHF', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1043),
  ('second regression',
   [2017, 'EUR', 'SEK', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   23100),
  ('normal control 1',
   [873, 'EUR', 'EUR', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   873),
  ('normal control 2',
   [1003, 'SEK', 'SEK', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1003),
  ('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',
   [1234, 'CHF', 'EUR', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1283)],
 [('regression: cash step currency',
   [2502, 'EUR', 'SEK', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   28700),
  ('partial repair probe: cash step currency',
   [1234, 'CHF', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1283),
  ('second regression',
   [2502, 'SEK', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   225),
  ('normal control 1',
   [2110, 'EUR', 'SEK', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   24202),
  ('normal control 2',
   [1999, 'CHF', 'EUR', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2079),
  ('normal control 3',
   [1999, 'EUR', 'SEK', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   22929),
  ('normal control 4',
   [852, 'EUR', 'SEK', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   9772)],
 [('regression: cash step currency',
   [2502, 'EUR', 'SEK', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   28700),
  ('partial repair probe: cash step currency',
   [1234, 'EUR', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1234),
  ('second regression',
   [2502, 'EUR', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2502),
  ('normal control 1',
   [1234, 'EUR', 'EUR', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1234),
  ('normal control 2',
   [1999, 'CHF', 'EUR', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2079),
  ('normal control 3',
   [2203, 'EUR', 'EUR', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2203),
  ('normal control 4',
   [1999, 'SEK', 'SEK', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2000)]]
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: cash step currency225225Passed
partial repair probe: cash step currency12351234Failed
second regression9090Passed
normal control 1111111Passed
normal control 210031003Passed
normal control 341944194Passed
normal control 419991999Passed

SHA-256 / 4b6d8b9e4d6272a58d85a444023bce7a3fffb7376610c5bab91bcfb435e10d7e

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: cash step currency',
   [2502, 'SEK', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   225),
  ('partial repair probe: cash step currency',
   [1234, 'EUR', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1234),
  ('second regression',
   [1003, 'SEK', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   90),
  ('normal control 1',
   [1234, 'SEK', 'EUR', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   111),
  ('normal control 2',
   [1003, 'CHF', 'CHF', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1003),
  ('normal control 3',
   [4194, 'EUR', 'EUR', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   4194),
  ('normal control 4',
   [1999, 'EUR', 'EUR', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1999)],
 [('regression: cash step currency',
   [1003, 'CHF', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1043),
  ('partial repair probe: cash step currency',
   [2502, 'EUR', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2502),
  ('second regression',
   [1003, 'EUR', 'SEK', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   11500),
  ('normal control 1',
   [3395, 'EUR', 'SEK', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   38941),
  ('normal control 2',
   [2795, 'EUR', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2795),
  ('normal control 3',
   [1234, 'CHF', 'EUR', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1283),
  ('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: cash step currency',
   [2387, 'CHF', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2482),
  ('partial repair probe: cash step currency',
   [1003, 'CHF', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1043),
  ('second regression',
   [2017, 'EUR', 'SEK', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   23100),
  ('normal control 1',
   [873, 'EUR', 'EUR', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   873),
  ('normal control 2',
   [1003, 'SEK', 'SEK', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1003),
  ('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',
   [1234, 'CHF', 'EUR', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1283)],
 [('regression: cash step currency',
   [2502, 'EUR', 'SEK', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   28700),
  ('partial repair probe: cash step currency',
   [1234, 'CHF', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1283),
  ('second regression',
   [2502, 'SEK', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   225),
  ('normal control 1',
   [2110, 'EUR', 'SEK', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   24202),
  ('normal control 2',
   [1999, 'CHF', 'EUR', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2079),
  ('normal control 3',
   [1999, 'EUR', 'SEK', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   22929),
  ('normal control 4',
   [852, 'EUR', 'SEK', 'card',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   9772)],
 [('regression: cash step currency',
   [2502, 'EUR', 'SEK', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   28700),
  ('partial repair probe: cash step currency',
   [1234, 'EUR', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1234),
  ('second regression',
   [2502, 'EUR', 'EUR', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2502),
  ('normal control 1',
   [1234, 'EUR', 'EUR', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   1234),
  ('normal control 2',
   [1999, 'CHF', 'EUR', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2079),
  ('normal control 3',
   [2203, 'EUR', 'EUR', 'wallet',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2203),
  ('normal control 4',
   [1999, 'SEK', 'SEK', 'cash',
    {'CHFEUR': [104, 100], 'EURCHF': [94, 100], 'EURSEK': [1147, 100], 'SEKEUR': [9, 100]},
    {'CHF': 5, 'SEK': 100}],
   2000)]]
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: cash step currency225225Passed
partial repair probe: cash step currency12341234Passed
second regression9090Passed
normal control 1111111Passed
normal control 210031003Passed
normal control 341944194Passed
normal control 419991999Passed

SHA-256 / c9311d673be4d5b18c1212c4855a10e2cb463798419400a061b421a0926b3371

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

Case digest / 2b6e350f34ac21ff30f84a2423850b86312b462cb10970fe785c166cdd5d8a78