{"record":{"id":"a4acfc9b6ba3844b","repo":"rtk-ai/rtk","slug":"test-s-failed","errorCode":null,"errorMessage":"{} test(s) failed","messagePattern":"(.+?) test\\(s\\) failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/hooks/verify_cmd.rs","lineNumber":45,"sourceCode":"\n    if total == 0 {\n        println!(\"No inline tests found.\");\n    } else {\n        println!(\"{}/{} tests passed\", passed, total);\n    }\n\n    if require_all && !results.filters_without_tests.is_empty() {\n        for name in &results.filters_without_tests {\n            eprintln!(\"MISSING tests for filter: {}\", name);\n        }\n        anyhow::bail!(\n            \"{} filter(s) have no inline tests (use --require-all in CI)\",\n            results.filters_without_tests.len()\n        );\n    }\n\n    if failed > 0 {\n        anyhow::bail!(\"{} test(s) failed\", failed);\n    }\n\n    Ok(())\n}\n","sourceCodeStart":27,"sourceCodeEnd":50,"githubUrl":"https://github.com/rtk-ai/rtk/blob/0924356b4caba4989607227b7c8824d3d8098719/src/hooks/verify_cmd.rs#L27-L50","documentation":"`rtk verify` executes the inline tests defined inside TOML custom filters. If any executed test fails (its actual filtered output does not match the expected output), the command prints each failure with expected/actual on stderr, reports the pass count, then bails with the total number of failing tests. It means one or more filter rules no longer behave as their tests specify.","triggerScenarios":"Running `rtk verify` (with or without --require-all, and with or without a filter-name argument) when `run_filter_tests` returns outcomes where `passed == false` for at least one test — i.e. failed > 0 after the require-all check.","commonSituations":"Editing a filter's pattern or replacement without updating its inline tests; a test whose expected output was written for an older filter format; typos in expected strings; a regex change that alters which lines match.","solutions":["Read the FAIL blocks on stderr: compare each test's `expected` vs `actual`, then fix the filter pattern or update the test to the correct expectation.","Re-run `rtk verify <filter-name>` scoped to the failing filter for a faster iterate loop.","If the new behavior is correct, update the inline test's `expected` value; if not, revert the filter change.","Run `rtk verify` locally as part of the pre-commit gate so failures are caught before CI."],"exampleFix":"// before: test expectation out of sync with the pattern\n[[filters.my-filter.tests]]\ninput = \"warning: slow\"\nexpected = \"SLOW\"\n\n// after: correct expectation after pattern change\n[[filters.my-filter.tests]]\ninput = \"warning: slow\"\nexpected = \"slow\"","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"import subprocess\nr = subprocess.run([\"rtk\", \"verify\"], capture_output=True, text=True)\nif r.returncode != 0 and \"test(s) failed\" in r.stderr:\n    for line in r.stderr.splitlines():\n        if line.startswith(\"FAIL\"):\n            print(line)  # surface expected vs actual to the developer\n    raise SystemExit(\"fix filter patterns or update inline test expectations\")","preventionTips":["Run `rtk verify` locally after every edit to a filter's pattern or replacement.","When changing a filter intentionally, update its inline expected values in the same commit.","Keep test inputs small and deterministic so expected outputs are easy to maintain.","Wire `rtk verify` into the pre-commit gate so failures never reach CI."],"tags":["testing","filters","toml","ci"],"backgroundTag":"assertion-failed","analyzedSha":"0924356b4caba4989607227b7c8824d3d8098719","analyzedAt":"2026-09-19T19:25:29.612Z","contentChangedAt":"2026-09-19T19:25:29.612Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}