FAILURE MAP
← Case archive

FA-12936 / Numerical aggregation / Open access

Capped prefix balance: An overflowing balance resets instead of saturating. · case 01

The reduction disagrees with its explicit aggregation oracle.

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

ROOT CAUSE

An overflowing balance resets instead of saturating.

THE FAILURE

An overflowing balance resets instead of saturating.

Unsuccessful approach: Reflecting an overflow back into range models a different boundary.

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=b+x
        b=0 if b<0 or b>cap else b
    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 102Failed
regression 233Passed
regression 300Passed
regression 444Passed
regression 522Passed
variable path00Passed

SHA-256 / f22f072c6396599afedd9156d424237af6fbeae0896443b933dc435521c7dfde

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=abs(b+x) if b+x<0 else (2*cap-b-x if b+x>cap else 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 112Failed
regression 233Passed
regression 300Passed
regression 444Passed
regression 512Failed
variable path30Failed

SHA-256 / e99cf7161d7c6d4b25cac10daf21e2376ffe3255b1105d099a680e2e0979911d

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 6 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / cd72d6b03a7edfa830c1645b52a6948d531a272bfa877e813d46951b0b2fed35