FAILURE MAP
← Case archive

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

Express lane dynamic price: a density equal to the band limit falls into the next band · case 01

Express lane dynamic price returns a wrong result when a density equal to the band limit falls into the next band.

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

ROOT CAUSE

At exactly the band limit the next, more expensive band is targeted.

VERIFIED REPAIR

Restore the density band edge rule so that the step reads `if x['density'] <= upto:`.

Unsuccessful approach: A one-unit tolerance keeps the next density in the cheaper band.

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 = 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': 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': 27, 'prev_price': 700, 'bands': [[13, 250], [14, 450], [27, 550], [34, 850]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [675, 0]), ({'density': 15, 'prev_price': 325, 'bands': [[10, 150], [15, 275], [33, 550], [36, 800]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 2, 'hov2_pct': 50}, [275, 0]), ({'density': 43, 'prev_price': 800, 'bands': [[25, 125], [40, 200], [42, 375], [43, 825]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 50}, [825, 825]), ({'density': 11, 'prev_price': 525, 'bands': [[11, 100], [14, 500], [16, 675], [33, 725]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [475, 475]), ({'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': 11, 'prev_price': 450, 'bands': [[10, 75], [11, 475], [15, 500], [26, 875]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 50}, [475, 235])], [({'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': 39, 'prev_price': 725, 'bands': [[20, 100], [24, 125], [38, 225], [39, 875]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 70}, [825, 0]), ({'density': 24, 'prev_price': 225, 'bands': [[17, 175], [24, 225], [25, 650], [42, 925]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 50}, [225, 110]), ({'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': 38, 'prev_price': 400, 'bands': [[23, 200], [38, 300], [41, 400], [43, 725]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 4, 'hov2_pct': 50}, [350, 175]), ({'density': 34, 'prev_price': 400, 'bands': [[18, 225], [34, 375], [39, 700], [44, 1000]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 50}, [375, 0]), ({'density': 34, 'prev_price': 850, 'bands': [[11, 75], [12, 100], [33, 400], [34, 825]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 70}, [825, 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': 15, 'prev_price': 425, 'bands': [[14, 200], [15, 475], [21, 500], [39, 625]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 70}, [475, 475]), ({'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': 15, 'prev_price': 275, 'bands': [[10, 175], [15, 200], [30, 300], [37, 875]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [225, 225]), ({'density': 24, 'prev_price': 375, 'bands': [[18, 50], [24, 200], [30, 400], [40, 850]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 70}, [325, 325]), ({'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': 31, 'prev_price': 425, 'bands': [[29, 50], [31, 275], [35, 750], [38, 900]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [325, 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': 22, 'prev_price': 450, 'bands': [[21, 225], [22, 500], [42, 600], [43, 825]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [475, 0])], [({'density': 35, 'prev_price': 350, 'bands': [[31, 50], [32, 200], [34, 375], [35, 950]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 70}, [400, 0]), ({'density': 29, 'prev_price': 325, 'bands': [[28, 50], [29, 325], [31, 800], [42, 850]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 50}, [325, 325]), ({'density': 16, 'prev_price': 275, 'bands': [[16, 250], [33, 275], [36, 325], [42, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 50}, [250, 250]), ({'density': 33, 'prev_price': 850, 'bands': [[17, 175], [26, 500], [27, 525], [33, 875]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [875, 0]), ({'density': 19, 'prev_price': 425, 'bands': [[19, 200], [21, 400], [27, 425], [29, 450]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 50}, [375, 375]), ({'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': 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': 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': 14, 'prev_price': 75, 'bands': [[13, 50], [14, 300], [17, 400], [38, 450]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [175, 175]), ({'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': 32, 'prev_price': 725, 'bands': [[18, 225], [31, 550], [32, 825], [42, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [750, 750]), ({'density': 24, 'prev_price': 725, 'bands': [[11, 300], [18, 375], [24, 600], [35, 925]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [675, 675]), ({'density': 27, 'prev_price': 650, 'bands': [[19, 450], [27, 725], [33, 850], [40, 1000]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 70}, [725, 725]), ({'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': 25, 'prev_price': 775, 'bands': [[10, 225], [11, 600], [25, 725], [39, 1000]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 50}, [725, 360]), ({'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])]]
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[50, 50][50, 50]Passed
fee oracle 1[1000, 1000][1000, 1000]Passed
fee oracle 2[725, 0][675, 0]Failed
fee oracle 3[425, 0][275, 0]Failed
fee oracle 4[900, 900][825, 825]Failed
fee oracle 5[500, 500][475, 475]Failed
fee oracle 6[350, 245][350, 245]Passed
fee oracle 7[500, 250][475, 235]Failed

SHA-256 / 73aeebce38556faadb04ee7e52ce605f3dd7da678d7d744b58589f39ff21606f

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 + 1:
            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': 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': 27, 'prev_price': 700, 'bands': [[13, 250], [14, 450], [27, 550], [34, 850]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [675, 0]), ({'density': 15, 'prev_price': 325, 'bands': [[10, 150], [15, 275], [33, 550], [36, 800]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 2, 'hov2_pct': 50}, [275, 0]), ({'density': 43, 'prev_price': 800, 'bands': [[25, 125], [40, 200], [42, 375], [43, 825]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 50}, [825, 825]), ({'density': 11, 'prev_price': 525, 'bands': [[11, 100], [14, 500], [16, 675], [33, 725]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [475, 475]), ({'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': 11, 'prev_price': 450, 'bands': [[10, 75], [11, 475], [15, 500], [26, 875]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 50}, [475, 235])], [({'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': 39, 'prev_price': 725, 'bands': [[20, 100], [24, 125], [38, 225], [39, 875]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 70}, [825, 0]), ({'density': 24, 'prev_price': 225, 'bands': [[17, 175], [24, 225], [25, 650], [42, 925]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 50}, [225, 110]), ({'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': 38, 'prev_price': 400, 'bands': [[23, 200], [38, 300], [41, 400], [43, 725]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 4, 'hov2_pct': 50}, [350, 175]), ({'density': 34, 'prev_price': 400, 'bands': [[18, 225], [34, 375], [39, 700], [44, 1000]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 50}, [375, 0]), ({'density': 34, 'prev_price': 850, 'bands': [[11, 75], [12, 100], [33, 400], [34, 825]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 70}, [825, 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': 15, 'prev_price': 425, 'bands': [[14, 200], [15, 475], [21, 500], [39, 625]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 70}, [475, 475]), ({'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': 15, 'prev_price': 275, 'bands': [[10, 175], [15, 200], [30, 300], [37, 875]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [225, 225]), ({'density': 24, 'prev_price': 375, 'bands': [[18, 50], [24, 200], [30, 400], [40, 850]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 70}, [325, 325]), ({'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': 31, 'prev_price': 425, 'bands': [[29, 50], [31, 275], [35, 750], [38, 900]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [325, 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': 22, 'prev_price': 450, 'bands': [[21, 225], [22, 500], [42, 600], [43, 825]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [475, 0])], [({'density': 35, 'prev_price': 350, 'bands': [[31, 50], [32, 200], [34, 375], [35, 950]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 70}, [400, 0]), ({'density': 29, 'prev_price': 325, 'bands': [[28, 50], [29, 325], [31, 800], [42, 850]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 50}, [325, 325]), ({'density': 16, 'prev_price': 275, 'bands': [[16, 250], [33, 275], [36, 325], [42, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 50}, [250, 250]), ({'density': 33, 'prev_price': 850, 'bands': [[17, 175], [26, 500], [27, 525], [33, 875]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [875, 0]), ({'density': 19, 'prev_price': 425, 'bands': [[19, 200], [21, 400], [27, 425], [29, 450]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 50}, [375, 375]), ({'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': 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': 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': 14, 'prev_price': 75, 'bands': [[13, 50], [14, 300], [17, 400], [38, 450]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [175, 175]), ({'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': 32, 'prev_price': 725, 'bands': [[18, 225], [31, 550], [32, 825], [42, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [750, 750]), ({'density': 24, 'prev_price': 725, 'bands': [[11, 300], [18, 375], [24, 600], [35, 925]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [675, 675]), ({'density': 27, 'prev_price': 650, 'bands': [[19, 450], [27, 725], [33, 850], [40, 1000]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 70}, [725, 725]), ({'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': 25, 'prev_price': 775, 'bands': [[10, 225], [11, 600], [25, 725], [39, 1000]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 50}, [725, 360]), ({'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])]]
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[50, 50][50, 50]Passed
fee oracle 1[1000, 1000][1000, 1000]Passed
fee oracle 2[675, 0][675, 0]Passed
fee oracle 3[275, 0][275, 0]Passed
fee oracle 4[700, 700][825, 825]Failed
fee oracle 5[475, 475][475, 475]Passed
fee oracle 6[350, 245][350, 245]Passed
fee oracle 7[350, 175][475, 235]Failed

SHA-256 / 04ba79d7412bd14e9714efb030ded28804e9e8a1fba4a4073830a4ad2c564f18

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': 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': 27, 'prev_price': 700, 'bands': [[13, 250], [14, 450], [27, 550], [34, 850]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [675, 0]), ({'density': 15, 'prev_price': 325, 'bands': [[10, 150], [15, 275], [33, 550], [36, 800]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 2, 'hov2_pct': 50}, [275, 0]), ({'density': 43, 'prev_price': 800, 'bands': [[25, 125], [40, 200], [42, 375], [43, 825]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 50}, [825, 825]), ({'density': 11, 'prev_price': 525, 'bands': [[11, 100], [14, 500], [16, 675], [33, 725]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [475, 475]), ({'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': 11, 'prev_price': 450, 'bands': [[10, 75], [11, 475], [15, 500], [26, 875]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 50}, [475, 235])], [({'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': 39, 'prev_price': 725, 'bands': [[20, 100], [24, 125], [38, 225], [39, 875]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 70}, [825, 0]), ({'density': 24, 'prev_price': 225, 'bands': [[17, 175], [24, 225], [25, 650], [42, 925]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 50}, [225, 110]), ({'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': 38, 'prev_price': 400, 'bands': [[23, 200], [38, 300], [41, 400], [43, 725]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 2, 'hov_free_min': 4, 'hov2_pct': 50}, [350, 175]), ({'density': 34, 'prev_price': 400, 'bands': [[18, 225], [34, 375], [39, 700], [44, 1000]], 'max_step': 25, 'min_price': 50, 'max_price': 1200, 'occupancy': 4, 'hov_free_min': 2, 'hov2_pct': 50}, [375, 0]), ({'density': 34, 'prev_price': 850, 'bands': [[11, 75], [12, 100], [33, 400], [34, 825]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 4, 'hov_free_min': 4, 'hov2_pct': 70}, [825, 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': 15, 'prev_price': 425, 'bands': [[14, 200], [15, 475], [21, 500], [39, 625]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 4, 'hov2_pct': 70}, [475, 475]), ({'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': 15, 'prev_price': 275, 'bands': [[10, 175], [15, 200], [30, 300], [37, 875]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [225, 225]), ({'density': 24, 'prev_price': 375, 'bands': [[18, 50], [24, 200], [30, 400], [40, 850]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 70}, [325, 325]), ({'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': 31, 'prev_price': 425, 'bands': [[29, 50], [31, 275], [35, 750], [38, 900]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [325, 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': 22, 'prev_price': 450, 'bands': [[21, 225], [22, 500], [42, 600], [43, 825]], 'max_step': 25, 'min_price': 50, 'max_price': 800, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 70}, [475, 0])], [({'density': 35, 'prev_price': 350, 'bands': [[31, 50], [32, 200], [34, 375], [35, 950]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 2, 'hov_free_min': 2, 'hov2_pct': 70}, [400, 0]), ({'density': 29, 'prev_price': 325, 'bands': [[28, 50], [29, 325], [31, 800], [42, 850]], 'max_step': 100, 'min_price': 50, 'max_price': 800, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 50}, [325, 325]), ({'density': 16, 'prev_price': 275, 'bands': [[16, 250], [33, 275], [36, 325], [42, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 50}, [250, 250]), ({'density': 33, 'prev_price': 850, 'bands': [[17, 175], [26, 500], [27, 525], [33, 875]], 'max_step': 50, 'min_price': 50, 'max_price': 1200, 'occupancy': 3, 'hov_free_min': 3, 'hov2_pct': 50}, [875, 0]), ({'density': 19, 'prev_price': 425, 'bands': [[19, 200], [21, 400], [27, 425], [29, 450]], 'max_step': 50, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 2, 'hov2_pct': 50}, [375, 375]), ({'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': 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': 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': 14, 'prev_price': 75, 'bands': [[13, 50], [14, 300], [17, 400], [38, 450]], 'max_step': 100, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [175, 175]), ({'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': 32, 'prev_price': 725, 'bands': [[18, 225], [31, 550], [32, 825], [42, 900]], 'max_step': 25, 'min_price': 50, 'max_price': 1000, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 70}, [750, 750]), ({'density': 24, 'prev_price': 725, 'bands': [[11, 300], [18, 375], [24, 600], [35, 925]], 'max_step': 50, 'min_price': 50, 'max_price': 800, 'occupancy': 1, 'hov_free_min': 3, 'hov2_pct': 50}, [675, 675]), ({'density': 27, 'prev_price': 650, 'bands': [[19, 450], [27, 725], [33, 850], [40, 1000]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 1, 'hov_free_min': 4, 'hov2_pct': 70}, [725, 725]), ({'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': 25, 'prev_price': 775, 'bands': [[10, 225], [11, 600], [25, 725], [39, 1000]], 'max_step': 100, 'min_price': 50, 'max_price': 1200, 'occupancy': 2, 'hov_free_min': 3, 'hov2_pct': 50}, [725, 360]), ({'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])]]
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[50, 50][50, 50]Passed
fee oracle 1[1000, 1000][1000, 1000]Passed
fee oracle 2[675, 0][675, 0]Passed
fee oracle 3[275, 0][275, 0]Passed
fee oracle 4[825, 825][825, 825]Passed
fee oracle 5[475, 475][475, 475]Passed
fee oracle 6[350, 245][350, 245]Passed
fee oracle 7[475, 235][475, 235]Passed

SHA-256 / b5546e34243613bf05a768a6916656eb624f73257e0ecfa30bd3625d45ba6b4c

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

Case digest / e113438622a0b939cbb7e930fe77254cae421049d232d335c125848cf86b0dc2