FA-12321 / Battery state accounting / Open access
Overflow charge is retained as a hidden future credit · case 01
Only the final event sum is clipped to capacity.
ROOT CAUSE
Only the final event sum is clipped to capacity.
VERIFIED REPAIR
Apply capacity and zero bounds after every transfer.
Unsuccessful approach: Clipping upper bounds per event still carries negative inventory debt across later charges.
Case contract
Return final inventory after ordered signed transfer attempts; each event independently clips the inventory to [0,capacity].
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(initial, capacity, deltas):
return min(capacity,max(0,initial+sum(deltas)))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('overflow then drain', solve(9*N,10*N,[5*N,-3*N]), 7*N)
check('underflow then fill', solve(N,10*N,[-5*N,3*N]), 3*N)
check('no events', solve(4*N,10*N,[]), 4*N)
check('ordinary', solve(4*N,10*N,[N,-2*N]), 3*N)
check('zero capacity', solve(0,0,[N,-N]), 0)
check('multiple clipping', solve(5*N,10*N,[20*N,-30*N,4*N]), 4*N)
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 |
|---|---|---|---|
| overflow then drain | 10 | 7 | Failed |
| underflow then fill | 0 | 3 | Failed |
| no events | 4 | 4 | Passed |
| ordinary | 3 | 3 | Passed |
| zero capacity | 0 | 0 | Passed |
| multiple clipping | 0 | 4 | Failed |
SHA-256 / a8cebd3c6518a695a27e9a0b06ba2aef162512ce1c7e89bb8ba659bdd2ff0db2
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(initial, capacity, deltas):
q=initial
for d in deltas:
q=min(capacity,q+d)
return max(0,q)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('overflow then drain', solve(9*N,10*N,[5*N,-3*N]), 7*N)
check('underflow then fill', solve(N,10*N,[-5*N,3*N]), 3*N)
check('no events', solve(4*N,10*N,[]), 4*N)
check('ordinary', solve(4*N,10*N,[N,-2*N]), 3*N)
check('zero capacity', solve(0,0,[N,-N]), 0)
check('multiple clipping', solve(5*N,10*N,[20*N,-30*N,4*N]), 4*N)
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 |
|---|---|---|---|
| overflow then drain | 7 | 7 | Passed |
| underflow then fill | 0 | 3 | Failed |
| no events | 4 | 4 | Passed |
| ordinary | 3 | 3 | Passed |
| zero capacity | 0 | 0 | Passed |
| multiple clipping | 0 | 4 | Failed |
SHA-256 / 5355533a8bc44ead7394d23c43cf1daa6e84527dc4511dbde5075d878d6caf73
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(initial, capacity, deltas):
q=initial
for d in deltas:
q=min(capacity,max(0,q+d))
return q
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('overflow then drain', solve(9*N,10*N,[5*N,-3*N]), 7*N)
check('underflow then fill', solve(N,10*N,[-5*N,3*N]), 3*N)
check('no events', solve(4*N,10*N,[]), 4*N)
check('ordinary', solve(4*N,10*N,[N,-2*N]), 3*N)
check('zero capacity', solve(0,0,[N,-N]), 0)
check('multiple clipping', solve(5*N,10*N,[20*N,-30*N,4*N]), 4*N)
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 |
|---|---|---|---|
| overflow then drain | 7 | 7 | Passed |
| underflow then fill | 3 | 3 | Passed |
| no events | 4 | 4 | Passed |
| ordinary | 3 | 3 | Passed |
| zero capacity | 0 | 0 | Passed |
| multiple clipping | 4 | 4 | Passed |
SHA-256 / 954d1fc2c4d6b942b52467966328235a076675371d4b7c941cf7ac21d32a51c7
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.842821+00:00.
Case digest / 9e8d72e40c04a3bc773ebb471094279b41f6b7ef9a6db152fa111cccac3d48d2