FAILURE MAP
← Case archive

FA-68566 / Toll and parking fee computation / Open access

Express lane dynamic price: price decreases are not rate limited · case 01

Express lane dynamic price returns a wrong result when price decreases are not rate limited.

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

ROOT CAUSE

Only increases are limited, so the price can collapse in a single interval.

VERIFIED REPAIR

Restore the price change limit rule so that the step reads `max(-x['max_step'], min(x['max_step'], target - prev))`.

Unsuccessful approach: Taking the absolute difference always moves the price upward.

Case contract

Input {density, prev_price, bands: [[density upto, price]] ascending, max_step, min_price, max_price, occupancy, hov_free_min, hov2_pct}. The target is the first band whose upto is >= density, else max_price. The posted price moves from prev_price toward the target by at most max_step either way, then is clamped to [min_price, max_price]. Vehicles with occupancy >= hov_free_min pay 0; occupancy 2 (when not free) pays hov2_pct percent floored to 5 cents. Return [posted, charged].

Why this case matters

Fee engines bill customers in integer cents; a wrong boundary, rounding stage or cap scope silently over- or under-charges.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    target = x['max_price']
    for upto, price in x['bands']:
        if x['density'] <= upto:
            target = price
            break
    prev = x['prev_price']
    step = min(x['max_step'], target - prev)
    price = max(x['min_price'], min(x['max_price'], prev + step))
    if x['occupancy'] >= x['hov_free_min']:
        return [price, 0]
    if x['occupancy'] == 2:
        return [price, price * x['hov2_pct'] // 100 // 5 * 5]
    return [price, price]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 13, 'prev_price': 1250, 'bands': [[10, 50], [13, 550], [18, 750], [26, 975]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [800, 560]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 44, 'prev_price': 1050, 'bands': [[23, 125], [24, 150], [40, 350], [44, 450]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 2, 'hov2_pct': 70}, [1000, 0]), ({'density': 21, 'prev_price': 825, 'bands': [[21, 300], [28, 325], [35, 750], [36, 850]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 70}, [800, 800]), ({'density': 35, 'prev_price': 1150, 'bands': [[20, 100], [25, 150], [34, 625], [35, 800]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 70}, [1000, 0]), ({'density': 15, 'prev_price': 875, 'bands': [[12, 150], [15, 475], [30, 550], [44, 600]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 50}, [850, 850]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50])], [({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 11, 'prev_price': 425, 'bands': [[11, 250], [17, 600], [38, 775], [41, 850]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 70}, [325, 0]), ({'density': 44, 'prev_price': 375, 'bands': [[16, 250], [22, 325], [30, 675], [44, 750]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 50}, [400, 0]), ({'density': 24, 'prev_price': 1225, 'bands': [[24, 50], [28, 700], [30, 800], [44, 925]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [800, 0]), ({'density': 32, 'prev_price': 600, 'bands': [[12, 250], [13, 275], [21, 475], [32, 700]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 50}, [625, 0]), ({'density': 42, 'prev_price': 1225, 'bands': [[11, 125], [21, 325], [42, 850], [44, 1000]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1175, 1175]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245])], [({'density': 25, 'prev_price': 1100, 'bands': [[13, 175], [18, 325], [20, 350], [37, 650]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 50}, [1000, 1000]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 23, 'prev_price': 525, 'bands': [[11, 225], [17, 450], [23, 625], [27, 925]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 50}, [625, 0]), ({'density': 38, 'prev_price': 1125, 'bands': [[19, 375], [23, 775], [36, 900], [38, 975]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [1025, 1025]), ({'density': 3, 'prev_price': 425, 'bands': [[12, 275], [34, 850], [38, 875], [40, 975]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 50}, [325, 325]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 37, 'prev_price': 700, 'bands': [[16, 175], [17, 200], [22, 300], [37, 675]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [675, 0])], [({'density': 17, 'prev_price': 100, 'bands': [[10, 125], [17, 325], [30, 675], [41, 750]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 4, 'hov2_pct': 70}, [150, 105]), ({'density': 15, 'prev_price': 975, 'bands': [[15, 125], [18, 250], [42, 525], [43, 975]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [800, 560]), ({'density': 23, 'prev_price': 1050, 'bands': [[14, 100], [15, 175], [23, 575], [32, 700]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [800, 0]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 27, 'prev_price': 625, 'bands': [[19, 75], [27, 250], [33, 450], [36, 775]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [525, 525]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 23, 'prev_price': 725, 'bands': [[20, 275], [23, 350], [34, 675], [35, 750]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 70}, [675, 675]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245])], [({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 30, 'prev_price': 175, 'bands': [[18, 325], [27, 425], [28, 575], [42, 875]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [275, 275]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 42, 'prev_price': 375, 'bands': [[11, 175], [26, 375], [32, 650], [42, 950]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 70}, [475, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 23, 'prev_price': 750, 'bands': [[13, 325], [23, 450], [39, 850], [44, 875]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 4, 'hov2_pct': 50}, [650, 325]), ({'density': 21, 'prev_price': 900, 'bands': [[17, 75], [21, 100], [25, 400], [35, 625]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 70}, [800, 0]), ({'density': 20, 'prev_price': 900, 'bands': [[20, 50], [26, 400], [28, 525], [43, 750]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 70}, [800, 0])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check('fee oracle' + ' %d' % i, 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
fee oracle 0[1000, 1000][1000, 1000]Passed
fee oracle 1[550, 385][800, 560]Failed
fee oracle 2[350, 245][350, 245]Passed
fee oracle 3[450, 0][1000, 0]Failed
fee oracle 4[300, 300][800, 800]Failed
fee oracle 5[800, 0][1000, 0]Failed
fee oracle 6[475, 475][850, 850]Failed
fee oracle 7[50, 50][50, 50]Passed

SHA-256 / 6471357311ca6b8ea0ee1760f17147a82b1de16479d0f2e4a27215ef033561af

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    target = x['max_price']
    for upto, price in x['bands']:
        if x['density'] <= upto:
            target = price
            break
    prev = x['prev_price']
    step = max(-x['max_step'], min(x['max_step'], abs(target - prev)))
    price = max(x['min_price'], min(x['max_price'], prev + step))
    if x['occupancy'] >= x['hov_free_min']:
        return [price, 0]
    if x['occupancy'] == 2:
        return [price, price * x['hov2_pct'] // 100 // 5 * 5]
    return [price, price]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 13, 'prev_price': 1250, 'bands': [[10, 50], [13, 550], [18, 750], [26, 975]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [800, 560]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 44, 'prev_price': 1050, 'bands': [[23, 125], [24, 150], [40, 350], [44, 450]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 2, 'hov2_pct': 70}, [1000, 0]), ({'density': 21, 'prev_price': 825, 'bands': [[21, 300], [28, 325], [35, 750], [36, 850]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 70}, [800, 800]), ({'density': 35, 'prev_price': 1150, 'bands': [[20, 100], [25, 150], [34, 625], [35, 800]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 70}, [1000, 0]), ({'density': 15, 'prev_price': 875, 'bands': [[12, 150], [15, 475], [30, 550], [44, 600]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 50}, [850, 850]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50])], [({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 11, 'prev_price': 425, 'bands': [[11, 250], [17, 600], [38, 775], [41, 850]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 70}, [325, 0]), ({'density': 44, 'prev_price': 375, 'bands': [[16, 250], [22, 325], [30, 675], [44, 750]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 50}, [400, 0]), ({'density': 24, 'prev_price': 1225, 'bands': [[24, 50], [28, 700], [30, 800], [44, 925]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [800, 0]), ({'density': 32, 'prev_price': 600, 'bands': [[12, 250], [13, 275], [21, 475], [32, 700]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 50}, [625, 0]), ({'density': 42, 'prev_price': 1225, 'bands': [[11, 125], [21, 325], [42, 850], [44, 1000]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1175, 1175]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245])], [({'density': 25, 'prev_price': 1100, 'bands': [[13, 175], [18, 325], [20, 350], [37, 650]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 50}, [1000, 1000]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 23, 'prev_price': 525, 'bands': [[11, 225], [17, 450], [23, 625], [27, 925]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 50}, [625, 0]), ({'density': 38, 'prev_price': 1125, 'bands': [[19, 375], [23, 775], [36, 900], [38, 975]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [1025, 1025]), ({'density': 3, 'prev_price': 425, 'bands': [[12, 275], [34, 850], [38, 875], [40, 975]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 50}, [325, 325]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 37, 'prev_price': 700, 'bands': [[16, 175], [17, 200], [22, 300], [37, 675]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [675, 0])], [({'density': 17, 'prev_price': 100, 'bands': [[10, 125], [17, 325], [30, 675], [41, 750]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 4, 'hov2_pct': 70}, [150, 105]), ({'density': 15, 'prev_price': 975, 'bands': [[15, 125], [18, 250], [42, 525], [43, 975]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [800, 560]), ({'density': 23, 'prev_price': 1050, 'bands': [[14, 100], [15, 175], [23, 575], [32, 700]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [800, 0]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 27, 'prev_price': 625, 'bands': [[19, 75], [27, 250], [33, 450], [36, 775]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [525, 525]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 23, 'prev_price': 725, 'bands': [[20, 275], [23, 350], [34, 675], [35, 750]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 70}, [675, 675]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245])], [({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 30, 'prev_price': 175, 'bands': [[18, 325], [27, 425], [28, 575], [42, 875]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [275, 275]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 42, 'prev_price': 375, 'bands': [[11, 175], [26, 375], [32, 650], [42, 950]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 70}, [475, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 23, 'prev_price': 750, 'bands': [[13, 325], [23, 450], [39, 850], [44, 875]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 4, 'hov2_pct': 50}, [650, 325]), ({'density': 21, 'prev_price': 900, 'bands': [[17, 75], [21, 100], [25, 400], [35, 625]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 70}, [800, 0]), ({'density': 20, 'prev_price': 900, 'bands': [[20, 50], [26, 400], [28, 525], [43, 750]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 70}, [800, 0])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check('fee oracle' + ' %d' % i, 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
fee oracle 0[1000, 1000][1000, 1000]Passed
fee oracle 1[800, 560][800, 560]Passed
fee oracle 2[350, 245][350, 245]Passed
fee oracle 3[1000, 0][1000, 0]Passed
fee oracle 4[850, 850][800, 800]Failed
fee oracle 5[1000, 0][1000, 0]Passed
fee oracle 6[900, 900][850, 850]Failed
fee oracle 7[50, 50][50, 50]Passed

SHA-256 / f4cf805e9bf402b1fc0701a6b884086f64158e595e9ebb4c7a0cb4c682abe1d1

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    target = x['max_price']
    for upto, price in x['bands']:
        if x['density'] <= upto:
            target = price
            break
    prev = x['prev_price']
    step = max(-x['max_step'], min(x['max_step'], target - prev))
    price = max(x['min_price'], min(x['max_price'], prev + step))
    if x['occupancy'] >= x['hov_free_min']:
        return [price, 0]
    if x['occupancy'] == 2:
        return [price, price * x['hov2_pct'] // 100 // 5 * 5]
    return [price, price]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 13, 'prev_price': 1250, 'bands': [[10, 50], [13, 550], [18, 750], [26, 975]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [800, 560]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 44, 'prev_price': 1050, 'bands': [[23, 125], [24, 150], [40, 350], [44, 450]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 2, 'hov2_pct': 70}, [1000, 0]), ({'density': 21, 'prev_price': 825, 'bands': [[21, 300], [28, 325], [35, 750], [36, 850]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 70}, [800, 800]), ({'density': 35, 'prev_price': 1150, 'bands': [[20, 100], [25, 150], [34, 625], [35, 800]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 70}, [1000, 0]), ({'density': 15, 'prev_price': 875, 'bands': [[12, 150], [15, 475], [30, 550], [44, 600]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 50}, [850, 850]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50])], [({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 11, 'prev_price': 425, 'bands': [[11, 250], [17, 600], [38, 775], [41, 850]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 70}, [325, 0]), ({'density': 44, 'prev_price': 375, 'bands': [[16, 250], [22, 325], [30, 675], [44, 750]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 50}, [400, 0]), ({'density': 24, 'prev_price': 1225, 'bands': [[24, 50], [28, 700], [30, 800], [44, 925]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [800, 0]), ({'density': 32, 'prev_price': 600, 'bands': [[12, 250], [13, 275], [21, 475], [32, 700]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 50}, [625, 0]), ({'density': 42, 'prev_price': 1225, 'bands': [[11, 125], [21, 325], [42, 850], [44, 1000]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1175, 1175]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245])], [({'density': 25, 'prev_price': 1100, 'bands': [[13, 175], [18, 325], [20, 350], [37, 650]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 50}, [1000, 1000]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 23, 'prev_price': 525, 'bands': [[11, 225], [17, 450], [23, 625], [27, 925]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 50}, [625, 0]), ({'density': 38, 'prev_price': 1125, 'bands': [[19, 375], [23, 775], [36, 900], [38, 975]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [1025, 1025]), ({'density': 3, 'prev_price': 425, 'bands': [[12, 275], [34, 850], [38, 875], [40, 975]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 50}, [325, 325]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 37, 'prev_price': 700, 'bands': [[16, 175], [17, 200], [22, 300], [37, 675]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [675, 0])], [({'density': 17, 'prev_price': 100, 'bands': [[10, 125], [17, 325], [30, 675], [41, 750]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 4, 'hov2_pct': 70}, [150, 105]), ({'density': 15, 'prev_price': 975, 'bands': [[15, 125], [18, 250], [42, 525], [43, 975]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [800, 560]), ({'density': 23, 'prev_price': 1050, 'bands': [[14, 100], [15, 175], [23, 575], [32, 700]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [800, 0]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 27, 'prev_price': 625, 'bands': [[19, 75], [27, 250], [33, 450], [36, 775]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [525, 525]), ({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 23, 'prev_price': 725, 'bands': [[20, 275], [23, 350], [34, 675], [35, 750]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 70}, [675, 675]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245])], [({'density': 45, 'prev_price': 1100, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [1000, 1000]), ({'density': 30, 'prev_price': 175, 'bands': [[18, 325], [27, 425], [28, 575], [42, 875]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [275, 275]), ({'density': 25, 'prev_price': 0, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [50, 50]), ({'density': 42, 'prev_price': 375, 'bands': [[11, 175], [26, 375], [32, 650], [42, 950]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 70}, [475, 0]), ({'density': 20, 'prev_price': 300, 'bands': [[12, 100], [20, 400], [30, 700], [40, 900]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 70}, [350, 245]), ({'density': 23, 'prev_price': 750, 'bands': [[13, 325], [23, 450], [39, 850], [44, 875]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 4, 'hov2_pct': 50}, [650, 325]), ({'density': 21, 'prev_price': 900, 'bands': [[17, 75], [21, 100], [25, 400], [35, 625]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 4, 'hov_free_min': 3, 'hov2_pct': 70}, [800, 0]), ({'density': 20, 'prev_price': 900, 'bands': [[20, 50], [26, 400], [28, 525], [43, 750]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 70}, [800, 0])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check('fee oracle' + ' %d' % i, 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
fee oracle 0[1000, 1000][1000, 1000]Passed
fee oracle 1[800, 560][800, 560]Passed
fee oracle 2[350, 245][350, 245]Passed
fee oracle 3[1000, 0][1000, 0]Passed
fee oracle 4[800, 800][800, 800]Passed
fee oracle 5[1000, 0][1000, 0]Passed
fee oracle 6[850, 850][850, 850]Passed
fee oracle 7[50, 50][50, 50]Passed

SHA-256 / 762907cf95395cdae41475e6a06ec4c4a40544a2c6df10f2a64208fc2466f8a2

Verification & scope

A deterministic, bounded toy model with a stipulated contract; it makes no claim of conformance to any agency manual or standard. 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:48:03.466382+00:00.

Case digest / 847bd9a234afadb2c2d81c3d8616fb81d2549dcb62d920743fd23b987c72e797