rtk-ai/rtk · error · anyhow::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` executes the inline test cases embedded in filter TOML files. With --require-all it also enforces a coverage gate: every filter must carry at least one [[tests.<filter-name>]] entry; filters without tests are listed on stderr ('MISSING tests for filter: X') before this counted bail. Intended for CI so untested filters cannot ship silently.

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 d977e1c316)

Solutions

  1. Add a [[tests.<filter-name>]] block (name, input, expected) for each filter listed on stderr
  2. Run `rtk verify` without --require-all first to see the passed/total summary and the gaps
  3. Keep --require-all in CI — the friction is the point of the gate

Example fix

# .rtk/filters.toml before
[filters.make]
match_command = "^make\\b"
# no tests → verify --require-all fails

# after
[[tests.make]]
name = "strips make chatter"
input = """
make[1]: Entering directory '/home/user'
gcc -O2 foo.c
"""
expected = """
gcc -O2 foo.c
"""
Defensive patterns

Strategy: validation

Validate before calling

# CI: require full inline-test coverage for custom filters
rtk verify --require-all

Prevention

When it happens

Trigger: `rtk verify --require-all` while any [filters.*] entry in .rtk/filters.toml or ~/.config/rtk/filters.toml has no matching [[tests.<name>]] section — src/hooks/verify_cmd.rs:40.

Common situations: Enabling --require-all in CI after filters already exist; adding a new filter and forgetting its inline tests.

Related errors


AI-assisted analysis of rtk-ai/rtk@d977e1c316 (2026-08-16). Data as JSON: /api/errors/e15deb8ee13c46bd. Report an issue: GitHub.