{"abstract":"A 50% promo takes 40.00 off an 80.00 ride despite a 10.00 cap.","category":"Ride-hailing fare and surge pricing","checks":7,"contract":"Cents throughout. Surge (tenths) multiplies only base+distance+time, rounded half up. A percentage promo discounts the surged amount (floor), capped at promo cap cents. The booking fee is added after the discount. Tax (basis points, rounded half up) applies to surged - discount + booking fee; tolls and airport fees are passed through untaxed and unsurged.","evaluation_group":"w2-ride-hailing-fare-surge-fare-composition","failed_approach":"Treating the cap as dollars multiplies it by 100.","family":"w2-ride-hailing-fare-surge-fare-composition-promo-cap","id":"FA-85391","implementations":{"attempt":{"sha256":"cfb86725864289adefd98ff452526d8028988472d4bc9cabf8d2d6e0e28ff329","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(parts, surge, promo, tax_bp):\n    def half_up(num, den):\n        return (num * 2 + den) // (den * 2)\n    core = parts['base'] + parts['distance'] + parts['time']\n    surged = half_up(core * surge, 10)\n    disc = 0\n    if promo:\n        disc = min(surged * promo['pct'] // 100, promo['cap'] * 100)\n    sub = surged - disc + parts['booking_fee']\n    tax = half_up(sub * tax_bp, 10000)\n    total = sub + tax + parts['tolls'] + parts['airport_fee']\n    return {'surged': surged, 'discount': disc, 'tax': tax, 'total': total}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2070, 'time': 734, 'tolls': 375}, 10,\n    {'cap': 1000, 'pct': 50}, 1000],\n   {'discount': 1000, 'surged': 3054, 'tax': 205, 'total': 2634}),\n  ('partial repair probe: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 1506, 'time': 265, 'tolls': 375}, 10,\n    {'cap': 1000, 'pct': 50}, 0],\n   {'discount': 1000, 'surged': 2021, 'tax': 0, 'total': 1641}),\n  ('second regression',\n   [{'airport_fee': 500, 'base': 250, 'booking_fee': 175, 'distance': 2171, 'time': 246, 'tolls': 375}, 17,\n    {'cap': 5, 'pct': 15}, 1000],\n   {'discount': 5, 'surged': 4534, 'tax': 470, 'total': 6049}),\n  ('normal control 1',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 245, 'distance': 855, 'time': 216, 'tolls': 0}, 12, None,\n    825],\n   {'discount': 0, 'surged': 1465, 'tax': 141, 'total': 2351}),\n  ('normal control 2',\n   [{'airport_fee': 500, 'base': 250, 'booking_fee': 0, 'distance': 599, 'time': 617, 'tolls': 0}, 12, None,\n    0],\n   {'discount': 0, 'surged': 1759, 'tax': 0, 'total': 2259}),\n  ('normal control 3',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 2589, 'time': 635, 'tolls': 690}, 25,\n    None, 825],\n   {'discount': 0, 'surged': 8435, 'tax': 710, 'total': 10510}),\n  ('normal control 4',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 429, 'time': 564, 'tolls': 375}, 17,\n    {'cap': 500, 'pct': 20}, 825],\n   {'discount': 388, 'surged': 1943, 'tax': 143, 'total': 2248})],\n [('regression: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2808, 'time': 350, 'tolls': 0}, 15,\n    {'cap': 1000, 'pct': 50}, 825],\n   {'discount': 1000, 'surged': 5112, 'tax': 339, 'total': 4451}),\n  ('partial repair probe: promo cap',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 1187, 'time': 97, 'tolls': 0}, 25,\n    {'cap': 1000, 'pct': 50}, 0],\n   {'discount': 1000, 'surged': 3585, 'tax': 0, 'total': 2585}),\n  ('second regression',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 218, 'time': 836, 'tolls': 0}, 15,\n    {'cap': 5, 'pct': 15}, 0],\n   {'discount': 5, 'surged': 1956, 'tax': 0, 'total': 2126}),\n  ('normal control 1',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2595, 'time': 377, 'tolls': 375}, 25, None,\n    0],\n   {'discount': 0, 'surged': 8055, 'tax': 0, 'total': 8430}),\n  ('normal control 2',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 359, 'time': 804, 'tolls': 0}, 10, None,\n    625],\n   {'discount': 0, 'surged': 1313, 'tax': 93, 'total': 2081}),\n  ('normal control 3',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 1650, 'time': 892, 'tolls': 690}, 17,\n    None, 1000],\n   {'discount': 0, 'surged': 4576, 'tax': 475, 'total': 6416}),\n  ('normal control 4',\n   [{'airport_fee': 500, 'base': 250, 'booking_fee': 245, 'distance': 2382, 'time': 551, 'tolls': 690}, 25,\n    None, 825],\n   {'discount': 0, 'surged': 7958, 'tax': 677, 'total': 10070})],\n [('regression: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 2496, 'time': 616, 'tolls': 690}, 10,\n    {'cap': 1000, 'pct': 50}, 825],\n   {'discount': 1000, 'surged': 3362, 'tax': 215, 'total': 3512}),\n  ('partial repair probe: promo cap',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 2743, 'time': 287, 'tolls': 0}, 15,\n    {'cap': 1000, 'pct': 50}, 825],\n   {'discount': 1000, 'surged': 4770, 'tax': 325, 'total': 4270}),\n  ('second regression',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2977, 'time': 212, 'tolls': 0}, 15,\n    {'cap': 500, 'pct': 20}, 0],\n   {'discount': 500, 'surged': 5159, 'tax': 0, 'total': 4659}),\n  ('normal control 1',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 245, 'distance': 530, 'time': 327, 'tolls': 690}, 10, None,\n    625],\n   {'discount': 0, 'surged': 1007, 'tax': 78, 'total': 2020}),\n  ('normal control 2',\n   [{'airport_fee': 500, 'base': 250, 'booking_fee': 175, 'distance': 693, 'time': 420, 'tolls': 375}, 25,\n    None, 825],\n   {'discount': 0, 'surged': 3408, 'tax': 296, 'total': 4754}),\n  ('normal control 3',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 403, 'time': 448, 'tolls': 0}, 15,\n    {'cap': 500, 'pct': 20}, 0],\n   {'discount': 330, 'surged': 1652, 'tax': 0, 'total': 1497}),\n  ('normal control 4',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 245, 'distance': 925, 'time': 819, 'tolls': 0}, 12, None,\n    625],\n   {'discount': 0, 'surged': 2273, 'tax': 157, 'total': 2675})],\n [('regression: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 1887, 'time': 798, 'tolls': 0}, 17,\n    {'cap': 1000, 'pct': 50}, 1000],\n   {'discount': 1000, 'surged': 4990, 'tax': 417, 'total': 4582}),\n  ('partial repair probe: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 2043, 'time': 744, 'tolls': 690}, 17,\n    {'cap': 500, 'pct': 20}, 0],\n   {'discount': 500, 'surged': 5163, 'tax': 0, 'total': 5528}),\n  ('second regression',\n   [{'airport_fee': 500, 'base': 250, 'booking_fee': 245, 'distance': 1583, 'time': 804, 'tolls': 0}, 25,\n    {'cap': 500, 'pct': 20}, 825],\n   {'discount': 500, 'surged': 6593, 'tax': 523, 'total': 7361}),\n  ('normal control 1',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 464, 'time': 114, 'tolls': 0}, 17,\n    {'cap': 500, 'pct': 20}, 0],\n   {'discount': 247, 'surged': 1238, 'tax': 0, 'total': 1166}),\n  ('normal control 2',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 504, 'time': 655, 'tolls': 375}, 25, None,\n    0],\n   {'discount': 0, 'surged': 3523, 'tax': 0, 'total': 4073}),\n  ('normal control 3',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 0, 'distance': 403, 'time': 175, 'tolls': 375}, 12,\n    {'cap': 1000, 'pct': 50}, 825],\n   {'discount': 437, 'surged': 874, 'tax': 36, 'total': 1348}),\n  ('normal control 4',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2545, 'time': 164, 'tolls': 690}, 15, None,\n    625],\n   {'discount': 0, 'surged': 4439, 'tax': 277, 'total': 5406})],\n [('regression: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 592, 'time': 318, 'tolls': 690}, 10,\n    {'cap': 5, 'pct': 15}, 625],\n   {'discount': 5, 'surged': 1160, 'tax': 72, 'total': 1917}),\n  ('partial repair probe: promo cap',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 2992, 'time': 342, 'tolls': 690}, 10,\n    {'cap': 500, 'pct': 20}, 0],\n   {'discount': 500, 'surged': 3484, 'tax': 0, 'total': 3674}),\n  ('second regression',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 920, 'time': 542, 'tolls': 690}, 17,\n    {'cap': 500, 'pct': 20}, 1000],\n   {'discount': 500, 'surged': 2740, 'tax': 242, 'total': 3347}),\n  ('normal control 1',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 0, 'distance': 1845, 'time': 397, 'tolls': 375}, 15,\n    None, 1000],\n   {'discount': 0, 'surged': 3588, 'tax': 359, 'total': 4822}),\n  ('normal control 2',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 0, 'distance': 2544, 'time': 666, 'tolls': 690}, 10,\n    None, 625],\n   {'discount': 0, 'surged': 3360, 'tax': 210, 'total': 4760}),\n  ('normal control 3',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 275, 'time': 747, 'tolls': 690}, 25, None,\n    1000],\n   {'discount': 0, 'surged': 3180, 'tax': 343, 'total': 4458}),\n  ('normal control 4',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2045, 'time': 515, 'tolls': 0}, 15, None,\n    0],\n   {'discount': 0, 'surged': 4215, 'tax': 0, 'total': 4215})]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"abbc75e48e537266353844f7962317421dd546e39f590cec4537d699d3e51fb9","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(parts, surge, promo, tax_bp):\n    def half_up(num, den):\n        return (num * 2 + den) // (den * 2)\n    core = parts['base'] + parts['distance'] + parts['time']\n    surged = half_up(core * surge, 10)\n    disc = 0\n    if promo:\n        disc = surged * promo['pct'] // 100\n    sub = surged - disc + parts['booking_fee']\n    tax = half_up(sub * tax_bp, 10000)\n    total = sub + tax + parts['tolls'] + parts['airport_fee']\n    return {'surged': surged, 'discount': disc, 'tax': tax, 'total': total}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2070, 'time': 734, 'tolls': 375}, 10,\n    {'cap': 1000, 'pct': 50}, 1000],\n   {'discount': 1000, 'surged': 3054, 'tax': 205, 'total': 2634}),\n  ('partial repair probe: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 1506, 'time': 265, 'tolls': 375}, 10,\n    {'cap': 1000, 'pct': 50}, 0],\n   {'discount': 1000, 'surged': 2021, 'tax': 0, 'total': 1641}),\n  ('second regression',\n   [{'airport_fee': 500, 'base': 250, 'booking_fee': 175, 'distance': 2171, 'time': 246, 'tolls': 375}, 17,\n    {'cap': 5, 'pct': 15}, 1000],\n   {'discount': 5, 'surged': 4534, 'tax': 470, 'total': 6049}),\n  ('normal control 1',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 245, 'distance': 855, 'time': 216, 'tolls': 0}, 12, None,\n    825],\n   {'discount': 0, 'surged': 1465, 'tax': 141, 'total': 2351}),\n  ('normal control 2',\n   [{'airport_fee': 500, 'base': 250, 'booking_fee': 0, 'distance': 599, 'time': 617, 'tolls': 0}, 12, None,\n    0],\n   {'discount': 0, 'surged': 1759, 'tax': 0, 'total': 2259}),\n  ('normal control 3',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 2589, 'time': 635, 'tolls': 690}, 25,\n    None, 825],\n   {'discount': 0, 'surged': 8435, 'tax': 710, 'total': 10510}),\n  ('normal control 4',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 429, 'time': 564, 'tolls': 375}, 17,\n    {'cap': 500, 'pct': 20}, 825],\n   {'discount': 388, 'surged': 1943, 'tax': 143, 'total': 2248})],\n [('regression: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2808, 'time': 350, 'tolls': 0}, 15,\n    {'cap': 1000, 'pct': 50}, 825],\n   {'discount': 1000, 'surged': 5112, 'tax': 339, 'total': 4451}),\n  ('partial repair probe: promo cap',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 1187, 'time': 97, 'tolls': 0}, 25,\n    {'cap': 1000, 'pct': 50}, 0],\n   {'discount': 1000, 'surged': 3585, 'tax': 0, 'total': 2585}),\n  ('second regression',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 218, 'time': 836, 'tolls': 0}, 15,\n    {'cap': 5, 'pct': 15}, 0],\n   {'discount': 5, 'surged': 1956, 'tax': 0, 'total': 2126}),\n  ('normal control 1',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2595, 'time': 377, 'tolls': 375}, 25, None,\n    0],\n   {'discount': 0, 'surged': 8055, 'tax': 0, 'total': 8430}),\n  ('normal control 2',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 359, 'time': 804, 'tolls': 0}, 10, None,\n    625],\n   {'discount': 0, 'surged': 1313, 'tax': 93, 'total': 2081}),\n  ('normal control 3',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 1650, 'time': 892, 'tolls': 690}, 17,\n    None, 1000],\n   {'discount': 0, 'surged': 4576, 'tax': 475, 'total': 6416}),\n  ('normal control 4',\n   [{'airport_fee': 500, 'base': 250, 'booking_fee': 245, 'distance': 2382, 'time': 551, 'tolls': 690}, 25,\n    None, 825],\n   {'discount': 0, 'surged': 7958, 'tax': 677, 'total': 10070})],\n [('regression: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 2496, 'time': 616, 'tolls': 690}, 10,\n    {'cap': 1000, 'pct': 50}, 825],\n   {'discount': 1000, 'surged': 3362, 'tax': 215, 'total': 3512}),\n  ('partial repair probe: promo cap',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 2743, 'time': 287, 'tolls': 0}, 15,\n    {'cap': 1000, 'pct': 50}, 825],\n   {'discount': 1000, 'surged': 4770, 'tax': 325, 'total': 4270}),\n  ('second regression',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2977, 'time': 212, 'tolls': 0}, 15,\n    {'cap': 500, 'pct': 20}, 0],\n   {'discount': 500, 'surged': 5159, 'tax': 0, 'total': 4659}),\n  ('normal control 1',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 245, 'distance': 530, 'time': 327, 'tolls': 690}, 10, None,\n    625],\n   {'discount': 0, 'surged': 1007, 'tax': 78, 'total': 2020}),\n  ('normal control 2',\n   [{'airport_fee': 500, 'base': 250, 'booking_fee': 175, 'distance': 693, 'time': 420, 'tolls': 375}, 25,\n    None, 825],\n   {'discount': 0, 'surged': 3408, 'tax': 296, 'total': 4754}),\n  ('normal control 3',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 403, 'time': 448, 'tolls': 0}, 15,\n    {'cap': 500, 'pct': 20}, 0],\n   {'discount': 330, 'surged': 1652, 'tax': 0, 'total': 1497}),\n  ('normal control 4',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 245, 'distance': 925, 'time': 819, 'tolls': 0}, 12, None,\n    625],\n   {'discount': 0, 'surged': 2273, 'tax': 157, 'total': 2675})],\n [('regression: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 1887, 'time': 798, 'tolls': 0}, 17,\n    {'cap': 1000, 'pct': 50}, 1000],\n   {'discount': 1000, 'surged': 4990, 'tax': 417, 'total': 4582}),\n  ('partial repair probe: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 2043, 'time': 744, 'tolls': 690}, 17,\n    {'cap': 500, 'pct': 20}, 0],\n   {'discount': 500, 'surged': 5163, 'tax': 0, 'total': 5528}),\n  ('second regression',\n   [{'airport_fee': 500, 'base': 250, 'booking_fee': 245, 'distance': 1583, 'time': 804, 'tolls': 0}, 25,\n    {'cap': 500, 'pct': 20}, 825],\n   {'discount': 500, 'surged': 6593, 'tax': 523, 'total': 7361}),\n  ('normal control 1',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 464, 'time': 114, 'tolls': 0}, 17,\n    {'cap': 500, 'pct': 20}, 0],\n   {'discount': 247, 'surged': 1238, 'tax': 0, 'total': 1166}),\n  ('normal control 2',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 504, 'time': 655, 'tolls': 375}, 25, None,\n    0],\n   {'discount': 0, 'surged': 3523, 'tax': 0, 'total': 4073}),\n  ('normal control 3',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 0, 'distance': 403, 'time': 175, 'tolls': 375}, 12,\n    {'cap': 1000, 'pct': 50}, 825],\n   {'discount': 437, 'surged': 874, 'tax': 36, 'total': 1348}),\n  ('normal control 4',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2545, 'time': 164, 'tolls': 690}, 15, None,\n    625],\n   {'discount': 0, 'surged': 4439, 'tax': 277, 'total': 5406})],\n [('regression: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 592, 'time': 318, 'tolls': 690}, 10,\n    {'cap': 5, 'pct': 15}, 625],\n   {'discount': 5, 'surged': 1160, 'tax': 72, 'total': 1917}),\n  ('partial repair probe: promo cap',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 2992, 'time': 342, 'tolls': 690}, 10,\n    {'cap': 500, 'pct': 20}, 0],\n   {'discount': 500, 'surged': 3484, 'tax': 0, 'total': 3674}),\n  ('second regression',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 920, 'time': 542, 'tolls': 690}, 17,\n    {'cap': 500, 'pct': 20}, 1000],\n   {'discount': 500, 'surged': 2740, 'tax': 242, 'total': 3347}),\n  ('normal control 1',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 0, 'distance': 1845, 'time': 397, 'tolls': 375}, 15,\n    None, 1000],\n   {'discount': 0, 'surged': 3588, 'tax': 359, 'total': 4822}),\n  ('normal control 2',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 0, 'distance': 2544, 'time': 666, 'tolls': 690}, 10,\n    None, 625],\n   {'discount': 0, 'surged': 3360, 'tax': 210, 'total': 4760}),\n  ('normal control 3',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 275, 'time': 747, 'tolls': 690}, 25, None,\n    1000],\n   {'discount': 0, 'surged': 3180, 'tax': 343, 'total': 4458}),\n  ('normal control 4',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2045, 'time': 515, 'tolls': 0}, 15, None,\n    0],\n   {'discount': 0, 'surged': 4215, 'tax': 0, 'total': 4215})]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"e9c06ea04107c581c8fa6aeb730ba4331dcea3c8822809119fa3326e88d6236f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(parts, surge, promo, tax_bp):\n    def half_up(num, den):\n        return (num * 2 + den) // (den * 2)\n    core = parts['base'] + parts['distance'] + parts['time']\n    surged = half_up(core * surge, 10)\n    disc = 0\n    if promo:\n        disc = min(surged * promo['pct'] // 100, promo['cap'])\n    sub = surged - disc + parts['booking_fee']\n    tax = half_up(sub * tax_bp, 10000)\n    total = sub + tax + parts['tolls'] + parts['airport_fee']\n    return {'surged': surged, 'discount': disc, 'tax': tax, 'total': total}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2070, 'time': 734, 'tolls': 375}, 10,\n    {'cap': 1000, 'pct': 50}, 1000],\n   {'discount': 1000, 'surged': 3054, 'tax': 205, 'total': 2634}),\n  ('partial repair probe: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 1506, 'time': 265, 'tolls': 375}, 10,\n    {'cap': 1000, 'pct': 50}, 0],\n   {'discount': 1000, 'surged': 2021, 'tax': 0, 'total': 1641}),\n  ('second regression',\n   [{'airport_fee': 500, 'base': 250, 'booking_fee': 175, 'distance': 2171, 'time': 246, 'tolls': 375}, 17,\n    {'cap': 5, 'pct': 15}, 1000],\n   {'discount': 5, 'surged': 4534, 'tax': 470, 'total': 6049}),\n  ('normal control 1',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 245, 'distance': 855, 'time': 216, 'tolls': 0}, 12, None,\n    825],\n   {'discount': 0, 'surged': 1465, 'tax': 141, 'total': 2351}),\n  ('normal control 2',\n   [{'airport_fee': 500, 'base': 250, 'booking_fee': 0, 'distance': 599, 'time': 617, 'tolls': 0}, 12, None,\n    0],\n   {'discount': 0, 'surged': 1759, 'tax': 0, 'total': 2259}),\n  ('normal control 3',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 2589, 'time': 635, 'tolls': 690}, 25,\n    None, 825],\n   {'discount': 0, 'surged': 8435, 'tax': 710, 'total': 10510}),\n  ('normal control 4',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 429, 'time': 564, 'tolls': 375}, 17,\n    {'cap': 500, 'pct': 20}, 825],\n   {'discount': 388, 'surged': 1943, 'tax': 143, 'total': 2248})],\n [('regression: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2808, 'time': 350, 'tolls': 0}, 15,\n    {'cap': 1000, 'pct': 50}, 825],\n   {'discount': 1000, 'surged': 5112, 'tax': 339, 'total': 4451}),\n  ('partial repair probe: promo cap',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 1187, 'time': 97, 'tolls': 0}, 25,\n    {'cap': 1000, 'pct': 50}, 0],\n   {'discount': 1000, 'surged': 3585, 'tax': 0, 'total': 2585}),\n  ('second regression',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 218, 'time': 836, 'tolls': 0}, 15,\n    {'cap': 5, 'pct': 15}, 0],\n   {'discount': 5, 'surged': 1956, 'tax': 0, 'total': 2126}),\n  ('normal control 1',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2595, 'time': 377, 'tolls': 375}, 25, None,\n    0],\n   {'discount': 0, 'surged': 8055, 'tax': 0, 'total': 8430}),\n  ('normal control 2',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 359, 'time': 804, 'tolls': 0}, 10, None,\n    625],\n   {'discount': 0, 'surged': 1313, 'tax': 93, 'total': 2081}),\n  ('normal control 3',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 175, 'distance': 1650, 'time': 892, 'tolls': 690}, 17,\n    None, 1000],\n   {'discount': 0, 'surged': 4576, 'tax': 475, 'total': 6416}),\n  ('normal control 4',\n   [{'airport_fee': 500, 'base': 250, 'booking_fee': 245, 'distance': 2382, 'time': 551, 'tolls': 690}, 25,\n    None, 825],\n   {'discount': 0, 'surged': 7958, 'tax': 677, 'total': 10070})],\n [('regression: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 2496, 'time': 616, 'tolls': 690}, 10,\n    {'cap': 1000, 'pct': 50}, 825],\n   {'discount': 1000, 'surged': 3362, 'tax': 215, 'total': 3512}),\n  ('partial repair probe: promo cap',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 2743, 'time': 287, 'tolls': 0}, 15,\n    {'cap': 1000, 'pct': 50}, 825],\n   {'discount': 1000, 'surged': 4770, 'tax': 325, 'total': 4270}),\n  ('second regression',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2977, 'time': 212, 'tolls': 0}, 15,\n    {'cap': 500, 'pct': 20}, 0],\n   {'discount': 500, 'surged': 5159, 'tax': 0, 'total': 4659}),\n  ('normal control 1',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 245, 'distance': 530, 'time': 327, 'tolls': 690}, 10, None,\n    625],\n   {'discount': 0, 'surged': 1007, 'tax': 78, 'total': 2020}),\n  ('normal control 2',\n   [{'airport_fee': 500, 'base': 250, 'booking_fee': 175, 'distance': 693, 'time': 420, 'tolls': 375}, 25,\n    None, 825],\n   {'discount': 0, 'surged': 3408, 'tax': 296, 'total': 4754}),\n  ('normal control 3',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 403, 'time': 448, 'tolls': 0}, 15,\n    {'cap': 500, 'pct': 20}, 0],\n   {'discount': 330, 'surged': 1652, 'tax': 0, 'total': 1497}),\n  ('normal control 4',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 245, 'distance': 925, 'time': 819, 'tolls': 0}, 12, None,\n    625],\n   {'discount': 0, 'surged': 2273, 'tax': 157, 'total': 2675})],\n [('regression: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 1887, 'time': 798, 'tolls': 0}, 17,\n    {'cap': 1000, 'pct': 50}, 1000],\n   {'discount': 1000, 'surged': 4990, 'tax': 417, 'total': 4582}),\n  ('partial repair probe: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 2043, 'time': 744, 'tolls': 690}, 17,\n    {'cap': 500, 'pct': 20}, 0],\n   {'discount': 500, 'surged': 5163, 'tax': 0, 'total': 5528}),\n  ('second regression',\n   [{'airport_fee': 500, 'base': 250, 'booking_fee': 245, 'distance': 1583, 'time': 804, 'tolls': 0}, 25,\n    {'cap': 500, 'pct': 20}, 825],\n   {'discount': 500, 'surged': 6593, 'tax': 523, 'total': 7361}),\n  ('normal control 1',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 464, 'time': 114, 'tolls': 0}, 17,\n    {'cap': 500, 'pct': 20}, 0],\n   {'discount': 247, 'surged': 1238, 'tax': 0, 'total': 1166}),\n  ('normal control 2',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 175, 'distance': 504, 'time': 655, 'tolls': 375}, 25, None,\n    0],\n   {'discount': 0, 'surged': 3523, 'tax': 0, 'total': 4073}),\n  ('normal control 3',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 0, 'distance': 403, 'time': 175, 'tolls': 375}, 12,\n    {'cap': 1000, 'pct': 50}, 825],\n   {'discount': 437, 'surged': 874, 'tax': 36, 'total': 1348}),\n  ('normal control 4',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2545, 'time': 164, 'tolls': 690}, 15, None,\n    625],\n   {'discount': 0, 'surged': 4439, 'tax': 277, 'total': 5406})],\n [('regression: promo cap',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 592, 'time': 318, 'tolls': 690}, 10,\n    {'cap': 5, 'pct': 15}, 625],\n   {'discount': 5, 'surged': 1160, 'tax': 72, 'total': 1917}),\n  ('partial repair probe: promo cap',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 0, 'distance': 2992, 'time': 342, 'tolls': 690}, 10,\n    {'cap': 500, 'pct': 20}, 0],\n   {'discount': 500, 'surged': 3484, 'tax': 0, 'total': 3674}),\n  ('second regression',\n   [{'airport_fee': 0, 'base': 150, 'booking_fee': 175, 'distance': 920, 'time': 542, 'tolls': 690}, 17,\n    {'cap': 500, 'pct': 20}, 1000],\n   {'discount': 500, 'surged': 2740, 'tax': 242, 'total': 3347}),\n  ('normal control 1',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 0, 'distance': 1845, 'time': 397, 'tolls': 375}, 15,\n    None, 1000],\n   {'discount': 0, 'surged': 3588, 'tax': 359, 'total': 4822}),\n  ('normal control 2',\n   [{'airport_fee': 500, 'base': 150, 'booking_fee': 0, 'distance': 2544, 'time': 666, 'tolls': 690}, 10,\n    None, 625],\n   {'discount': 0, 'surged': 3360, 'tax': 210, 'total': 4760}),\n  ('normal control 3',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 245, 'distance': 275, 'time': 747, 'tolls': 690}, 25, None,\n    1000],\n   {'discount': 0, 'surged': 3180, 'tax': 343, 'total': 4458}),\n  ('normal control 4',\n   [{'airport_fee': 0, 'base': 250, 'booking_fee': 0, 'distance': 2045, 'time': 515, 'tolls': 0}, 15, None,\n    0],\n   {'discount': 0, 'surged': 4215, 'tax': 0, 'total': 4215})]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-ride-hailing-fare-surge-fare-composition-promo-cap","generated_at":"2026-09-29T14:50:39.891157+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Ride-hailing prices are computed per trip at scale; ordering, unit and boundary slips become systematic over- or under-charging.","repair":"Limit the discount to the cap in cents.","root_cause":"The cap is never applied to the percentage discount.","sha256":"9a6bcd50b193926e95761e3ce1cf5e5710a94c8614894886332643ff8b595bf9","title":"Percentage promo ignores its cap · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.371,"exit_code":1,"observations":[{"actual":{"discount":1527,"surged":3054,"tax":153,"total":2055},"check":"regression: promo cap","expected":{"discount":1000,"surged":3054,"tax":205,"total":2634},"passed":false},{"actual":{"discount":1010,"surged":2021,"tax":0,"total":1631},"check":"partial repair probe: promo cap","expected":{"discount":1000,"surged":2021,"tax":0,"total":1641},"passed":false},{"actual":{"discount":500,"surged":4534,"tax":421,"total":5505},"check":"second regression","expected":{"discount":5,"surged":4534,"tax":470,"total":6049},"passed":false},{"actual":{"discount":0,"surged":1465,"tax":141,"total":2351},"check":"normal control 1","expected":{"discount":0,"surged":1465,"tax":141,"total":2351},"passed":true},{"actual":{"discount":0,"surged":1759,"tax":0,"total":2259},"check":"normal control 2","expected":{"discount":0,"surged":1759,"tax":0,"total":2259},"passed":true},{"actual":{"discount":0,"surged":8435,"tax":710,"total":10510},"check":"normal control 3","expected":{"discount":0,"surged":8435,"tax":710,"total":10510},"passed":true},{"actual":{"discount":388,"surged":1943,"tax":143,"total":2248},"check":"normal control 4","expected":{"discount":388,"surged":1943,"tax":143,"total":2248},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: promo cap\", \"actual\": {\"surged\": 3054, \"discount\": 1527, \"tax\": 153, \"total\": 2055}, \"expected\": {\"discount\": 1000, \"surged\": 3054, \"tax\": 205, \"total\": 2634}, \"passed\": false}, {\"check\": \"partial repair probe: promo cap\", \"actual\": {\"surged\": 2021, \"discount\": 1010, \"tax\": 0, \"total\": 1631}, \"expected\": {\"discount\": 1000, \"surged\": 2021, \"tax\": 0, \"total\": 1641}, \"passed\": false}, {\"check\": \"second regression\", \"actual\": {\"surged\": 4534, \"discount\": 500, \"tax\": 421, \"total\": 5505}, \"expected\": {\"discount\": 5, \"surged\": 4534, \"tax\": 470, \"total\": 6049}, \"passed\": false}, {\"check\": \"normal control 1\", \"actual\": {\"surged\": 1465, \"discount\": 0, \"tax\": 141, \"total\": 2351}, \"expected\": {\"discount\": 0, \"surged\": 1465, \"tax\": 141, \"total\": 2351}, \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": {\"surged\": 1759, \"discount\": 0, \"tax\": 0, \"total\": 2259}, \"expected\": {\"discount\": 0, \"surged\": 1759, \"tax\": 0, \"total\": 2259}, \"passed\": true}, {\"check\": \"normal control 3\", \"actual\": {\"surged\": 8435, \"discount\": 0, \"tax\": 710, \"total\": 10510}, \"expected\": {\"discount\": 0, \"surged\": 8435, \"tax\": 710, \"total\": 10510}, \"passed\": true}, {\"check\": \"normal control 4\", \"actual\": {\"surged\": 1943, \"discount\": 388, \"tax\": 143, \"total\": 2248}, \"expected\": {\"discount\": 388, \"surged\": 1943, \"tax\": 143, \"total\": 2248}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.425,"exit_code":1,"observations":[{"actual":{"discount":1527,"surged":3054,"tax":153,"total":2055},"check":"regression: promo cap","expected":{"discount":1000,"surged":3054,"tax":205,"total":2634},"passed":false},{"actual":{"discount":1010,"surged":2021,"tax":0,"total":1631},"check":"partial repair probe: promo cap","expected":{"discount":1000,"surged":2021,"tax":0,"total":1641},"passed":false},{"actual":{"discount":680,"surged":4534,"tax":403,"total":5307},"check":"second regression","expected":{"discount":5,"surged":4534,"tax":470,"total":6049},"passed":false},{"actual":{"discount":0,"surged":1465,"tax":141,"total":2351},"check":"normal control 1","expected":{"discount":0,"surged":1465,"tax":141,"total":2351},"passed":true},{"actual":{"discount":0,"surged":1759,"tax":0,"total":2259},"check":"normal control 2","expected":{"discount":0,"surged":1759,"tax":0,"total":2259},"passed":true},{"actual":{"discount":0,"surged":8435,"tax":710,"total":10510},"check":"normal control 3","expected":{"discount":0,"surged":8435,"tax":710,"total":10510},"passed":true},{"actual":{"discount":388,"surged":1943,"tax":143,"total":2248},"check":"normal control 4","expected":{"discount":388,"surged":1943,"tax":143,"total":2248},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: promo cap\", \"actual\": {\"surged\": 3054, \"discount\": 1527, \"tax\": 153, \"total\": 2055}, \"expected\": {\"discount\": 1000, \"surged\": 3054, \"tax\": 205, \"total\": 2634}, \"passed\": false}, {\"check\": \"partial repair probe: promo cap\", \"actual\": {\"surged\": 2021, \"discount\": 1010, \"tax\": 0, \"total\": 1631}, \"expected\": {\"discount\": 1000, \"surged\": 2021, \"tax\": 0, \"total\": 1641}, \"passed\": false}, {\"check\": \"second regression\", \"actual\": {\"surged\": 4534, \"discount\": 680, \"tax\": 403, \"total\": 5307}, \"expected\": {\"discount\": 5, \"surged\": 4534, \"tax\": 470, \"total\": 6049}, \"passed\": false}, {\"check\": \"normal control 1\", \"actual\": {\"surged\": 1465, \"discount\": 0, \"tax\": 141, \"total\": 2351}, \"expected\": {\"discount\": 0, \"surged\": 1465, \"tax\": 141, \"total\": 2351}, \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": {\"surged\": 1759, \"discount\": 0, \"tax\": 0, \"total\": 2259}, \"expected\": {\"discount\": 0, \"surged\": 1759, \"tax\": 0, \"total\": 2259}, \"passed\": true}, {\"check\": \"normal control 3\", \"actual\": {\"surged\": 8435, \"discount\": 0, \"tax\": 710, \"total\": 10510}, \"expected\": {\"discount\": 0, \"surged\": 8435, \"tax\": 710, \"total\": 10510}, \"passed\": true}, {\"check\": \"normal control 4\", \"actual\": {\"surged\": 1943, \"discount\": 388, \"tax\": 143, \"total\": 2248}, \"expected\": {\"discount\": 388, \"surged\": 1943, \"tax\": 143, \"total\": 2248}, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.968,"exit_code":0,"observations":[{"actual":{"discount":1000,"surged":3054,"tax":205,"total":2634},"check":"regression: promo cap","expected":{"discount":1000,"surged":3054,"tax":205,"total":2634},"passed":true},{"actual":{"discount":1000,"surged":2021,"tax":0,"total":1641},"check":"partial repair probe: promo cap","expected":{"discount":1000,"surged":2021,"tax":0,"total":1641},"passed":true},{"actual":{"discount":5,"surged":4534,"tax":470,"total":6049},"check":"second regression","expected":{"discount":5,"surged":4534,"tax":470,"total":6049},"passed":true},{"actual":{"discount":0,"surged":1465,"tax":141,"total":2351},"check":"normal control 1","expected":{"discount":0,"surged":1465,"tax":141,"total":2351},"passed":true},{"actual":{"discount":0,"surged":1759,"tax":0,"total":2259},"check":"normal control 2","expected":{"discount":0,"surged":1759,"tax":0,"total":2259},"passed":true},{"actual":{"discount":0,"surged":8435,"tax":710,"total":10510},"check":"normal control 3","expected":{"discount":0,"surged":8435,"tax":710,"total":10510},"passed":true},{"actual":{"discount":388,"surged":1943,"tax":143,"total":2248},"check":"normal control 4","expected":{"discount":388,"surged":1943,"tax":143,"total":2248},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: promo cap\", \"actual\": {\"surged\": 3054, \"discount\": 1000, \"tax\": 205, \"total\": 2634}, \"expected\": {\"discount\": 1000, \"surged\": 3054, \"tax\": 205, \"total\": 2634}, \"passed\": true}, {\"check\": \"partial repair probe: promo cap\", \"actual\": {\"surged\": 2021, \"discount\": 1000, \"tax\": 0, \"total\": 1641}, \"expected\": {\"discount\": 1000, \"surged\": 2021, \"tax\": 0, \"total\": 1641}, \"passed\": true}, {\"check\": \"second regression\", \"actual\": {\"surged\": 4534, \"discount\": 5, \"tax\": 470, \"total\": 6049}, \"expected\": {\"discount\": 5, \"surged\": 4534, \"tax\": 470, \"total\": 6049}, \"passed\": true}, {\"check\": \"normal control 1\", \"actual\": {\"surged\": 1465, \"discount\": 0, \"tax\": 141, \"total\": 2351}, \"expected\": {\"discount\": 0, \"surged\": 1465, \"tax\": 141, \"total\": 2351}, \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": {\"surged\": 1759, \"discount\": 0, \"tax\": 0, \"total\": 2259}, \"expected\": {\"discount\": 0, \"surged\": 1759, \"tax\": 0, \"total\": 2259}, \"passed\": true}, {\"check\": \"normal control 3\", \"actual\": {\"surged\": 8435, \"discount\": 0, \"tax\": 710, \"total\": 10510}, \"expected\": {\"discount\": 0, \"surged\": 8435, \"tax\": 710, \"total\": 10510}, \"passed\": true}, {\"check\": \"normal control 4\", \"actual\": {\"surged\": 1943, \"discount\": 388, \"tax\": 143, \"total\": 2248}, \"expected\": {\"discount\": 388, \"surged\": 1943, \"tax\": 143, \"total\": 2248}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}