FAILURE MAP
← Case archive

FA-12296 / Battery state accounting / Open access

Capacity calibration invents stored charge · case 01

Capacity recalibration preserves a displayed fraction instead of stored inventory.

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

ROOT CAUSE

Capacity recalibration preserves a displayed fraction instead of stored inventory.

VERIFIED REPAIR

Keep absolute charge, clipping only if the new capacity is smaller.

Unsuccessful approach: Clipping only on downward capacity changes still rescales upward changes.

Case contract

Return absolute stored integer charge after replacing the capacity estimate; cap at new capacity. Old capacity is positive and charge lies within it.

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, old_capacity, new_capacity):
    return charge * new_capacity // old_capacity
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('upward', solve(4*N, 10*N, 20*N), 4*N)
check('downward no clip', solve(4*N, 10*N, 8*N), 4*N)
check('clip', solve(9*N, 10*N, 6*N), 6*N)
check('empty', solve(0, 10*N, 20*N), 0)
check('unchanged', solve(7*N, 10*N, 10*N), 7*N)
check('zero capacity', solve(7*N, 10*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 fixtureActualExpectedOutcome
upward84Failed
downward no clip34Failed
clip56Failed
empty00Passed
unchanged77Passed
zero capacity00Passed

SHA-256 / 25e9c32efb03275c18a840b52368a6840be5f304a6cfc023e84cb91f44f3575a

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(charge, old_capacity, new_capacity):
    return min(charge, new_capacity) if new_capacity < old_capacity else charge * new_capacity // old_capacity
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('upward', solve(4*N, 10*N, 20*N), 4*N)
check('downward no clip', solve(4*N, 10*N, 8*N), 4*N)
check('clip', solve(9*N, 10*N, 6*N), 6*N)
check('empty', solve(0, 10*N, 20*N), 0)
check('unchanged', solve(7*N, 10*N, 10*N), 7*N)
check('zero capacity', solve(7*N, 10*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 fixtureActualExpectedOutcome
upward84Failed
downward no clip44Passed
clip66Passed
empty00Passed
unchanged77Passed
zero capacity00Passed

SHA-256 / c3b2eb0a9af632ff4d40404179ddc76360a07e354ededf6af135908569349db9

3 / The verified repair

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

N = 1
observations = []
def solve(charge, old_capacity, new_capacity):
    return min(charge, new_capacity)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('upward', solve(4*N, 10*N, 20*N), 4*N)
check('downward no clip', solve(4*N, 10*N, 8*N), 4*N)
check('clip', solve(9*N, 10*N, 6*N), 6*N)
check('empty', solve(0, 10*N, 20*N), 0)
check('unchanged', solve(7*N, 10*N, 10*N), 7*N)
check('zero capacity', solve(7*N, 10*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 fixtureActualExpectedOutcome
upward44Passed
downward no clip44Passed
clip66Passed
empty00Passed
unchanged77Passed
zero capacity00Passed

SHA-256 / 8cfe6bae0865d0c1efbd308b106a1f302a1c07d00d9fd56f3d9aa37a040faa4e

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

Case digest / 83c396f4ab06998a7e03b701417f29c46f2ddbcaf1338b2ec5103d9131bc0d6b