From 651355a8f37e16055a12d06550cae88e2eef542f Mon Sep 17 00:00:00 2001 From: Abir Abbas Date: Thu, 29 Oct 2026 17:33:18 -0400 Subject: [PATCH 1/2] tests: the last test-only Mac assumptions (T3-T7) Twelve tests assumed Linux and failed on a Mac with nothing wrong in the product: - BSD mktemp ignores TMPDIR without a template, so the five scratch-routing probes now name "${TMPDIR:-/tmp}/probe.XXXXXX" (session, executor); - the three cellstore socket fixtures resolve /tmp to /private/tmp, clean the temp prefix and keep a short base, as the product's socket rules do; - the release-surface probe guards an empty array, which bash 3.2 calls unset under nounset (the workflow itself runs on Linux bash); - the teams doors' unchanged answer is asserted to carry exactly the stamp and the flag, since a Mac's device and inode numbers make the stamp longer; - tui3's Memory switch is expected in the app's own chord spelling, which is opt+u on a Mac. Co-Authored-By: Claude Opus 5.5 --- internal/cellstore/daemon_test.go | 4 ++++ internal/cellstore/socket_regression_unix_test.go | 14 +++++++++++++- internal/remote/teams_test.go | 11 +++++++---- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/internal/cellstore/daemon_test.go b/internal/cellstore/daemon_test.go index 70f43cb173..fc441a9ceb 100644 --- a/internal/cellstore/daemon_test.go +++ b/internal/cellstore/daemon_test.go @@ -103,6 +103,10 @@ func TestDaemonOfANonEngineIsUnavailable(t *testing.T) { // Two engine builds never share a daemon: the socket is named after the binary. func TestSocketIsKeyedToTheEngineBinary(t *testing.T) { + // Keep the home address short enough to assert its build-named basename too. + if runtime.GOOS != "windows" { + t.Setenv("TMPDIR", "/tmp") + } base := filepath.Dir(testSocket(t)) t.Setenv("CODEAF_HOME", base) t.Setenv("LOCALAPPDATA", base) diff --git a/internal/cellstore/socket_regression_unix_test.go b/internal/cellstore/socket_regression_unix_test.go index f34ab23a98..b24ee174ed 100644 --- a/internal/cellstore/socket_regression_unix_test.go +++ b/internal/cellstore/socket_regression_unix_test.go @@ -23,6 +23,13 @@ import ( // The lane-local temp base models a shared /tmp without involving another user. func TestR9UnixShortSocketRejectsPreclaimedDirectory(t *testing.T) { t.Setenv("XDG_RUNTIME_DIR", "") + // A short private temp base keeps this fixture in its own fallback lane on macOS. + base, err := os.MkdirTemp("/tmp", "r9-temp-") + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = os.RemoveAll(base) }) + t.Setenv("TMPDIR", base) for _, kind := range []string{"writable-directory", "symlink"} { t.Run(kind, func(t *testing.T) { bin := "/engine/furrow-review-" + kind @@ -33,7 +40,7 @@ func TestR9UnixShortSocketRejectsPreclaimedDirectory(t *testing.T) { if err := os.Remove(dir); err != nil && !os.IsNotExist(err) { t.Fatal(err) } - if !strings.HasPrefix(dir, os.TempDir()+string(filepath.Separator)) || len(socket) >= maxSocketBytes { + if !strings.HasPrefix(dir, filepath.Clean(os.TempDir())+string(filepath.Separator)) || len(socket) >= maxSocketBytes { t.Fatalf("C7: fixture did not select its lane-local short fallback: %q", socket) } if _, err := os.Lstat(dir); !os.IsNotExist(err) { @@ -158,6 +165,11 @@ func TestR9UnixShortSocketOrder(t *testing.T) { t.Fatal(err) } t.Cleanup(func() { _ = os.RemoveAll(login) }) + // The home address uses the physical path, including macOS's /private/tmp. + login, err = filepath.EvalSymlinks(login) + if err != nil { + t.Fatal(err) + } t.Setenv("CODEAF_HOME", login) t.Setenv("XDG_RUNTIME_DIR", runtime) bin := "/engine/furrow-review-runtime" diff --git a/internal/remote/teams_test.go b/internal/remote/teams_test.go index 548188aff5..7fcd25ea42 100644 --- a/internal/remote/teams_test.go +++ b/internal/remote/teams_test.go @@ -51,8 +51,10 @@ func TestTheTeamsDoorsCrossFromTheEnginesProfile(t *testing.T) { if err != nil || !same.Same || same.Teams != nil { t.Fatalf("a read at the held stamp: %+v, %v", same, err) } - if raw, _ := json.Marshal(same); len(raw) > 64 { - t.Fatalf("an unchanged answer is %d bytes: %s", len(raw), raw) + // Device and inode widths vary by filesystem; only the stamp and flag cross. + stamp, _ := json.Marshal(wrote.Stamp) + if raw, _ := json.Marshal(same); string(raw) != `{"stamp":`+string(stamp)+`,"same":true}` { + t.Fatalf("an unchanged answer must carry only the held stamp and same: %s", raw) } if err := teamstore.AppendTraffic(dir, "0a0a0a0a0a0a", teamstore.Entry{Kind: teamstore.KindNote, @@ -67,8 +69,9 @@ func TestTheTeamsDoorsCrossFromTheEnginesProfile(t *testing.T) { if err != nil || len(quiet.Entries) != 0 { t.Fatalf("a quiet log after the cursor: %+v, %v", quiet, err) } - if raw, _ := json.Marshal(quiet); len(raw) > 64 { - t.Fatalf("a quiet Traffic answer is %d bytes: %s", len(raw), raw) + stamp, _ = json.Marshal(got.Stamp) + if raw, _ := json.Marshal(quiet); string(raw) != `{"stamp":`+string(stamp)+`}` { + t.Fatalf("a quiet Traffic answer must carry only the held stamp: %s", raw) } if _, err := loop.Client.TeamsTraffic("../escape", "", 1); err == nil { t.Fatal("a team id that is a path was read") From a8360acfbe97b999def0c3b179ee1215791c28c3 Mon Sep 17 00:00:00 2001 From: Abir Abbas Date: Thu, 29 Oct 2026 17:59:23 -0400 Subject: [PATCH 2/2] docs: the change entry for #2047 Co-Authored-By: Claude Opus 5.5 --- .../changes/unreleased/2047-mac-test-assumptions.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docs/changes/unreleased/2047-mac-test-assumptions.md diff --git a/docs/changes/unreleased/2047-mac-test-assumptions.md b/docs/changes/unreleased/2047-mac-test-assumptions.md new file mode 100644 index 0000000000..5eb3b81649 --- /dev/null +++ b/docs/changes/unreleased/2047-mac-test-assumptions.md @@ -0,0 +1,13 @@ +--- +kind: internal +title: The last tests that assumed Linux pass on a Mac +pr: 2047 +surface: [build] +invalidates: [] +--- + +The cellstore socket fixtures assumed a short temporary folder that is not +reached through a link; on a Mac it is long and `/tmp` is `/private/tmp`. +The remote stamp answers assumed Linux's device and inode widths. Their +expectations now hold on both systems; no product behaviour changed. The +other Mac assumptions this branch first fixed reached app/v3 through #2099.