GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use tests/common's binary() and git_sha256 in 40 more CLI tests (#824) by mikolalysenko · Pull Request #1258 · SocketDev/socket-patch

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 9, 2026 •
edited by cursor Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

LLM Description written by Claude Code:claude-opus-5-5

Refs #824 (children 2–3, slice 2; the tracker stays open for the files that open PRs change).

Summary

Forty more CLI test files drop their private binary() and git_sha256 and import the ones in tests/common instead. Standalone test binaries declare #[path = "common/mod.rs"] mod common;; directory binaries (apply/, cli/, get/, remove/, repair/, rollback/, scan/, e2e_vex_lockfile/) use crate::common. The two pnpm build suites keep their SOCKET_PATCH_PNPM_E2E_SOCKET_BIN override, renamed to socket_bin() so it no longer looks like a copy. The shared_helper_copies ratchet drops the 40 migrated files.

Why

  • Issue: Tracking: share CLI test helpers through one test-support module instead of 100+ per-file copies #824 (register C30, register/20-audit-core.md; living document doc/08-tests-ci-docs.md, shared test support). It follows Use tests/common's binary() and git_sha256 in CLI tests (#824) #1124, which moved the first ~75 files.
  • Leverage: B 0, U 0 (the test-binary merge, C31, waits on Mirror global flags into the environment once before dispatch, and read the lock timeout through one accessor #794), D 56 duplicate helper bodies collapsed (31 binary(), 25 git_sha256), S 0, R L (test-only). It ranked first among candidates whose files no open PR changes. Every production candidate with higher B or U (the manifest-load cluster An unparseable .socket/manifest.json is reported under five different --json error codes depending on the command #931/apply, apply --check and vendor report noManifest (exit 0) when .socket/manifest.json exists but can't be stat'd #998/scan reads a corrupt manifest as empty, so --prune skips GC and reports success #1063/A directory at .socket/manifest.json exits 2 with no --json output when --manifest-path spells the path, but exits 1 with manifest_unreadable under the default path #1123, Locate hosted Maven pom edits and their upstream restore through the formats::maven element scanner #717, Upstream restore sends every public-registry lookup at once; the registry_concurrency cap has no caller #1220, Chunk patch batch searches through one core helper with one set of batch limits #675, Mirror global flags into the environment once before dispatch, and read the lock timeout through one accessor #794) overlaps an open PR.

What changed

  • 40 test files: private helpers deleted, shared ones imported; unused sha2/PathBuf imports removed.
  • 9 standalone e2e suites take cache_env/hermetic through common instead of loading them twice (189dddb, from the final review).
  • tests/cli/shared_helper_copies.rs: 40 entries removed from PENDING_PRIVATE_HELPERS (31 left: 27 files changed by open PRs, and 4 shared modules whose includers don't all declare mod common).

Deleted

git diff --stat origin/main: 41 files, +152/−421 (after 189dddb), all under crates/socket-patch-cli/tests. Production: 0 lines.

Behavior

None. Every removed git_sha256 was the Git-blob SHA-256 (SHA256("blob <len>\0" ++ bytes)) or a call to compute_git_sha256_from_bytes; tests/common's own tests pin both shapes as equal. Every removed binary() returned env!("CARGO_BIN_EXE_socket-patch") as a PathBuf or &'static str, and every caller compiles against the PathBuf version.

Test evidence

  • cargo test -p socket-patch-cli --all-features --no-run on all 34 touched targets: no warnings.
  • cargo test -p socket-patch-cli --all-features on the same targets plus spawn_env_hygiene: all pass (apply 119, cli 97 including the ratchet, get 81, remove 99, rollback 57, scan 120, e2e_vex_lockfile 344, vendor_jvm_cli 50, e2e_vendor_pnpm_build 49, e2e_vendor_pypi_build 52, …). The only failures are the 2 root-only repair tests (repair_exits_zero_and_stays_quiet_when_lock_file_unremovable, repair_cleanup_failure_is_reported_in_json_and_silent_modes). They fail the same way on main because the sandbox runs as root, and their files are not changed here.
  • cargo clippy --workspace --all-features -- -D warnings: clean.
  • rustfmt was run only on the touched files whose main copy was already rustfmt-clean (all 41).

Risk

Low. Test-only, mechanical, and the compiler checks every call site. The ignored e2e bodies (docker, toolchain builds) are compiled but not run here; they call the same helpers as before.

🤖 Generated with Claude Code


Note

Low Risk
Test-only mechanical deduplication; shared helpers are already pinned by tests/common and the ratchet test.

Overview
Forty CLI integration/e2e tests now import shared binary() and git_sha256() from tests/common instead of maintaining local copies. Standalone test binaries add #[path = "common/mod.rs"] mod common; nested suites under apply/, cli/, get/, etc. use crate::common. Several e2e suites also pull cache_env / hermetic through common so those modules are not loaded twice.

The shared_helper_copies ratchet drops the 40 migrated paths from PENDING_PRIVATE_HELPERS, leaving only files still pending or blocked by other PRs.

pnpm build e2e keeps the SOCKET_PATCH_PNPM_E2E_SOCKET_BIN override but renames the local helper to socket_bin() so it is not confused with the shared binary().

No production or CLI runtime behavior changes—duplicate helper bodies and unused sha2 imports are removed only.

Reviewed by Cursor Bugbot for commit 189dddb. Configure here.


Generated by Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Claude (claude) added 2 commits October 9, 2026 10:11
@claude
Start refactor for #824
ef15e7e
Assisted-by: Claude Code:claude-opus-5-5
@claude
Use common binary() and git_sha256 in 40 tests
bad5ac2
Forty more CLI test files drop their private copies of binary() and
git_sha256 and import tests/common's instead, so a change to how the
tests find the binary or hash a blob is made in one place. The two
pnpm build suites keep their SOCKET_PATCH_PNPM_E2E_SOCKET_BIN override
as a named socket_bin() helper. No test changes what it asserts.

The shared_helper_copies ratchet drops the migrated files; the 27
files open PRs change and the 4 shared modules stay listed.

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko Mikola Lysenko (mikolalysenko) added refactor Structural change: duplicated code or logic, missing abstraction, layering, dead code arch-refactor PR opened by the scheduled architecture refactor routine labels Oct 9, 2026
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 9, 2026
Tracking: share CLI test helpers through one test-support module instead of 100+ per-file copies #824
Closed
7 tasks
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review October 9, 2026 10:13
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

cursor[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Mikola Lysenko (mikolalysenko) pushed a commit that referenced this pull request Oct 9, 2026
@claude
refactor: run 20261009T101429Z (#1258, #1227 merged)
b1a0a27
Assisted-by: Claude Code:claude-opus-5-5
cursor[bot]
cursor Bot reviewed Oct 9, 2026
View reviewed changes

@cursor cursor Bot left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Oct 9, 2026
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

Labeled Ready for review by the burn-down agent.

  • Head: bad5ac25b37969fbb56747cb7ed625d781db3790
  • CI: all 293 check runs on this head completed success/skipped/neutral; no merge conflict with main.
  • Bugbot: reviewed this head, no findings; no unresolved review threads.
  • CHANGELOG.md untouched.

Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

Final review brief (bad5ac25b)

What it does: 40 socket-patch-cli test files drop their private binary() and git_sha256 copies and use the shared ones from tests/common (more of #824). The shared_helper_copies ratchet loses the matching 40 entries. The two pnpm build suites keep their SOCKET_PATCH_PNPM_E2E_SOCKET_BIN override, now as socket_bin().

Risk: low. Test-only and mechanical: 41 files, +142/−401, no production code. Every removed copy matched the shared helper. git_sha256 was always SHA256("blob <len>\0" + content) or compute_git_sha256_from_bytes, and binary() was always CARGO_BIN_EXE_socket-patch. The compiler checks every call site, and no assertion was removed.

Look here:

  • tests/common/mod.rs:46 binary and :126 git_sha256: the shared helpers. The module is #[allow(dead_code)] (:17).
  • e2e_vendor_pnpm_build.rs:106: socket_bin() keeps the env override, and no bare binary() call is left in either pnpm suite.
  • cli/shared_helper_copies.rs:16:`` the ratchet list.
  • e2e_gem.rs:21-32: the wiring pattern; see the note below.

Verified: Compared every removed helper line by line with the shared one. cargo test -p socket-patch-cli --all-features --no-run builds all 29 touched targets with no warnings. Ran 10 of them, all passing: cli (incl. the ratchet), rollback, scan, e2e_vex_lockfile, e2e_vendor_pnpm_build, vendor_jvm_cli, cli_scan_silent, covgap_commands_scan_mod, mode_migration_cargo, e2e_gem. CHANGELOG.md untouched. CI 293/293 success/skipped (ci-ok, clippy green), Bugbot success, no review threads, mergeable.

Changes I made: none.

Open questions / non-blocking note: 9 standalone files now pull in common/mod.rs (which already has pub mod cache_env/hermetic) and also keep their own #[path = "common/cache_env.rs"]/hermetic.rs mods: e2e_gem, e2e_npm, e2e_pypi, e2e_redirect_{gem,gradle}build, e2e_scan, e2e_vendor{composer,pnpm,pypi}_build. That adds clippy::duplicate_mod hits, and 6 targets that were clean now fail under local cargo clippy --all-targets. CI's clippy runs without --all-targets (ci.yml:81), and main already has 312 such errors, so nothing gates on this. A later #824 pass can switch those files to use common::{cache_env, hermetic};. e2e_gem.rs also keeps a private git_sha256_file, which is outside this PR's scope.

Auto-merge is armed, so approving sends it straight to the merge queue.


Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Mikola Lysenko (mikolalysenko) enabled auto-merge October 9, 2026 12:24
@claude
Reach cache_env and hermetic through common
189dddb
Nine standalone e2e suites now include common/mod.rs, which already
declares cache_env and hermetic, yet still loaded those two files a
second time through their own #[path] mods (clippy::duplicate_mod under
--all-targets). They take common's modules instead.

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

[agent] Addressed the final-review note in 189dddb: the 9 standalone suites (e2e_gem, e2e_npm, e2e_pypi, e2e_redirect_{gem,gradle}build, e2e_scan, e2e_vendor{composer,pnpm,pypi}_build) now take use common::{cache_env, hermetic} instead of re-loading those files through their own #[path] mods, so the cache_env.rs/hermetic.rs duplicate_mod hits are gone. All 9 targets pass (cargo test -p socket-patch-cli --all-features).

One duplicate_mod hit of the same kind remains under --all-targets: common/jvm_env.rs is loaded by both common/mod.rs and the shared prebuilt_common/mod.rs in the four suites that include both modules. e2e_vex_lockfile/main.rs on main already has this pattern. Fixing it means changing prebuilt_common, whose includers don't all declare mod common, so it stays for a later #824 pass. e2e_gem.rs's private git_sha256_file is also left for that pass.


Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

cursor[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Oct 9, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 189dddb. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mikolalysenko
Mikola Lysenko (mikolalysenko) disabled auto-merge October 9, 2026 12:52
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

[final reviewer] Disarmed auto-merge: the head moved from bad5ac25b (my brief) to 189dddb, a non-merge commit that addresses the brief note (shared cache_env/hermetic helpers in 9 standalone suites). ci-ok hasn't finished on the new head yet. I'll re-review the delta and re-arm once CI is green and the brief is updated.


Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 9, 2026
Tracking: assert stable codes instead of human sentences in CLI tests, and fold the covgap suites #1089
Open
14 tasks
Tanmay182003
Tanmay Singla (Tanmay182003) approved these changes Oct 9, 2026
View reviewed changes
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 9, 2026
Read --json envelopes in CLI tests through one tests/common/envelope module (#1089) #1272
Merged
@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Oct 9, 2026
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 9, 2026
Retry CI toolchain installs past rustup download blips #1286
Merged
Merged via the queue into main with commit 88d5c59 Oct 9, 2026
253 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the arch-refactor/824-shared-test-helpers-2 branch October 9, 2026 15:00
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 11, 2026
CI: share test helpers in 17 more test files (#824) #1402
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments
@Tanmay182003 Tanmay Singla (Tanmay182003) Tanmay182003 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

arch-refactor PR opened by the scheduled architecture refactor routine Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review refactor Structural change: duplicated code or logic, missing abstraction, layering, dead code

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mikolalysenko @Tanmay182003 @claude
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.