FAILURE MAP
← Case archive

FA-93291 / EV charging session scheduling / Open access

Staggered start after tariff switch: delay modulus range · case 01

The configured maximum delay is never used and some chargers start earlier than intended.

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

ROOT CAUSE

The spread modulus excludes max_delay itself.

THE FAILURE

The spread modulus excludes max_delay itself.

Unsuccessful approach: Shrinking the modulus further removes two possible delays.

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 if max_delay else 0
    start = max(tariff_start, now) + delay
    latest = depart - dur
    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: delay modulus range', ['CP278', 28, 172, 319, 97, 30], [181, 9, 'ok']],
  ['regression: delay modulus range (partial repair)', ['CP201', 49, 94, 552, 247, 5],
   [98, 4, '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: delay modulus range', ['CP272', 217, 184, 482, 298, 15], [184, 15, 'ok']],
  ['regression: delay modulus range (partial repair)', ['CP363', 205, 166, 509, 88, 10],
   [209, 4, '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: delay modulus range', ['CP201', 269, 83, 492, 35, 10], [269, 0, 'ok']],
  ['regression: delay modulus range (partial repair)', ['CP896', 198, 47, 277, 26, 15],
   [211, 13, 'ok']],
  ['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: delay modulus range', ['CP996', 26, 122, 444, 207, 5], [124, 2, 'ok']],
  ['regression: delay modulus range (partial repair)', ['CP267', 210, 178, 655, 84, 5],
   [214, 4, 'ok']],
  ['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: delay modulus range', ['CP353', 241, 118, 320, 150, 5], [170, 1, 'ok']],
  ['regression: delay modulus range (partial repair)', ['CP168', 85, 91, 538, 99, 30],
   [93, 2, 'ok']],
  ['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, 4, 'ok'][50, 16, 'ok']Failed
boundary: tariff already active[50, 0, 'ok'][56, 6, 'ok']Failed
regression: delay modulus range[179, 7, 'ok'][181, 9, 'ok']Failed
regression: delay modulus range (partial repair)[98, 4, 'ok'][98, 4, 'ok']Passed
control 1[40, 0, 'ok'][40, 0, 'ok']Passed
control 2[150, 8, 'late'][150, 10, 'late']Failed

SHA-256 / f44046565cceccef41d09aacb1a90b915fe42a81be9ea34cae7a8dd023825588

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) if max_delay > 1 else 0
    start = max(tariff_start, now) + delay
    latest = depart - dur
    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: delay modulus range', ['CP278', 28, 172, 319, 97, 30], [181, 9, 'ok']],
  ['regression: delay modulus range (partial repair)', ['CP201', 49, 94, 552, 247, 5],
   [98, 4, '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: delay modulus range', ['CP272', 217, 184, 482, 298, 15], [184, 15, 'ok']],
  ['regression: delay modulus range (partial repair)', ['CP363', 205, 166, 509, 88, 10],
   [209, 4, '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: delay modulus range', ['CP201', 269, 83, 492, 35, 10], [269, 0, 'ok']],
  ['regression: delay modulus range (partial repair)', ['CP896', 198, 47, 277, 26, 15],
   [211, 13, 'ok']],
  ['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: delay modulus range', ['CP996', 26, 122, 444, 207, 5], [124, 2, 'ok']],
  ['regression: delay modulus range (partial repair)', ['CP267', 210, 178, 655, 84, 5],
   [214, 4, 'ok']],
  ['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: delay modulus range', ['CP353', 241, 118, 320, 150, 5], [170, 1, 'ok']],
  ['regression: delay modulus range (partial repair)', ['CP168', 85, 91, 538, 99, 30],
   [93, 2, 'ok']],
  ['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, 23, 'ok'][50, 16, 'ok']Failed
boundary: tariff already active[52, 2, 'ok'][56, 6, 'ok']Failed
regression: delay modulus range[179, 7, 'ok'][181, 9, 'ok']Failed
regression: delay modulus range (partial repair)[96, 2, 'ok'][98, 4, 'ok']Failed
control 1[40, 0, 'ok'][40, 0, 'ok']Passed
control 2[150, 8, 'late'][150, 10, 'late']Failed

SHA-256 / 5a5e602c5381202fd2387397150f913a95c8bf410a23460b8478dabb7622dd4b

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

Case digest / af7a37aa575639d59c4cc89ac504af146613c4e5429e985568f73dc17992b4d5