Skip to content

Fix Windows flake in gem global-gemfile refusal e2e - #1169

Merged
Mikola Lysenko (mikolalysenko) merged 1 commit into
mainfrom
ci-janitor/gem-global-gemfile-hermetic
Oct 8, 2026
Merged

Mikola Lysenko (mikolalysenko) merged 1 commit into
mainfrom
ci-janitor/gem-global-gemfile-hermetic

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

gem_hosted_global_gemfile_setting_is_refused (crates/socket-patch-cli/tests/e2e_redirect_gem_stale_install.rs) fails now and then on the test (windows-latest, 2) leg. It caused 2 merge-queue evictions on 2026-10-08:

Neither PR touches gem code. Both failures have the same signature:

panicked at e2e_redirect_gem_stale_install.rs:1027:13:
the global gemfile setting must be refused: {"status":"error","scannedPackages":0, ... "redirect":{..."warnings":[]...}

In the second failure the test ran for about 10.8s (20:19:53 to 20:20:04). Every other test in the binary finished in under a second.

Root cause

The test writes a Gemfile/Gemfile.lock pair plus a global BUNDLE_GEMFILE: Gemfile.next. The scan correctly refuses the lock (gem_lock_unsupported), so the lock contributes no packages. The scan only got as far as the batch call, the redirect stage and the redirect_gem_bundle_gemfile_unsupported refusal because it found the host's globally installed gems through gem env gemdir/gempath. Locally on Linux that gives scannedPackages: 17, all of them system gems.

On Windows runners, gem env (a gem.cmd shim starting Ruby) sometimes takes longer than PROBE_TIMEOUT (10s, utils/process.rs). When that happens the scan finds 0 packages, makes no batch call and runs no redirect, so the expected warning never appears. The test was quietly depending on how fast the CI runner's Ruby install starts.

Fix

Lay the gem down in the project's bundler deployment layout with the existing materialize_installed_gem helper, as the other tests in this file already do. The scan then finds stale-probe-gem without asking the host. The production code path is unchanged. Every assertion is unchanged: refusal code and detail, redirected == 0, Gemfile and lock byte-identical, nothing attested, non-zero exit.

Proof

  • Reproduced the CI failure locally by hiding gem from the child process: PATH=/nonexistent on the test binary, on origin/main. Result: FAILED, with the same scannedPackages:0 / empty redirect.warnings envelope as on CI.
  • With the fix: 50/50 passes with PATH=/nonexistent (no gem) and 100/100 passes with the normal PATH.
  • The whole e2e_redirect_gem_stale_install binary passes (37/37).
  • rustfmt --check on the touched file passes, and so does cargo clippy -p socket-patch-cli --test e2e_redirect_gem_stale_install -- -D warnings.

No tests were removed or moved; the test still runs in the same test (*) legs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xr7gMxM5ugBStCpk6kJ3V4


Generated by Claude Code

gem_hosted_global_gemfile_setting_is_refused only reached the redirect
stage because the scan found the host's globally installed gems via
`gem env`: the refused lock contributes no packages, so without an
installed package no batch call fires and the refusal never runs.

On Windows runners `gem env` sometimes outlives the 10s probe budget.
The scan then reports scannedPackages: 0 and the test fails. This
evicted two merge-queue entries on 2026-10-08 (#1147 and one at
17:31 UTC).

Lay the gem down in the project with materialize_installed_gem, as
the other tests in this file do, so the test no longer depends on
the host's Ruby install.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xr7gMxM5ugBStCpk6kJ3V4
@mikolalysenko Mikola Lysenko (mikolalysenko) added the ci-janitor Opened by the CI janitor routine (flakes, redundant tests, CI perf) label Oct 8, 2026
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

bugbot run


Generated by Claude Code

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 818923f. Configure here.

@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Oct 8, 2026
@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Oct 8, 2026
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

Burn-down agent: labeled Ready for review at 818923f.

  • CI: all check suites on the head are success (204 check runs, ci-ok success); no main-wide failures.
  • Bugbot: reviewed this head (Cursor check success); no unresolved review threads.
  • Mergeable, no CHANGELOG.md change.
  • Slack announcement not sent this run (Slack send tool unavailable); the next run will retry.

Generated by Claude Code

Merged via the queue into main with commit 5d03e0e Oct 8, 2026
204 checks passed
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the ci-janitor/gem-global-gemfile-hermetic branch October 8, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-janitor Opened by the CI janitor routine (flakes, redundant tests, CI perf) Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants