rtk-ai/rtk · error

filter(s) have no inline tests (use --require-all in CI)

Error message

{} filter(s) have no inline tests (use --require-all in CI)

What it means

`rtk verify` runs inline tests embedded in TOML custom filters. With the --require-all flag (intended for CI), the command additionally fails when any discovered filter has no inline tests at all, listing each such filter on stderr before bailing. This enforces test coverage for every custom filter so untested output-rewriting rules cannot ship.

Solutions

  1. Add inline tests to each listed filter in the TOML file (test entries with input/expected output) until `rtk verify --require-all` passes.
  2. Run `rtk verify` without --require-all locally to see pass/fail counts, then fix only the MISSING-tests filters listed on stderr.
  3. If a filter is intentionally test-free (e.g. experimental), drop --require-all from the CI invocation or exclude that filter from the verified set.
  4. Check that the tests are in the correct TOML section/format so they are discovered — malformed test entries may count as 'no tests'.

Example fix

// before: filter with no tests
[filters.my-filter]
pattern = "warning: .*"

// after: add an inline test
[filters.my-filter]
pattern = "warning: .*"

[[filters.my-filter.tests]]
input = "warning: slow build"
expected = "warning: slow build"
Defensive patterns

Strategy: validation

Validate before calling

import re, pathlib

def filters_missing_tests(toml_text):
    # heuristic: every [filters.<name>] section should be followed by a [[filters.<name>.tests]] block
    names = re.findall(r'^\[filters\.([\w-]+)\]', toml_text, re.M)
    missing = [n for n in names if f"[[filters.{n}.tests]]" not in toml_text]
    return missing

text = pathlib.Path(".rtk/filters.toml").read_text()
missing = filters_missing_tests(text)
if missing:
    raise SystemExit(f"add inline tests for: {missing}")

Try / catch

import subprocess
r = subprocess.run(["rtk", "verify", "--require-all"], capture_output=True, text=True)
if r.returncode != 0 and "have no inline tests" in r.stderr:
    print("Coverage gate failed:", r.stderr)
    # decide: add tests or run without --require-all locally
else:
    raise RuntimeError(r.stderr)

Prevention

When it happens

Trigger: Running `rtk verify --require-all` when `run_filter_tests` reports non-empty `filters_without_tests` — i.e. at least one TOML filter is loaded but defines no inline [[tests]] entries. Optionally scoped by passing a filter name; the check applies to whatever set of filters is evaluated.

Common situations: Adding a new filter to .rtk/filters.toml without writing its inline tests, then running the CI verify gate; upgrading rtk where --require-all was newly added to the CI script; reusing a filter copied from elsewhere that never had tests.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of rtk-ai/rtk@0924356b4c (2026-09-19). Data as JSON: /api/errors/e15deb8ee13c46bd. Report an issue: GitHub.

Appendix: source

Thrown at src/hooks/verify_cmd.rs:38

        if !outcome.passed {
            eprintln!(
                "FAIL [{}] {}\n  expected: {:?}\n  actual:   {:?}",
                outcome.filter_name, outcome.test_name, outcome.expected, outcome.actual
            );
        }
    }

    if total == 0 {
        println!("No inline tests found.");
    } else {
        println!("{}/{} tests passed", passed, total);
    }

    if require_all && !results.filters_without_tests.is_empty() {
        for name in &results.filters_without_tests {
            eprintln!("MISSING tests for filter: {}", name);
        }
        anyhow::bail!(
            "{} filter(s) have no inline tests (use --require-all in CI)",
            results.filters_without_tests.len()
        );
    }

    if failed > 0 {
        anyhow::bail!("{} test(s) failed", failed);
    }

    Ok(())
}

View on GitHub (pinned to 0924356b4c)