FAILURE MAP
← Case archive

FA-93311 / EV charging session scheduling / Open access

Staggered start after tariff switch: latest start derivation · case 01

Charging is pulled forward even when the staggered start would still finish in time.

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

ROOT CAUSE

The latest start subtracts the stagger delay a second time.

THE FAILURE

The latest start subtracts the stagger delay a second time.

Unsuccessful approach: Using depart as the latest start lets sessions finish after departure.

Case contract

To avoid a demand spike at a tariff switch each charger delays its start by delay = sum((i+1)*ord(c) for i, c in enumerate(cid)) % (max_delay+1) minutes after max(tariff_start, now). If that start is later than depart - dur it is pulled back to max(depart - dur, now). Status is 'ok' when start + dur <= depart else 'late'. Return [start, delay, status].

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(cid, tariff_start, now, depart, dur, max_delay):
    delay = sum((i + 1) * ord(c) for i, c in enumerate(cid)) % (max_delay + 1)
    start = max(tariff_start, now) + delay
    latest = depart - dur - delay
    if start > latest:
        start = max(latest, now)
    status = 'ok' if start + dur <= depart else 'late'
    return [start, delay, status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: no stagger configured', ['CP7', 100, 50, 400, 60, 0], [100, 0, 'ok']],
  ['boundary: deadline forces immediate start', ['CP12', 100, 50, 120, 70, 30], [50, 16, 'ok']],
  ['boundary: tariff already active', ['CP3', 10, 50, 400, 60, 10], [56, 6, 'ok']],
  ['regression: latest start derivation', ['CP929', 258, 12, 235, 31, 30], [204, 15, 'ok']],
  ['regression: latest start derivation (partial repair)', ['CP495', 117, 47, 359, 266, 0],
   [93, 0, 'ok']],
  ['control 1', ['CP310', 208, 18, 199, 159, 0], [40, 0, 'ok']],
  ['control 2', ['CP766', 294, 150, 208, 201, 30], [150, 10, 'late']]],
 [['boundary: no stagger configured', ['CP7', 100, 50, 400, 60, 0], [100, 0, 'ok']],
  ['boundary: deadline forces immediate start', ['CP12', 100, 50, 120, 70, 30], [50, 16, 'ok']],
  ['boundary: tariff already active', ['CP3', 10, 50, 400, 60, 10], [56, 6, 'ok']],
  ['regression: latest start derivation', ['CP990', 237, 16, 437, 299, 30], [138, 29, 'ok']],
  ['regression: latest start derivation (partial repair)', ['CP272', 217, 184, 482, 298, 15],
   [184, 15, 'ok']],
  ['control 1', ['CP883', 235, 120, 211, 80, 5], [131, 4, 'ok']],
  ['control 2', ['CP742', 19, 177, 199, 247, 10], [177, 3, 'late']]],
 [['boundary: no stagger configured', ['CP7', 100, 50, 400, 60, 0], [100, 0, 'ok']],
  ['boundary: deadline forces immediate start', ['CP12', 100, 50, 120, 70, 30], [50, 16, 'ok']],
  ['boundary: tariff already active', ['CP3', 10, 50, 400, 60, 10], [56, 6, 'ok']],
  ['regression: latest start derivation', ['CP466', 247, 123, 302, 127, 5], [175, 5, 'ok']],
  ['regression: latest start derivation (partial repair)', ['CP803', 164, 112, 215, 145, 5],
   [112, 2, 'late']],
  ['control 1', ['CP783', 204, 99, 341, 202, 5], [139, 1, 'ok']],
  ['control 2', ['CP490', 211, 107, 512, 167, 10], [215, 4, 'ok']]],
 [['boundary: no stagger configured', ['CP7', 100, 50, 400, 60, 0], [100, 0, 'ok']],
  ['boundary: deadline forces immediate start', ['CP12', 100, 50, 120, 70, 30], [50, 16, 'ok']],
  ['boundary: tariff already active', ['CP3', 10, 50, 400, 60, 10], [56, 6, 'ok']],
  ['regression: latest start derivation', ['CP873', 194, 7, 146, 117, 15], [29, 6, 'ok']],
  ['regression: latest start derivation (partial repair)', ['CP174', 226, 53, 139, 171, 5],
   [53, 2, 'late']],
  ['control 1', ['CP137', 10, 19, 66, 6, 15], [24, 5, 'ok']],
  ['control 2', ['CP783', 210, 193, 350, 267, 30], [193, 3, 'late']]],
 [['boundary: no stagger configured', ['CP7', 100, 50, 400, 60, 0], [100, 0, 'ok']],
  ['boundary: deadline forces immediate start', ['CP12', 100, 50, 120, 70, 30], [50, 16, 'ok']],
  ['boundary: tariff already active', ['CP3', 10, 50, 400, 60, 10], [56, 6, 'ok']],
  ['regression: latest start derivation', ['CP353', 241, 118, 320, 150, 5], [170, 1, 'ok']],
  ['regression: latest start derivation (partial repair)', ['CP776', 104, 179, 210, 259, 30],
   [179, 14, 'late']],
  ['control 1', ['CP873', 194, 7, 146, 117, 15], [29, 6, 'ok']],
  ['control 2', ['CP733', 56, 136, 418, 4, 0], [136, 0, 'ok']]]]
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: no stagger configured[100, 0, 'ok'][100, 0, 'ok']Passed
boundary: deadline forces immediate start[50, 16, 'ok'][50, 16, 'ok']Passed
boundary: tariff already active[56, 6, 'ok'][56, 6, 'ok']Passed
regression: latest start derivation[189, 15, 'ok'][204, 15, 'ok']Failed
regression: latest start derivation (partial repair)[93, 0, 'ok'][93, 0, 'ok']Passed
control 1[40, 0, 'ok'][40, 0, 'ok']Passed
control 2[150, 10, 'late'][150, 10, 'late']Passed

