FAILURE MAP
← Case archive

FA-12891 / Numerical aggregation / Open access

Clipped contribution sum: Clipping happens after aggregation rather than before each contribution. · case 01

The reduction disagrees with its explicit aggregation oracle.

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

ROOT CAUSE

Clipping happens after aggregation rather than before each contribution.

VERIFIED REPAIR

Preserve the clipped contribution sum contract at the identified reduction decision.

Unsuccessful approach: Multiplying global bounds by count still permits cancellation across outliers.

Case contract

For lo<=hi, clip each integer contribution into [lo,hi], then sum. Empty is zero.

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, lo, hi):
    return min(hi,max(lo,sum(xs))) if xs else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([-9, 2, 8], 0, 5)), 7)
check('regression 2', solve(*([], 1, 3)), 0)
check('regression 3', solve(*([1, 2, 3], 0, 5)), 6)
check('regression 4', solve(*([-4, -2], -3, -1)), -5)
check('regression 5', solve(*([0, 0, 9], 2, 4)), 8)
check("variable cap", solve([0,N,N*4],1,N+1),2*N+2)
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 117Failed
regression 200Passed
regression 356Failed
regression 4-3-5Failed
regression 548Failed
variable cap24Failed

SHA-256 / dd6d6cacf3ba5dfc2b8f01412f323a8b871ab9ffda3f51f7e967bf7a63e548a0

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, lo, hi):
    return min(hi*len(xs),max(lo*len(xs),sum(xs)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([-9, 2, 8], 0, 5)), 7)
check('regression 2', solve(*([], 1, 3)), 0)
check('regression 3', solve(*([1, 2, 3], 0, 5)), 6)
check('regression 4', solve(*([-4, -2], -3, -1)), -5)
check('regression 5', solve(*([0, 0, 9], 2, 4)), 8)
check("variable cap", solve([0,N,N*4],1,N+1),2*N+2)
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 117Failed
regression 200Passed
regression 366Passed
regression 4-6-5Failed
regression 598Failed
variable cap54Failed

SHA-256 / 0690c61ba5e895409e840868264416b5c3211d6978a0e4438d4875ef9472f497

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, lo, hi):
    return sum(min(hi,max(lo,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(*([-9, 2, 8], 0, 5)), 7)
check('regression 2', solve(*([], 1, 3)), 0)
check('regression 3', solve(*([1, 2, 3], 0, 5)), 6)
check('regression 4', solve(*([-4, -2], -3, -1)), -5)
check('regression 5', solve(*([0, 0, 9], 2, 4)), 8)
check("variable cap", solve([0,N,N*4],1,N+1),2*N+2)
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 177Passed
regression 200Passed
regression 366Passed
regression 4-5-5Passed
regression 588Passed
variable cap44Passed

SHA-256 / 292d2346600b360db4ccacda4326c8fc92cbbdeeb13fc7443e3492b695c3e822

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

Case digest / daa53e88e843688208ba8d5baf55239068cb29f74cbc78cd511a39640044b0c0