FAILURE MAP
← Case archive

FA-92886 / EV charging session scheduling / Open access

Post-charge idle occupancy fee: night waiver window edges · case 01

The first billable morning minute is waived and the first night minute is billed.

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

ROOT CAUSE

The billable window bounds are shifted by one minute at both ends.

THE FAILURE

The billable window bounds are shifted by one minute at both ends.

Unsuccessful approach: Making both ends inclusive still bills the 22:00 minute.

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):
    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: night waiver window edges', [745, 831, 1323, 0, 40, 1000, 10], [489, 1000]],
  ['regression: night waiver window edges (partial repair)', [1210, 1288, 1405, 30, 40, None, 5],
   [2, 40]],
  ['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: night waiver window edges', [935, 1103, 1359, 15, 25, 0, 15], [202, 0]],
  ['regression: night waiver window edges (partial repair)', [937, 1179, 1382, 15, 40, None, 1],
   [126, 5040]],
  ['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: night waiver window edges', [1142, 1227, 1440, 10, 25, 0, 1], [83, 0]],
  ['regression: night waiver window edges (partial repair)', [1042, 1241, 1388, 10, 25, 1000, 10],
   [69, 175]],
  ['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: night waiver window edges', [37, 320, 601, 10, 5, None, 10], [241, 125]],
  ['regression: night waiver window edges (partial repair)', [926, 1191, 1440, 15, 25, None, 15],
   [114, 200]],
  ['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: night waiver window edges', [1177, 1189, 1440, 15, 5, 1000, 5], [116, 120]],
  ['regression: night waiver window edges (partial repair)', [808, 1193, 1387, 15, 5, None, 1],
   [112, 560]],
  ['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[21, 210][20, 200]Failed
regression: night waiver window edges[490, 1000][489, 1000]Failed
regression: night waiver window edges (partial repair)[3, 40][2, 40]Failed
control 1[285, 1000][285, 1000]Passed
control 2[388, 130][388, 130]Passed

SHA-256 / 2d0dda67a7c984ba996b4786cb2ad655c44e313cbe63de5f5a1c818b1f8b0d7d

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):
    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: night waiver window edges', [745, 831, 1323, 0, 40, 1000, 10], [489, 1000]],
  ['regression: night waiver window edges (partial repair)', [1210, 1288, 1405, 30, 40, None, 5],
   [2, 40]],
  ['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: night waiver window edges', [935, 1103, 1359, 15, 25, 0, 15], [202, 0]],
  ['regression: night waiver window edges (partial repair)', [937, 1179, 1382, 15, 40, None, 1],
   [126, 5040]],
  ['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: night waiver window edges', [1142, 1227, 1440, 10, 25, 0, 1], [83, 0]],
  ['regression: night waiver window edges (partial repair)', [1042, 1241, 1388, 10, 25, 1000, 10],
   [69, 175]],
  ['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: night waiver window edges', [37, 320, 601, 10, 5, None, 10], [241, 125]],
  ['regression: night waiver window edges (partial repair)', [926, 1191, 1440, 15, 25, None, 15],
   [114, 200]],
  ['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: night waiver window edges', [1177, 1189, 1440, 15, 5, 1000, 5], [116, 120]],
  ['regression: night waiver window edges (partial repair)', [808, 1193, 1387, 15, 5, None, 1],
   [112, 560]],
  ['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[21, 210][20, 200]Failed
regression: night waiver window edges[490, 1000][489, 1000]Failed
regression: night waiver window edges (partial repair)[3, 40][2, 40]Failed
control 1[285, 1000][285, 1000]Passed
control 2[388, 130][388, 130]Passed

SHA-256 / 142703d39a27862fe02dcdf5fee6d6eb1078641c20e6e46715b111a09cf66f1b

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 7eca5c99a4bde28b416c87d82b04a602abe44731445b4059a26eff49151ac24f