Repository navigation
Open
Labels
agent:triagedarch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)Filed by a scheduled architecture audit routine (see the architecture review discussion)priority:p3refactorStructural change: duplicated code or logic, missing abstraction, layering, dead codeStructural change: duplicated code or logic, missing abstraction, layering, dead code
Description
[agent] Filed by the scheduled architecture audit (audit-cli-tests). Register: register comment.
Kind: refactor. Register ID: T55 (follows T51/#1941, which covers tests/apply).
Problem
Suites that already include tests/common still keep their own copies of its helpers:
has_command, 9 copies besidecommon::has_commandL57:e2e_npm.rsL42,e2e_gem.rsL47,e2e_scan.rsL66,e2e_hosted_production.rsL275,e2e_vendored_production.rsL291,e2e_redirect_rush_sim.rsL97,e2e_redirect_yarn_berry_build.rsL118,e2e_yarn4_pnpm_linker_build.rsL113,e2e_yarn4_workspaces_build.rsL113. The common one has 2 users.sha256_hex, 16 copies besidecommon::sha256_hexL136, e.g. e2e_redirect_cargo_build.rs L135,``mode_migration_cargo.rsL128, `e2e_vex_lockfile/{maven,nuget,poetry,uv}.rs`, `maven_build_common`, `hosted_maven_common`, `vlt_e2e_common`, `jvm_fixture_repo`. `update_fixture::sha256_file` and `update_fixture::real_binary` duplicate `sha256_hex` and `oracle::binary` too.git_sha256_fileandassert_run_ok, 4 copies each, andnpm_run, 3 copies, ine2e_npm,e2e_gem,e2e_scanande2e_pypi: the filescommonwas extracted from.common::npm_runandcommon::env_maphave 0 users.stderr_chatter, 5 byte-identical copies (md5 equal):cli_apply_silent.rsL49-L59,cli_scan_silent.rsL69,apply/apply_silent_staging_errors.rsL30,rollback/cli_rollback_silent.rsL43,vendor/vendor_silent_errors.rs. The same filter is also inlined 6× incli_remove_silent.rs(L77-L84). The filter is dead:--silentmutes theSOCKET_API_TOKENnotice in core (utils/notice.rsL51-L58). Removing the clauses leaves all tests green incli_apply_silent(7),cli_scan_silent(6) andcli_remove_silent(10) (executed). So it should be deleted, not centralised: it can only hide a regression.rollback_jsonre-implementsenvelope:events(L16-L21),```warning_codes(L162), `events_with_mode` (= `envelope::mode_events`) and `assert_rollback_envelope` L174-L199.```` The last has drifted from `envelope::assert_envelope_invariants` L193: it requires `skipped ==` the event count where envelope allows `<=`, accepts 3 statuses instead of 10, and skips the `error`/`dryRun` checks. 20 of its 22 includers already have `common::envelope`.
Proposed change
- Delete the local
has_command,sha256_hex,git_sha256_file,assert_run_okandnpm_runcopies and callcommon::*. For files that don't includecommon/mod.rs(e.g.docker_e2e_pypi), includecommon/oracle.rs, or movesha256_hexthere. - Delete
stderr_chatterand the inline filter. Assert directly onstderr. - Make
rollback_jsonre-exportenvelope::{events, warning_codes, mode_events}. Expressassert_rollback_envelopeasassert_envelope_invariants(v, "rollback")plus its rollback-only checks. - Delete the dead
common::env_mapandupdate_fixture::{raw_asset, delay_asset}.
Size
About 35 test files. About −400 / +30 lines, all mechanical.
Acceptance criteria
grep -rn "fn has_command\|fn sha256_hex\|fn stderr_chatter" crates/socket-patch-cli/testsfinds only thecommondefinitions.- Every suite stays green. Any rollback test that fails under
assert_envelope_invariantsis a real envelope finding, to be reported, not masked.
Metadata
Metadata
Assignees
Labels
agent:triagedarch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)Filed by a scheduled architecture audit routine (see the architecture review discussion)priority:p3refactorStructural change: duplicated code or logic, missing abstraction, layering, dead codeStructural change: duplicated code or logic, missing abstraction, layering, dead code
Activity
mikolalysenko commentedon Nov 1, 2026
[agent] Triage:
priority:p3(test-only helper reuse). No duplicate or open PR found. Follows #1941 (tests/applyfixtures, open PR #1944), which does not cover these suites.Generated by Claude Code