diff --git a/docs/changes/unreleased/2092-remote-task-fixtures-macos.md b/docs/changes/unreleased/2092-remote-task-fixtures-macos.md new file mode 100644 index 0000000000..bb15992617 --- /dev/null +++ b/docs/changes/unreleased/2092-remote-task-fixtures-macos.md @@ -0,0 +1,7 @@ +--- +kind: internal +title: Remote-task session fixtures pass on macOS temporary folders +pr: 2092 +surface: [engine] +invalidates: [] +--- diff --git a/internal/session/task_remote_recovery_test.go b/internal/session/task_remote_recovery_test.go index 45446926ce..57b3cf5168 100644 --- a/internal/session/task_remote_recovery_test.go +++ b/internal/session/task_remote_recovery_test.go @@ -654,12 +654,14 @@ func TestAPrivateTaskRunsElsewhereAndWaitsForLocalReviewAndApply(t *testing.T) { t.Setenv("CODEAF_HOME", t.TempDir()) t.Setenv("CODEAF_PROTOTYPE_WORKSPACE_OWNERSHIP", "1") reached := make(chan struct{}, 1) + var written string remote := &scriptedTaskEngine{start: func(ctx context.Context, spec RunSpec) RunSummary { + written = filepath.Join(spec.Workspace, "private-output.txt") reached <- struct{}{} r := remoteRecordFor(spec) r.Finished, r.Restored = true, true _ = spec.SaveRemote(r, true) - if err := os.WriteFile(filepath.Join(spec.Workspace, "private-output.txt"), []byte("the returned private change\n"), 0600); err != nil { + if err := os.WriteFile(written, []byte("the returned private change\n"), 0600); err != nil { t.Error(err) } _ = spec.Store.CompleteRoot("private change made") @@ -681,6 +683,11 @@ func TestAPrivateTaskRunsElsewhereAndWaitsForLocalReviewAndApply(t *testing.T) { if _, err := os.Stat(filepath.Join(a.config.Workspace, "private-output.txt")); !os.IsNotExist(err) { t.Fatal("private result applied before review") } + // macOS gives a new file its folder's group, and the private copy sits under + // this test's temporary home, so with TMPDIR in /private/tmp the returned + // file is wheel's and Apply cannot carry that group. The fixture takes the + // process's own, as the other Apply fixtures do. + normalizeWorkspaceApplyFixtureMetadata(t, written) review, err := a.ReviewTaskWorkspaceRoot(context.Background(), id, "work") if err != nil { t.Fatal(err) diff --git a/internal/session/task_start_r8b_test.go b/internal/session/task_start_r8b_test.go index 3d33c90777..9daf8acfc2 100644 --- a/internal/session/task_start_r8b_test.go +++ b/internal/session/task_start_r8b_test.go @@ -123,6 +123,12 @@ func remoteStartHome(t *testing.T) { t.Fatal(err) } t.Cleanup(func() { _ = os.RemoveAll(home) }) + // On macOS /tmp is a link into /private/tmp, and owned conversation + // storage refuses a recorded binding whose spelling crosses a link. A real + // home is already canonical, so the fixture names its home the same way. + if home, err = filepath.EvalSymlinks(home); err != nil { + t.Fatal(err) + } t.Setenv("HOME", home) t.Setenv("CODEAF_HOME", home) }