FAILURE MAP
← Case archive

FA-93126 / EV charging session scheduling / Open access

Weekly recurring charging windows: whole-day rule · case 01

A rule with equal start and end allows charging only around its start minute on two days.

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

ROOT CAUSE

Equal start and end falls through to the overnight branch instead of meaning the whole day.

VERIFIED REPAIR

Treat start == end as the full selected day.

Unsuccessful approach: Recognising only 00:00-00:00 as whole-day leaves other equal-bound rules broken.

Case contract

rules are [day_mask, start, end] with bit 0 = Monday .. bit 6 = Sunday. start < end is a same-day window [start, end); start == end means the whole selected day; start > end crosses midnight and belongs to its start day (Sunday continues into Monday). Return the sorted indices of rules allowing charging at (day 0..6, minute 0..1439).

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(rules, day, minute):
    hits = []
    for i, (mask, s, e) in enumerate(rules):
        today = mask >> day & 1
        yday = mask >> (day - 1) % 7 & 1
        if s < e:
            if today and s <= minute < e:
                hits.append(i)
        elif (today and minute >= s) or (yday and minute < e):
            hits.append(i)
    return hits
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: Monday morning after Sunday night window', [[[64, 1320, 360]], 0, 100], [0]],
  ['boundary: same-day window end minute', [[[127, 60, 360]], 3, 360], []],
  ['boundary: whole-day rule', [[[4, 420, 420]], 2, 5], [0]],
  ['regression: whole-day rule', [[[5, 1320, 420], [82, 1080, 1320], [98, 1380, 1380]], 0, 61], []],
  ['regression: whole-day rule (partial repair)',
   [[[45, 360, 60], [46, 1080, 1080], [85, 360, 1320], [7, 60, 1320]], 4, 360], [2]],
  ['control 1', [[[75, 1380, 360]], 0, 1379], []],
  ['control 2', [[[26, 1380, 420], [118, 360, 0], [104, 1080, 1080]], 3, 0], [2]]],
 [['boundary: Monday morning after Sunday night window', [[[64, 1320, 360]], 0, 100], [0]],
  ['boundary: same-day window end minute', [[[127, 60, 360]], 3, 360], []],
  ['boundary: whole-day rule', [[[4, 420, 420]], 2, 5], [0]],
  ['regression: whole-day rule',
   [[[125, 0, 420], [59, 0, 420], [30, 360, 360], [28, 360, 0]], 1, 30], [1, 2]],
  ['regression: whole-day rule (partial repair)',
   [[[126, 360, 1380], [61, 1380, 1380], [23, 1380, 1320], [93, 420, 420]], 6, 30], [3]],
  ['control 1', [[[18, 60, 0], [118, 1080, 0], [124, 60, 360], [93, 1080, 60]], 4, 0], [3]],
  ['control 2', [[[28, 1320, 1080], [123, 420, 1380], [9, 1380, 0]], 6, 359], []]],
 [['boundary: Monday morning after Sunday night window', [[[64, 1320, 360]], 0, 100], [0]],
  ['boundary: same-day window end minute', [[[127, 60, 360]], 3, 360], []],
  ['boundary: whole-day rule', [[[4, 420, 420]], 2, 5], [0]],
  ['regression: whole-day rule', [[[26, 1080, 1080], [82, 60, 1320]], 1, 0], [0]],
  ['regression: whole-day rule (partial repair)',
   [[[86, 360, 1380], [82, 1080, 1080], [85, 0, 1320], [47, 1380, 60]], 4, 1079], [0, 1, 2]],
  ['control 1', [[[103, 0, 360], [65, 360, 1380], [37, 1080, 1080]], 4, 60], []],
  ['control 2', [[[52, 420, 1320], [97, 1080, 360]], 0, 0], [1]]],
 [['boundary: Monday morning after Sunday night window', [[[64, 1320, 360]], 0, 100], [0]],
  ['boundary: same-day window end minute', [[[127, 60, 360]], 3, 360], []],
  ['boundary: whole-day rule', [[[4, 420, 420]], 2, 5], [0]],
  ['regression: whole-day rule',
   [[[33, 1080, 420], [17, 360, 360], [101, 1380, 1380], [116, 1380, 1080]], 2, 1379], [2]],
  ['regression: whole-day rule (partial repair)',
   [[[5, 0, 420], [59, 1080, 360], [114, 420, 420], [82, 1320, 1320]], 4, 359], [1, 2, 3]],
  ['control 1', [[[105, 420, 360], [31, 1380, 1320], [47, 1080, 1320]], 4, 60], [0, 1]],
  ['control 2', [[[59, 360, 60], [45, 420, 60]], 5, 360], [0]]],
 [['boundary: Monday morning after Sunday night window', [[[64, 1320, 360]], 0, 100], [0]],
  ['boundary: same-day window end minute', [[[127, 60, 360]], 3, 360], []],
  ['boundary: whole-day rule', [[[4, 420, 420]], 2, 5], [0]],
  ['regression: whole-day rule', [[[42, 60, 60], [116, 360, 1320], [122, 0, 0]], 3, 59], [0, 2]],
  ['regression: whole-day rule (partial repair)', [[[64, 1320, 1320], [79, 420, 60]], 0, 420], [1]],
  ['control 1', [[[51, 360, 60], [78, 1080, 1080], [25, 1320, 360], [11, 360, 0]], 2, 1380], [1]],
  ['control 2', [[[16, 1380, 0]], 1, 360], []]]]
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: Monday morning after Sunday night window[0][0]Passed
boundary: same-day window end minute[][]Passed
boundary: whole-day rule[][0]Failed
regression: whole-day rule[2][]Failed
regression: whole-day rule (partial repair)[1, 2][2]Failed
control 1[][]Passed
control 2[][2]Failed

