FA-93216 / EV charging session scheduling / Open access
Connector session state machine: timeout applies only to Preparing · case 01
Long charging sessions are kicked back to Available.
ROOT CAUSE
The plug timeout is evaluated in every state once a plug time exists.
VERIFIED REPAIR
Only a Preparing connector can time out.
Unsuccessful approach: Also checking Available counts phantom timeouts after the car has left.
Case contract
Chronological [t, event] pairs drive states Available, Preparing, Charging, SuspendedEV, Finishing. plug: Available->Preparing. auth: Preparing->Charging. ev_pause/ev_resume toggle Charging/SuspendedEV. stop: Charging or SuspendedEV->Finishing. unplug: any non-Available state ->Available, counted abrupt from Charging or SuspendedEV. Before handling each event, a Preparing connector whose plug is more than timeout seconds old returns to Available (one timeout). Invalid events are ignored. Return [state, seconds spent in Charging, timeouts, abrupt].
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(events, timeout):
state = 'Available'
plug_t = None
since = None
charged = 0
timeouts = 0
abrupt = 0
for t, ev in events:
if plug_t is not None and t - plug_t > timeout:
state = 'Available'
timeouts += 1
if ev == 'plug' and state == 'Available':
state = 'Preparing'
plug_t = t
elif ev == 'auth' and state == 'Preparing':
state = 'Charging'
since = t
elif ev == 'ev_pause' and state == 'Charging':
charged += t - since
state = 'SuspendedEV'
elif ev == 'ev_resume' and state == 'SuspendedEV':
state = 'Charging'
since = t
elif ev == 'stop' and state in ('Charging', 'SuspendedEV'):
if state == 'Charging':
charged += t - since
state = 'Finishing'
elif ev == 'unplug' and state != 'Available':
if state == 'Charging':
charged += t - since
if state in ('Charging', 'SuspendedEV'):
abrupt += 1
state = 'Available'
return [state, charged, timeouts, abrupt]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: authorised exactly at timeout', [[[0, 'plug'], [60, 'auth'], [100, 'stop']], 60],
['Finishing', 40, 0, 0]],
['normal: pause and resume',
[[[0, 'plug'], [5, 'auth'], [65, 'ev_pause'], [125, 'ev_resume'], [185, 'stop'],
[190, 'unplug']],
60],
['Available', 120, 0, 0]],
['boundary: unplug while charging', [[[0, 'plug'], [10, 'auth'], [70, 'unplug']], 60],
['Available', 60, 0, 1]],
['regression: timeout applies only to Preparing',
[[[61, 'plug'], [66, 'stop'], [66, 'unplug'], [366, 'stop'], [371, 'stop'], [491, 'plug'],
[491, 'unplug'], [611, 'auth'], [611, 'auth'], [731, 'plug']],
90],
['Preparing', 0, 0, 0]],
['regression: timeout applies only to Preparing (partial repair)',
[[[60, 'ev_pause'], [90, 'ev_pause'], [95, 'plug'], [155, 'unplug'], [185, 'ev_pause']], 60],
['Available', 0, 0, 0]],
['control 1',
[[[5, 'plug'], [5, 'plug'], [15, 'plug'], [315, 'auth'], [376, 'ev_resume'], [496, 'auth'],
[796, 'auth'], [1096, 'unplug']],
60],
['Available', 0, 1, 0]],
['control 2', [[[30, 'unplug'], [91, 'auth'], [96, 'unplug'], [106, 'ev_resume']], 90],
['Available', 0, 0, 0]]],
[['boundary: authorised exactly at timeout', [[[0, 'plug'], [60, 'auth'], [100, 'stop']], 60],
['Finishing', 40, 0, 0]],
['normal: pause and resume',
[[[0, 'plug'], [5, 'auth'], [65, 'ev_pause'], [125, 'ev_resume'], [185, 'stop'],
[190, 'unplug']],
60],
['Available', 120, 0, 0]],
['boundary: unplug while charging', [[[0, 'plug'], [10, 'auth'], [70, 'unplug']], 60],
['Available', 60, 0, 1]],
['regression: timeout applies only to Preparing',
[[[5, 'ev_resume'], [15, 'unplug'], [75, 'ev_pause'], [375, 'stop'], [675, 'plug'],
[795, 'stop'], [856, 'auth']],
30],
['Available', 0, 1, 0]],
['regression: timeout applies only to Preparing (partial repair)',
[[[120, 'plug'], [130, 'stop'], [135, 'plug'], [140, 'plug'], [201, 'auth'], [321, 'plug'],
[382, 'stop'], [502, 'ev_resume'], [532, 'auth'], [562, 'unplug']],
60],
['Available', 0, 2, 0]],
['control 1', [[[120, 'auth'], [240, 'ev_resume'], [540, 'unplug']], 60], ['Available', 0, 0, 0]],
['control 2', [[[60, 'unplug'], [180, 'stop'], [240, 'stop'], [270, 'unplug']], 60],
['Available', 0, 0, 0]]],
[['boundary: authorised exactly at timeout', [[[0, 'plug'], [60, 'auth'], [100, 'stop']], 60],
['Finishing', 40, 0, 0]],
['normal: pause and resume',
[[[0, 'plug'], [5, 'auth'], [65, 'ev_pause'], [125, 'ev_resume'], [185, 'stop'],
[190, 'unplug']],
60],
['Available', 120, 0, 0]],
['boundary: unplug while charging', [[[0, 'plug'], [10, 'auth'], [70, 'unplug']], 60],
['Available', 60, 0, 1]],
['regression: timeout applies only to Preparing',
[[[0, 'plug'], [300, 'plug'], [600, 'ev_pause'], [600, 'plug'], [720, 'plug'], [781, 'auth'],
[841, 'auth'], [961, 'ev_pause'], [1261, 'auth']],
30],
['Available', 0, 4, 0]],
['regression: timeout applies only to Preparing (partial repair)',
[[[60, 'unplug'], [180, 'plug'], [190, 'unplug'], [250, 'stop'], [370, 'plug'], [370, 'unplug']],
60],
['Available', 0, 0, 0]],
['control 1', [[[0, 'unplug'], [10, 'ev_pause'], [10, 'plug']], 60], ['Preparing', 0, 0, 0]],
['control 2', [[[300, 'plug'], [360, 'ev_pause'], [421, 'ev_pause']], 30],
['Available', 0, 1, 0]]],
[['boundary: authorised exactly at timeout', [[[0, 'plug'], [60, 'auth'], [100, 'stop']], 60],
['Finishing', 40, 0, 0]],
['normal: pause and resume',
[[[0, 'plug'], [5, 'auth'], [65, 'ev_pause'], [125, 'ev_resume'], [185, 'stop'],
[190, 'unplug']],
60],
['Available', 120, 0, 0]],
['boundary: unplug while charging', [[[0, 'plug'], [10, 'auth'], [70, 'unplug']], 60],
['Available', 60, 0, 1]],
['regression: timeout applies only to Preparing',
[[[10, 'auth'], [10, 'stop'], [15, 'ev_resume'], [135, 'unplug'], [435, 'ev_pause'],
[735, 'plug'], [1035, 'auth'], [1335, 'unplug'], [1635, 'ev_pause'], [1695, 'auth']],
90],
['Available', 0, 1, 0]],
['regression: timeout applies only to Preparing (partial repair)',
[[[30, 'unplug'], [330, 'plug'], [391, 'unplug'], [401, 'unplug'], [411, 'auth'],
[441, 'ev_pause'], [441, 'stop']],
90],
['Available', 0, 0, 0]],
['control 1',
[[[61, 'auth'], [91, 'unplug'], [211, 'unplug'], [221, 'ev_resume'], [281, 'plug'],
[311, 'ev_pause'], [321, 'unplug'], [326, 'plug']],
30],
['Preparing', 0, 1, 0]],
['control 2',
[[[300, 'plug'], [600, 'ev_resume'], [900, 'ev_resume'], [961, 'unplug'], [966, 'auth'],
[971, 'unplug'], [1271, 'auth'], [1276, 'ev_pause']],
60],
['Available', 0, 1, 0]]],
[['boundary: authorised exactly at timeout', [[[0, 'plug'], [60, 'auth'], [100, 'stop']], 60],
['Finishing', 40, 0, 0]],
['normal: pause and resume',
[[[0, 'plug'], [5, 'auth'], [65, 'ev_pause'], [125, 'ev_resume'], [185, 'stop'],
[190, 'unplug']],
60],
['Available', 120, 0, 0]],
['boundary: unplug while charging', [[[0, 'plug'], [10, 'auth'], [70, 'unplug']], 60],
['Available', 60, 0, 1]],
['regression: timeout applies only to Preparing',
[[[5, 'ev_resume'], [65, 'unplug'], [75, 'unplug'], [75, 'auth'], [135, 'auth'], [140, 'plug'],
[440, 'plug'], [440, 'unplug'], [501, 'stop'], [511, 'plug']],
30],
['Preparing', 0, 1, 0]],
['regression: timeout applies only to Preparing (partial repair)',
[[[61, 'unplug'], [121, 'ev_pause'], [131, 'auth'], [131, 'auth'], [251, 'plug'],
[256, 'ev_pause'], [376, 'auth'], [376, 'ev_resume'], [376, 'plug'], [376, 'unplug']],
60],
['Available', 0, 1, 0]],
['control 1', [[[61, 'unplug'], [361, 'auth'], [421, 'unplug'], [426, 'ev_pause']], 60],
['Available', 0, 0, 0]],
['control 2',
[[[5, 'ev_resume'], [305, 'unplug'], [605, 'plug'], [665, 'ev_resume'], [670, 'ev_resume']], 60],
['Available', 0, 1, 0]]]]
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: authorised exactly at timeout | ['Available', 0, 1, 0] | ['Finishing', 40, 0, 0] | Failed |
| normal: pause and resume | ['Available', 0, 4, 0] | ['Available', 120, 0, 0] | Failed |
| boundary: unplug while charging | ['Available', 0, 1, 0] | ['Available', 60, 0, 1] | Failed |
| regression: timeout applies only to Preparing | ['Preparing', 0, 6, 0] | ['Preparing', 0, 0, 0] | Failed |
| regression: timeout applies only to Preparing (partial repair) | ['Available', 0, 1, 0] | ['Available', 0, 0, 0] | Failed |
| control 1 | ['Available', 0, 5, 0] | ['Available', 0, 1, 0] | Failed |
| control 2 | ['Available', 0, 0, 0] | ['Available', 0, 0, 0] | Passed |
SHA-256 / c06eb35871abc3e405f1a24166d83a2c718787a0476f9418a199736e04b99c4d
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(events, timeout):
state = 'Available'
plug_t = None
since = None
charged = 0
timeouts = 0
abrupt = 0
for t, ev in events:
if state in ('Preparing', 'Available') and plug_t is not None and t - plug_t > timeout:
state = 'Available'
timeouts += 1
if ev == 'plug' and state == 'Available':
state = 'Preparing'
plug_t = t
elif ev == 'auth' and state == 'Preparing':
state = 'Charging'
since = t
elif ev == 'ev_pause' and state == 'Charging':
charged += t - since
state = 'SuspendedEV'
elif ev == 'ev_resume' and state == 'SuspendedEV':
state = 'Charging'
since = t
elif ev == 'stop' and state in ('Charging', 'SuspendedEV'):
if state == 'Charging':
charged += t - since
state = 'Finishing'
elif ev == 'unplug' and state != 'Available':
if state == 'Charging':
charged += t - since
if state in ('Charging', 'SuspendedEV'):
abrupt += 1
state = 'Available'
return [state, charged, timeouts, abrupt]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: authorised exactly at timeout', [[[0, 'plug'], [60, 'auth'], [100, 'stop']], 60],
['Finishing', 40, 0, 0]],
['normal: pause and resume',
[[[0, 'plug'], [5, 'auth'], [65, 'ev_pause'], [125, 'ev_resume'], [185, 'stop'],
[190, 'unplug']],
60],
['Available', 120, 0, 0]],
['boundary: unplug while charging', [[[0, 'plug'], [10, 'auth'], [70, 'unplug']], 60],
['Available', 60, 0, 1]],
['regression: timeout applies only to Preparing',
[[[61, 'plug'], [66, 'stop'], [66, 'unplug'], [366, 'stop'], [371, 'stop'], [491, 'plug'],
[491, 'unplug'], [611, 'auth'], [611, 'auth'], [731, 'plug']],
90],
['Preparing', 0, 0, 0]],
['regression: timeout applies only to Preparing (partial repair)',
[[[60, 'ev_pause'], [90, 'ev_pause'], [95, 'plug'], [155, 'unplug'], [185, 'ev_pause']], 60],
['Available', 0, 0, 0]],
['control 1',
[[[5, 'plug'], [5, 'plug'], [15, 'plug'], [315, 'auth'], [376, 'ev_resume'], [496, 'auth'],
[796, 'auth'], [1096, 'unplug']],
60],
['Available', 0, 1, 0]],
['control 2', [[[30, 'unplug'], [91, 'auth'], [96, 'unplug'], [106, 'ev_resume']], 90],
['Available', 0, 0, 0]]],
[['boundary: authorised exactly at timeout', [[[0, 'plug'], [60, 'auth'], [100, 'stop']], 60],
['Finishing', 40, 0, 0]],
['normal: pause and resume',
[[[0, 'plug'], [5, 'auth'], [65, 'ev_pause'], [125, 'ev_resume'], [185, 'stop'],
[190, 'unplug']],
60],
['Available', 120, 0, 0]],
['boundary: unplug while charging', [[[0, 'plug'], [10, 'auth'], [70, 'unplug']], 60],
['Available', 60, 0, 1]],
['regression: timeout applies only to Preparing',
[[[5, 'ev_resume'], [15, 'unplug'], [75, 'ev_pause'], [375, 'stop'], [675, 'plug'],
[795, 'stop'], [856, 'auth']],
30],
['Available', 0, 1, 0]],
['regression: timeout applies only to Preparing (partial repair)',
[[[120, 'plug'], [130, 'stop'], [135, 'plug'], [140, 'plug'], [201, 'auth'], [321, 'plug'],
[382, 'stop'], [502, 'ev_resume'], [532, 'auth'], [562, 'unplug']],
60],
['Available', 0, 2, 0]],
['control 1', [[[120, 'auth'], [240, 'ev_resume'], [540, 'unplug']], 60], ['Available', 0, 0, 0]],
['control 2', [[[60, 'unplug'], [180, 'stop'], [240, 'stop'], [270, 'unplug']], 60],
['Available', 0, 0, 0]]],
[['boundary: authorised exactly at timeout', [[[0, 'plug'], [60, 'auth'], [100, 'stop']], 60],
['Finishing', 40, 0, 0]],
['normal: pause and resume',
[[[0, 'plug'], [5, 'auth'], [65, 'ev_pause'], [125, 'ev_resume'], [185, 'stop'],
[190, 'unplug']],
60],
['Available', 120, 0, 0]],
['boundary: unplug while charging', [[[0, 'plug'], [10, 'auth'], [70, 'unplug']], 60],
['Available', 60, 0, 1]],
['regression: timeout applies only to Preparing',
[[[0, 'plug'], [300, 'plug'], [600, 'ev_pause'], [600, 'plug'], [720, 'plug'], [781, 'auth'],
[841, 'auth'], [961, 'ev_pause'], [1261, 'auth']],
30],
['Available', 0, 4, 0]],
['regression: timeout applies only to Preparing (partial repair)',
[[[60, 'unplug'], [180, 'plug'], [190, 'unplug'], [250, 'stop'], [370, 'plug'], [370, 'unplug']],
60],
['Available', 0, 0, 0]],
['control 1', [[[0, 'unplug'], [10, 'ev_pause'], [10, 'plug']], 60], ['Preparing', 0, 0, 0]],
['control 2', [[[300, 'plug'], [360, 'ev_pause'], [421, 'ev_pause']], 30],
['Available', 0, 1, 0]]],
[['boundary: authorised exactly at timeout', [[[0, 'plug'], [60, 'auth'], [100, 'stop']], 60],
['Finishing', 40, 0, 0]],
['normal: pause and resume',
[[[0, 'plug'], [5, 'auth'], [65, 'ev_pause'], [125, 'ev_resume'], [185, 'stop'],
[190, 'unplug']],
60],
['Available', 120, 0, 0]],
['boundary: unplug while charging', [[[0, 'plug'], [10, 'auth'], [70, 'unplug']], 60],
['Available', 60, 0, 1]],
['regression: timeout applies only to Preparing',
[[[10, 'auth'], [10, 'stop'], [15, 'ev_resume'], [135, 'unplug'], [435, 'ev_pause'],
[735, 'plug'], [1035, 'auth'], [1335, 'unplug'], [1635, 'ev_pause'], [1695, 'auth']],
90],
['Available', 0, 1, 0]],
['regression: timeout applies only to Preparing (partial repair)',
[[[30, 'unplug'], [330, 'plug'], [391, 'unplug'], [401, 'unplug'], [411, 'auth'],
[441, 'ev_pause'], [441, 'stop']],
90],
['Available', 0, 0, 0]],
['control 1',
[[[61, 'auth'], [91, 'unplug'], [211, 'unplug'], [221, 'ev_resume'], [281, 'plug'],
[311, 'ev_pause'], [321, 'unplug'], [326, 'plug']],
30],
['Preparing', 0, 1, 0]],
['control 2',
[[[300, 'plug'], [600, 'ev_resume'], [900, 'ev_resume'], [961, 'unplug'], [966, 'auth'],
[971, 'unplug'], [1271, 'auth'], [1276, 'ev_pause']],
60],
['Available', 0, 1, 0]]],
[['boundary: authorised exactly at timeout', [[[0, 'plug'], [60, 'auth'], [100, 'stop']], 60],
['Finishing', 40, 0, 0]],
['normal: pause and resume',
[[[0, 'plug'], [5, 'auth'], [65, 'ev_pause'], [125, 'ev_resume'], [185, 'stop'],
[190, 'unplug']],
60],
['Available', 120, 0, 0]],
['boundary: unplug while charging', [[[0, 'plug'], [10, 'auth'], [70, 'unplug']], 60],
['Available', 60, 0, 1]],
['regression: timeout applies only to Preparing',
[[[5, 'ev_resume'], [65, 'unplug'], [75, 'unplug'], [75, 'auth'], [135, 'auth'], [140, 'plug'],
[440, 'plug'], [440, 'unplug'], [501, 'stop'], [511, 'plug']],
30],
['Preparing', 0, 1, 0]],
['regression: timeout applies only to Preparing (partial repair)',
[[[61, 'unplug'], [121, 'ev_pause'], [131, 'auth'], [131, 'auth'], [251, 'plug'],
[256, 'ev_pause'], [376, 'auth'], [376, 'ev_resume'], [376, 'plug'], [376, 'unplug']],
60],
['Available', 0, 1, 0]],
['control 1', [[[61, 'unplug'], [361, 'auth'], [421, 'unplug'], [426, 'ev_pause']], 60],
['Available', 0, 0, 0]],
['control 2',
[[[5, 'ev_resume'], [305, 'unplug'], [605, 'plug'], [665, 'ev_resume'], [670, 'ev_resume']], 60],
['Available', 0, 1, 0]]]]
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: authorised exactly at timeout | ['Finishing', 40, 0, 0] | ['Finishing', 40, 0, 0] | Passed |
| normal: pause and resume | ['Available', 120, 0, 0] | ['Available', 120, 0, 0] | Passed |
| boundary: unplug while charging | ['Available', 60, 0, 1] | ['Available', 60, 0, 1] | Passed |
| regression: timeout applies only to Preparing | ['Preparing', 0, 6, 0] | ['Preparing', 0, 0, 0] | Failed |
| regression: timeout applies only to Preparing (partial repair) | ['Available', 0, 1, 0] | ['Available', 0, 0, 0] | Failed |
| control 1 | ['Available', 0, 5, 0] | ['Available', 0, 1, 0] | Failed |
| control 2 | ['Available', 0, 0, 0] | ['Available', 0, 0, 0] | Passed |
SHA-256 / cb78402b8b26b668b32c36daa2164c9f0a88fa57321106518afd5553df429db0
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(events, timeout):
state = 'Available'
plug_t = None
since = None
charged = 0
timeouts = 0
abrupt = 0
for t, ev in events:
if state == 'Preparing' and t - plug_t > timeout:
state = 'Available'
timeouts += 1
if ev == 'plug' and state == 'Available':
state = 'Preparing'
plug_t = t
elif ev == 'auth' and state == 'Preparing':
state = 'Charging'
since = t
elif ev == 'ev_pause' and state == 'Charging':
charged += t - since
state = 'SuspendedEV'
elif ev == 'ev_resume' and state == 'SuspendedEV':
state = 'Charging'
since = t
elif ev == 'stop' and state in ('Charging', 'SuspendedEV'):
if state == 'Charging':
charged += t - since
state = 'Finishing'
elif ev == 'unplug' and state != 'Available':
if state == 'Charging':
charged += t - since
if state in ('Charging', 'SuspendedEV'):
abrupt += 1
state = 'Available'
return [state, charged, timeouts, abrupt]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: authorised exactly at timeout', [[[0, 'plug'], [60, 'auth'], [100, 'stop']], 60],
['Finishing', 40, 0, 0]],
['normal: pause and resume',
[[[0, 'plug'], [5, 'auth'], [65, 'ev_pause'], [125, 'ev_resume'], [185, 'stop'],
[190, 'unplug']],
60],
['Available', 120, 0, 0]],
['boundary: unplug while charging', [[[0, 'plug'], [10, 'auth'], [70, 'unplug']], 60],
['Available', 60, 0, 1]],
['regression: timeout applies only to Preparing',
[[[61, 'plug'], [66, 'stop'], [66, 'unplug'], [366, 'stop'], [371, 'stop'], [491, 'plug'],
[491, 'unplug'], [611, 'auth'], [611, 'auth'], [731, 'plug']],
90],
['Preparing', 0, 0, 0]],
['regression: timeout applies only to Preparing (partial repair)',
[[[60, 'ev_pause'], [90, 'ev_pause'], [95, 'plug'], [155, 'unplug'], [185, 'ev_pause']], 60],
['Available', 0, 0, 0]],
['control 1',
[[[5, 'plug'], [5, 'plug'], [15, 'plug'], [315, 'auth'], [376, 'ev_resume'], [496, 'auth'],
[796, 'auth'], [1096, 'unplug']],
60],
['Available', 0, 1, 0]],
['control 2', [[[30, 'unplug'], [91, 'auth'], [96, 'unplug'], [106, 'ev_resume']], 90],
['Available', 0, 0, 0]]],
[['boundary: authorised exactly at timeout', [[[0, 'plug'], [60, 'auth'], [100, 'stop']], 60],
['Finishing', 40, 0, 0]],
['normal: pause and resume',
[[[0, 'plug'], [5, 'auth'], [65, 'ev_pause'], [125, 'ev_resume'], [185, 'stop'],
[190, 'unplug']],
60],
['Available', 120, 0, 0]],
['boundary: unplug while charging', [[[0, 'plug'], [10, 'auth'], [70, 'unplug']], 60],
['Available', 60, 0, 1]],
['regression: timeout applies only to Preparing',
[[[5, 'ev_resume'], [15, 'unplug'], [75, 'ev_pause'], [375, 'stop'], [675, 'plug'],
[795, 'stop'], [856, 'auth']],
30],
['Available', 0, 1, 0]],
['regression: timeout applies only to Preparing (partial repair)',
[[[120, 'plug'], [130, 'stop'], [135, 'plug'], [140, 'plug'], [201, 'auth'], [321, 'plug'],
[382, 'stop'], [502, 'ev_resume'], [532, 'auth'], [562, 'unplug']],
60],
['Available', 0, 2, 0]],
['control 1', [[[120, 'auth'], [240, 'ev_resume'], [540, 'unplug']], 60], ['Available', 0, 0, 0]],
['control 2', [[[60, 'unplug'], [180, 'stop'], [240, 'stop'], [270, 'unplug']], 60],
['Available', 0, 0, 0]]],
[['boundary: authorised exactly at timeout', [[[0, 'plug'], [60, 'auth'], [100, 'stop']], 60],
['Finishing', 40, 0, 0]],
['normal: pause and resume',
[[[0, 'plug'], [5, 'auth'], [65, 'ev_pause'], [125, 'ev_resume'], [185, 'stop'],
[190, 'unplug']],
60],
['Available', 120, 0, 0]],
['boundary: unplug while charging', [[[0, 'plug'], [10, 'auth'], [70, 'unplug']], 60],
['Available', 60, 0, 1]],
['regression: timeout applies only to Preparing',
[[[0, 'plug'], [300, 'plug'], [600, 'ev_pause'], [600, 'plug'], [720, 'plug'], [781, 'auth'],
[841, 'auth'], [961, 'ev_pause'], [1261, 'auth']],
30],
['Available', 0, 4, 0]],
['regression: timeout applies only to Preparing (partial repair)',
[[[60, 'unplug'], [180, 'plug'], [190, 'unplug'], [250, 'stop'], [370, 'plug'], [370, 'unplug']],
60],
['Available', 0, 0, 0]],
['control 1', [[[0, 'unplug'], [10, 'ev_pause'], [10, 'plug']], 60], ['Preparing', 0, 0, 0]],
['control 2', [[[300, 'plug'], [360, 'ev_pause'], [421, 'ev_pause']], 30],
['Available', 0, 1, 0]]],
[['boundary: authorised exactly at timeout', [[[0, 'plug'], [60, 'auth'], [100, 'stop']], 60],
['Finishing', 40, 0, 0]],
['normal: pause and resume',
[[[0, 'plug'], [5, 'auth'], [65, 'ev_pause'], [125, 'ev_resume'], [185, 'stop'],
[190, 'unplug']],
60],
['Available', 120, 0, 0]],
['boundary: unplug while charging', [[[0, 'plug'], [10, 'auth'], [70, 'unplug']], 60],
['Available', 60, 0, 1]],
['regression: timeout applies only to Preparing',
[[[10, 'auth'], [10, 'stop'], [15, 'ev_resume'], [135, 'unplug'], [435, 'ev_pause'],
[735, 'plug'], [1035, 'auth'], [1335, 'unplug'], [1635, 'ev_pause'], [1695, 'auth']],
90],
['Available', 0, 1, 0]],
['regression: timeout applies only to Preparing (partial repair)',
[[[30, 'unplug'], [330, 'plug'], [391, 'unplug'], [401, 'unplug'], [411, 'auth'],
[441, 'ev_pause'], [441, 'stop']],
90],
['Available', 0, 0, 0]],
['control 1',
[[[61, 'auth'], [91, 'unplug'], [211, 'unplug'], [221, 'ev_resume'], [281, 'plug'],
[311, 'ev_pause'], [321, 'unplug'], [326, 'plug']],
30],
['Preparing', 0, 1, 0]],
['control 2',
[[[300, 'plug'], [600, 'ev_resume'], [900, 'ev_resume'], [961, 'unplug'], [966, 'auth'],
[971, 'unplug'], [1271, 'auth'], [1276, 'ev_pause']],
60],
['Available', 0, 1, 0]]],
[['boundary: authorised exactly at timeout', [[[0, 'plug'], [60, 'auth'], [100, 'stop']], 60],
['Finishing', 40, 0, 0]],
['normal: pause and resume',
[[[0, 'plug'], [5, 'auth'], [65, 'ev_pause'], [125, 'ev_resume'], [185, 'stop'],
[190, 'unplug']],
60],
['Available', 120, 0, 0]],
['boundary: unplug while charging', [[[0, 'plug'], [10, 'auth'], [70, 'unplug']], 60],
['Available', 60, 0, 1]],
['regression: timeout applies only to Preparing',
[[[5, 'ev_resume'], [65, 'unplug'], [75, 'unplug'], [75, 'auth'], [135, 'auth'], [140, 'plug'],
[440, 'plug'], [440, 'unplug'], [501, 'stop'], [511, 'plug']],
30],
['Preparing', 0, 1, 0]],
['regression: timeout applies only to Preparing (partial repair)',
[[[61, 'unplug'], [121, 'ev_pause'], [131, 'auth'], [131, 'auth'], [251, 'plug'],
[256, 'ev_pause'], [376, 'auth'], [376, 'ev_resume'], [376, 'plug'], [376, 'unplug']],
60],
['Available', 0, 1, 0]],
['control 1', [[[61, 'unplug'], [361, 'auth'], [421, 'unplug'], [426, 'ev_pause']], 60],
['Available', 0, 0, 0]],
['control 2',
[[[5, 'ev_resume'], [305, 'unplug'], [605, 'plug'], [665, 'ev_resume'], [670, 'ev_resume']], 60],
['Available', 0, 1, 0]]]]
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: authorised exactly at timeout | ['Finishing', 40, 0, 0] | ['Finishing', 40, 0, 0] | Passed |
| normal: pause and resume | ['Available', 120, 0, 0] | ['Available', 120, 0, 0] | Passed |
| boundary: unplug while charging | ['Available', 60, 0, 1] | ['Available', 60, 0, 1] | Passed |
| regression: timeout applies only to Preparing | ['Preparing', 0, 0, 0] | ['Preparing', 0, 0, 0] | Passed |
| regression: timeout applies only to Preparing (partial repair) | ['Available', 0, 0, 0] | ['Available', 0, 0, 0] | Passed |
| control 1 | ['Available', 0, 1, 0] | ['Available', 0, 1, 0] | Passed |
| control 2 | ['Available', 0, 0, 0] | ['Available', 0, 0, 0] | Passed |
SHA-256 / ad8f8c7e513ec53f1572f6737e1f234bc36e2584cff4bfdf778106ccdc1cb466
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:53.079486+00:00.
Case digest / 225f7902f8a84b1b926ce6fb3bdd72ed40e85a2a3f8a6a55803948ccc991c2ba