FAILURE MAP
← Case archive

FA-93001 / EV charging session scheduling / Open access

Connector reservation conflict check: free connector search order · case 01

Open-choice reservations land on the highest connector instead of the lowest free one.

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

ROOT CAUSE

The search iterates connectors from the top down.

THE FAILURE

The search iterates connectors from the top down.

Unsuccessful approach: Ascending but half-open range never offers the last connector.

Case contract

Connectors are numbered 1..n_conn. existing holds [connector, start, end) reservations. req is [start, end, connector or None]. end <= start or an out-of-range connector returns 'invalid'. Two reservations on the same connector conflict unless separated by at least buffer minutes on both sides. Return the requested connector if free, or the lowest free connector when None was requested, else None.

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(existing, req, buffer, n_conn):
    s, e, want = req
    if e <= s:
        return 'invalid'
    if want is not None and not 1 <= want <= n_conn:
        return 'invalid'
    conns = [want] if want is not None else list(range(n_conn, 0, -1))
    for c in conns:
        clash = False
        for c2, s2, e2 in existing:
            if c2 == c and s < e2 + buffer and s2 < e + buffer:
                clash = True
                break
        if not clash:
            return c
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: back-to-back with buffer', [[[1, 0, 30]], [40, 60, 1], 10, 1], 1],
  ['boundary: zero-length request', [[], [10, 10, None], 0, 2], 'invalid'],
  ['boundary: last connector requested', [[[1, 0, 30]], [0, 30, 3], 0, 3], 3],
  ['regression: free connector search order',
   [[[1, 100, 133], [2, 11, 28], [1, 134, 160]], [20, 80, None], 10, 3], 1],
  ['regression: free connector search order (partial repair)', [[], [95, 125, None], 5, 1], 1],
  ['control 1', [[[2, 157, 203], [1, 191, 236]], [179, 224, None], 5, 2], None],
  ['control 2',
   [[[3, 190, 210], [4, 11, 28], [2, 54, 68], [4, 54, 104], [3, 134, 162]], [79, 139, 4], 5, 4],
   None]],
 [['boundary: back-to-back with buffer', [[[1, 0, 30]], [40, 60, 1], 10, 1], 1],
  ['boundary: zero-length request', [[], [10, 10, None], 0, 2], 'invalid'],
  ['boundary: last connector requested', [[[1, 0, 30]], [0, 30, 3], 0, 3], 3],
  ['regression: free connector search order', [[[2, 159, 208], [1, 9, 67]], [210, 255, None], 0, 3],
   1],
  ['regression: free connector search order (partial repair)', [[], [95, 125, None], 5, 1], 1],
  ['control 1',
   [[[2, 130, 150], [3, 5, 36], [3, 174, 193], [2, 18, 78], [1, 61, 115], [4, 68, 95]],
    [171, 201, 2], 10, 4],
   2],
  ['control 2',
   [[[3, 116, 135], [1, 178, 208], [1, 83, 123], [1, 136, 157], [3, 111, 126], [1, 97, 137]],
    [217, 222, 2], 0, 3],
   2]],
 [['boundary: back-to-back with buffer', [[[1, 0, 30]], [40, 60, 1], 10, 1], 1],
  ['boundary: zero-length request', [[], [10, 10, None], 0, 2], 'invalid'],
  ['boundary: last connector requested', [[[1, 0, 30]], [0, 30, 3], 0, 3], 3],
  ['regression: free connector search order', [[], [149, 154, None], 5, 4], 1],
  ['regression: free connector search order (partial repair)',
   [[[1, 130, 147], [1, 82, 133], [1, 89, 133], [1, 193, 215], [1, 86, 134]], [2, 32, None], 0, 1],
   1],
  ['control 1', [[[3, 198, 211], [1, 147, 191], [4, 137, 178]], [148, 208, None], 10, 4], 2],
  ['control 2',
   [[[1, 75, 109], [1, 5, 46], [3, 128, 161], [3, 171, 198], [2, 190, 240], [1, 13, 36]],
    [58, 73, 1], 10, 3],
   None]],
 [['boundary: back-to-back with buffer', [[[1, 0, 30]], [40, 60, 1], 10, 1], 1],
  ['boundary: zero-length request', [[], [10, 10, None], 0, 2], 'invalid'],
  ['boundary: last connector requested', [[[1, 0, 30]], [0, 30, 3], 0, 3], 3],
  ['regression: free connector search order',
   [[[2, 102, 160], [3, 28, 74], [3, 56, 79], [2, 172, 229]], [175, 220, None], 0, 3], 1],
  ['regression: free connector search order (partial repair)',
   [[[1, 99, 122]], [151, 211, None], 0, 1], 1],
  ['control 1', [[[3, 69, 129], [1, 134, 154], [4, 142, 167]], [67, 72, 0], 15, 4], 'invalid'],
  ['control 2', [[[2, 188, 212]], [190, 180, 2], 15, 2], 'invalid']],
 [['boundary: back-to-back with buffer', [[[1, 0, 30]], [40, 60, 1], 10, 1], 1],
  ['boundary: zero-length request', [[], [10, 10, None], 0, 2], 'invalid'],
  ['boundary: last connector requested', [[[1, 0, 30]], [0, 30, 3], 0, 3], 3],
  ['regression: free connector search order',
   [[[2, 114, 134], [3, 125, 180], [2, 120, 174], [1, 44, 57], [2, 110, 149]], [220, 235, None], 10,
    4],
   1],
  ['regression: free connector search order (partial repair)',
   [[[1, 189, 228]], [107, 152, None], 0, 1], 1],
  ['control 1', [[[4, 7, 51], [4, 60, 108], [1, 80, 129]], [8, 68, None], 0, 4], 1],
  ['control 2',
   [[[1, 169, 199], [1, 193, 217], [1, 118, 149], [1, 4, 58], [1, 125, 169], [1, 1, 52]],
    [156, 146, None], 10, 1],
   'invalid']]]
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: back-to-back with buffer11Passed
boundary: zero-length requestinvalidinvalidPassed
boundary: last connector requested33Passed
regression: free connector search order31Failed
regression: free connector search order (partial repair)11Passed
control 1NoneNonePassed
control 2NoneNonePassed

