FAILURE MAP
← Case archive

FA-92901 / EV charging session scheduling / Open access

Post-charge idle occupancy fee: unfinished session handling · case 01

Sessions that never finished charging are charged an idle fee.

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

ROOT CAUSE

A missing completion time is back-filled with the plug-in time, so the whole stay looks idle.

VERIFIED REPAIR

Return no idle time when the session never completed.

Unsuccessful approach: Estimating completion as the midpoint of the stay still invents idle minutes.

Case contract

Times are minutes 0..1440 of one day. done is when charging finished (None: never finished, no idle fee). Idle time starts at done+grace and ends at unplug (exclusive). Only minutes in [360, 1320) are billable (night waiver). Fee = ceil(billable/block)*rate cents, then capped at cap when cap is not None (cap 0 waives the fee). Return [billable minutes, fee].

Why this case matters

Depot, workplace and public EV chargers schedule sessions against prices, circuit limits and departure deadlines; a wrong decision silently strands a driver or overloads a feeder.

1 / The failure

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

N = 1
observations = []
def solve(plug, done, unplug, grace, rate, cap, block):
    done = plug if done is None else done
    if unplug <= done:
        return [0, 0]
    start = done + grace
    if unplug <= start:
        return [0, 0]
    billable = 0
    for m in range(start, unplug):
        if 360 <= m < 1320:
            billable += 1
    blocks = -(-billable // block)
    fee = blocks * rate
    if cap is not None:
        fee = min(fee, cap)
    return [billable, fee]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
  ['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
  ['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
  ['regression: unfinished session handling', [1028, None, 1141, 10, 25, None, 1], [0, 0]],
  ['regression: unfinished session handling (partial repair)', [944, None, 1413, 10, 5, None, 5],
   [0, 0]],
  ['control 1', [708, 712, 1012, 15, 25, 1000, 5], [285, 1000]],
  ['control 2', [424, 721, 1119, 10, 5, None, 15], [388, 130]]],
 [['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
  ['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
  ['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
  ['regression: unfinished session handling', [865, None, 934, 30, 40, None, 5], [0, 0]],
  ['regression: unfinished session handling (partial repair)', [994, None, 1274, 0, 25, 300, 1],
   [0, 0]],
  ['control 1', [1149, 1440, 1440, 0, 25, None, 1], [0, 0]],
  ['control 2', [421, 583, 815, 15, 5, 300, 15], [217, 75]]],
 [['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
  ['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
  ['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
  ['regression: unfinished session handling', [1105, None, 1257, 0, 40, None, 1], [0, 0]],
  ['regression: unfinished session handling (partial repair)', [1005, None, 1404, 0, 25, None, 1],
   [0, 0]],
  ['control 1', [1122, 1422, 1434, 10, 25, 0, 10], [0, 0]],
  ['control 2', [325, 596, 781, 30, 25, None, 15], [155, 275]]],
 [['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
  ['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
  ['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
  ['regression: unfinished session handling', [527, None, 794, 0, 40, None, 5], [0, 0]],
  ['regression: unfinished session handling (partial repair)', [408, None, 653, 10, 40, 1000, 5],
   [0, 0]],
  ['control 1', [887, 906, 899, 15, 5, 1000, 10], [0, 0]],
  ['control 2', [684, 849, 1335, 30, 25, 1000, 10], [441, 1000]]],
 [['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
  ['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
  ['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
  ['regression: unfinished session handling', [365, None, 438, 15, 40, 1000, 15], [0, 0]],
  ['regression: unfinished session handling (partial repair)', [768, None, 1112, 30, 25, None, 15],
   [0, 0]],
  ['control 1', [942, 1011, 983, 15, 25, 300, 10], [0, 0]],
  ['control 2', [306, 373, 739, 10, 25, None, 10], [356, 900]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
boundary: unplugged inside grace[0, 0][0, 0]Passed
boundary: never finished[300, 1500][0, 0]Failed
boundary: idle crosses night waiver[20, 200][20, 200]Passed
regression: unfinished session handling[103, 2575][0, 0]Failed
regression: unfinished session handling (partial repair)[366, 370][0, 0]Failed
control 1[285, 1000][285, 1000]Passed
control 2[388, 130][388, 130]Passed

SHA-256 / 6ba7fe0e7412876e8679a79c868186b0020bee47eed8b23235bfd1580bcc4b50

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(plug, done, unplug, grace, rate, cap, block):
    done = (plug + unplug) // 2 if done is None else done
    if unplug <= done:
        return [0, 0]
    start = done + grace
    if unplug <= start:
        return [0, 0]
    billable = 0
    for m in range(start, unplug):
        if 360 <= m < 1320:
            billable += 1
    blocks = -(-billable // block)
    fee = blocks * rate
    if cap is not None:
        fee = min(fee, cap)
    return [billable, fee]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
  ['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
  ['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
  ['regression: unfinished session handling', [1028, None, 1141, 10, 25, None, 1], [0, 0]],
  ['regression: unfinished session handling (partial repair)', [944, None, 1413, 10, 5, None, 5],
   [0, 0]],
  ['control 1', [708, 712, 1012, 15, 25, 1000, 5], [285, 1000]],
  ['control 2', [424, 721, 1119, 10, 5, None, 15], [388, 130]]],
 [['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
  ['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
  ['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
  ['regression: unfinished session handling', [865, None, 934, 30, 40, None, 5], [0, 0]],
  ['regression: unfinished session handling (partial repair)', [994, None, 1274, 0, 25, 300, 1],
   [0, 0]],
  ['control 1', [1149, 1440, 1440, 0, 25, None, 1], [0, 0]],
  ['control 2', [421, 583, 815, 15, 5, 300, 15], [217, 75]]],
 [['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
  ['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
  ['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
  ['regression: unfinished session handling', [1105, None, 1257, 0, 40, None, 1], [0, 0]],
  ['regression: unfinished session handling (partial repair)', [1005, None, 1404, 0, 25, None, 1],
   [0, 0]],
  ['control 1', [1122, 1422, 1434, 10, 25, 0, 10], [0, 0]],
  ['control 2', [325, 596, 781, 30, 25, None, 15], [155, 275]]],
 [['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
  ['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
  ['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
  ['regression: unfinished session handling', [527, None, 794, 0, 40, None, 5], [0, 0]],
  ['regression: unfinished session handling (partial repair)', [408, None, 653, 10, 40, 1000, 5],
   [0, 0]],
  ['control 1', [887, 906, 899, 15, 5, 1000, 10], [0, 0]],
  ['control 2', [684, 849, 1335, 30, 25, 1000, 10], [441, 1000]]],
 [['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
  ['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
  ['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
  ['regression: unfinished session handling', [365, None, 438, 15, 40, 1000, 15], [0, 0]],
  ['regression: unfinished session handling (partial repair)', [768, None, 1112, 30, 25, None, 15],
   [0, 0]],
  ['control 1', [942, 1011, 983, 15, 25, 300, 10], [0, 0]],
  ['control 2', [306, 373, 739, 10, 25, None, 10], [356, 900]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
boundary: unplugged inside grace[0, 0][0, 0]Passed
boundary: never finished[150, 750][0, 0]Failed
boundary: idle crosses night waiver[20, 200][20, 200]Passed
regression: unfinished session handling[47, 1175][0, 0]Failed
regression: unfinished session handling (partial repair)[132, 135][0, 0]Failed
control 1[285, 1000][285, 1000]Passed
control 2[388, 130][388, 130]Passed

SHA-256 / 7768d632a86afaf0bf1cd091d63c27e702663b5b0b4e9ec0bce739852c860fa7

3 / The verified repair

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

N = 1
observations = []
def solve(plug, done, unplug, grace, rate, cap, block):
    if done is None or unplug <= done:
        return [0, 0]
    start = done + grace
    if unplug <= start:
        return [0, 0]
    billable = 0
    for m in range(start, unplug):
        if 360 <= m < 1320:
            billable += 1
    blocks = -(-billable // block)
    fee = blocks * rate
    if cap is not None:
        fee = min(fee, cap)
    return [billable, fee]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
  ['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
  ['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
  ['regression: unfinished session handling', [1028, None, 1141, 10, 25, None, 1], [0, 0]],
  ['regression: unfinished session handling (partial repair)', [944, None, 1413, 10, 5, None, 5],
   [0, 0]],
  ['control 1', [708, 712, 1012, 15, 25, 1000, 5], [285, 1000]],
  ['control 2', [424, 721, 1119, 10, 5, None, 15], [388, 130]]],
 [['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
  ['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
  ['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
  ['regression: unfinished session handling', [865, None, 934, 30, 40, None, 5], [0, 0]],
  ['regression: unfinished session handling (partial repair)', [994, None, 1274, 0, 25, 300, 1],
   [0, 0]],
  ['control 1', [1149, 1440, 1440, 0, 25, None, 1], [0, 0]],
  ['control 2', [421, 583, 815, 15, 5, 300, 15], [217, 75]]],
 [['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
  ['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
  ['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
  ['regression: unfinished session handling', [1105, None, 1257, 0, 40, None, 1], [0, 0]],
  ['regression: unfinished session handling (partial repair)', [1005, None, 1404, 0, 25, None, 1],
   [0, 0]],
  ['control 1', [1122, 1422, 1434, 10, 25, 0, 10], [0, 0]],
  ['control 2', [325, 596, 781, 30, 25, None, 15], [155, 275]]],
 [['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
  ['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
  ['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
  ['regression: unfinished session handling', [527, None, 794, 0, 40, None, 5], [0, 0]],
  ['regression: unfinished session handling (partial repair)', [408, None, 653, 10, 40, 1000, 5],
   [0, 0]],
  ['control 1', [887, 906, 899, 15, 5, 1000, 10], [0, 0]],
  ['control 2', [684, 849, 1335, 30, 25, 1000, 10], [441, 1000]]],
 [['boundary: unplugged inside grace', [600, 700, 710, 15, 25, None, 5], [0, 0]],
  ['boundary: never finished', [600, None, 900, 0, 25, None, 5], [0, 0]],
  ['boundary: idle crosses night waiver', [1200, 1300, 1400, 0, 10, None, 1], [20, 200]],
  ['regression: unfinished session handling', [365, None, 438, 15, 40, 1000, 15], [0, 0]],
  ['regression: unfinished session handling (partial repair)', [768, None, 1112, 30, 25, None, 15],
   [0, 0]],
  ['control 1', [942, 1011, 983, 15, 25, 300, 10], [0, 0]],
  ['control 2', [306, 373, 739, 10, 25, None, 10], [356, 900]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
boundary: unplugged inside grace[0, 0][0, 0]Passed
boundary: never finished[0, 0][0, 0]Passed
boundary: idle crosses night waiver[20, 200][20, 200]Passed
regression: unfinished session handling[0, 0][0, 0]Passed
regression: unfinished session handling (partial repair)[0, 0][0, 0]Passed
control 1[285, 1000][285, 1000]Passed
control 2[388, 130][388, 130]Passed

SHA-256 / 2ca272388fc35c0c0a6e6235232055ca9bd8d78cc898d88148d33001da0d762f

Verification & scope

Deterministic stipulated toy contract for teaching; no claim of conformance with any standard, vendor protocol or production controller. 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:51:50.369067+00:00.

Case digest / 4ed313bf809c6cd78f80c15c517c87dacb2dd338de71ae60c4aee2cb169728ee