Repository navigation
test(cli): use tests/common's helpers instead of local copies (T55) - #2241
Mikola Lysenko (mikolalysenko) wants to merge 5 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
The stderr_chatter filter (4 byte-identical copies) dropped API-token warning lines that these offline and cached runs never print, so the emptiness checks now assert on the whole stderr and the presence checks read it directly. Assisted-by: Claude Code:claude-opus-5-5
Delete local copies identical to tests/common's: has_command in six
suites, git_sha256_file in four, sha256_hex in nine, and the yarn
suites' second include of common/cache_env.rs. Delete the unused
common::{env_map, npm_run} and update_fixture's raw_asset and
delay_asset.
Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
Drop the second #[path] include of common/cache_env.rs and common/hermetic.rs beside mod common, and state why the silent suites' stderr never holds the proxy notice: it is an info notice, muted under --silent and --json. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
PR SummaryLow Risk Overview Removes unused test utilities ( Behavioral change in tests only: deletes the Reviewed by Cursor Bugbot for commit 0d967b7. Configure here. |
Assisted-by: Claude Code:claude-opus-5-5
LLM Description written by Claude Code:claude-opus-5-5
Refs #1959 (T55, first slice). Living document: Part 5, tests.
Why
Suites that already include
tests/commonkept their own copies of its helpers. This deletes the copies that are byte-for-byte or behaviourally identical tocommon's and callscommon::*instead. It also drops thestderr_chatterfilter, which hid stray lines from the silent-mode emptiness checks.Changes
has_command: deleted 6 copies identical tocommon::has_command(e2e_npm,e2e_gem,e2e_scan,e2e_yarn4_pnpm_linker_build,e2e_yarn4_workspaces_build,e2e_redirect_yarn_berry_build). These kept: thepm_command/go versionvariants ine2e_hosted_production,e2e_vendored_productionande2e_artifactory_mirror, and thetool_command+.success()variants ine2e_vendor_rushande2e_redirect_rush_sim, because they behave differently.git_sha256_file: deleted 4 copies (e2e_npm,e2e_gem,e2e_scan,e2e_pypi).sha256_hex: deleted 9 copies (mode_migration_cargo,e2e_redirect_cargo_build,e2e_vex_vendor,repair/repair_vendor_e2e,e2e_vex_lockfile/{maven,uv,poetry,nuget},vlt_e2e_common, which now re-exportscommon::sha256_hex).hex::encodeandformat!("{:x}")produce the same lowercase hex.e2e_redirect_rush_simno longer#[path]-includecommon/cache_env.rs(and, for rush,common/hermetic.rs) a second time besidemod common.common::{env_map, npm_run}(0 callers) andupdate_fixture::{raw_asset, delay_asset}plus theasset_delayfield.stderr_chattercopies (cli_apply_silent,cli_scan_silent,apply/apply_silent_staging_errors,vendor/vendor_silent_errors). The filter dropped any line containingSOCKET_API_TOKENorContinuing anyway:stderr.is_empty():scan_silent_no_packages_produces_no_output,scan_silent_apply_flow_produces_no_output_but_still_applies,scan_vendor_silent_gc_prints_nothing,apply_json_offline_missing_source_keeps_stderr_cleanandvendor_json_online_fetch_failure_keeps_stderr_clean.stderrdirectly.eprintln!("No SOCKET_API_TOKEN set (injected)")at the top ofmain, all 5 emptiness tests fail. Before this PR the filter hid that line and they passed. They pass again once it is removed.cli_scan_silent. The one incli_apply_silentnow gives the real reason: the notice is an info notice, muted under--silent/--json.Size
git diff --stat: 23 files, +46 / −298, all undercrates/socket-patch-cli/tests/. Production: 0.Behavior change
None in the product. The 5 silent-mode tests are stricter, as described above.
Verification
cargo test -p socket-patch-cli --tests --no-run: every test target builds with no new warnings. Two pre-existing unused-import warnings remain, inin_process_vendor_bun_takeover/registry.rsandvendor/e2e_golang_redirect.rs.apply,cli,cli_apply_silent,cli_scan_silent,common_selftests,e2e_vex_lockfile,e2e_vex_vendor,mode_migration_cargo,vendor,update,self_update_e2e,self_update_failures_e2eande2e_redirect_rush_sim. The toolchain e2e suites (e2e_npm,e2e_gem,e2e_scan,e2e_pypi, the yarn suites) compile but are#[ignore]d or toolchain-gated here.repair: 116 pass. 2 fail only because the sandbox runs as root (repair_cleanup_failure_is_reported_in_json_and_silent_modes,repair_exits_zero_and_stays_quiet_when_lock_file_unremovable); they are chmod tests that pass in CI.cargo clippy --workspace --all-features -- -D warnings: clean./code-review highfindings not fixed hererollback/cli_rollback_silent.rsstill has a 5thstderr_chatter, ande2e_redirect_gem_build.rsasha256_hex. Both files are held by open fixer PRs (Fix reporting of an installed gem that matches no variant (#2231) #2237, Fix hosted gem unwind behind a private mirror (#2230) #2233/Remove hosted and vendored mode for gems locked as platform gems #2226), so they wait for the next slice. So doe2e_bazel_build/*andmaven_build_common/, which open PRs also change.The local
npm_run/assert_run_okine2e_npm/e2e_scanwere not folded:assert_run_okwraps each file's ownrun;npm_runstripsSOCKET_*, whichcommon::run_toolchaindoesn't.Folding them means changing
run_toolchainfirst; that is the next slice.Extending the
shared_helper_copiesguard tohas_command/sha256_hexwaits until the remaining copies are gone.Pre-existing:
common::has_commandprobes withCommand::new, nothermetic::tool_command, so on Windows the.cmdnpm/yarn shims read as missing. This PR keeps that behaviour; it is noted on Use tests/common's helpers in the suites that already include it: has_command ×9, sha256_hex ×16, a dead stderr_chatter filter ×5, and rollback_json's drifted envelope readers #1959.Risk
Low: test-only and mechanical. No
cfg(windows)/cfg(unix)code changed.🤖 Generated with Claude Code
https://claude.ai/code/session_011f9aePrALfrCutpZn63ds9