FAILURE MAP
← Case archive

FA-12916 / Numerical aggregation / Open access

Capped prefix balance: Only the final net balance is clamped. · case 01

The reduction disagrees with its explicit aggregation oracle.

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

ROOT CAUSE

Only the final net balance is clamped.

VERIFIED REPAIR

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

Unsuccessful approach: Clipping every delta before summing still loses state-dependent overflow.

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):
    return max(0,min(cap,sum(xs)))
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 203Failed
regression 300Passed
regression 444Passed
regression 512Failed
variable path20Failed

SHA-256 / e53debea9d55ab65484c2bdf49c3f46e0cc90427e36df6264a8d3c4f3c4c0643

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):
    return max(0,min(cap,sum(max(-cap,min(cap,x)) for x in xs)))
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 203Failed
regression 300Passed
regression 444Passed
regression 522Passed
variable path00Passed

SHA-256 / e45b584e396d2602f55cd658219113fea598e3b55216901ca100ec9a78fadf14

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

Case digest / d70b7712a389381dd5170feabe20a6739dcb4c42f028903daf3d7b728f476fcd