Repository navigation
CI: hermetic spawns in Go test suites (#823) - #1495
Merged
Mikola Lysenko (mikolalysenko) merged 3 commits intoOct 13, 2026
Merged
Conversation
Assisted-by: Claude Code:claude-opus-5-5
This was referenced Oct 13, 2026
The four Go suites started socket-patch with a bare Command::new and their own SOCKET_* handling, which had drifted from the shared tests/common/hermetic.rs: e2e_golang and the vendor redirect suite removed only a hand-picked list of vars, so any other ambient SOCKET_* (dry run, manifest path) reached the child, and none forced the update notifier off. A developer's shell could silently change what these tests exercise. They now start from hermetic::command and keep only their Go env (GOMODCACHE, GOPATH, GOFLAGS, plus VIRTUAL_ENV via Extra::Venv). The files leave PENDING_RAW_SPAWNS (26 -> 22) so the ratchet keeps them hermetic. Refs #823 Assisted-by: Claude Code:claude-opus-5-5
From /code-review high on the Go hermetic migration: - hermetic::command now removes the SOCKET_CLI_* peer aliases by name, like the flag-bound vars. The binary promotes a peer token onto SOCKET_API_TOKEN, so one set after the command was built put the child on the authenticated path. - e2e_golang's scans are unscoped, so an activated VIRTUAL_ENV added the venv's packages to the batch and broke the exact-PURL checks. Both spawn sites now share one builder that scrubs it. - e2e_golang_build and the vendor redirect suite use the shared common::run_with_env runner instead of private copies, and the redundant SOCKET_DRY_RUN set_var guard is gone (the builder seeds and scrubs it itself). Refs #823 Assisted-by: Claude Code:claude-opus-5-5
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 13, 2026 18:34
Collaborator
Author
|
BugBot review Generated by Claude Code |
There was a problem hiding this comment.
✅ 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 b73ca1a. Configure here.
Tanmay Singla (Tanmay182003)
approved these changes
Oct 13, 2026
Mikola Lysenko (mikolalysenko)
pushed a commit
that referenced
this pull request
Oct 13, 2026
The NuGet and PyPI e2e suites started socket-patch with a bare Command::new and their own partial SOCKET_* scrubs, so a developer's ambient SOCKET_* settings, real `socket login` config or activated venv could change what the tests exercised. They now spawn through the shared hermetic builder, scrub VIRTUAL_ENV, and leave the spawn-hygiene ratchet's pending list (26 -> 22 with #1495's slice). Refs #823 Assisted-by: Claude Code:claude-opus-5-5
Mikola Lysenko (mikolalysenko)
deleted the
agent/fix-ci-hermetic-golang
branch
October 13, 2026 18:59
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.
LLM Description written by Claude Code:claude-opus-5-5
Refs #823 (slice 11; the issue stays open for the remaining
PENDING_RAW_SPAWNSfiles)What
The four Go suites still started
socket-patchwith a bareCommand::newand their own partialSOCKET_*handling, which had drifted fromtests/common/hermetic.rs:e2e_golang.rs: two spawn sites seeded and removed a hand-picked list ofSOCKET_*vars. Any other ambientSOCKET_*(e.g.SOCKET_DRY_RUN,SOCKET_MANIFEST_PATH) reached the child, and nothing forced the update notifier or the config layer off.e2e_golang_build.rs: sweptSOCKET_*but didn't forceSOCKET_NO_CONFIG/SOCKET_NO_UPDATE_CHECK, so a developer's realsocket logincould reach the child.e2e_golang_workspace_build.rs: private sweep plus hand-set opt-outs, no update-check opt-out.vendor/e2e_golang_redirect.rs: removed only six named vars.All four now spawn through the shared builder:
e2e_golangthrough onegolang_commandhelper (also scrubsVIRTUAL_ENV: its scans are unscoped, so an activated venv added packages to the exact-PURL batch),e2e_golang_buildand the vendor redirect suite throughcommon::run_with_env, and the workspace suite throughhermetic::command+Extra::Venv(it needsprebuilt_common::prepare_command). The files leavePENDING_RAW_SPAWNS(26 -> 22), so thespawn_env_hygieneratchet keeps them hermetic.hermetic::commandnow also removes theSOCKET_CLI_*peer aliases (SOCKET_CLI_API_TOKEN& co.) by name, like the flag-bound vars. The binary promotes a peer token ontoSOCKET_API_TOKEN, so one set in-process after the command was built put the child on the authenticated path (found by/code-review high; this suite used to removeSOCKET_CLI_API_TOKENby hand).Test-only change; no product code touched.
CI cost
No workflow change. Lean PR run: same job count and job-minutes before and after (these suites already run in the same jobs).
Test evidence
cargo fmt --all -- --check: clean.cargo clippyon the five touched test targets: same output asorigin/main(the pre-existingduplicate_mod/type_complexitylints in shared test modules; CI'scargo clippy --workspacedoesn't build tests).cargo test -p socket-patch-cli --all-features --test e2e_golang --test e2e_golang_build --test e2e_golang_workspace_build --test vendor --test spawn_env_hygiene -- --include-ignoredwith go 1.24.7, run with a hostile ambient env (VIRTUAL_ENVpointing at a venv holdingrequests-2.31.0,SOCKET_DRY_RUN=true,SOCKET_ECOSYSTEMS=npm,SOCKET_CLI_API_TOKEN=x): 23 + 26 + 16 + 95 + 15 passed, 0 failed.command_drops_flag_bound_vars_set_after_it_is_built(extended with the four peer aliases) fails without thehermetic.rschange (SOCKET_CLI_API_TOKEN set after build leaked) and passes with it. The ratchet's stale-entry check fails if any of the four files is left onPENDING_RAW_SPAWNS.cargo test --workspacedidn't fit the session's disk; CI runs it./code-review high
Fixed: venv leak in
e2e_golang, duplicated env pin across its two spawn sites, private runner copies ine2e_golang_buildand the vendor redirect suite (nowcommon::run_with_env), peer-alias removal by name, and the redundantSOCKET_DRY_RUNset_var guard.Not fixed: sharing the prebuilt-aware runner between
e2e_golang_workspace_buildande2e_vendor_golang_build. That touches a file outside this slice and is a refactor, not a hermeticity gap.🤖 Generated with Claude Code
https://claude.ai/code/session_01FtgsyfBXmzpdFpQSBz4awp
Generated by Claude Code