SHA-256 / c2b4a7b23f71689b04a260e53a238816a2d640f59a3e078d70038a73ad2f55e2

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(rules, day, minute):
    hits = []
    for i, (mask, s, e) in enumerate(rules):
        today = mask >> day & 1
        yday = mask >> (day - 1) % 7 & 1
        if s == e == 0:
            if today:
                hits.append(i)
        elif s < e:
            if today and s <= minute < e:
                hits.append(i)
        elif (today and minute >= s) or (yday and minute < e):
            hits.append(i)
    return hits
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: Monday morning after Sunday night window', [[[64, 1320, 360]], 0, 100], [0]],
  ['boundary: same-day window end minute', [[[127, 60, 360]], 3, 360], []],
  ['boundary: whole-day rule', [[[4, 420, 420]], 2, 5], [0]],
  ['regression: whole-day rule', [[[5, 1320, 420], [82, 1080, 1320], [98, 1380, 1380]], 0, 61], []],
  ['regression: whole-day rule (partial repair)',
   [[[45, 360, 60], [46, 1080, 1080], [85, 360, 1320], [7, 60, 1320]], 4, 360], [2]],
  ['control 1', [[[75, 1380, 360]], 0, 1379], []],
  ['control 2', [[[26, 1380, 420], [118, 360, 0], [104, 1080, 1080]], 3, 0], [2]]],
 [['boundary: Monday morning after Sunday night window', [[[64, 1320, 360]], 0, 100], [0]],
  ['boundary: same-day window end minute', [[[127, 60, 360]], 3, 360], []],
  ['boundary: whole-day rule', [[[4, 420, 420]], 2, 5], [0]],
  ['regression: whole-day rule',
   [[[125, 0, 420], [59, 0, 420], [30, 360, 360], [28, 360, 0]], 1, 30], [1, 2]],
  ['regression: whole-day rule (partial repair)',
   [[[126, 360, 1380], [61, 1380, 1380], [23, 1380, 1320], [93, 420, 420]], 6, 30], [3]],
  ['control 1', [[[18, 60, 0], [118, 1080, 0], [124, 60, 360], [93, 1080, 60]], 4, 0], [3]],
  ['control 2', [[[28, 1320, 1080], [123, 420, 1380], [9, 1380, 0]], 6, 359], []]],
 [['boundary: Monday morning after Sunday night window', [[[64, 1320, 360]], 0, 100], [0]],
  ['boundary: same-day window end minute', [[[127, 60, 360]], 3, 360], []],
  ['boundary: whole-day rule', [[[4, 420, 420]], 2, 5], [0]],
  ['regression: whole-day rule', [[[26, 1080, 1080], [82, 60, 1320]], 1, 0], [0]],
  ['regression: whole-day rule (partial repair)',
   [[[86, 360, 1380], [82, 1080, 1080], [85, 0, 1320], [47, 1380, 60]], 4, 1079], [0, 1, 2]],
  ['control 1', [[[103, 0, 360], [65, 360, 1380], [37, 1080, 1080]], 4, 60], []],
  ['control 2', [[[52, 420, 1320], [97, 1080, 360]], 0, 0], [1]]],
 [['boundary: Monday morning after Sunday night window', [[[64, 1320, 360]], 0, 100], [0]],
  ['boundary: same-day window end minute', [[[127, 60, 360]], 3, 360], []],
  ['boundary: whole-day rule', [[[4, 420, 420]], 2, 5], [0]],
  ['regression: whole-day rule',
   [[[33, 1080, 420], [17, 360, 360], [101, 1380, 1380], [116, 1380, 1080]], 2, 1379], [2]],
  ['regression: whole-day rule (partial repair)',
   [[[5, 0, 420], [59, 1080, 360], [114, 420, 420], [82, 1320, 1320]], 4, 359], [1, 2, 3]],
  ['control 1', [[[105, 420, 360], [31, 1380, 1320], [47, 1080, 1320]], 4, 60], [0, 1]],
  ['control 2', [[[59, 360, 60], [45, 420, 60]], 5, 360], [0]]],
 [['boundary: Monday morning after Sunday night window', [[[64, 1320, 360]], 0, 100], [0]],
  ['boundary: same-day window end minute', [[[127, 60, 360]], 3, 360], []],
  ['boundary: whole-day rule', [[[4, 420, 420]], 2, 5], [0]],
  ['regression: whole-day rule', [[[42, 60, 60], [116, 360, 1320], [122, 0, 0]], 3, 59], [0, 2]],
  ['regression: whole-day rule (partial repair)', [[[64, 1320, 1320], [79, 420, 60]], 0, 420], [1]],
  ['control 1', [[[51, 360, 60], [78, 1080, 1080], [25, 1320, 360], [11, 360, 0]], 2, 1380], [1]],
  ['control 2', [[[16, 1380, 0]], 1, 360], []]]]
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: Monday morning after Sunday night window[0][0]Passed
boundary: same-day window end minute[][]Passed
boundary: whole-day rule[][0]Failed
regression: whole-day rule[2][]Failed
regression: whole-day rule (partial repair)[1, 2][2]Failed
control 1[][]Passed
control 2[][2]Failed

