FA-91421 / Digital signal filters / Open access
Centered average accepts an even window · case 01
K = 2 silently produces a three-sample window instead of "bad-window".
ROOT CAUSE
The odd-length check is missing, so K//2 rounds an even window up to K+1 taps.
THE FAILURE
The odd-length check is missing, so K//2 rounds an even window up to K+1 taps.
Unsuccessful approach: The attempted repair only rejects even windows larger than 2.
Case contract
Input [K, mode, samples]; K must be odd ("bad-window"). Centered moving average over indices i-K//2..i+K//2 with edge mode "shrink" (average available samples), "zero" (missing samples count as 0, divide by K), "replicate" (clamp index) or "reflect" (mirror without repeating the edge: -1 -> 1, n -> n-2). Return exact fraction strings.
Why this case matters
Offline smoothing needs explicit edge handling; mirror and padding conventions differ between tools and are easy to mix up.
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):
k, mode, xs = x
if k < 1:
return 'bad-window'
n = len(xs)
h = k // 2
out = []
for i in range(n):
vals = []
for j in range(i - h, i + h + 1):
if 0 <= j < n:
vals.append(xs[j])
elif mode == 'zero':
vals.append(0)
elif mode == 'replicate':
vals.append(xs[min(max(j, 0), n - 1)])
elif mode == 'reflect':
jj = -j if j < 0 else 2 * (n - 1) - j
vals.append(xs[jj])
out.append(str(Fraction(sum(vals), len(vals))))
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: even window', [2, 'shrink', [1, 2, 3]], 'bad-window'], ['regression: even window four', [4, 'zero', [1, 2, 3, 4]], 'bad-window'], ['control: reflect edges', [3, 'reflect', [1, 5, 2, 8]], ['11/3', '8/3', '5', '4']], ['control: reflect wide', [5, 'reflect', [4, 0, 2, 6, 1]], ['8/5', '12/5', '13/5', '3', '17/5']], ['control: zero padding', [3, 'zero', [3, 3, 3]], ['2', '3', '2']], ['control: shrink edges', [3, 'shrink', [2, 4, 6]], ['3', '4', '5']]], [['regression: even window four', [4, 'zero', [1, 2, 3, 4]], 'bad-window'], ['regression: even window', [2, 'shrink', [1, 2, 3]], 'bad-window'], ['control: replicate', [5, 'replicate', [1, 2, 3, 10]], ['8/5', '17/5', '26/5', '7']], ['control: random centered 0', [3, 'zero', [6, -1, 8]], ['5/3', '13/3', '7/3']], ['control: random centered 1', [3, 'shrink', [-4, 0, 9]], ['-2', '5/3', '9/2']], ['control: random centered 2', [5, 'replicate', [3, 1, 0, 6, 1, 3]], ['2', '13/5', '11/5', '11/5', '13/5', '16/5']]], [['regression: even window', [2, 'shrink', [1, 2, 3]], 'bad-window'], ['regression: even window four', [4, 'zero', [1, 2, 3, 4]], 'bad-window'], ['control: random centered 3', [3, 'reflect', [-2, 3, 6]], ['4/3', '7/3', '4']], ['control: random centered 4', [5, 'zero', [-5, 1, -2]], ['-6/5', '-6/5', '-6/5']], ['control: random centered 5', [5, 'zero', [-2, 7, -2]], ['3/5', '3/5', '3/5']], ['control: random centered 6', [3, 'shrink', [0, 8, -5, -4, 8, 9]], ['4', '1', '-1/3', '-1/3', '13/3', '17/2']]], [['regression: even window four', [4, 'zero', [1, 2, 3, 4]], 'bad-window'], ['regression: even window', [2, 'shrink', [1, 2, 3]], 'bad-window'], ['control: random centered 7', [3, 'shrink', [0, 4, -2, -2, 2, -3]], ['2', '2/3', '0', '-2/3', '-1', '-1/2']], ['control: random centered 8', [3, 'shrink', [3, -3, 2, -2]], ['0', '2/3', '-1', '0']], ['control: random centered 9', [3, 'replicate', [8, 2, 4, 4, 6]], ['6', '14/3', '10/3', '14/3', '16/3']], ['control: random centered 10', [5, 'reflect', [-1, -5, 8]], ['1', '-8/5', '-4/5']]], [['regression: even window', [2, 'shrink', [1, 2, 3]], 'bad-window'], ['regression: even window four', [4, 'zero', [1, 2, 3, 4]], 'bad-window'], ['control: random centered 11', [3, 'shrink', [-1, -3, -4, 4, 1]], ['-2', '-8/3', '-1', '1/3', '5/2']], ['control: random centered 12', [5, 'replicate', [-4, 2, -1, 3, 0, -4]], ['-11/5', '-4/5', '0', '0', '-6/5', '-9/5']], ['control: random centered 13', [3, 'replicate', [3, 1, 2, 4, -3]], ['7/3', '2', '7/3', '1', '-2/3']], ['control: random centered 14', [1, 'zero', [7, 5, 6, 0, 8]], ['7', '5', '6', '0', '8']]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: even window | ['3/2', '2', '5/2'] | bad-window | Failed |
| regression: even window four | ['6/5', '2', '2', '9/5'] | bad-window | Failed |
| control: reflect edges | ['11/3', '8/3', '5', '4'] | ['11/3', '8/3', '5', '4'] | Passed |
| control: reflect wide | ['8/5', '12/5', '13/5', '3', '17/5'] | ['8/5', '12/5', '13/5', '3', '17/5'] | Passed |
| control: zero padding | ['2', '3', '2'] | ['2', '3', '2'] | Passed |
| control: shrink edges | ['3', '4', '5'] | ['3', '4', '5'] | Passed |
SHA-256 / 86eb3370c6474f3a611a15013d80b59c31f6483379694f612193e3ec551720d0
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):
k, mode, xs = x
if k < 1 or k % 2 == 0 and k > 2:
return 'bad-window'
n = len(xs)
h = k // 2
out = []
for i in range(n):
vals = []
for j in range(i - h, i + h + 1):
if 0 <= j < n:
vals.append(xs[j])
elif mode == 'zero':
vals.append(0)
elif mode == 'replicate':
vals.append(xs[min(max(j, 0), n - 1)])
elif mode == 'reflect':
jj = -j if j < 0 else 2 * (n - 1) - j
vals.append(xs[jj])
out.append(str(Fraction(sum(vals), len(vals))))
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: even window', [2, 'shrink', [1, 2, 3]], 'bad-window'], ['regression: even window four', [4, 'zero', [1, 2, 3, 4]], 'bad-window'], ['control: reflect edges', [3, 'reflect', [1, 5, 2, 8]], ['11/3', '8/3', '5', '4']], ['control: reflect wide', [5, 'reflect', [4, 0, 2, 6, 1]], ['8/5', '12/5', '13/5', '3', '17/5']], ['control: zero padding', [3, 'zero', [3, 3, 3]], ['2', '3', '2']], ['control: shrink edges', [3, 'shrink', [2, 4, 6]], ['3', '4', '5']]], [['regression: even window four', [4, 'zero', [1, 2, 3, 4]], 'bad-window'], ['regression: even window', [2, 'shrink', [1, 2, 3]], 'bad-window'], ['control: replicate', [5, 'replicate', [1, 2, 3, 10]], ['8/5', '17/5', '26/5', '7']], ['control: random centered 0', [3, 'zero', [6, -1, 8]], ['5/3', '13/3', '7/3']], ['control: random centered 1', [3, 'shrink', [-4, 0, 9]], ['-2', '5/3', '9/2']], ['control: random centered 2', [5, 'replicate', [3, 1, 0, 6, 1, 3]], ['2', '13/5', '11/5', '11/5', '13/5', '16/5']]], [['regression: even window', [2, 'shrink', [1, 2, 3]], 'bad-window'], ['regression: even window four', [4, 'zero', [1, 2, 3, 4]], 'bad-window'], ['control: random centered 3', [3, 'reflect', [-2, 3, 6]], ['4/3', '7/3', '4']], ['control: random centered 4', [5, 'zero', [-5, 1, -2]], ['-6/5', '-6/5', '-6/5']], ['control: random centered 5', [5, 'zero', [-2, 7, -2]], ['3/5', '3/5', '3/5']], ['control: random centered 6', [3, 'shrink', [0, 8, -5, -4, 8, 9]], ['4', '1', '-1/3', '-1/3', '13/3', '17/2']]], [['regression: even window four', [4, 'zero', [1, 2, 3, 4]], 'bad-window'], ['regression: even window', [2, 'shrink', [1, 2, 3]], 'bad-window'], ['control: random centered 7', [3, 'shrink', [0, 4, -2, -2, 2, -3]], ['2', '2/3', '0', '-2/3', '-1', '-1/2']], ['control: random centered 8', [3, 'shrink', [3, -3, 2, -2]], ['0', '2/3', '-1', '0']], ['control: random centered 9', [3, 'replicate', [8, 2, 4, 4, 6]], ['6', '14/3', '10/3', '14/3', '16/3']], ['control: random centered 10', [5, 'reflect', [-1, -5, 8]], ['1', '-8/5', '-4/5']]], [['regression: even window', [2, 'shrink', [1, 2, 3]], 'bad-window'], ['regression: even window four', [4, 'zero', [1, 2, 3, 4]], 'bad-window'], ['control: random centered 11', [3, 'shrink', [-1, -3, -4, 4, 1]], ['-2', '-8/3', '-1', '1/3', '5/2']], ['control: random centered 12', [5, 'replicate', [-4, 2, -1, 3, 0, -4]], ['-11/5', '-4/5', '0', '0', '-6/5', '-9/5']], ['control: random centered 13', [3, 'replicate', [3, 1, 2, 4, -3]], ['7/3', '2', '7/3', '1', '-2/3']], ['control: random centered 14', [1, 'zero', [7, 5, 6, 0, 8]], ['7', '5', '6', '0', '8']]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: even window | ['3/2', '2', '5/2'] | bad-window | Failed |
| regression: even window four | bad-window | bad-window | Passed |
| control: reflect edges | ['11/3', '8/3', '5', '4'] | ['11/3', '8/3', '5', '4'] | Passed |
| control: reflect wide | ['8/5', '12/5', '13/5', '3', '17/5'] | ['8/5', '12/5', '13/5', '3', '17/5'] | Passed |
| control: zero padding | ['2', '3', '2'] | ['2', '3', '2'] | Passed |
| control: shrink edges | ['3', '4', '5'] | ['3', '4', '5'] | Passed |
SHA-256 / 6db72b70983c663e8094b0bf8ee9d2d66134c79426d78f9b320f2cc47112935d
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
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.727443+00:00.
Case digest / fca701eb854c87fccb450a857e72e15721e0bfa7e54c42e6f1fcd09871e3aac1