Repository navigation
test: remove tautological and duplicate Rust unit tests - #3057
Merged
fengmk2 merged 1 commit intoOct 15, 2026
Merged
Conversation
- Drop the `assert!(true)` placeholder test in `vp create`. - Drop four `detect_shell` tests in `env use` that duplicate the `commands::shell` tests of the same function. - Drop tests of test-only helpers (`resolution::test_utils` and the `list_args` helper); every resolution parser test already exercises them. - Fold the unrolled `is_newer_version` and `should_run_for_command` cases in `upgrade_check` 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. |
Contributor
CLI artifact sizes (
|
| Artifact | Format | Base | PR | Change |
|---|---|---|---|---|
packages/cli/dist |
Directory total | 2.21 MiB | 2.21 MiB | 0 B (0.00%) |
packages/core/dist |
Directory total | 4.08 MiB | 4.08 MiB | 0 B (0.00%) |
| Combined package dist | Directory total | 6.29 MiB | 6.29 MiB | 0 B (0.00%) |
vp (Linux x64) |
Binary | 10.15 MiB | 10.15 MiB | 0 B (0.00%) |
vp (Linux x64) |
gzip -9 | 4.48 MiB | 4.48 MiB | 0 B (0.00%) |
| NAPI (Linux x64) | Binary | 33.59 MiB | 33.59 MiB | 0 B (0.00%) |
| NAPI (Linux x64) | gzip -9 | 13.37 MiB | 13.37 MiB | 0 B (0.00%) |
vp (macOS ARM64) |
Binary | 7.57 MiB | 7.57 MiB | 0 B (0.00%) |
vp (macOS ARM64) |
gzip -9 | 3.92 MiB | 3.92 MiB | 0 B (0.00%) |
| NAPI (macOS ARM64) | Binary | 40.86 MiB | 40.86 MiB | 0 B (0.00%) |
| NAPI (macOS ARM64) | gzip -9 | 17.60 MiB | 17.60 MiB | 0 B (0.00%) |
vp (Windows x64) |
Binary | 8.21 MiB | 8.21 MiB | 0 B (0.00%) |
vp (Windows x64) |
gzip -9 | 3.63 MiB | 3.63 MiB | -1 B (-0.00%) |
| NAPI (Windows x64) | Binary | 29.65 MiB | 29.65 MiB | 0 B (0.00%) |
| NAPI (Windows x64) | gzip -9 | 12.09 MiB | 12.09 MiB | -6 B (-0.00%) |
| Trampoline (Windows x64) | Binary | 13.50 KiB | 13.50 KiB | 0 B (0.00%) |
| Trampoline (Windows x64) | gzip -9 | 7.09 KiB | 7.09 KiB | 0 B (0.00%) |
| Installer (Windows x64) | Binary | 3.60 MiB | 3.60 MiB | 0 B (0.00%) |
| Installer (Windows x64) | gzip -9 | 1.77 MiB | 1.77 MiB | 0 B (0.00%) |
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://claude-prune-tests-duplicate-shell-and-helper-test-viteplus-dev.voidzero-docs.workers.dev (commit 687935d)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
fengmk2
approved these changes
Oct 15, 2026
fengmk2
deleted the
claude/prune-tests-duplicate-shell-and-helper-tests
branch
October 15, 2026 02:29
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:
vp_global_cliandvp_pm_clicarried Rust unit tests that could not fail when the product broke: anassert!(true)increate.rs, fourenv useshell-detection tests that repeatcommands::shelltests for codeenv useonly imports, and three tests of test-only helpers.upgrade_check.rshad 20 hand-unrolled lookup tests.After: those 8 tests are gone and the 20 lookup tests are 2 table-driven tests that keep every row and comment, with the failing row named in the assertion message. Only test code changes: every hunk is inside a
#[cfg(test)]module or the#[cfg(test)]-onlyresolution::test_utilsmodule.How: each candidate was defended by mutating product code with the most realistic regression only it would catch, running the crate's tests, and reverting. No deleted test failed alone on any mutation.
Totals
vp_global_clicases collected (Linux)vp_pm_clicases collected#[test]/#[tokio::test]attributes in tracked Rust (static count) and 1,492 staticit/testcalls in 101 JS spec files (not collected; Vitest needs a fullpackages/corebuild).vp_global_cli3.13 s → 3.32 s,vp_pm_cli27.81 s → 29.06 s (noise).Per file
crates/vp_global_cli/src/commands/create.rs›test_create_command_module_existsassert!(true))."new"instead of"create") passes all 502 tests, so this test cannot fail. The wholemod testsgoes.vp createdelegation. It may be covered by the PTY snapshot suite, which was not run.crates/vp_global_cli/src/commands/env/use.rs›test_detect_shell_vp_shell_{powershell,fish,nu},test_detect_shell_posix_defaultdetect_shell/Shell::from_strlive incommands/shell.rs;env useonly imports them.fishis byte-identical tocommands::shell::tests::test_detect_shell_vp_shell_fish;nutotest_detect_shell_vp_shell_explicit; lowercasepowershellbytest_shell_from_strandtest_detect_shell_vp_shell_case_insensitive;posix_defaultbytest_detect_shell_defaults_without_vp_shell.commands::shelltest.use vp_shared::env_vars;import is now#[cfg(windows)], since only the three Windows-only tests in the module still use it.crates/vp_pm_cli/src/resolution/test_utils.rs›parses_args_without_a_program_name,parses_subcommands_without_a_program_namecrates/vp_pm_cli/src/resolution/commands/list.rs›list_args_helper_keeps_pattern(and its test-onlylist_argshelper, which had no other caller)test_list_with_pattern_and_pass_through_args; M10 failstest_parser_accepts_short_dev_and_global_flagsandcli::tests::projects_managed_global_commands. The nominee passes both.Folds (
crates/vp_global_cli/src/upgrade_check.rs)is_newer_version_*tests →is_newer_version_compares_semver(12 rows, original comments kept, one comment added for the0.0.0dev-build row).should_run_for_*/should_not_run_for_*tests →should_run_for_command_skips_excluded_and_machine_readable_commands(11 rows).Kept after defense — do not re-nominate
None: no nominee survived its defense.
Case counts
commands/create.rscommands/env/use.rs(Linux)upgrade_check.rsresolution/commands/list.rsresolution/test_utils.rs0 new failures (0 failed and 4 ignored, before and after).
Mutations
Each was temporary and reverted (
git statusclean afterwards).create.rs:15: delegate"new"instead of"create". Failed: none.shell.rs:30:"fish"→"fishshell". Failed:use::…_fish,shell::test_shell_from_str,shell::…_fish.shell.rs:31:"nu" | "nushell"→"nushell". Failed:use::…_nu,shell::…_explicit,shell::test_shell_from_str.shell.rs:32: drop"powershell". Failed:use::…_powershell,shell::…_case_insensitive,shell::test_shell_from_str.shell.rs:54: default alwaysCmd. Failed:use::…_posix_default,shell::…_defaults_without_vp_shell,shell::…_invalid_vp_shell_falls_back_to_default.shell.rs:49: upper-case the value. Failed: none (equivalent mutation;from_strlowercases).test_utils.rs:70:test_argvno longer prepends a program name. Failed: 122 tests, including both nominees.test_utils.rs:57:parse_subcommandgets raw args. Failed: 17 tests (config,dist_tag,owner,stage,token, plus the nominee).list.rs:78-80: pnpm drops the pattern. Failed:test_list_with_pattern_and_pass_through_argsonly.list.rs:11:patternbecomes#[arg(long)]. Failed:test_parser_accepts_short_dev_and_global_flags,cli::tests::projects_managed_global_commands.upgrade_check.rs:170(after the fold):>→>=. Failed:is_newer_version_compares_semver.upgrade_check.rs:338(after the fold):Upgraderemoved from the excluded commands. Failed:should_run_for_command_skips_excluded_and_machine_readable_commands.upgrade_check.rs:165(after the fold): the0.0.0early return removed. Failed:is_newer_version_compares_semver.What ran and what did not
cargo test -p vp_global_cliandcargo test -p vp_pm_cliwith--report-time;cargo clippy -p vp_global_cli -p vp_pm_cli --all-targets --all-features -- --deny warningswith thejust lintallow-list;cargo fmt --all -- --check;git diff --check. All pass.just test/just lint/just check; Windows targets (none installed here, so the#[cfg(windows)]import gate was reviewed but not compiled; Windows CI will compile it); the JS/Vitest suite; the PTY snapshot suite.Excluded pull requests
55 open PRs touch 737 files between them; none of the 5 files here is among them. #3055 #3052 #3051 #3049 #3047 #3046 #3044 #3040 #3038 #3037 #3020 #3018 #3014 #3012 #3009 #3008 #3000 #2986 #2981 #2966 #2936 #2922 #2900 #2863 #2862 #2810 #2792 #2740 #2721 #2699 #2695 #2574 #2557 #2552 #2549 #2543 #2542 #2541 #2483 #2475 #2463 #2462 #2461 #2456 #2428 #2418 #2357 #2267 #2125 #1958 #1783 #1782 #1614 #1517 #1180.
Age check (cutoff: 30 days, 2026-09-14)
First-added dates from
git log -S, followed across thevite_*→vp_*crate rename.test_create_command_module_existstest_detect_shell_posix_defaulttest_detect_shell_vp_shell_{powershell,fish,nu}test_utilstests andlist_args_helper_keeps_patternupgrade_checktestsNone was added for a bug or incident, and none is in a permission, security or entitlement suite.
Checks
vp_global_clivp_pm_cligit diff --checkTo revert:
git revert 687935d7461f97f8d6cf53b62e2b9c718c23d413.🤖 Generated with Claude Code
https://claude.ai/code/session_01PxVsmvB9xfZKfVnUonY8kf
Generated by Claude Code