Repository navigation
test: remove redundant unit tests and fold lookup tables - #882
Open
Brooooooklyn wants to merge 1 commit into
Open
Brooooooklyn wants to merge 1 commit into
Brooooooklyn wants to merge 1 commit into
Conversation
Delete unit tests that cannot fail on a regression another test does not already catch: a `f() == f()` tautology, a determinism check that the hash tests already cover, and three strict-subset duplicates. Fold three hand-unrolled lookup tables into table-driven tests, keeping every row and comment. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PxVsmvB9xfZKfVnUonY8kf
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
fspy benchmarklinuxmacoswindows |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Brooklyn · project thread
Before: five unit tests could not fail on a regression that no other test catches: a
f() == f()tautology, a "hash twice and compare" check, and three tests whose assertions are a subset of a neighbour's. Twofspy_shared_unixtables and the labeled-writer tests were hand-unrolled into one#[test]per row.After: the five tests are gone, and the three tables are table-driven tests that keep every row, its inputs and its expected value. Only
#[cfg(test)]code changes.How: each removal was defended by mutating product code with the most realistic regression it could catch, running the crate's tests, and reverting.
Totals
fspy_shared_unix,vt,vt_glob,vt_powershell,vt_workspace,vt_planlib tests): 282 → 259 cases. The whole workspace was not run (see below), so there is no workspace-wide total.npm_workspace_with_exclusions28 ms,test_file_hashes_are_consistent6 ms, the rest under 1 ms).Removals
vt_powershelltests::is_stdin_terminal_is_idempotent— tautology:assert_eq!(is_stdin_terminal(), is_stdin_terminal())on aLazyLock. Mutation R1 (negate the cachedis_terminal()): the test passes, as does everything else invt_powershellandvt_plan. The behaviour that depends on it is covered byvt_planps1_shim::tests::skips_rewrite_when_not_interactive(mutation R1b, skipping the!is_interactivecheck, fails it).vtsession::execute::glob::tests::test_file_hashes_are_consistent— determinism check. Mutation R2 (seed the file hasher randomly per call) fails it and alsosession::execute::hash::tests::other_files_hash_raw_contentandredacted_file_hashes_without_content, which pin exact hash values.vtsession::reporter::grouped::writer::tests::buffers_output— subset ofshared_buffer_interleaves, which appends several chunks from two writers to one shared buffer and checks the joined result. Mutation R5 (replace instead of append) fails both.vt_globpath::tests::test_match_ignores_directory_only_patterns—build/**with!build/keep/**;test_match_ignores_directory_patternsasserts the same shapes (build/**,dist/**with!dist/public/**). Mutations R4 (ignore negations) and R4b (treat negated globs as positive) fail 8 and 9 otherpathtests.vt_workspacetests::test_get_package_graph_npm_workspace_with_exclusions— despite its name it only asserts that the root andpackages/normalare found; its closing comment says exclusions "might not work" and asserts nothing about them. Mutation R3 (drop negated workspace globs): it passed (run at the earlier base), whiletest_get_package_graph_workspace_exclusions,…_workspace_work_with_last_match_winsand…_npm_workspace_with_root_relative_prefixesfail. Mutation R3b (stop adding the root package) fails 13 other graph tests,test_get_package_graph_npm_workspaceamong them.Folds (every row kept)
fspy_shared_unix/src/exec/mod.rsappends_value_to_the_env_list:fspy_shared_unix/src/exec/which.rstest_whichENAMETOOLONG→ENOENTvt/src/session/reporter/labeled/writer.rsprefixes_each_lineEach assertion carries the row's name, so a failure still names the case.
Kept after defense
vt_subprocess_testtests::test_command_for_fnwas nominated and kept: its defense could not be completed safely (see "What ran").Case counts (lib tests)
0 failures before and after.
What ran and what did not
0346c268and on this branch: the lib tests of the six crates above with--report-time; mutations R1–R5, R1b, R3b, R4b and RF1–RF3, each reverted afterwards;cargo fmt --checkon the touched files;cargo clippy -p fspy_shared_unix -p vt -p vt_glob -p vt_powershell -p vt_workspace --tests -- -D warnings(clean).just lintandjust test, macOS and Windows, and the e2e/snapshot suites. Thevt_subprocess_testandvt_pty_terminalsuites were deliberately not run: while defendingtest_command_for_fn, a mutation that swapped the child's id and payload arguments left children with an empty argument, which libtest took as a filter matching every test, so each child re-ran the suite and spawned without bound.Open pull requests: of the 61 open, only #601 touches a file here, and it renames
crates/vt/src/session/execute/glob.rswithout changing its content.Ages: all five deleted tests are older than a month (newest:
is_stdin_terminal_is_idempotent, 2026-06-28). None was added for a bug, and none is in a permission or security suite.To revert:
git revert 2c324106.Generated by Claude Code