FA-92986 / EV charging session scheduling / Open access
Connector reservation conflict check: connector range · case 01
Requests for the highest-numbered connector are rejected and connector 0 is accepted.
ROOT CAUSE
The range check assumes zero-based connector numbering.
VERIFIED REPAIR
Accept connectors 1..n_conn inclusive.
Unsuccessful approach: Fixing the lower bound only still rejects 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 0 <= 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: connector range', [[[2, 38, 60], [1, 98, 144], [2, 103, 163]], [15, 30, 2], 0, 2],
2],
['regression: connector range (partial repair)', [[], [200, 215, 1], 0, 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: connector range',
[[[2, 99, 132], [2, 2, 55], [1, 39, 86], [1, 193, 252], [2, 195, 234], [1, 113, 173]],
[150, 210, 2], 10, 2],
None],
['regression: connector range (partial repair)',
[[[1, 25, 81], [1, 152, 165], [1, 43, 90], [1, 62, 73]], [69, 84, 1], 10, 1], None],
['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: connector range',
[[[2, 114, 152], [1, 105, 138], [2, 141, 185], [2, 30, 56], [2, 103, 145], [2, 127, 147]],
[12, 17, 0], 15, 3],
'invalid'],
['regression: connector range (partial repair)',
[[[2, 129, 171], [1, 169, 226], [1, 85, 130], [1, 33, 84]], [46, 51, 2], 5, 2], 2],
['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: connector range', [[], [214, 229, 2], 10, 2], 2],
['regression: connector range (partial repair)', [[[1, 1, 57], [2, 28, 64]], [70, 75, 2], 15, 2],
None],
['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: connector range',
[[[1, 100, 116], [1, 77, 119], [1, 115, 153], [2, 193, 239], [2, 186, 231]], [87, 117, 2], 10,
2],
2],
['regression: connector range (partial repair)',
[[[1, 94, 122], [1, 115, 163], [1, 80, 117], [1, 67, 119], [1, 188, 233]], [125, 170, 1], 5, 1],
None],
['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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| boundary: back-to-back with buffer | invalid | 1 | Failed |
| boundary: zero-length request | invalid | invalid | Passed |
| boundary: last connector requested | invalid | 3 | Failed |
| regression: connector range | invalid | 2 | Failed |
| regression: connector range (partial repair) | invalid | 1 | Failed |
| control 1 | None | None | Passed |
| control 2 | invalid | None | Failed |
SHA-256 / 0115560082bd06e93552b349cd54f4cd4c6fc5344ca161718f6b03b47fe3799a
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: connector range', [[[2, 38, 60], [1, 98, 144], [2, 103, 163]], [15, 30, 2], 0, 2],
2],
['regression: connector range (partial repair)', [[], [200, 215, 1], 0, 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: connector range',
[[[2, 99, 132], [2, 2, 55], [1, 39, 86], [1, 193, 252], [2, 195, 234], [1, 113, 173]],
[150, 210, 2], 10, 2],
None],
['regression: connector range (partial repair)',
[[[1, 25, 81], [1, 152, 165], [1, 43, 90], [1, 62, 73]], [69, 84, 1], 10, 1], None],
['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: connector range',
[[[2, 114, 152], [1, 105, 138], [2, 141, 185], [2, 30, 56], [2, 103, 145], [2, 127, 147]],
[12, 17, 0], 15, 3],
'invalid'],
['regression: connector range (partial repair)',
[[[2, 129, 171], [1, 169, 226], [1, 85, 130], [1, 33, 84]], [46, 51, 2], 5, 2], 2],
['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: connector range', [[], [214, 229, 2], 10, 2], 2],
['regression: connector range (partial repair)', [[[1, 1, 57], [2, 28, 64]], [70, 75, 2], 15, 2],
None],
['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: connector range',
[[[1, 100, 116], [1, 77, 119], [1, 115, 153], [2, 193, 239], [2, 186, 231]], [87, 117, 2], 10,
2],
2],
['regression: connector range (partial repair)',
[[[1, 94, 122], [1, 115, 163], [1, 80, 117], [1, 67, 119], [1, 188, 233]], [125, 170, 1], 5, 1],
None],
['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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| boundary: back-to-back with buffer | invalid | 1 | Failed |
| boundary: zero-length request | invalid | invalid | Passed |
| boundary: last connector requested | invalid | 3 | Failed |
| regression: connector range | invalid | 2 | Failed |
| regression: connector range (partial repair) | invalid | 1 | Failed |
| control 1 | None | None | Passed |
| control 2 | invalid | None | Failed |
SHA-256 / f2ec425c2e2ab6c219033942fa7c4a501f48972a89579f70b0a63672bd36626b
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: connector range', [[[2, 38, 60], [1, 98, 144], [2, 103, 163]], [15, 30, 2], 0, 2],
2],
['regression: connector range (partial repair)', [[], [200, 215, 1], 0, 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: connector range',
[[[2, 99, 132], [2, 2, 55], [1, 39, 86], [1, 193, 252], [2, 195, 234], [1, 113, 173]],
[150, 210, 2], 10, 2],
None],
['regression: connector range (partial repair)',
[[[1, 25, 81], [1, 152, 165], [1, 43, 90], [1, 62, 73]], [69, 84, 1], 10, 1], None],
['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: connector range',
[[[2, 114, 152], [1, 105, 138], [2, 141, 185], [2, 30, 56], [2, 103, 145], [2, 127, 147]],
[12, 17, 0], 15, 3],
'invalid'],
['regression: connector range (partial repair)',
[[[2, 129, 171], [1, 169, 226], [1, 85, 130], [1, 33, 84]], [46, 51, 2], 5, 2], 2],
['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: connector range', [[], [214, 229, 2], 10, 2], 2],
['regression: connector range (partial repair)', [[[1, 1, 57], [2, 28, 64]], [70, 75, 2], 15, 2],
None],
['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: connector range',
[[[1, 100, 116], [1, 77, 119], [1, 115, 153], [2, 193, 239], [2, 186, 231]], [87, 117, 2], 10,
2],
2],
['regression: connector range (partial repair)',
[[[1, 94, 122], [1, 115, 163], [1, 80, 117], [1, 67, 119], [1, 188, 233]], [125, 170, 1], 5, 1],
None],
['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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| boundary: back-to-back with buffer | 1 | 1 | Passed |
| boundary: zero-length request | invalid | invalid | Passed |
| boundary: last connector requested | 3 | 3 | Passed |
| regression: connector range | 2 | 2 | Passed |
| regression: connector range (partial repair) | 1 | 1 | Passed |
| control 1 | None | None | Passed |
| control 2 | None | None | Passed |
SHA-256 / acf9d236d7c2053825d9e51e49ab29301741053df18785aaec69cdfe7c6f2945
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.030290+00:00.
Case digest / 367ff1ab5a3cf5ae3547a5a7dd315e1419d11405d9ae3b280d880e8f83880dfc