Repository navigation
Description
Having filed a number of defects here, I went back and asked the more useful question: why did a green 2,520-test suite not catch them? The answer is structural rather than sloppy, and I think it is more actionable than any individual bug.
Provenance: AI-assisted source audit, human-directed, at v0.44.2 (700bdde). Counts and the test run were produced on this machine; items marked SOURCE are read from code.
1. Six integration test files compile away on Windows — 53 tests
Every one of these starts with #![cfg(unix)]:
| file | tests |
|---|---|
tests/search_faithful_test.rs |
15 |
tests/search_compress_test.rs |
14 |
tests/grep_faithful_format_test.rs |
11 |
tests/grep_context_test.rs |
6 |
tests/search_error_test.rs |
5 |
tests/pipeline_stdin_test.rs |
2 |
On Windows cargo test prints running 0 tests / test result: ok. six times — a green result for zero executed tests. .github/workflows/ci.yml:60 runs the matrix [ubuntu-latest, windows-latest, macos-latest] with a bare cargo test --all, and release.yml ships a Windows binary. So the Windows leg of CI proves nothing about grep, search, or the stdin pipeline — the areas those files cover.
Whether the gating is deliberate (POSIX-only assumptions in the fixtures) or accidental, the effect is that the Windows job's green tick is not evidence for those features.
2. The two files that decide everything have no tests
src/discover/rules.rs 1009 lines 0 tests
src/core/runner.rs 286 lines 0 tests
rules.rs holds the RULES table that decides which commands get rewritten and to what — the source of the yadm→git, gradle→gradlew, find -delete and biome check issues I filed. runner.rs is the shared exec → filter → guard → tee → track → exit-code skeleton every *_cmd.rs funnels through.
Also zero tests: analytics/gain.rs (762 lines), discover/mod.rs (297), cmds/system/summary.rs (301), cmds/system/deps.rs (277).
This is the structural answer to the question in the title: the leaves are well tested, the trunk is not. Most *_cmd.rs files have thorough tests of their pure filter functions, and those functions are usually correct — the defects live in how they are wired together.
3. Savings tests measure with a different metric than the tool reports
Tests assert with core/utils.rs:300 count_tokens = split_whitespace().count() (words). Production rtk gain and the never_worse guard (core/guard.rs:8) use estimate_tokens = ceil(len/4) (bytes).
On the project's own fixture tests/fixtures/mvn_test_pass_slice_raw.txt, the two disagree across the 60% floor: 35.6% by words, 62.4% by bytes. So a test asserting savings >= 60.0 is asserting a number the tool never reports, in either direction.
Related: cmds/system/pipe_cmd.rs:560,581 assert savings >= 40.0 with the comment // TODO: grep pipe filter below 60% target. .claude/rules/cli-testing.md calls ≥60% "the release blocker". The two filters known to miss the floor had their own gate lowered to 40, so the gap can neither be detected as fixed nor as regressed.
4. A few tests that cannot fail
cmds/system/search.rs:1334test_grep_overflow_uses_uncapped_total— the body islet total = per_file + 42; let overflow = total - per_file; assert_eq!(overflow, 42).per_filecancels; it calls no production function. Its comment says it "documents that the search filter avoids the diff_cmd bug", but the filter's overflow path is never touched.jvm/mvn_cmd.rs:1938print_savings_summary— a#[test]with zero assertions (twoprintln!s) and#[ignore]d, so it can neither fail nor be seen.discover/registry.rs:4078test_all_patterns_are_valid_regexre-compiles patterns thatregistry.rs:52already compiles in aLazyLockwith.expect(...)— a bad pattern panics hundreds of other tests first, so this can never be the test that tells you.
5. Absence-only assertions that a broken feature satisfies
scala/sbt_cmd.rs:582test_filter_sbt_test_failures_no_noise— fourassert!(!output.contains(...))and nothing else.filter_sbt_test()returning""(every failure lost) passes.php/pint_cmd.rs:223test_pint_invalid_json_falls_back— asserts only!result.contains("pint: ok"). The behaviour in the name, falling back to raw output, is the one thing not asserted; returning""passes.js/pnpm_cmd.rs:651,660andcloud/psql_cmd.rs:319,326— same shape on filter output.
To be fair to the suite: this is 4 OR-assertions in 2,534 tests, no assert!(true)-equivalents, and no commented-out assertions. The vacuity is structural, not careless.
6. Integration tests skip silently when rg is missing
28 sites across the search/grep integration files do if !rg_available() { return; } — an unconditional pass with no skip marker and nothing in the summary. No workflow installs ripgrep (ci.yml:215 installs only tree). On any runner without rg, the search contract self-disables while reporting green.
Tests that are genuinely good — the model to copy
I want to be specific here, because the above is a lot of criticism:
git/diff_cmd.rs:430test_condense_unified_diff_overflow_count_accuracynames the exact old defect in its comment ("changes vec capped at 15, so old code showed+5 more") and asserts the true+190 more. This is the shape everything above is missing.core/guard.rs:15-56— seven tests pinnever_worseon both sides of the boundary plus tie/empty cases, and use the sameestimate_tokensproduction uses. The only savings-adjacent tests whose metric matches the shipped one.tests/guard_integration_test.rs— the one integration file with nocfg(unix); 11 end-to-end process tests asserting exit codes, not just substrings. Ran green here on Windows.discover/registry.rs:1496and:4319— regression tests that name the defect they lock ("must FAIL before the fix and PASS after").
Suggested priorities (untested — no programmer has reviewed these)
- Make the Windows leg mean something — either port the six files off
cfg(unix)or, if they are genuinely POSIX-only, say so and add Windows equivalents, so the matrix does not imply coverage it does not have. - Test the trunk — even a handful of table-driven tests over
RULES(given command → expected rewrite) would have caughtyadm→git, thefindcatch-all and thegradleswap in one go. - Use
estimate_tokensin savings tests, so the assertions and the tool agree. - Fail loudly rather than silently when
rgis absent, and install it in CI.
Activity
pszymkowiak commentedon Aug 4, 2026
🔍 Automated Triage
bughighSummary
Structural audit finds 53 integration tests are Windows-disabled via #![cfg(unix)], the rewrite RULES table and shared runner.rs have zero tests, and savings tests use word-count instead of the byte-based estimate_tokens the tool actually reports — recommend porting/adding Windows tests, table-driving RULES, and aligning test metric with production.
📁 Relevant files
tests/search_faithful_test.rstests/search_compress_test.rstests/grep_faithful_format_test.rstests/grep_context_test.rstests/search_error_test.rstests/pipeline_stdin_test.rssrc/discover/rules.rssrc/core/runner.rssrc/core/utils.rssrc/core/guard.rs.github/workflows/ci.ymlTriaged automatically by wshm · This is an automated analysis, not a human review.
HetCreep commentedon Aug 30, 2026
Correcting my own report, and confirming that nothing in it has been fixed. Re-verified at
develop@0de9610.Provenance: AI-assisted source audit, human-directed, at
develop@0de9610. Line and test counts were re-counted at this commit; the Windowscargo test --alloutput was not re-run — see "not checked".Strike one figure
Section 3's "35.6% by words" is wrong and I cannot reconstruct how I arrived at it. The fixture's own word counts, combined with the repo's passing
savings >= 50.0assertion on that same fixture, force a figure of at least 57.5%. Please disregard that number; the surrounding point about which metric is used still stands, but the arithmetic supporting it does not.One item to drop from the list
src/cmds/system/deps.rsshould come off the "also zero tests" list — it now has 3. In fairness those tests are collateral of unrelated BOM work and cover one of five summarizers (summarize_package_json_str), leavingrun()and the other four at zero, so I am not presenting this as a fix to the issue. It is simply no longer accurate as written.Corrected counts, all in the same direction
#![cfg(unix)]files).src/discover/rules.rs: 1009 → 1032 lines, still 0 tests.src/core/runner.rs: 286 lines, still 0 tests.count_tokensdefinitions: 15.The CI matrix cite is unchanged and exact.
Not checked
I did not re-run
cargo test --allon Windows, so the "six suites printrunning 0 tests" observation is inferred from the crate-root#![cfg(unix)]rather than observed at this commit.HetCreep commentedon Oct 14, 2026
Re-checked on v1.0.0 (stable, 2026-10-13): the official release binary plus the v1.0.0 source. Provenance: AI-assisted check, human-directed. "ran" = executed against
rtk 1.0.0with a control; "read" = verified from source only.Fixed:
src/core/runner.rsnow has 39#[test]s (it had none at the time of the report). Thanks.Still live at v1.0.0 (read):
tests/*.rsstarting with#![cfg(unix)]: 12 files now (curl_stdin, grep_context, grep_faithful_format, init_agent_cursor, init_opencode, native_test_expression, pipeline_stdin, search_compress/error/faithful/stdin, signal_flush), more than the 6 counted originally; they do not run on the Windows job.src/discover/rules.rshas nomod tests(0 tests);src/cmds/system/summary.rshas 0.pipe_cmd.rs:652,675assertsavings >= 40.0 // TODO;search.rs:1854is a tautology (per_file + 42 - per_file);mvn_cmd.rs:4971print_savings_summaryis#[ignore]with no assertion.ci.yml:284installs ripgrep only in the benchmark job, so therg_availableskips apply in the test job.Correction to the original text: the "35.6% by words" figure in section 3 was wrong when written (the fixture's own word counts force at least 57.5%); I have not re-measured it.