FAILURE MAP
← Case archive

FA-12926 / Numerical aggregation / Open access

Capped prefix balance: Excess intermediate credit survives the upper saturation bound. · case 01

The reduction disagrees with its explicit aggregation oracle.

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

ROOT CAUSE

Excess intermediate credit survives the upper saturation bound.

VERIFIED REPAIR

Preserve the capped prefix balance contract at the identified reduction decision.

Unsuccessful approach: Capping only the final balance lets later debits consume previously rejected credit.

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 xs: b=max(0,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 fixtureActualExpectedOutcome
regression 152Failed
regression 233Passed
regression 300Passed
regression 444Passed
regression 522Passed
variable path30Failed

SHA-256 / f34883703f25531b512b3a86e84643f2f114ba00901771e256c0d598339e2c9b

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 xs: b=max(0,b+x)
    return min(cap,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 fixtureActualExpectedOutcome
regression 152Failed
regression 233Passed
regression 300Passed
regression 444Passed
regression 522Passed
variable path20Failed

SHA-256 / 73ae1c17f1c6ff5143b63e8680bf8204ccf95551bf69560fe4f9ccb4e6abfb1f

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 fixtureActualExpectedOutcome
regression 122Passed
regression 233Passed
regression 300Passed
regression 444Passed
regression 522Passed
variable path00Passed

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

Case digest / 29202e9ffe3a9d5729229c6e95787f8a817ec6b23b5e4a78202c3e4a012117a3