FAILURE MAP
← Case archive

FA-12326 / Battery state accounting / Open access

Idle loss is charged once per observation · case 01

Repeated observations accumulate loss regardless of elapsed model time.

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

ROOT CAUSE

Repeated observations accumulate loss regardless of elapsed model time.

VERIFIED REPAIR

Settle loss from the last settlement time and advance that timestamp.

Unsuccessful approach: Charging from the original timestamp on every observation double bills elapsed intervals.

Case contract

Return final charge under a constant integer loss of one unit per tick and ordered observation timestamps at or after start; settle each elapsed interval once, floor at zero.

Why this case matters

An explicit synthetic battery bookkeeping model isolates this state-accounting error; it is not an engineering prediction or safety procedure.

1 / The failure

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

N = 1
observations = []
def solve(charge, start, times):
    return max(0,charge-len(times))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated timestamp', solve(20*N,0,[N,N,2*N]), 18*N)
check('one observation', solve(20*N,0,[3*N]), 17*N)
check('no observation', solve(20*N,0,[]), 20*N)
check('zero interval', solve(20*N,N,[N,N]), 20*N)
check('offset clock', solve(20*N,10*N,[11*N,13*N]), 17*N)
check('exhaustion', solve(N,0,[2*N,4*N]), 0)
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
repeated timestamp1718Failed
one observation1917Failed
no observation2020Passed
zero interval1820Failed
offset clock1817Failed
exhaustion00Passed

SHA-256 / d264454d53e7232378dbf7c3576c7734f25f726e2c777ef7a63fad5788bdd50f

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(charge, start, times):
    for t in times:
        charge=max(0,charge-(t-start))
    return charge
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated timestamp', solve(20*N,0,[N,N,2*N]), 18*N)
check('one observation', solve(20*N,0,[3*N]), 17*N)
check('no observation', solve(20*N,0,[]), 20*N)
check('zero interval', solve(20*N,N,[N,N]), 20*N)
check('offset clock', solve(20*N,10*N,[11*N,13*N]), 17*N)
check('exhaustion', solve(N,0,[2*N,4*N]), 0)
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
repeated timestamp1618Failed
one observation1717Passed
no observation2020Passed
zero interval2020Passed
offset clock1617Failed
exhaustion00Passed

SHA-256 / e3c9242a8fa442006a513b87ce9c4058303d1bb37fbb81376da4a9f6cc0848ec

3 / The verified repair

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

N = 1
observations = []
def solve(charge, start, times):
    for t in times:
        charge=max(0,charge-(t-start))
        start=t
    return charge
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated timestamp', solve(20*N,0,[N,N,2*N]), 18*N)
check('one observation', solve(20*N,0,[3*N]), 17*N)
check('no observation', solve(20*N,0,[]), 20*N)
check('zero interval', solve(20*N,N,[N,N]), 20*N)
check('offset clock', solve(20*N,10*N,[11*N,13*N]), 17*N)
check('exhaustion', solve(N,0,[2*N,4*N]), 0)
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
repeated timestamp1818Passed
one observation1717Passed
no observation2020Passed
zero interval2020Passed
offset clock1717Passed
exhaustion00Passed

SHA-256 / 16c8c7804866db984608765814884d5863bc80b3675dc5a6934588bb7acac417

Verification & scope

Integer toy accounting with declared loss rules; no electrochemistry, hardware behavior, or safety claims. 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:38:55.933445+00:00.

Case digest / e836c3543b4ec84db29c21640ef8ef6c56de43d487b862fd3b0a68463c7ed2aa