FA-12281 / Power metering accounting / Open access
Expired export-credit lots reduce current import charges · case 01
Expired export-credit lots reduce current import charges.
ROOT CAUSE
Expired lots remain spendable against the current bill.
VERIFIED REPAIR
Filter by inclusive expiry and consume in ascending expiry order.
Unsuccessful approach: Filtering expired lots but consuming newest first strands older credits that expire sooner.
Case contract
Lots [expiry_period, energy] are export credits. At billing period p, keep only expiry>=p, consume oldest-expiring lots first against nonnegative import need, and return [uncovered need, remaining energy by ascending expiry]. Expired lots vanish; zero remainders are omitted.
Why this case matters
Meter settlement depends on explicit register and tariff policies; this controlled model makes that policy observable.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(lots, period, need):
out=[]
for expiry,energy in sorted(lots):
used=min(need,energy); need-=used
if energy>used: out.append([expiry,energy-used])
return [need,out]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expired credit', solve([[1,N]],2,N),[N,[]])
check('oldest spent first', solve([[3,N],[2,N]],2,N),[0,[[3,N]]])
check('inclusive expiry', solve([[2,N]],2,N),[0,[]])
check('partial credit', solve([[2,3*N]],2,N),[0,[[2,2*N]]])
check('uncovered import', solve([[2,N]],2,3*N),[2*N,[]])
check('zero import still expires lots', solve([[1,N],[3,N]],2,0),[0,[[3,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 |
|---|---|---|---|
| expired credit | [0, []] | [1, []] | Failed |
| oldest spent first | [0, [[3, 1]]] | [0, [[3, 1]]] | Passed |
| inclusive expiry | [0, []] | [0, []] | Passed |
| partial credit | [0, [[2, 2]]] | [0, [[2, 2]]] | Passed |
| uncovered import | [2, []] | [2, []] | Passed |
| zero import still expires lots | [0, [[1, 1], [3, 1]]] | [0, [[3, 1]]] | Failed |
SHA-256 / 5dab0d05c2f8ad86a16c1d37b144273cab1f4c7b98d3be5f13bd37b42fd326f5
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(lots, period, need):
out=[]
for expiry,energy in sorted(lots,reverse=True):
if expiry<period: continue
used=min(need,energy); need-=used
if energy>used: out.append([expiry,energy-used])
return [need,sorted(out)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expired credit', solve([[1,N]],2,N),[N,[]])
check('oldest spent first', solve([[3,N],[2,N]],2,N),[0,[[3,N]]])
check('inclusive expiry', solve([[2,N]],2,N),[0,[]])
check('partial credit', solve([[2,3*N]],2,N),[0,[[2,2*N]]])
check('uncovered import', solve([[2,N]],2,3*N),[2*N,[]])
check('zero import still expires lots', solve([[1,N],[3,N]],2,0),[0,[[3,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 |
|---|---|---|---|
| expired credit | [1, []] | [1, []] | Passed |
| oldest spent first | [0, [[2, 1]]] | [0, [[3, 1]]] | Failed |
| inclusive expiry | [0, []] | [0, []] | Passed |
| partial credit | [0, [[2, 2]]] | [0, [[2, 2]]] | Passed |
| uncovered import | [2, []] | [2, []] | Passed |
| zero import still expires lots | [0, [[3, 1]]] | [0, [[3, 1]]] | Passed |
SHA-256 / f91867feb9fdd52992e3541d5cdf38319256c54a1a26a3a35488cfa940a55af3
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(lots, period, need):
out=[]
for expiry,energy in sorted(lots):
if expiry<period: continue
used=min(need,energy); need-=used
if energy>used: out.append([expiry,energy-used])
return [need,out]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expired credit', solve([[1,N]],2,N),[N,[]])
check('oldest spent first', solve([[3,N],[2,N]],2,N),[0,[[3,N]]])
check('inclusive expiry', solve([[2,N]],2,N),[0,[]])
check('partial credit', solve([[2,3*N]],2,N),[0,[[2,2*N]]])
check('uncovered import', solve([[2,N]],2,3*N),[2*N,[]])
check('zero import still expires lots', solve([[1,N],[3,N]],2,0),[0,[[3,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 |
|---|---|---|---|
| expired credit | [1, []] | [1, []] | Passed |
| oldest spent first | [0, [[3, 1]]] | [0, [[3, 1]]] | Passed |
| inclusive expiry | [0, []] | [0, []] | Passed |
| partial credit | [0, [[2, 2]]] | [0, [[2, 2]]] | Passed |
| uncovered import | [2, []] | [2, []] | Passed |
| zero import still expires lots | [0, [[3, 1]]] | [0, [[3, 1]]] | Passed |
SHA-256 / 5253aa83e2c277462e8a3182ab641810e39237e3703362e6cadfb1eade2fbcc5
Verification & scope
Simplified integer-energy accounting model; no hardware protocol, legal tariff, measurement uncertainty, or live grid behavior is represented. 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.552157+00:00.
Case digest / 1704d0f800cb0c128bb346fa33dca9200738ae63b7a90e3314d297e97e5aab66