SHA-256 / 1a468a4d5411f1d5a23eca2ae42adef71c2c2626cfbecf6932a141e04de59a1d

3 / The verified repair

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

N = 1
observations = []
def solve(rules, day, minute):
    hits = []
    for i, (mask, s, e) in enumerate(rules):
        today = mask >> day & 1
        yday = mask >> (day - 1) % 7 & 1
        if s == e:
            if today:
                hits.append(i)
        elif s < e:
            if today and s <= minute < e:
                hits.append(i)
        elif (today and minute >= s) or (yday and minute < e):
            hits.append(i)
    return hits
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: Monday morning after Sunday night window', [[[64, 1320, 360]], 0, 100], [0]],
  ['boundary: same-day window end minute', [[[127, 60, 360]], 3, 360], []],
  ['boundary: whole-day rule', [[[4, 420, 420]], 2, 5], [0]],
  ['regression: whole-day rule', [[[5, 1320, 420], [82, 1080, 1320], [98, 1380, 1380]], 0, 61], []],
  ['regression: whole-day rule (partial repair)',
   [[[45, 360, 60], [46, 1080, 1080], [85, 360, 1320], [7, 60, 1320]], 4, 360], [2]],
  ['control 1', [[[75, 1380, 360]], 0, 1379], []],
  ['control 2', [[[26, 1380, 420], [118, 360, 0], [104, 1080, 1080]], 3, 0], [2]]],
 [['boundary: Monday morning after Sunday night window', [[[64, 1320, 360]], 0, 100], [0]],
  ['boundary: same-day window end minute', [[[127, 60, 360]], 3, 360], []],
  ['boundary: whole-day rule', [[[4, 420, 420]], 2, 5], [0]],
  ['regression: whole-day rule',
   [[[125, 0, 420], [59, 0, 420], [30, 360, 360], [28, 360, 0]], 1, 30], [1, 2]],
  ['regression: whole-day rule (partial repair)',
   [[[126, 360, 1380], [61, 1380, 1380], [23, 1380, 1320], [93, 420, 420]], 6, 30], [3]],
  ['control 1', [[[18, 60, 0], [118, 1080, 0], [124, 60, 360], [93, 1080, 60]], 4, 0], [3]],
  ['control 2', [[[28, 1320, 1080], [123, 420, 1380], [9, 1380, 0]], 6, 359], []]],
 [['boundary: Monday morning after Sunday night window', [[[64, 1320, 360]], 0, 100], [0]],
  ['boundary: same-day window end minute', [[[127, 60, 360]], 3, 360], []],
  ['boundary: whole-day rule', [[[4, 420, 420]], 2, 5], [0]],
  ['regression: whole-day rule', [[[26, 1080, 1080], [82, 60, 1320]], 1, 0], [0]],
  ['regression: whole-day rule (partial repair)',
   [[[86, 360, 1380], [82, 1080, 1080], [85, 0, 1320], [47, 1380, 60]], 4, 1079], [0, 1, 2]],
  ['control 1', [[[103, 0, 360], [65, 360, 1380], [37, 1080, 1080]], 4, 60], []],
  ['control 2', [[[52, 420, 1320], [97, 1080, 360]], 0, 0], [1]]],
 [['boundary: Monday morning after Sunday night window', [[[64, 1320, 360]], 0, 100], [0]],
  ['boundary: same-day window end minute', [[[127, 60, 360]], 3, 360], []],
  ['boundary: whole-day rule', [[[4, 420, 420]], 2, 5], [0]],
  ['regression: whole-day rule',
   [[[33, 1080, 420], [17, 360, 360], [101, 1380, 1380], [116, 1380, 1080]], 2, 1379], [2]],
  ['regression: whole-day rule (partial repair)',
   [[[5, 0, 420], [59, 1080, 360], [114, 420, 420], [82, 1320, 1320]], 4, 359], [1, 2, 3]],
  ['control 1', [[[105, 420, 360], [31, 1380, 1320], [47, 1080, 1320]], 4, 60], [0, 1]],
  ['control 2', [[[59, 360, 60], [45, 420, 60]], 5, 360], [0]]],
 [['boundary: Monday morning after Sunday night window', [[[64, 1320, 360]], 0, 100], [0]],
  ['boundary: same-day window end minute', [[[127, 60, 360]], 3, 360], []],
  ['boundary: whole-day rule', [[[4, 420, 420]], 2, 5], [0]],
  ['regression: whole-day rule', [[[42, 60, 60], [116, 360, 1320], [122, 0, 0]], 3, 59], [0, 2]],
  ['regression: whole-day rule (partial repair)', [[[64, 1320, 1320], [79, 420, 60]], 0, 420], [1]],
  ['control 1', [[[51, 360, 60], [78, 1080, 1080], [25, 1320, 360], [11, 360, 0]], 2, 1380], [1]],
  ['control 2', [[[16, 1380, 0]], 1, 360], []]]]
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: Monday morning after Sunday night window[0][0]Passed
boundary: same-day window end minute[][]Passed
boundary: whole-day rule[0][0]Passed
regression: whole-day rule[][]Passed
regression: whole-day rule (partial repair)[2][2]Passed
control 1[][]Passed
control 2[2][2]Passed

SHA-256 / 28f38d0fbdad50dafe38dad6decf777102a60d7faa1613b0f72285fb11eb67ac

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

Case digest / 2512cfec01694aa7d82d68609491db2c37ad98c2ff63b8429cd2b9317d246e51