SHA-256 / fe7198ea48dcaa619127951c1dacf274d6366e2576ae8ebcb49be4b463660d1b

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(existing, req, buffer, n_conn):
    s, e, want = req
    if e <= s:
        return 'invalid'
    if want is not None and not 1 <= want <= n_conn:
        return 'invalid'
    conns = [want] if want is not None else list(range(1, n_conn))
    for c in conns:
        clash = False
        for c2, s2, e2 in existing:
            if c2 == c and s < e2 + buffer and s2 < e + buffer:
                clash = True
                break
        if not clash:
            return c
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: back-to-back with buffer', [[[1, 0, 30]], [40, 60, 1], 10, 1], 1],
  ['boundary: zero-length request', [[], [10, 10, None], 0, 2], 'invalid'],
  ['boundary: last connector requested', [[[1, 0, 30]], [0, 30, 3], 0, 3], 3],
  ['regression: free connector search order',
   [[[1, 100, 133], [2, 11, 28], [1, 134, 160]], [20, 80, None], 10, 3], 1],
  ['regression: free connector search order (partial repair)', [[], [95, 125, None], 5, 1], 1],
  ['control 1', [[[2, 157, 203], [1, 191, 236]], [179, 224, None], 5, 2], None],
  ['control 2',
   [[[3, 190, 210], [4, 11, 28], [2, 54, 68], [4, 54, 104], [3, 134, 162]], [79, 139, 4], 5, 4],
   None]],
 [['boundary: back-to-back with buffer', [[[1, 0, 30]], [40, 60, 1], 10, 1], 1],
  ['boundary: zero-length request', [[], [10, 10, None], 0, 2], 'invalid'],
  ['boundary: last connector requested', [[[1, 0, 30]], [0, 30, 3], 0, 3], 3],
  ['regression: free connector search order', [[[2, 159, 208], [1, 9, 67]], [210, 255, None], 0, 3],
   1],
  ['regression: free connector search order (partial repair)', [[], [95, 125, None], 5, 1], 1],
  ['control 1',
   [[[2, 130, 150], [3, 5, 36], [3, 174, 193], [2, 18, 78], [1, 61, 115], [4, 68, 95]],
    [171, 201, 2], 10, 4],
   2],
  ['control 2',
   [[[3, 116, 135], [1, 178, 208], [1, 83, 123], [1, 136, 157], [3, 111, 126], [1, 97, 137]],
    [217, 222, 2], 0, 3],
   2]],
 [['boundary: back-to-back with buffer', [[[1, 0, 30]], [40, 60, 1], 10, 1], 1],
  ['boundary: zero-length request', [[], [10, 10, None], 0, 2], 'invalid'],
  ['boundary: last connector requested', [[[1, 0, 30]], [0, 30, 3], 0, 3], 3],
  ['regression: free connector search order', [[], [149, 154, None], 5, 4], 1],
  ['regression: free connector search order (partial repair)',
   [[[1, 130, 147], [1, 82, 133], [1, 89, 133], [1, 193, 215], [1, 86, 134]], [2, 32, None], 0, 1],
   1],
  ['control 1', [[[3, 198, 211], [1, 147, 191], [4, 137, 178]], [148, 208, None], 10, 4], 2],
  ['control 2',
   [[[1, 75, 109], [1, 5, 46], [3, 128, 161], [3, 171, 198], [2, 190, 240], [1, 13, 36]],
    [58, 73, 1], 10, 3],
   None]],
 [['boundary: back-to-back with buffer', [[[1, 0, 30]], [40, 60, 1], 10, 1], 1],
  ['boundary: zero-length request', [[], [10, 10, None], 0, 2], 'invalid'],
  ['boundary: last connector requested', [[[1, 0, 30]], [0, 30, 3], 0, 3], 3],
  ['regression: free connector search order',
   [[[2, 102, 160], [3, 28, 74], [3, 56, 79], [2, 172, 229]], [175, 220, None], 0, 3], 1],
  ['regression: free connector search order (partial repair)',
   [[[1, 99, 122]], [151, 211, None], 0, 1], 1],
  ['control 1', [[[3, 69, 129], [1, 134, 154], [4, 142, 167]], [67, 72, 0], 15, 4], 'invalid'],
  ['control 2', [[[2, 188, 212]], [190, 180, 2], 15, 2], 'invalid']],
 [['boundary: back-to-back with buffer', [[[1, 0, 30]], [40, 60, 1], 10, 1], 1],
  ['boundary: zero-length request', [[], [10, 10, None], 0, 2], 'invalid'],
  ['boundary: last connector requested', [[[1, 0, 30]], [0, 30, 3], 0, 3], 3],
  ['regression: free connector search order',
   [[[2, 114, 134], [3, 125, 180], [2, 120, 174], [1, 44, 57], [2, 110, 149]], [220, 235, None], 10,
    4],
   1],
  ['regression: free connector search order (partial repair)',
   [[[1, 189, 228]], [107, 152, None], 0, 1], 1],
  ['control 1', [[[4, 7, 51], [4, 60, 108], [1, 80, 129]], [8, 68, None], 0, 4], 1],
  ['control 2',
   [[[1, 169, 199], [1, 193, 217], [1, 118, 149], [1, 4, 58], [1, 125, 169], [1, 1, 52]],
    [156, 146, None], 10, 1],
   'invalid']]]
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: back-to-back with buffer11Passed
boundary: zero-length requestinvalidinvalidPassed
boundary: last connector requested33Passed
regression: free connector search order11Passed
regression: free connector search order (partial repair)None1Failed
control 1NoneNonePassed
control 2NoneNonePassed

SHA-256 / a242969ca31ebb19f98d0dc7d663df4429feaf707e1ee44d1c0d2af4fba07a9e

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

Case digest / fa6975a41880c6c7fa50dcb5a0a15e8e9ee753da38cf0667574fb8784bc55b09