FAILURE MAP
← Case archive

FA-91401 / Digital signal filters / Open access

Running average starts evicting one sample late · case 01

The first full window contains W+1 samples summed but divided by W.

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

ROOT CAUSE

The eviction condition is i > w, so the sample leaving the window at i == w is kept.

THE FAILURE

The eviction condition is i > w, so the sample leaving the window at i == w is kept.

Unsuccessful approach: The attempted repair evicts from i >= w but removes xs[i - w + 1], a sample still inside the window.

Case contract

Input [W, samples]; causal moving average using a running sum. During warm-up divide by the number of samples seen (min(n+1, W)). Return exact fraction strings; "bad-window" if W < 1.

Why this case matters

Running-sum boxcars are the cheapest smoothing filter; eviction and warm-up slips bias every early or late sample.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x):
    w, xs = x
    if w < 1:
        return 'bad-window'
    acc = 0
    out = []
    for i, v in enumerate(xs):
        acc += v
        if i > w:
            acc -= xs[i - w]
        out.append(str(Fraction(acc, min(i + 1, w))))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: window one', [1, [3, 1, 4]], ['3', '1', '4']], ['regression: window three long', [3, [3, 0, 3, 6, 0, 9]], ['3', '3/2', '2', '3', '3', '5']], ['regression: random average 1', [2, [-4, -1, -3, 5, -4]], ['-4', '-5/2', '-2', '1', '1/2']], ['control: window equals length', [3, [1, 2, 3]], ['1', '3/2', '2']], ['control: bad window', [0, [1]], 'bad-window'], ['control: random average 0', [4, [-2, 2]], ['-2', '0']], ['control: random average 7', [4, [-1, -2, 0, 7]], ['-1', '-3/2', '-1', '1']]], [['regression: random average 2', [1, [8, 4, 7]], ['8', '4', '7']], ['regression: random average 3', [3, [5, 2, 8, 7, 6, 1, 1]], ['5', '7/2', '5', '17/3', '7', '14/3', '8/3']], ['regression: random average 1', [2, [-4, -1, -3, 5, -4]], ['-4', '-5/2', '-2', '1', '1/2']], ['control: random average 8', [2, [-4]], ['-4']], ['control: random average 9', [4, [7]], ['7']], ['control: random average 11', [5, [-1, 3, 3]], ['-1', '1', '5/3']], ['control: random average 12', [3, [0]], ['0']]], [['regression: random average 6', [1, [-4, 1, 2, -3, 3]], ['-4', '1', '2', '-3', '3']], ['regression: random average 10', [3, [9, 3, 6, 3, 5, 8]], ['9', '6', '6', '4', '14/3', '16/3']], ['regression: random average 3', [3, [5, 2, 8, 7, 6, 1, 1]], ['5', '7/2', '5', '17/3', '7', '14/3', '8/3']], ['control: random average 13', [2, [-1]], ['-1']], ['control: random average 16', [4, [6]], ['6']], ['control: random average 18', [3, [0, -3]], ['0', '-3/2']], ['control: random average 26', [2, [7]], ['7']]], [['regression: random average 15', [3, [-3, 9, -1, 5, 7, -4]], ['-3', '3', '5/3', '13/3', '11/3', '8/3']], ['regression: random average 17', [5, [-3, -2, -2, 6, 7, 9, -4, 5]], ['-3', '-5/2', '-7/3', '-1/4', '6/5', '18/5', '16/5', '23/5']], ['repair check: random average 5', [1, [0, 1]], ['0', '1']], ['control: random average 28', [3, [-1, 5, 1]], ['-1', '2', '5/3']], ['control: random average 29', [5, [1, 1]], ['1', '1']], ['control: random average 30', [4, [-4, -3, 2]], ['-4', '-7/2', '-5/3']], ['control: random average 36', [5, [6]], ['6']]], [['regression: random average 21', [5, [4, 8, 3, -3, 0, 3]], ['4', '6', '5', '3', '12/5', '11/5']], ['regression: random average 22', [3, [2, 0, 4, 3, -3, 1, 0]], ['2', '1', '2', '7/3', '4/3', '1/3', '-2/3']], ['regression: random average 10', [3, [9, 3, 6, 3, 5, 8]], ['9', '6', '6', '4', '14/3', '16/3']], ['control: random average 39', [3, [-4]], ['-4']], ['control: window equals length', [3, [1, 2, 3]], ['1', '3/2', '2']], ['control: bad window', [0, [1]], 'bad-window'], ['control: random average 0', [4, [-2, 2]], ['-2', '0']]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
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: window one['3', '4', '7']['3', '1', '4']Failed
regression: window three long['3', '3/2', '2', '4', '4', '6']['3', '3/2', '2', '3', '3', '5']Failed
regression: random average 1['-4', '-5/2', '-4', '-1', '-3/2']['-4', '-5/2', '-2', '1', '1/2']Failed
control: window equals length['1', '3/2', '2']['1', '3/2', '2']Passed
control: bad windowbad-windowbad-windowPassed
control: random average 0['-2', '0']['-2', '0']Passed
control: random average 7['-1', '-3/2', '-1', '1']['-1', '-3/2', '-1', '1']Passed

