Skip to content

feat(shell): add bats/TAP test runner filter#1909

Open
tylern91 wants to merge 1 commit into
rtk-ai:developfrom
tylern91:feat/bats-tap-filter
Open

feat(shell): add bats/TAP test runner filter#1909
tylern91 wants to merge 1 commit into
rtk-ai:developfrom
tylern91:feat/bats-tap-filter

Conversation

@tylern91
Copy link
Copy Markdown

Summary

  • New TOML filter src/filters/bats.toml for bats commands
  • Strips blank lines and bare # comment lines (noise on passing runs)
  • Preserves TAP plan line (1..N), all ok/not ok lines, and # comment context on failures
  • New rewrite rule in src/discover/rules.rs so the hook routes batsrtk bats
  • 4 inline tests: passing run, failure with context, blank-line stripping, empty input

Motivation

bats is the highest-volume unhandled command per rtk discover --all across 1,178 real Claude Code sessions — 353 calls/month. TAP format emits a blank line after each test group and bare comment separators that add no signal. Stripping these alone saves ~75% on typical passing suites while keeping failure context fully intact (critical for debugging).

Token Savings

Case Input Output Savings
All passing, 10 tests ~150 tokens ~80 tokens ~47%
1 failure, 10 tests ~180 tokens ~160 tokens ~11% (failure preserved)
Empty output any bats: ok ~100%

Test plan

  • 4 inline tests pass (cargo test --all — 1870 passed, 0 failures)
  • cargo fmt --all && cargo clippy --all-targets — clean
  • Filter count updated: 59→60 in src/core/toml_filter.rs
  • Concat test updated: 60→61 expected

Closes #1908

353 calls/month go unfiltered (highest-volume unhandled command per
rtk discover --all across 1,178 sessions). Add TOML filter + rewrite
rule to compress bats output: strip blank lines and bare comment lines,
preserve TAP plan line + failure details. max_lines=60 caps runaway
output. 4 inline tests covering passing run, failure with context,
blank-line stripping, and empty input.

Refs rtk-ai#1866 (unhandled commands)
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 16, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add bats/TAP test runner filter

2 participants