FA-12316 / Battery state accounting / Open access
Reserve policy permanently deletes charge · case 01
The protected reserve is subtracted from stored inventory even without delivery.
ROOT CAUSE
The protected reserve is subtracted from stored inventory even without delivery.
VERIFIED REPAIR
Debit only delivered charge and preserve the protected reserve.
Unsuccessful approach: Capping delivery by reserve still subtracts the reserve from the reported remaining inventory.
Case contract
Return [delivered,remaining] for nonnegative inventory, request, reserve; reserve limits access but does not delete stored charge.
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, reserve, request):
d=min(request,charge)
return [d, max(0,charge-d-reserve)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('floor', solve(10*N,3*N,10*N), [7*N,3*N])
check('no request', solve(10*N,3*N,0), [0,10*N])
check('under reserve', solve(2*N,3*N,N), [0,2*N])
check('no reserve', solve(10*N,0,4*N), [4*N,6*N])
check('partial', solve(10*N,3*N,2*N), [2*N,8*N])
check('empty', solve(0,3*N,N), [0,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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| floor | [10, 0] | [7, 3] | Failed |
| no request | [0, 7] | [0, 10] | Failed |
| under reserve | [1, 0] | [0, 2] | Failed |
| no reserve | [4, 6] | [4, 6] | Passed |
| partial | [2, 5] | [2, 8] | Failed |
| empty | [0, 0] | [0, 0] | Passed |
SHA-256 / 926e9986913795d28a066af5fa9f6f3d3b67f81f501e2efaf2cab98a84d837df
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(charge, reserve, request):
d=min(request,max(0,charge-reserve))
return [d,max(0,charge-d-reserve)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('floor', solve(10*N,3*N,10*N), [7*N,3*N])
check('no request', solve(10*N,3*N,0), [0,10*N])
check('under reserve', solve(2*N,3*N,N), [0,2*N])
check('no reserve', solve(10*N,0,4*N), [4*N,6*N])
check('partial', solve(10*N,3*N,2*N), [2*N,8*N])
check('empty', solve(0,3*N,N), [0,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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| floor | [7, 0] | [7, 3] | Failed |
| no request | [0, 7] | [0, 10] | Failed |
| under reserve | [0, 0] | [0, 2] | Failed |
| no reserve | [4, 6] | [4, 6] | Passed |
| partial | [2, 5] | [2, 8] | Failed |
| empty | [0, 0] | [0, 0] | Passed |
SHA-256 / 9be66ca71e96339f25419dfcad55849acff45ef23aedca8fb021cd043a9e1361
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(charge, reserve, request):
d=min(request,max(0,charge-reserve))
return [d,charge-d]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('floor', solve(10*N,3*N,10*N), [7*N,3*N])
check('no request', solve(10*N,3*N,0), [0,10*N])
check('under reserve', solve(2*N,3*N,N), [0,2*N])
check('no reserve', solve(10*N,0,4*N), [4*N,6*N])
check('partial', solve(10*N,3*N,2*N), [2*N,8*N])
check('empty', solve(0,3*N,N), [0,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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| floor | [7, 3] | [7, 3] | Passed |
| no request | [0, 10] | [0, 10] | Passed |
| under reserve | [0, 2] | [0, 2] | Passed |
| no reserve | [4, 6] | [4, 6] | Passed |
| partial | [2, 8] | [2, 8] | Passed |
| empty | [0, 0] | [0, 0] | Passed |
SHA-256 / e3de972c65727fec5b6f0eae0078de0a1956b6d2e16df24fb13ebdeff6fcb181
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.761058+00:00.
Case digest / 3d9a5a5759f86ff1945d6aa758f970dff2d7e69a9ad8d56a5ce55cebd423640f