{"abstract":"The output starts with padded samples and is shifted by pad samples.","category":"Digital signal filters","checks":7,"contract":"Input [taps, samples] (integers). Zero-phase filtering: pad = min(3 (len(taps) - 1), len - 1); extend with odd reflection about each end (2 x[0] - x[i] for i = pad..1 before, 2 x[-1] - x[n-1-i] for i = 1..pad after); filter forward with zero initial state, reverse, filter again, reverse, and return the middle len samples.","evaluation_group":"w2-digital_signal_filters-filtfilt-odd-extension","failed_approach":"The attempted repair slices from pad to the end, keeping the trailing padding.","family":"w2-digital_signal_filters-filtfilt-odd-extension-padding-trim","id":"FA-91671","implementations":{"attempt":{"sha256":"290541d2a99d93f88ec3fefd6cd078d0455622d6dbcc68bd83a54ed1bfc08548","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    b, xs = x\n    n = len(xs)\n    if n == 0:\n        return []\n    pad = min(3 * (len(b) - 1), n - 1)\n    front = [2 * xs[0] - xs[i] for i in range(pad, 0, -1)]\n    back = [2 * xs[-1] - xs[n - 1 - i] for i in range(1, pad + 1)]\n    ext = front + xs + back\n    def fir(sig):\n        return [sum(b[k] * sig[i - k] for k in range(len(b)) if i - k >= 0) for i in range(len(sig))]\n    y = fir(ext)\n    y = fir(y[::-1])[::-1]\n    return y[pad:]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: ramp with two-tap average', [[1, 1], [1, 2, 3, 4, 5]], [4, 8, 12, 16, 20]], ['regression: step with three taps', [[1, 2, 1], [0, 0, 4, 4, 4, 4]], [0, 20, 44, 60, 64, 64]], ['regression: short signal', [[1, 1, 1], [2, 5]], [22, 21]], ['control: single sample', [[1, 2], [3]], [3]], ['control: empty', [[1, 1], []], []], ['control: random filtfilt 3', [[-1], [-4, 3, -2, 7, 9, 5, 3, -2, 1]], [-4, 3, -2, 7, 9, 5, 3, -2, 1]], ['control: random filtfilt 4', [[-1], [8, 1, 1, 8]], [8, 1, 1, 8]]], [['regression: random filtfilt 0', [[-1, -1], [-5, 3]], [-20, 12]], ['regression: random filtfilt 1', [[2, -1], [-1, 3, 2, 2, 8, 5, 5, 0, -3]], [-1, 13, 0, -10, 26, -1, 15, -4, -3]], ['regression: short signal', [[1, 1, 1], [2, 5]], [22, 21]], ['control: random filtfilt 5', [[2, 1, -1, 3], [0]], [0]], ['control: random filtfilt 7', [[-2], [8, -5, -4, -4, -2, 9, 6, 3]], [32, -20, -16, -16, -8, 36, 24, 12]], ['control: random filtfilt 12', [[0], [-2, 4, -5, -1, 8, 4, 3, 0, 1]], [0, 0, 0, 0, 0, 0, 0, 0, 0]], ['control: random filtfilt 15', [[1], [-1, -5, 2]], [-1, -5, 2]]], [['regression: random filtfilt 6', [[1, 3, -2, -1], [-3, -1, -4]], [-2, 59, -4]], ['regression: random filtfilt 8', [[-1, -2], [5, 5, 7]], [45, 49, 63]], ['regression: random filtfilt 1', [[2, -1], [-1, 3, 2, 2, 8, 5, 5, 0, -3]], [-1, 13, 0, -10, 26, -1, 15, -4, -3]], ['control: random filtfilt 16', [[-1, -1, 0], [8]], [8]], ['control: random filtfilt 17', [[-1, -2, -1], [-1]], [-1]], ['control: random filtfilt 19', [[-1], [-5, 9, -4, 7, -2]], [-5, 9, -4, 7, -2]], ['control: random filtfilt 24', [[-2], [-2, -3, 0, 4]], [-8, -12, 0, 16]]], [['regression: random filtfilt 10', [[2, 0, -2], [-3, 9, 2, 7]], [0, 104, -20, 0]], ['regression: random filtfilt 11', [[0, 3, 3, 3], [2, 0, 6]], [162, 288, 234]], ['regression: random filtfilt 6', [[1, 3, -2, -1], [-3, -1, -4]], [-2, 59, -4]], ['control: random filtfilt 27', [[0], [0, -5, 8, -2, 9, 3]], [0, 0, 0, 0, 0, 0]], ['control: random filtfilt 36', [[-2], [2, 6, 0, 0, 4, 9, 0, -4]], [8, 24, 0, 0, 16, 36, 0, -16]], ['control: random filtfilt 39', [[3, 2, 3], [6]], [54]], ['control: random filtfilt 42', [[3], [7, -3, 8, -3, -2, 6, 1, 0, -5]], [63, -27, 72, -27, -18, 54, 9, 0, -45]]], [['regression: random filtfilt 14', [[0, -1, -2, -1], [-3, 7]], [-53, -12]], ['regression: random filtfilt 18', [[2, -2], [2, -3, 5, -1, 3, -2, 3]], [0, -52, 56, -40, 36, -40, 0]], ['regression: random filtfilt 9', [[-2, 2, -2, 1], [4, -2, -2, 3, 0, 0, 6, 3]], [4, 12, -32, 27, -8, -20, 30, 3]], ['control: random filtfilt 46', [[-1, 1, 2, 2], [5]], [5]], ['control: random filtfilt 47', [[-2], [2, 2, 4, 6, 3, 6, 8]], [8, 8, 16, 24, 12, 24, 32]], ['control: single sample', [[1, 2], [3]], [3]], ['control: empty', [[1, 1], []], []]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"b000522fb3254800ee2f71138938df47d28fff12218586e886ffdf1511f39437","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    b, xs = x\n    n = len(xs)\n    if n == 0:\n        return []\n    pad = min(3 * (len(b) - 1), n - 1)\n    front = [2 * xs[0] - xs[i] for i in range(pad, 0, -1)]\n    back = [2 * xs[-1] - xs[n - 1 - i] for i in range(1, pad + 1)]\n    ext = front + xs + back\n    def fir(sig):\n        return [sum(b[k] * sig[i - k] for k in range(len(b)) if i - k >= 0) for i in range(len(sig))]\n    y = fir(ext)\n    y = fir(y[::-1])[::-1]\n    return y[:n]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: ramp with two-tap average', [[1, 1], [1, 2, 3, 4, 5]], [4, 8, 12, 16, 20]], ['regression: step with three taps', [[1, 2, 1], [0, 0, 4, 4, 4, 4]], [0, 20, 44, 60, 64, 64]], ['regression: short signal', [[1, 1, 1], [2, 5]], [22, 21]], ['control: single sample', [[1, 2], [3]], [3]], ['control: empty', [[1, 1], []], []], ['control: random filtfilt 3', [[-1], [-4, 3, -2, 7, 9, 5, 3, -2, 1]], [-4, 3, -2, 7, 9, 5, 3, -2, 1]], ['control: random filtfilt 4', [[-1], [8, 1, 1, 8]], [8, 1, 1, 8]]], [['regression: random filtfilt 0', [[-1, -1], [-5, 3]], [-20, 12]], ['regression: random filtfilt 1', [[2, -1], [-1, 3, 2, 2, 8, 5, 5, 0, -3]], [-1, 13, 0, -10, 26, -1, 15, -4, -3]], ['regression: short signal', [[1, 1, 1], [2, 5]], [22, 21]], ['control: random filtfilt 5', [[2, 1, -1, 3], [0]], [0]], ['control: random filtfilt 7', [[-2], [8, -5, -4, -4, -2, 9, 6, 3]], [32, -20, -16, -16, -8, 36, 24, 12]], ['control: random filtfilt 12', [[0], [-2, 4, -5, -1, 8, 4, 3, 0, 1]], [0, 0, 0, 0, 0, 0, 0, 0, 0]], ['control: random filtfilt 15', [[1], [-1, -5, 2]], [-1, -5, 2]]], [['regression: random filtfilt 6', [[1, 3, -2, -1], [-3, -1, -4]], [-2, 59, -4]], ['regression: random filtfilt 8', [[-1, -2], [5, 5, 7]], [45, 49, 63]], ['regression: random filtfilt 1', [[2, -1], [-1, 3, 2, 2, 8, 5, 5, 0, -3]], [-1, 13, 0, -10, 26, -1, 15, -4, -3]], ['control: random filtfilt 16', [[-1, -1, 0], [8]], [8]], ['control: random filtfilt 17', [[-1, -2, -1], [-1]], [-1]], ['control: random filtfilt 19', [[-1], [-5, 9, -4, 7, -2]], [-5, 9, -4, 7, -2]], ['control: random filtfilt 24', [[-2], [-2, -3, 0, 4]], [-8, -12, 0, 16]]], [['regression: random filtfilt 10', [[2, 0, -2], [-3, 9, 2, 7]], [0, 104, -20, 0]], ['regression: random filtfilt 11', [[0, 3, 3, 3], [2, 0, 6]], [162, 288, 234]], ['regression: random filtfilt 6', [[1, 3, -2, -1], [-3, -1, -4]], [-2, 59, -4]], ['control: random filtfilt 27', [[0], [0, -5, 8, -2, 9, 3]], [0, 0, 0, 0, 0, 0]], ['control: random filtfilt 36', [[-2], [2, 6, 0, 0, 4, 9, 0, -4]], [8, 24, 0, 0, 16, 36, 0, -16]], ['control: random filtfilt 39', [[3, 2, 3], [6]], [54]], ['control: random filtfilt 42', [[3], [7, -3, 8, -3, -2, 6, 1, 0, -5]], [63, -27, 72, -27, -18, 54, 9, 0, -45]]], [['regression: random filtfilt 14', [[0, -1, -2, -1], [-3, 7]], [-53, -12]], ['regression: random filtfilt 18', [[2, -2], [2, -3, 5, -1, 3, -2, 3]], [0, -52, 56, -40, 36, -40, 0]], ['regression: random filtfilt 9', [[-2, 2, -2, 1], [4, -2, -2, 3, 0, 0, 6, 3]], [4, 12, -32, 27, -8, -20, 30, 3]], ['control: random filtfilt 46', [[-1, 1, 2, 2], [5]], [5]], ['control: random filtfilt 47', [[-2], [2, 2, 4, 6, 3, 6, 8]], [8, 8, 16, 24, 12, 24, 32]], ['control: single sample', [[1, 2], [3]], [3]], ['control: empty', [[1, 1], []], []]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"55242d1965ec3c164605668ed83de4873710500f7e334c3ac58d139ff17ab183","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    b, xs = x\n    n = len(xs)\n    if n == 0:\n        return []\n    pad = min(3 * (len(b) - 1), n - 1)\n    front = [2 * xs[0] - xs[i] for i in range(pad, 0, -1)]\n    back = [2 * xs[-1] - xs[n - 1 - i] for i in range(1, pad + 1)]\n    ext = front + xs + back\n    def fir(sig):\n        return [sum(b[k] * sig[i - k] for k in range(len(b)) if i - k >= 0) for i in range(len(sig))]\n    y = fir(ext)\n    y = fir(y[::-1])[::-1]\n    return y[pad:pad + n]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: ramp with two-tap average', [[1, 1], [1, 2, 3, 4, 5]], [4, 8, 12, 16, 20]], ['regression: step with three taps', [[1, 2, 1], [0, 0, 4, 4, 4, 4]], [0, 20, 44, 60, 64, 64]], ['regression: short signal', [[1, 1, 1], [2, 5]], [22, 21]], ['control: single sample', [[1, 2], [3]], [3]], ['control: empty', [[1, 1], []], []], ['control: random filtfilt 3', [[-1], [-4, 3, -2, 7, 9, 5, 3, -2, 1]], [-4, 3, -2, 7, 9, 5, 3, -2, 1]], ['control: random filtfilt 4', [[-1], [8, 1, 1, 8]], [8, 1, 1, 8]]], [['regression: random filtfilt 0', [[-1, -1], [-5, 3]], [-20, 12]], ['regression: random filtfilt 1', [[2, -1], [-1, 3, 2, 2, 8, 5, 5, 0, -3]], [-1, 13, 0, -10, 26, -1, 15, -4, -3]], ['regression: short signal', [[1, 1, 1], [2, 5]], [22, 21]], ['control: random filtfilt 5', [[2, 1, -1, 3], [0]], [0]], ['control: random filtfilt 7', [[-2], [8, -5, -4, -4, -2, 9, 6, 3]], [32, -20, -16, -16, -8, 36, 24, 12]], ['control: random filtfilt 12', [[0], [-2, 4, -5, -1, 8, 4, 3, 0, 1]], [0, 0, 0, 0, 0, 0, 0, 0, 0]], ['control: random filtfilt 15', [[1], [-1, -5, 2]], [-1, -5, 2]]], [['regression: random filtfilt 6', [[1, 3, -2, -1], [-3, -1, -4]], [-2, 59, -4]], ['regression: random filtfilt 8', [[-1, -2], [5, 5, 7]], [45, 49, 63]], ['regression: random filtfilt 1', [[2, -1], [-1, 3, 2, 2, 8, 5, 5, 0, -3]], [-1, 13, 0, -10, 26, -1, 15, -4, -3]], ['control: random filtfilt 16', [[-1, -1, 0], [8]], [8]], ['control: random filtfilt 17', [[-1, -2, -1], [-1]], [-1]], ['control: random filtfilt 19', [[-1], [-5, 9, -4, 7, -2]], [-5, 9, -4, 7, -2]], ['control: random filtfilt 24', [[-2], [-2, -3, 0, 4]], [-8, -12, 0, 16]]], [['regression: random filtfilt 10', [[2, 0, -2], [-3, 9, 2, 7]], [0, 104, -20, 0]], ['regression: random filtfilt 11', [[0, 3, 3, 3], [2, 0, 6]], [162, 288, 234]], ['regression: random filtfilt 6', [[1, 3, -2, -1], [-3, -1, -4]], [-2, 59, -4]], ['control: random filtfilt 27', [[0], [0, -5, 8, -2, 9, 3]], [0, 0, 0, 0, 0, 0]], ['control: random filtfilt 36', [[-2], [2, 6, 0, 0, 4, 9, 0, -4]], [8, 24, 0, 0, 16, 36, 0, -16]], ['control: random filtfilt 39', [[3, 2, 3], [6]], [54]], ['control: random filtfilt 42', [[3], [7, -3, 8, -3, -2, 6, 1, 0, -5]], [63, -27, 72, -27, -18, 54, 9, 0, -45]]], [['regression: random filtfilt 14', [[0, -1, -2, -1], [-3, 7]], [-53, -12]], ['regression: random filtfilt 18', [[2, -2], [2, -3, 5, -1, 3, -2, 3]], [0, -52, 56, -40, 36, -40, 0]], ['regression: random filtfilt 9', [[-2, 2, -2, 1], [4, -2, -2, 3, 0, 0, 6, 3]], [4, 12, -32, 27, -8, -20, 30, 3]], ['control: random filtfilt 46', [[-1, 1, 2, 2], [5]], [5]], ['control: random filtfilt 47', [[-2], [2, 2, 4, 6, 3, 6, 8]], [8, 8, 16, 24, 12, 24, 32]], ['control: single sample', [[1, 2], [3]], [3]], ['control: empty', [[1, 1], []], []]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-digital_signal_filters-filtfilt-odd-extension-padding-trim","generated_at":"2026-09-29T14:51:38.199851+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Forward-backward filtering is used for offline zero-phase smoothing; padding and reversal slips create edge transients and phase shift.","repair":"Discard pad samples on each side.","root_cause":"The result is sliced as y[:n] instead of y[pad:pad + n].","sha256":"05b72707293ab709d11162cfc985e6b9db1a75a501f84eb77f379ab4b7a86098","title":"Forward-backward filter trims the wrong end of the padding · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":38.061,"exit_code":1,"observations":[{"actual":[4,8,12,16,20,24,28,15],"check":"regression: ramp with two-tap average","expected":[4,8,12,16,20],"passed":false},{"actual":[0,20,44,60,64,64,64,68,84,76,28],"check":"regression: step with three taps","expected":[0,20,44,60,64,64],"passed":false},{"actual":[22,21,15],"check":"regression: short signal","expected":[22,21],"passed":false},{"actual":[3],"check":"control: single sample","expected":[3],"passed":true},{"actual":[],"check":"control: empty","expected":[],"passed":true},{"actual":[-4,3,-2,7,9,5,3,-2,1],"check":"control: random filtfilt 3","expected":[-4,3,-2,7,9,5,3,-2,1],"passed":true},{"actual":[8,1,1,8],"check":"control: random filtfilt 4","expected":[8,1,1,8],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: ramp with two-tap average\", \"actual\": [4, 8, 12, 16, 20, 24, 28, 15], \"expected\": [4, 8, 12, 16, 20], \"passed\": false}, {\"check\": \"regression: step with three taps\", \"actual\": [0, 20, 44, 60, 64, 64, 64, 68, 84, 76, 28], \"expected\": [0, 20, 44, 60, 64, 64], \"passed\": false}, {\"check\": \"regression: short signal\", \"actual\": [22, 21, 15], \"expected\": [22, 21], \"passed\": false}, {\"check\": \"control: single sample\", \"actual\": [3], \"expected\": [3], \"passed\": true}, {\"check\": \"control: empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"control: random filtfilt 3\", \"actual\": [-4, 3, -2, 7, 9, 5, 3, -2, 1], \"expected\": [-4, 3, -2, 7, 9, 5, 3, -2, 1], \"passed\": true}, {\"check\": \"control: random filtfilt 4\", \"actual\": [8, 1, 1, 8], \"expected\": [8, 1, 1, 8], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.373,"exit_code":1,"observations":[{"actual":[-5,-4,0,4,8],"check":"regression: ramp with two-tap average","expected":[4,8,12,16,20],"passed":false},{"actual":[-44,-60,-60,-44,-20,0],"check":"regression: step with three taps","expected":[0,20,44,60,64,64],"passed":false},{"actual":[6,22],"check":"regression: short signal","expected":[22,21],"passed":false},{"actual":[3],"check":"control: single sample","expected":[3],"passed":true},{"actual":[],"check":"control: empty","expected":[],"passed":true},{"actual":[-4,3,-2,7,9,5,3,-2,1],"check":"control: random filtfilt 3","expected":[-4,3,-2,7,9,5,3,-2,1],"passed":true},{"actual":[8,1,1,8],"check":"control: random filtfilt 4","expected":[8,1,1,8],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: ramp with two-tap average\", \"actual\": [-5, -4, 0, 4, 8], \"expected\": [4, 8, 12, 16, 20], \"passed\": false}, {\"check\": \"regression: step with three taps\", \"actual\": [-44, -60, -60, -44, -20, 0], \"expected\": [0, 20, 44, 60, 64, 64], \"passed\": false}, {\"check\": \"regression: short signal\", \"actual\": [6, 22], \"expected\": [22, 21], \"passed\": false}, {\"check\": \"control: single sample\", \"actual\": [3], \"expected\": [3], \"passed\": true}, {\"check\": \"control: empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"control: random filtfilt 3\", \"actual\": [-4, 3, -2, 7, 9, 5, 3, -2, 1], \"expected\": [-4, 3, -2, 7, 9, 5, 3, -2, 1], \"passed\": true}, {\"check\": \"control: random filtfilt 4\", \"actual\": [8, 1, 1, 8], \"expected\": [8, 1, 1, 8], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":38.062,"exit_code":0,"observations":[{"actual":[4,8,12,16,20],"check":"regression: ramp with two-tap average","expected":[4,8,12,16,20],"passed":true},{"actual":[0,20,44,60,64,64],"check":"regression: step with three taps","expected":[0,20,44,60,64,64],"passed":true},{"actual":[22,21],"check":"regression: short signal","expected":[22,21],"passed":true},{"actual":[3],"check":"control: single sample","expected":[3],"passed":true},{"actual":[],"check":"control: empty","expected":[],"passed":true},{"actual":[-4,3,-2,7,9,5,3,-2,1],"check":"control: random filtfilt 3","expected":[-4,3,-2,7,9,5,3,-2,1],"passed":true},{"actual":[8,1,1,8],"check":"control: random filtfilt 4","expected":[8,1,1,8],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: ramp with two-tap average\", \"actual\": [4, 8, 12, 16, 20], \"expected\": [4, 8, 12, 16, 20], \"passed\": true}, {\"check\": \"regression: step with three taps\", \"actual\": [0, 20, 44, 60, 64, 64], \"expected\": [0, 20, 44, 60, 64, 64], \"passed\": true}, {\"check\": \"regression: short signal\", \"actual\": [22, 21], \"expected\": [22, 21], \"passed\": true}, {\"check\": \"control: single sample\", \"actual\": [3], \"expected\": [3], \"passed\": true}, {\"check\": \"control: empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"control: random filtfilt 3\", \"actual\": [-4, 3, -2, 7, 9, 5, 3, -2, 1], \"expected\": [-4, 3, -2, 7, 9, 5, 3, -2, 1], \"passed\": true}, {\"check\": \"control: random filtfilt 4\", \"actual\": [8, 1, 1, 8], \"expected\": [8, 1, 1, 8], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}