FA-12931 / Numerical aggregation / Open access
Capped prefix balance: Events are sorted before an order-dependent reduction. · case 01
The reduction disagrees with its explicit aggregation oracle.
ROOT CAUSE
Events are sorted before an order-dependent reduction.
VERIFIED REPAIR
Preserve the capped prefix balance contract at the identified reduction decision.
Unsuccessful approach: Processing positive deltas first also changes chronology.
Case contract
Starting at zero, apply each signed delta and clamp the running balance into [0,cap] after every event. cap is positive.
Why this case matters
Exact bounded examples isolate a reduction defect without floating-point or external-service effects.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, cap):
b=0
for x in sorted(xs): b=max(0,min(cap,b+x))
return b
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([8, -3], 5)), 2)
check('regression 2', solve(*([-4, 3], 5)), 3)
check('regression 3', solve(*([], 5)), 0)
check('regression 4', solve(*([2, 2], 5)), 4)
check('regression 5', solve(*([8, -9, 2], 5)), 2)
check("variable path",solve([N+4,-2],N+1),N-1)
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 |
|---|---|---|---|
| regression 1 | 5 | 2 | Failed |
| regression 2 | 3 | 3 | Passed |
| regression 3 | 0 | 0 | Passed |
| regression 4 | 4 | 4 | Passed |
| regression 5 | 5 | 2 | Failed |
| variable path | 2 | 0 | Failed |
SHA-256 / f9ba74cced4413f68f5cd646ab3cf776b79e65069f15428b591a229c2d7b1192
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, cap):
b=0
for x in sorted(xs,reverse=True): b=max(0,min(cap,b+x))
return b
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([8, -3], 5)), 2)
check('regression 2', solve(*([-4, 3], 5)), 3)
check('regression 3', solve(*([], 5)), 0)
check('regression 4', solve(*([2, 2], 5)), 4)
check('regression 5', solve(*([8, -9, 2], 5)), 2)
check("variable path",solve([N+4,-2],N+1),N-1)
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 |
|---|---|---|---|
| regression 1 | 2 | 2 | Passed |
| regression 2 | 0 | 3 | Failed |
| regression 3 | 0 | 0 | Passed |
| regression 4 | 4 | 4 | Passed |
| regression 5 | 0 | 2 | Failed |
| variable path | 0 | 0 | Passed |
SHA-256 / d7392875cd7f71e653ddc1abf3008f8a8915dbe693ab55b33c824f2ec507a9b1
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, cap):
balance=0
for x in xs:
balance=max(0,min(cap,balance+x))
return balance
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([8, -3], 5)), 2)
check('regression 2', solve(*([-4, 3], 5)), 3)
check('regression 3', solve(*([], 5)), 0)
check('regression 4', solve(*([2, 2], 5)), 4)
check('regression 5', solve(*([8, -9, 2], 5)), 2)
check("variable path",solve([N+4,-2],N+1),N-1)
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 |
|---|---|---|---|
| regression 1 | 2 | 2 | Passed |
| regression 2 | 3 | 3 | Passed |
| regression 3 | 0 | 0 | Passed |
| regression 4 | 4 | 4 | Passed |
| regression 5 | 2 | 2 | Passed |
| variable path | 0 | 0 | Passed |
SHA-256 / 67d2a02cda1a3ed2cde9738695bf60f9bb77734d47397183af3752d8ab110627
Verification & scope
Small offline integer/rational inputs only; no performance, statistical inference, or production-library conformance claim. 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:39:01.632328+00:00.
Case digest / 3e227242cb18927fb7f7d63f7daa71c4618826161733d5708a5811325c622c5a