Repository navigation
CI: hermetic spawns in apply/rollback tests (#823) - #1405
Merged
Mikola Lysenko (mikolalysenko) merged 3 commits intoOct 12, 2026
Merged
Conversation
Assisted-by: Claude Code:claude-opus-5-5
5 tasks
The apply, rollback, remove and get test suites spawned socket-patch with a bare Command::new. Most swept SOCKET_* by hand, but apply_invariants and in_process_npm_multicopy did not, so a developer shell exporting SOCKET_DRY_RUN, SOCKET_JSON or SOCKET_ECOSYSTEMS failed 15 of their tests for reasons unrelated to the code under test. All 14 files now spawn through the shared hermetic builder in tests/common/hermetic.rs and leave PENDING_RAW_SPAWNS, so the ratchet keeps them hermetic. The gem suites' private BUNDLE_* sweep becomes Extra::Bundle, with its own contract test. get_edge_cases_e2e was already hermetic; it was only listed because a comment quoted the bare-spawn spelling the detector matches. Refs #823 Assisted-by: Claude Code:claude-opus-5-5
Review follow-ups: the gem variant-mismatch suite now drops ambient BUNDLE_* too, so a developer's BUNDLE_PATH can't aim its apply at a real gem store. Extra::Bundle seeds BUNDLE_APP_CONFIG, which the gem crawler actually reads, so a dropped scrub line fails loudly. Remove env lines the hermetic builder already covers and rewrap the edited comments. Refs #823 Assisted-by: Claude Code:claude-opus-5-5
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 12, 2026 00:06
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 49e78d7. Configure here.
Wenxin Jiang (Wenxin-Jiang)
approved these changes
Oct 12, 2026
Collaborator
Author
|
Ready for review (burn-down agent)
Generated by Claude Code |
Mikola Lysenko (mikolalysenko)
deleted the
agent/fix-ci-hermetic-apply-rollback
branch
October 12, 2026 02:57
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 3; the issue stays open for the remaining files).
What it does
Test-only. The
apply/,rollback/,remove/andget/suites spawnedsocket-patchwith a bareCommand::new. Most sweptSOCKET_*by hand, butapply_invariantsandin_process_npm_multicopydid not, so a shell exportingSOCKET_DRY_RUN,SOCKET_JSONorSOCKET_ECOSYSTEMSfailed 15 of their tests for reasons unrelated to the code under test.common::hermetic_command. Their hand-rolled sweeps, hostile seeds and duplicateSOCKET_TELEMETRY_DISABLED/SOCKET_CLI_API_TOKENlines are gone, because the builder already forces or removes those.hermetic::Extra::Bundlereplaces the gem suites' privateBUNDLE_*sweep (4 files). It seedsBUNDLE_APP_CONFIG, which the gem crawler reads, and then scrubs it.cli_gem_variant_mismatch_policyhad noBUNDLE_*scrub before and now gets one.spawn_env_hygienegains a contract test for it.get/get_edge_cases_e2e.rswas already hermetic (it usescommon::run_with_env). It was on the list only because a comment quoted the bare-spawn spelling the detector matches, so that comment is reworded.PENDING_RAW_SPAWNS(140 → 126), so the ratchet keeps them hermetic.Left out to avoid conflicts:
apply/apply_network.rsandrollback/rollback_multicopy_blob_gate.rs, both changed by open PR #1402.Evidence (red → green)
Hostile shell:
SOCKET_DRY_RUN=true SOCKET_JSON=true SOCKET_ECOSYSTEMS=cargo SOCKET_OFFLINE=true BUNDLE_PATH=/nonexistent/bundle.apply(migrated files)apply_invariants, 9in_process_npm_multicopy)rollback,remove,getapply_network(9 more failures under that shell, on both main and this branch) is the excluded file above.Normal environment:
spawn_env_hygiene14 passed,apply132 passed (1 ignored),rollback57 passed,remove99 passed,get86 passed.cargo fmt --all -- --checkis clean. Running clippy on these test targets reports only findings that are already on main, in the unchangedcommon/mod.rsandprebuilt_common/mod.rs. CI's clippy job does not lint test targets.CI on 49e78d7: all 86 checks either passed or were skipped (including
ci-okandclippy). Bugbot found no issues./code-review high
I fixed these findings in 49e78d7: the missing
BUNDLE_*scrub incli_gem_variant_mismatch_policy, a hostile seed the crawler didn't read, deadSOCKET_CLI_API_TOKEN/ telemetry lines, and comments that ran past the wrap width. I left these out on purpose:BUNDLE_*inhermetic::commandfor every child. Suites that userun_with_envget no bundler scrub. For example,check_verifies_installed_tree::check_fails_on_an_unpatched_copy_in_a_refused_bundle_pathfails under an ambientBUNDLE_APP_CONFIG, on main as well as here. Moving the sweep into the shared builder changes the environment of every CLI test child, so it's a follow-up for Spawn every CLI test child through one hermetic Command builder; 10 test files inherit ambient SOCKET_* today #823, not part of this slice.hermetic::binary_command()instead ofhermetic_command(&binary()). I kept the spelling slice 2 (CI: hermetic spawns in scan/repair tests (#823) #1398) used. A tree-wide switch can be its own cleanup.rollback_cmdbetween the two rollback invariant files. That's a helper refactor and out of scope here.CI cost
No workflow change. A lean PR run is unchanged: same jobs, roughly the same job-minutes (about 28 Linux jobs, about 8 min wall time).
🤖 Generated with Claude Code
https://claude.ai/code/session_013sMuYxiSNRUULtv88CtBGM
Generated by Claude Code