SHA-256 / 0a55184984bc27f18437f57b8fddc8a2ba3bb8c69ced805fd61c0578e372d2d7

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(cid, tariff_start, now, depart, dur, max_delay):
    delay = sum((i + 1) * ord(c) for i, c in enumerate(cid)) % (max_delay + 1)
    start = max(tariff_start, now) + delay
    latest = depart
    if start > latest:
        start = max(latest, now)
    status = 'ok' if start + dur <= depart else 'late'
    return [start, delay, status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: no stagger configured', ['CP7', 100, 50, 400, 60, 0], [100, 0, 'ok']],
  ['boundary: deadline forces immediate start', ['CP12', 100, 50, 120, 70, 30], [50, 16, 'ok']],
  ['boundary: tariff already active', ['CP3', 10, 50, 400, 60, 10], [56, 6, 'ok']],
  ['regression: latest start derivation', ['CP929', 258, 12, 235, 31, 30], [204, 15, 'ok']],
  ['regression: latest start derivation (partial repair)', ['CP495', 117, 47, 359, 266, 0],
   [93, 0, 'ok']],
  ['control 1', ['CP310', 208, 18, 199, 159, 0], [40, 0, 'ok']],
  ['control 2', ['CP766', 294, 150, 208, 201, 30], [150, 10, 'late']]],
 [['boundary: no stagger configured', ['CP7', 100, 50, 400, 60, 0], [100, 0, 'ok']],
  ['boundary: deadline forces immediate start', ['CP12', 100, 50, 120, 70, 30], [50, 16, 'ok']],
  ['boundary: tariff already active', ['CP3', 10, 50, 400, 60, 10], [56, 6, 'ok']],
  ['regression: latest start derivation', ['CP990', 237, 16, 437, 299, 30], [138, 29, 'ok']],
  ['regression: latest start derivation (partial repair)', ['CP272', 217, 184, 482, 298, 15],
   [184, 15, 'ok']],
  ['control 1', ['CP883', 235, 120, 211, 80, 5], [131, 4, 'ok']],
  ['control 2', ['CP742', 19, 177, 199, 247, 10], [177, 3, 'late']]],
 [['boundary: no stagger configured', ['CP7', 100, 50, 400, 60, 0], [100, 0, 'ok']],
  ['boundary: deadline forces immediate start', ['CP12', 100, 50, 120, 70, 30], [50, 16, 'ok']],
  ['boundary: tariff already active', ['CP3', 10, 50, 400, 60, 10], [56, 6, 'ok']],
  ['regression: latest start derivation', ['CP466', 247, 123, 302, 127, 5], [175, 5, 'ok']],
  ['regression: latest start derivation (partial repair)', ['CP803', 164, 112, 215, 145, 5],
   [112, 2, 'late']],
  ['control 1', ['CP783', 204, 99, 341, 202, 5], [139, 1, 'ok']],
  ['control 2', ['CP490', 211, 107, 512, 167, 10], [215, 4, 'ok']]],
 [['boundary: no stagger configured', ['CP7', 100, 50, 400, 60, 0], [100, 0, 'ok']],
  ['boundary: deadline forces immediate start', ['CP12', 100, 50, 120, 70, 30], [50, 16, 'ok']],
  ['boundary: tariff already active', ['CP3', 10, 50, 400, 60, 10], [56, 6, 'ok']],
  ['regression: latest start derivation', ['CP873', 194, 7, 146, 117, 15], [29, 6, 'ok']],
  ['regression: latest start derivation (partial repair)', ['CP174', 226, 53, 139, 171, 5],
   [53, 2, 'late']],
  ['control 1', ['CP137', 10, 19, 66, 6, 15], [24, 5, 'ok']],
  ['control 2', ['CP783', 210, 193, 350, 267, 30], [193, 3, 'late']]],
 [['boundary: no stagger configured', ['CP7', 100, 50, 400, 60, 0], [100, 0, 'ok']],
  ['boundary: deadline forces immediate start', ['CP12', 100, 50, 120, 70, 30], [50, 16, 'ok']],
  ['boundary: tariff already active', ['CP3', 10, 50, 400, 60, 10], [56, 6, 'ok']],
  ['regression: latest start derivation', ['CP353', 241, 118, 320, 150, 5], [170, 1, 'ok']],
  ['regression: latest start derivation (partial repair)', ['CP776', 104, 179, 210, 259, 30],
   [179, 14, 'late']],
  ['control 1', ['CP873', 194, 7, 146, 117, 15], [29, 6, 'ok']],
  ['control 2', ['CP733', 56, 136, 418, 4, 0], [136, 0, 'ok']]]]
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: no stagger configured[100, 0, 'ok'][100, 0, 'ok']Passed
boundary: deadline forces immediate start[116, 16, 'late'][50, 16, 'ok']Failed
boundary: tariff already active[56, 6, 'ok'][56, 6, 'ok']Passed
regression: latest start derivation[235, 15, 'late'][204, 15, 'ok']Failed
regression: latest start derivation (partial repair)[117, 0, 'late'][93, 0, 'ok']Failed
control 1[199, 0, 'late'][40, 0, 'ok']Failed
control 2[208, 10, 'late'][150, 10, 'late']Failed

SHA-256 / 5db70cc4095800c6fd517692e61f2fd88198c59516986ba939fff859bb808a92

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

Case digest / 75629762df11bf30ba012f833870eef48e29601d8807d66868b14a015f2b34f7