FAILURE MAP
← Case archive

FA-92996 / EV charging session scheduling / Open access

Connector reservation conflict check: same-connector filter · case 01

A booking on connector 2 blocks a free connector 3.

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

ROOT CAUSE

Existing reservations are compared regardless of which connector they occupy.

VERIFIED REPAIR

Only reservations on the same connector conflict.

Unsuccessful approach: Filtering by c2 <= c still lets lower connectors block higher ones.

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(1, n_conn + 1))
    for c in conns:
        clash = False
        for c2, s2, e2 in existing:
            if 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: same-connector filter',
   [[[1, 100, 133], [2, 11, 28], [1, 134, 160]], [20, 80, None], 10, 3], 1],
  ['regression: same-connector filter (partial repair)',
   [[[3, 177, 218], [1, 136, 190], [4, 57, 79]], [155, 200, 2], 5, 4], 2],
  ['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: same-connector filter',
   [[[2, 18, 58], [2, 102, 153], [1, 73, 93], [4, 193, 224], [4, 85, 112]], [44, 49, None], 0, 4],
   1],
  ['regression: same-connector filter (partial repair)',
   [[[1, 162, 178], [1, 168, 179], [4, 176, 201], [3, 128, 179]], [187, 232, None], 10, 4], 2],
  ['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: same-connector filter',
   [[[2, 129, 171], [1, 169, 226], [1, 85, 130], [1, 33, 84]], [46, 51, 2], 5, 2], 2],
  ['regression: same-connector filter (partial repair)',
   [[[1, 105, 159], [2, 195, 210], [1, 9, 50], [3, 158, 180]], [73, 103, 3], 15, 3], 3],
  ['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: same-connector filter',
   [[[2, 102, 160], [3, 28, 74], [3, 56, 79], [2, 172, 229]], [175, 220, None], 0, 3], 1],
  ['regression: same-connector filter (partial repair)',
   [[[1, 172, 210], [1, 61, 81]], [200, 245, None], 0, 3], 2],
  ['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: same-connector filter',
   [[[1, 100, 116], [1, 77, 119], [1, 115, 153], [2, 193, 239], [2, 186, 231]], [87, 117, 2], 10,
    2],
   2],
  ['regression: same-connector filter (partial repair)',
   [[[1, 8, 36], [1, 100, 132]], [-5, 55, 2], 10, 3], 2],
  ['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 requestedNone3Failed
regression: same-connector filterNone1Failed
regression: same-connector filter (partial repair)None2Failed
control 1NoneNonePassed
control 2NoneNonePassed

SHA-256 / f9ec5df767b3f255cdeff756a5569ccad97cead4ca6ab969cc79eeb8848f866c

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 + 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: same-connector filter',
   [[[1, 100, 133], [2, 11, 28], [1, 134, 160]], [20, 80, None], 10, 3], 1],
  ['regression: same-connector filter (partial repair)',
   [[[3, 177, 218], [1, 136, 190], [4, 57, 79]], [155, 200, 2], 5, 4], 2],
  ['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: same-connector filter',
   [[[2, 18, 58], [2, 102, 153], [1, 73, 93], [4, 193, 224], [4, 85, 112]], [44, 49, None], 0, 4],
   1],
  ['regression: same-connector filter (partial repair)',
   [[[1, 162, 178], [1, 168, 179], [4, 176, 201], [3, 128, 179]], [187, 232, None], 10, 4], 2],
  ['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: same-connector filter',
   [[[2, 129, 171], [1, 169, 226], [1, 85, 130], [1, 33, 84]], [46, 51, 2], 5, 2], 2],
  ['regression: same-connector filter (partial repair)',
   [[[1, 105, 159], [2, 195, 210], [1, 9, 50], [3, 158, 180]], [73, 103, 3], 15, 3], 3],
  ['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: same-connector filter',
   [[[2, 102, 160], [3, 28, 74], [3, 56, 79], [2, 172, 229]], [175, 220, None], 0, 3], 1],
  ['regression: same-connector filter (partial repair)',
   [[[1, 172, 210], [1, 61, 81]], [200, 245, None], 0, 3], 2],
  ['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: same-connector filter',
   [[[1, 100, 116], [1, 77, 119], [1, 115, 153], [2, 193, 239], [2, 186, 231]], [87, 117, 2], 10,
    2],
   2],
  ['regression: same-connector filter (partial repair)',
   [[[1, 8, 36], [1, 100, 132]], [-5, 55, 2], 10, 3], 2],
  ['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 requestedNone3Failed
regression: same-connector filter11Passed
regression: same-connector filter (partial repair)None2Failed
control 1NoneNonePassed
control 2NoneNonePassed

SHA-256 / bcb2cdad5b8f49a82ca7de5474c6c14308bfe70c1ffb399dd237872471714cde

3 / The verified repair

Exit 0
"""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 + 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: same-connector filter',
   [[[1, 100, 133], [2, 11, 28], [1, 134, 160]], [20, 80, None], 10, 3], 1],
  ['regression: same-connector filter (partial repair)',
   [[[3, 177, 218], [1, 136, 190], [4, 57, 79]], [155, 200, 2], 5, 4], 2],
  ['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: same-connector filter',
   [[[2, 18, 58], [2, 102, 153], [1, 73, 93], [4, 193, 224], [4, 85, 112]], [44, 49, None], 0, 4],
   1],
  ['regression: same-connector filter (partial repair)',
   [[[1, 162, 178], [1, 168, 179], [4, 176, 201], [3, 128, 179]], [187, 232, None], 10, 4], 2],
  ['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: same-connector filter',
   [[[2, 129, 171], [1, 169, 226], [1, 85, 130], [1, 33, 84]], [46, 51, 2], 5, 2], 2],
  ['regression: same-connector filter (partial repair)',
   [[[1, 105, 159], [2, 195, 210], [1, 9, 50], [3, 158, 180]], [73, 103, 3], 15, 3], 3],
  ['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: same-connector filter',
   [[[2, 102, 160], [3, 28, 74], [3, 56, 79], [2, 172, 229]], [175, 220, None], 0, 3], 1],
  ['regression: same-connector filter (partial repair)',
   [[[1, 172, 210], [1, 61, 81]], [200, 245, None], 0, 3], 2],
  ['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: same-connector filter',
   [[[1, 100, 116], [1, 77, 119], [1, 115, 153], [2, 193, 239], [2, 186, 231]], [87, 117, 2], 10,
    2],
   2],
  ['regression: same-connector filter (partial repair)',
   [[[1, 8, 36], [1, 100, 132]], [-5, 55, 2], 10, 3], 2],
  ['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: same-connector filter11Passed
regression: same-connector filter (partial repair)22Passed
control 1NoneNonePassed
control 2NoneNonePassed

SHA-256 / 5eb029260ecc8b77a35f4f4a56cef8fbd1b0deea5ec1b9e7ee3e919a918a6271

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

Case digest / b837c7e80125c3125bfb42ce5442a2bb79b97d87f50f9e2f222fc2eb7deef5f7