Skip to content

Fix Go GOWORK test failing on macOS nightly - #1894

Merged
Mikola Lysenko (mikolalysenko) merged 1 commit into
mainfrom
ci-janitor/go-gowork-symlinked-tmp
Nov 2, 2026
Merged

Mikola Lysenko (mikolalysenko) merged 1 commit into
mainfrom
ci-janitor/go-gowork-symlinked-tmp

Conversation

@mikolalysenko

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

Copy link
Copy Markdown
Collaborator

Problem

The nightly CI run on main (41009903891) failed test (macos-latest, 2) with -p socket-patch-cli --test e2e_golang_workspace_build. It is the first nightly after #1812 (merged 2026-10-29 13:24 UTC), which added apply_never_writes_go_work_when_gowork_names_a_sibling_file. The 10-29 nightly passed on macOS. The test is deterministic, so every nightly will fail until it's fixed. Nightly CI on main has been red for 8 days in a row; the other failing leg (Windows crawler_maven_e2e) is handled by #1852.

Root cause

The test sets GOWORK to <tempdir>/ws/ci.work and then runs go run ./a with its working directory set inside that tempdir. go reads its working directory with symlinks resolved. On macOS the tempdir is under /var, which is a symlink to /private/var, so go sees the member at /private/var/... and the workspace at /var/.... It refuses the member:

directory a is contained in a module that is not one of the workspace modules listed in go.work.

This is a test harness problem. socket-patch's own checks (same_dir_key) already canonicalize paths. Linux PR and merge-queue legs never caught it because their tempdir has no symlink.

Fix

On Unix, stage this test under the canonicalized tempdir. Windows keeps the plain path, because canonicalize there returns a \\?\ path that go can't use. The Windows leg passes today.

Proof

Reproduced on Linux by pointing TMPDIR at a symlink, which mimics macOS:

TMPDIR symlinked plain TMPDIR
before (main) FAILED 2/2, same go error ok
after ok 5/5, plus the full file 31/31 ok

rustfmt --check is clean on the touched file. cargo clippy --test e2e_golang_workspace_build reports no findings in this file. The only findings are pre-existing ones in tests/prebuilt_common/mod.rs, and main has the same ones on the local 1.93 toolchain.

No tests were removed or moved.


Generated by Claude Code


Note

Low Risk
Test-only harness change in one e2e; no production code paths modified.

Overview
Fixes macOS nightly failures in apply_never_writes_go_work_when_gowork_names_a_sibling_file by staging the workspace under a canonical temp path on Unix instead of the raw tempfile path.

The test sets GOWORK to a sibling ci.work and runs go from member dirs; Go resolves the working directory through symlinks, so on macOS (/var → /private/var) the workspace file and member paths no longer matched and go run failed. Windows is unchanged—still uses the non-canonical path because canonicalize yields \\?\ paths Go rejects.

Staging and run_member now use this base path; assertions and product behavior under test are the same.

Reviewed by Cursor Bugbot for commit 15cf91e. Configure here.


Generated by Claude Code

The nightly macOS test leg has failed since #1812 added
apply_never_writes_go_work_when_gowork_names_a_sibling_file. The test
sets GOWORK to a file under the tempdir and then runs go in a member.
go takes its working directory with symlinks resolved, so on macOS
(/var -> /private/var) the member sits outside the workspace GOWORK
names and go refuses it: "directory a is contained in a module that
is not one of the workspace modules listed in go.work".

Stage the test under the canonical tempdir on Unix. Windows keeps the
plain path, where canonicalize would give a \\?\ path go can't use.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011f9aeT7Z8SgtvNfjPY7zCb
@mikolalysenko Mikola Lysenko (mikolalysenko) added the ci-janitor Opened by the CI janitor routine (flakes, redundant tests, CI perf) label Oct 30, 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 15cf91e. Configure here.

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

Copy link
Copy Markdown
Collaborator Author

[burn-down agent] Labeled Ready for review at 15cf91e.

  • CI: 50/50 checks green on 15cf91e; mergeable.
  • Bugbot: reviewed 15cf91e, no findings.
  • Reviewer note: test-only fix; canonicalizes the macOS tempdir so GOWORK matches the cwd Go resolves through /var. Should clear the e2e_golang_workspace_build failure on main's macOS nightly.

Generated by Claude Code

@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

Final review brief

What it does: This is a test-only fix for the GOWORK e2e test that fails on macOS nightly. On Unix the test now stages its workspace under the canonicalized tempdir. go resolves its cwd to /private/var/..., so an explicit GOWORK=/var/... no longer disagrees with it. Windows behaves exactly as before.

Risk: low. Only one test file changes, and no assertion is removed or loosened. The product code already canonicalizes paths (same_dir_key).

Look here

  • e2e_golang_workspace_build.rs:1412:`` base chosen per platform
  • e2e_golang_workspace_build.rs:1489:``` run_member(&base, ...)

Verified: I read the diff and the root cause holds: run_member sets current_dir without PWD, so go's Getwd returns the resolved path. Nothing else in the repo changes, and CHANGELOG.md is untouched. CI is 50/50 green, and Bugbot passed. The macOS leg runs only on nightly or dispatch, so the fix itself will be proven on the first nightly after merge. This is the failure that makes the macOS-only legs red on #1891 and #1896.

Changes I made: none.

Open questions (non-blocking): if a second test ever sets an absolute GOWORK, this should become a small canonical_tmp() helper.

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


Generated by Claude Code

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[agent] Reviewed 15cf91eb3274310a4045bfa928b5ebee0bb27f8b. Checked canonical temporary paths through Go workspace staging, download and member execution. No major correctness issues found. Validation: source and regression-test review plus the available exact-head CI checks; no local test pass is claimed.

@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit ff94955 Nov 2, 2026
50 checks passed
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the ci-janitor/go-gowork-symlinked-tmp branch November 2, 2026 16:22
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