Repository navigation
tests: fixtures get the physical temporary folder on macOS - #2033
Merged
Merged
Conversation
AbirAbbas
added a commit
that referenced
this pull request
Oct 29, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AbirAbbas
added a commit
that referenced
this pull request
Oct 29, 2026
Its workspace host socket lives under that home. Under macOS's temporary folder the address fit by a few bytes only while the folder was spelled through the /var link; spelled physically (as #2033 makes fixtures), it is too long and the host never listens. A /tmp home fits on every Unix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 29, 2026
Merged
AbirAbbas
added a commit
that referenced
this pull request
Oct 29, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AbirAbbas
added a commit
that referenced
this pull request
Oct 29, 2026
Its workspace host socket lives under that home. Under macOS's temporary folder the address fit by a few bytes only while the folder was spelled through the /var link; spelled physically (as #2033 makes fixtures), it is too long and the host never listens. A /tmp home fits on every Unix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AbirAbbas
added a commit
that referenced
this pull request
Oct 29, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AbirAbbas
force-pushed
the
test/canonical-temp-roots
branch
from
October 29, 2026 23:41
129a69d to
bc4d57d
Compare
Collaborator
Author
|
Closing unmerged: the Mac push stopped early to save usage. What this fixes and what is left is tracked in #2050. The branch |
This was referenced Oct 29, 2026
AbirAbbas
added a commit
that referenced
this pull request
Nov 2, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AbirAbbas
force-pushed
the
test/canonical-temp-roots
branch
from
November 2, 2026 13:35
bc4d57d to
1dd5494
Compare
macOS sets TMPDIR to /var/folders/.../T/, reached through the /var -> /private/var link. 101 tests in nine packages compared a raw t.TempDir() with a path the product resolved, or met the product's deliberate refusal of a binding that traverses a link, and failed on every Mac run; all of them pass when the test binary starts with a link-free TMPDIR. internal/testutil.CanonicalizeTempRoots resolves a set TMPDIR and GOTMPDIR and rewrites them only when the physical spelling differs, so it writes nothing on Linux or wherever the folder is already physical. TestMain calls it first in workspaceidentity, taskcopy, syncsetup, cellstore and handoff (new), and in session, tui3, cmd/codeaf and run (after any child-process dispatch). No product code or Makefile changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…scratch roots follow Review found three gaps. The helper also rewrote a linked, relative or missing root on Linux, so it was not the no-op it claimed; it now returns at once on every system but macOS, and a Linux test pins that. filepath.Abs cleaned a ".." before links were followed, which could name another folder; links are now resolved first. tui3 reads its scratch roots at package initialisation, before TestMain, so they kept the alias while fixtures moved to the physical folder; its TestMain refreshes that root. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lias case Review round 2: filepath.Abs anchored a relative root to the working directory's logical spelling, which can name another folder; a relative root is now left exactly as given (launchd always sets an absolute TMPDIR). The other-systems test no longer needs link privileges on Windows: its alias case runs only where a link can be made. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TestRemovedComputerReopensWithTheSameProjectLabel/project checks the hint row for "project: " and the chat's t.TempDir(). With the physical /private/var/folders spelling this PR gives tui3's TestMain, that folder, named after the test, is longer than a 160-column row leaves for the project, so the label was elided and the check failed on macOS. The frame is now 260 columns, as the package's other project-label tests draw it. The label itself is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shortStateRoot and shortEngineHome exist so a workspace host's socket fits the 104-byte limit. Under the physical /private/var/folders spelling this PR gives cmd/codeaf's TestMain, host.sock lands a few bytes past it, and the host, environment, cells and stale-socket tests failed with "too long a path for a socket". On macOS both roots are now made under /tmp, spelled physically (/private/tmp) like the package's other fixture roots. Linux and Windows keep the temporary folder, so they run exactly as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AbirAbbas
force-pushed
the
test/canonical-temp-roots
branch
from
November 2, 2026 15:45
1dd5494 to
71dda06
Compare
AbirAbbas
marked this pull request as ready for review
November 2, 2026 16:42
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.
Why
On macOS every process gets
TMPDIR=/var/folders/…/T/, and/varis a link to/private/var. A Mac run of the full tree on app/v3 12dadd6 (macOS 15.6, Go 1.26.5) found 101 tests in nine packages that fail every time for that reason alone. Some compare a rawt.TempDir()with a path the product resolved. Others hit the product's deliberate "workspace binding traverses a symbolic link" refusal. All 101 pass when the test binary starts with a link-free TMPDIR. Linux has no such alias, so CI never sees this.What changed (tests only; no product code, no Makefile)
internal/testutil.CanonicalizeTempRoots, for macOS only. It resolves an absoluteTMPDIRandGOTMPDIRwithfilepath.EvalSymlinks, following links before any lexical cleaning. It rewrites a variable only when the physical spelling differs.TestMaincalls it first in each of the nine packages:testmain_test.gofiles in workspaceidentity, taskcopy, syncsetup, cellstore and handoff;TestMainruns. ItsTestMainnow refreshes that root, so the root matches the fixtures.TMPDIR/GOTMPDIRtargets, empty and unset values, physical spellings left byte for byte, a missing target, a..after a link, and relative roots;What this does not fix. This is a fixture workaround. The 101 passing tests show that the fixtures now agree with the product. They do not show that the product handles aliases, and these packages no longer exercise
/varaliases by accident. The product alias defects found while auditing this are being handled separately: alias-spelled roots intaskcopy/results.go:144-154, incellstorecanonicalTreefor a missing child, incmd/codeafstatFile/ListAgents, and in the prototype workspace-set doors. Tests that make their own links still cover those deliberate refusals.How it was checked (this Mac)
./internal/testutilgo vetpasses for the ten touched packages, both darwin andGOOS=linux, and./internal/testutilalso withGOOS=windows.gofmtis clean.TestTasklessTakePreservesConversationWorkspaceIdentity(syncsetup) used to fail before this point, at the symlink refusal. Now it fails about half the time with "taskless takeover unexpectedly called a provider": 2 of 6 runs on this branch, and 3 of 6 on app/v3 with a physical TMPDIR exported from outside. Its stub counts every HTTP request, andsession.Newstarts a lane beat (internal/session/agent.go:511) whose first round can fetch endpoint metadata beforeClose. That race has nothing to do with this change and is left for a follow-up.testutil,workspaceidentity,handoff,run,taskcopy,cellstoreandsyncsetuppackages show no failure beyond app/v3's own;TestR9R23PersonalLearnerRefreshesColdRouterGenerationfails 3/3 on this Mac on pristine 1c4ec8a too, with either TMPDIR spelling. It is not this change, and it passed on 12dadd6.TestAWarmNoSendsBackToThePlanWithTheWordsAndAsksAgain(factory/worker; also seen on another branch's run);TestAWithdrawnOrStaleTakeoverIsIgnored(session; it races the shared directory watch that answers takeover requests, and passes 10/10 here);TestAppPresenceP1ReconnectReconcilesMissedOffline;TestAppCrewProposalEndsInOneReceipt.Codex adversarial review, three rounds:
Abscleaned..before links were followed. Links are now resolved first.Absanchored a relative root to a logical working directory. Relative roots are now left alone.Manual verification: none. This PR changes only tests; there is no app behaviour to exercise.
🤖 Generated with Claude Code