FAILURE MAP
← Case archive

FA-12306 / Battery state accounting / Open access

Removing a module loses charge provenance · case 01

Pack removal subtracts module capacity instead of that module inventory.

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

ROOT CAUSE

Pack removal subtracts module capacity instead of that module inventory.

VERIFIED REPAIR

Remove the inventory belonging to the named module only.

Unsuccessful approach: Subtracting average inventory assumes equally charged modules.

Case contract

Modules map unique identifiers to [charge,capacity]. Return total remaining charge after removing an existing identifier.

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(modules, removed):
    return sum(v[0] for v in modules.values()) - modules[removed][1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('low module', solve({'a':[N,10*N],'b':[8*N,10*N]}, 'a'), 8*N)
check('high module', solve({'a':[N,10*N],'b':[8*N,10*N]}, 'b'), N)
check('only module', solve({'a':[N,10*N]}, 'a'), 0)
check('empty removed', solve({'a':[0,10*N],'b':[8*N,10*N]}, 'a'), 8*N)
check('equal', solve({'a':[N,10*N],'b':[N,10*N]}, 'a'), N)
check('three', solve({'a':[N,10*N],'b':[2*N,10*N],'c':[7*N,10*N]}, 'b'), 8*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 fixtureActualExpectedOutcome
low module-18Failed
high module-11Failed
only module-90Failed
empty removed-28Failed
equal-81Failed
three08Failed

SHA-256 / 05b4be2a5d61c0cb8d07c7c94c39fe0fe2940f0cbdddc8f26649686a2849205a

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(modules, removed):
    return sum(v[0] for v in modules.values()) * (len(modules)-1)//len(modules)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('low module', solve({'a':[N,10*N],'b':[8*N,10*N]}, 'a'), 8*N)
check('high module', solve({'a':[N,10*N],'b':[8*N,10*N]}, 'b'), N)
check('only module', solve({'a':[N,10*N]}, 'a'), 0)
check('empty removed', solve({'a':[0,10*N],'b':[8*N,10*N]}, 'a'), 8*N)
check('equal', solve({'a':[N,10*N],'b':[N,10*N]}, 'a'), N)
check('three', solve({'a':[N,10*N],'b':[2*N,10*N],'c':[7*N,10*N]}, 'b'), 8*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 fixtureActualExpectedOutcome
low module48Failed
high module41Failed
only module00Passed
empty removed48Failed
equal11Passed
three68Failed

SHA-256 / d324aaa5ab08183df454604d96145a8e5f29aeb1a17631749fdfb48ab6967961

3 / The verified repair

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

N = 1
observations = []
def solve(modules, removed):
    return sum(v[0] for k,v in modules.items() if k != removed)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('low module', solve({'a':[N,10*N],'b':[8*N,10*N]}, 'a'), 8*N)
check('high module', solve({'a':[N,10*N],'b':[8*N,10*N]}, 'b'), N)
check('only module', solve({'a':[N,10*N]}, 'a'), 0)
check('empty removed', solve({'a':[0,10*N],'b':[8*N,10*N]}, 'a'), 8*N)
check('equal', solve({'a':[N,10*N],'b':[N,10*N]}, 'a'), N)
check('three', solve({'a':[N,10*N],'b':[2*N,10*N],'c':[7*N,10*N]}, 'b'), 8*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 fixtureActualExpectedOutcome
low module88Passed
high module11Passed
only module00Passed
empty removed88Passed
equal11Passed
three88Passed

SHA-256 / 1ddb4790c20cbce30bca6456f2b1fa75ec2ed86f84a21ba95ec2d05f44d8fc60

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

Case digest / 16b299f86f8f2f4f0edafb2081001619471e21827e237f9bf01c60dac659dab0