SHA-256 / bc1b8f738f3c9d2a64b67b52b99588680679e76bc7d8538dd0b8a2911c54f0da

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x):
    w, xs = x
    if w < 1:
        return 'bad-window'
    acc = 0
    out = []
    for i, v in enumerate(xs):
        acc += v
        if i >= w:
            acc -= xs[i - w + 1]
        out.append(str(Fraction(acc, min(i + 1, w))))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: window one', [1, [3, 1, 4]], ['3', '1', '4']], ['regression: window three long', [3, [3, 0, 3, 6, 0, 9]], ['3', '3/2', '2', '3', '3', '5']], ['regression: random average 1', [2, [-4, -1, -3, 5, -4]], ['-4', '-5/2', '-2', '1', '1/2']], ['control: window equals length', [3, [1, 2, 3]], ['1', '3/2', '2']], ['control: bad window', [0, [1]], 'bad-window'], ['control: random average 0', [4, [-2, 2]], ['-2', '0']], ['control: random average 7', [4, [-1, -2, 0, 7]], ['-1', '-3/2', '-1', '1']]], [['regression: random average 2', [1, [8, 4, 7]], ['8', '4', '7']], ['regression: random average 3', [3, [5, 2, 8, 7, 6, 1, 1]], ['5', '7/2', '5', '17/3', '7', '14/3', '8/3']], ['regression: random average 1', [2, [-4, -1, -3, 5, -4]], ['-4', '-5/2', '-2', '1', '1/2']], ['control: random average 8', [2, [-4]], ['-4']], ['control: random average 9', [4, [7]], ['7']], ['control: random average 11', [5, [-1, 3, 3]], ['-1', '1', '5/3']], ['control: random average 12', [3, [0]], ['0']]], [['regression: random average 6', [1, [-4, 1, 2, -3, 3]], ['-4', '1', '2', '-3', '3']], ['regression: random average 10', [3, [9, 3, 6, 3, 5, 8]], ['9', '6', '6', '4', '14/3', '16/3']], ['regression: random average 3', [3, [5, 2, 8, 7, 6, 1, 1]], ['5', '7/2', '5', '17/3', '7', '14/3', '8/3']], ['control: random average 13', [2, [-1]], ['-1']], ['control: random average 16', [4, [6]], ['6']], ['control: random average 18', [3, [0, -3]], ['0', '-3/2']], ['control: random average 26', [2, [7]], ['7']]], [['regression: random average 15', [3, [-3, 9, -1, 5, 7, -4]], ['-3', '3', '5/3', '13/3', '11/3', '8/3']], ['regression: random average 17', [5, [-3, -2, -2, 6, 7, 9, -4, 5]], ['-3', '-5/2', '-7/3', '-1/4', '6/5', '18/5', '16/5', '23/5']], ['repair check: random average 5', [1, [0, 1]], ['0', '1']], ['control: random average 28', [3, [-1, 5, 1]], ['-1', '2', '5/3']], ['control: random average 29', [5, [1, 1]], ['1', '1']], ['control: random average 30', [4, [-4, -3, 2]], ['-4', '-7/2', '-5/3']], ['control: random average 36', [5, [6]], ['6']]], [['regression: random average 21', [5, [4, 8, 3, -3, 0, 3]], ['4', '6', '5', '3', '12/5', '11/5']], ['regression: random average 22', [3, [2, 0, 4, 3, -3, 1, 0]], ['2', '1', '2', '7/3', '4/3', '1/3', '-2/3']], ['regression: random average 10', [3, [9, 3, 6, 3, 5, 8]], ['9', '6', '6', '4', '14/3', '16/3']], ['control: random average 39', [3, [-4]], ['-4']], ['control: window equals length', [3, [1, 2, 3]], ['1', '3/2', '2']], ['control: bad window', [0, [1]], 'bad-window'], ['control: random average 0', [4, [-2, 2]], ['-2', '0']]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
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: window one['3', '3', '3']['3', '1', '4']Failed
regression: window three long['3', '3/2', '2', '4', '3', '4']['3', '3/2', '2', '3', '3', '5']Failed
regression: random average 1['-4', '-5/2', '-7/2', '1/2', '-4']['-4', '-5/2', '-2', '1', '1/2']Failed
control: window equals length['1', '3/2', '2']['1', '3/2', '2']Passed
control: bad windowbad-windowbad-windowPassed
control: random average 0['-2', '0']['-2', '0']Passed
control: random average 7['-1', '-3/2', '-1', '1']['-1', '-3/2', '-1', '1']Passed

SHA-256 / e6bce33a4e604a8dfd14be66efe3907d116525b3c9a94f512bf048f7e8807371

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 7 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

A deterministic bounded teaching model with a stipulated toy contract; exact rational arithmetic or fixed-decimal rounding keeps outputs strict JSON. It is not a production DSP library and claims no standards conformance. 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:51:35.635024+00:00.

Case digest / f8f39622fee10cdca7d4ecec9d7bd5242dd6d81a9b53286d91c47bfffc383dbe