Repository navigation
Keep test children off production telemetry and fail e2e legs that run no tests - #1046
Merged
Merged
Conversation
Test child processes inherited no telemetry opt-out: the hermetic helper kept SOCKET_TELEMETRY_DISABLED out of its scrub but never set it, and .cargo/config.toml [env] only carried SOCKET_NO_CONFIG and SOCKET_NO_UPDATE_CHECK. An unauthenticated run with no mocked proxy URL POSTs its events to patches-api.socket.dev (audit B69). Set SOCKET_TELEMETRY_DISABLED=1 in the workspace [env] table and force it in hermetic::command. Suites that assert telemetry already opt back in with SOCKET_TELEMETRY_DISABLED=0 (or remove it) and a wiremock endpoint, and caller env still lands last. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The e2e runner failed a suite on "0 passed" only in Gradle legs, so a renamed module, a dropped #[ignore] under the default --ignored selector or a stale test_filter turned any other leg into a green 0/0. Apply the check to every suite in every leg (e2e and e2e-full share the steps). Every e2e and e2e-full leg on recent runs passes at least one test. The Windows e2e_redirect_npm_build leg skipped every test: the suite spawned a bare "npm", which Command::new cannot resolve to the npm.cmd shim, and the leg had no npm_required. Resolve npm from PATH with utils::process::resolve_tool (PATHEXT-aware, the CLI's own lookup) and set npm_required on the Windows row too (audit B70). Drops the now-unused E2E_JVM_TOOL env. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The digest ratchet failed with a bare assert_eq of two lists, so a stale entry (three of them reddened main after a merge burst, B01) read the same as a new inline copy. Split it the way the spawn-hygiene ratchets already do, and make all three messages name the files, the list constant and its source file, and the fix: use the shared helper for a new copy, delete the entry (after a rebase) for a stale one. The stale-entry check stays. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
clap reads every env-bound flag at parse time, and these two suites parsed argv with whatever SOCKET_* the test process carried. With the workspace SOCKET_TELEMETRY_DISABLED=1 default every parse came back with --no-telemetry set. Add hermetic::scrub_process_socket_env, the in-process half of hermetic::command (one-shot, so no parse reads the env while it changes), and route every parse in both suites through it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The e2e, e2e-full, cargo-vex-matrix(-full) jobs and the nine *-compatibility workflows launch the prebuilt test binaries themselves, so .cargo/config.toml [env] never reaches them; their env blocks copy that table by hand and were missing SOCKET_TELEMETRY_DISABLED. Add it to every copy, and add a test that fails when a workflow env block sets one of the three opt-outs without the other two (B69). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
cli_parse_apply and cli_parse_rollback each defined the same scrubbed Cli::try_parse_from wrapper; keep one copy in common/hermetic.rs. Also rewrap the hermetic::command doc comment. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 7, 2026 16:24
Collaborator
Author
|
bugbot run 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 5ad1365. Configure here.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Tanmay Singla (Tanmay182003)
approved these changes
Oct 7, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 8, 2026
Carry SOCKET_TELEMETRY_DISABLED into the e2e-macos and cargo-vex-matrix-macos env blocks that #1093 split out, so spawn_env_hygiene::workflow_env_copies_carry_every_opt_out holds. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Problem
From the architecture audit (theme: tests and CI):
tests/common/hermetic.rskeptSOCKET_TELEMETRY_DISABLEDout of its scrub but never set it, and.cargo/config.toml[env]only setSOCKET_NO_CONFIGandSOCKET_NO_UPDATE_CHECK. An unauthenticated run with no mocked proxy URL POSTs to patches-api.socket.dev.e2e_redirect_npm_buildleg skipped all 6 capstones on every PR: the suite spawned a barenpm, whichCommand::newcan't resolve tonpm.cmd, and the row had nonpm_required. The comment pointing at docs/testing/npm-compatibility.md was stale; that file never mentions Windows.PENDING_INLINE_DIGESTSratchet failed with a bareassert_eq!of two lists. A stale entry (the cause of the red main fixed in Fix main CI red on stale digest pending-list entries #1016) looked the same as a new inline copy.Change
SOCKET_TELEMETRY_DISABLED = "1"is now in the workspace[env]table, andhermetic::commandforces it.[env]covers every child of a test that cargo launches, including the ~150 files still on the raw-spawn list. It does not reach the CI legs that run the prebuilt test binaries directly (e2e,e2e-full,cargo-vex-matrix,cargo-vex-matrix-fullin ci.yml, and the nine*-compatibility.ymlworkflows). Their env blocks copy the[env]table by hand, so each copy now setsSOCKET_TELEMETRY_DISABLED: '1'too (13 blocks). A new test,workflow_env_copies_carry_every_opt_out, fails if any workflow env block sets one of the three opt-outs without the other two, so the copies can't drift again (checked failing-first by deleting one line). Suites that assert telemetry already opt back in aftercommandwithSOCKET_TELEMETRY_DISABLED=0or by removing it, plus a wiremock endpoint: telemetry_e2e, cli_config_fallback, covgap list, cli_parse_list, repair lifecycle. Caller env still lands last.cli_parse_applyandcli_parse_rollbackparsed--no-telemetryas set once the default was in place. They were also exposed to any developer'sSOCKET_*shell. Newhermetic::scrub_process_socket_env()is the in-process half ofhermetic::command: it runs once, so no parse reads the env while it changes.hermetic::try_parsewraps it aroundCli::try_parse_from, and every parse in both suites goes through that one wrapper.ci.yml"Run e2e tests" now fails any suite in any leg that reports0 passed.e2eande2e-fullshare these steps. I checked recent logs (PR run 37549486021, 155 e2e legs; nightly 37269953509, 30 e2e-full legs) and every leg passes at least one test, so no row trips the guard today. The unusedE2E_JVM_TOOLenv is removed.npm_e2e_common::npm_program()(and the lock-writer probe) resolve npm throughsocket_patch_core::utils::process::resolve_tool, the CLI's own PATHEXT-aware lookup, so Windows findsnpm.cmd. The Windows row now setsnpm_required: '1'.PENDING_INLINE_DIGESTS,PENDING_SCRUB_COPIES,PENDING_RAW_SPAWNS) now name the files, the constant, the source file and the fix: use the helper, or rebase and delete the entry. The stale-entry check is kept, as asked.Duplicate copies: none deleted. In-process
SOCKET_*scrub strategies go from 5 to 6: the fiveEnvScrub/SOCKET_ENV_VARScopies (cli_parse_get, cli_parse_repair, cli_parse_vendor, cli_parse_vex, remove_rollback_api_overrides) restore the env with an RAII guard, while the new sharedhermetic::scrub_process_socket_envremoves it once and never restores it. The new one exists once, incommon/hermetic.rs. Moving the five onto it is listed under Deferred.Overlap with #1018: that PR also edits
ci.yml, at the top (on/permissions) and around lines 2068-2110 and 2296+. My edits are confined to the e2e matrix comment and row (~958-969) and the e2e run step (~1625-1650), so the two should merge cleanly. #1016 (stale digest entries) is already on main; #1015 touches a different hunk of digest.rs.Testing
All run on macOS arm64 in the worktree, through the heavy-job limiter, with
CARGO_INCREMENTAL=0:cargo test -p socket-patch-cli --test spawn_env_hygienefailed both new tests,command_forces_telemetry_offandcargo_config_env_carries_the_opt_outs. After the fix: 11/11.cargo test --workspace --no-fail-fast: everything passes exceptcli_parse_applyandcli_parse_rollback, which the default broke and change 2 fixes (now 43/43 and 38/38);e2e_vendor_cargo_buildold-toolchain cells fail with "Bad CPU type" (x86_64 rustup 1.41 on arm64).mode_migration_npm::berry_vendored_then_hosted_takeover_leaves_pure_hostedfails the same way withSOCKET_TELEMETRY_DISABLED=0(local yarn 4.12; not this change).SOCKET_PATCH_NPM_E2E_REQUIRED=1 cargo test -p socket-patch-cli --test e2e_redirect_npm_build --test e2e_vendor_npm_build -- --include-ignored: 15/15 and 22/22. This exercises the new npm resolution.cargo clippy --workspace --all-features(the CI form): the only warning is the pre-existing macOS-onlyunused variable: unix_defaultin python_crawler.rs, which this PR doesn't touch.cargo clippy -p socket-patch-core -p socket-patch-cli --testsgives no diagnostics in any touched file. (--all-targets -D warningson this toolchain stops at about 20 pre-existing test-target lints in untouched core files.)python3 -m unittest discover -s scripts/tests -p 'test_ci_*.py': 43 OK.cargo test -p socket-patch-cli --test spawn_env_hygiene --test cli_parse_apply --test cli_parse_rollback: 12/12, 43/43, 38/38.cargo clippy -p socket-patch-cli --tests: no diagnostics in any touched file. Ranworkflow_env_copies_carry_every_opt_outwith one copy removed from go-compatibility.yml: it fails and names the block.e2e_redirect_npm_buildleg, which now really runs npm withnpm_required, and the generalized guard on every Linux/macOS/Windows leg.Deferred
EnvScrub/SOCKET_ENV_VARScopies ontohermetic::scrub_process_socket_env(or a restoring variant). This is Tracking: share CLI test helpers through one test-support module instead of 100+ per-file copies #824-adjacent test-helper consolidation.passed > 0guard can't see it, and rows without a_REQUIREDgate (e.g.e2e_redirect_rush_sim) can still go green having tested nothing.e2e_redirect_npm_buildleg has never run withnpm_required, locally or in CI yet (PR CI was still queued at this update). It must be green before merge. If it fails on real Windows npm bugs, either fix them or dropnpm_requiredon that one row with a tracking issue, and keep theresolve_toolchange.🤖 Generated with Claude Code
Note
Low Risk
Changes affect test/CI hygiene and workflow guards only; production telemetry behavior for real users is unchanged, and telemetry suites can still opt in explicitly.
Overview
Stops test and CI runs from posting telemetry to production by defaulting
SOCKET_TELEMETRY_DISABLED=1in.cargo/config.toml, forcing it inhermetic::command, and mirroring that opt-out across workflow env blocks that run prebuilt e2e binaries. New spawn-hygiene tests lock in the three-way opt-out set and scan workflows so partial copies cannot drift.Parser contract tests now use
hermetic::try_parse(with one-time in-processSOCKET_*scrubbing) so workspace defaults like--no-telemetrydo not change clap snapshots.CI reliability: the e2e runner fails any leg where a suite reports 0 passed (not only Gradle). Windows
e2e_redirect_npm_buildresolves npm via PATHEXT-awareresolve_tooland setsnpm_required: '1'so the leg cannot soft-skip. Digest and spawn-hygiene ratchets emit clearer fix/rebase messages instead of bare list diffs.Reviewed by Cursor Bugbot for commit 5ad1365. Configure here.
Generated by Claude Code