Skip to content
TypeScript

fix(server): server tests resolve the macOS temp dir symlink (#21442)

tatsuaki watanabe2a27e153559b
diff --git a/apps/server/src/config.ts b/apps/server/src/config.ts
index ef6f71a46a2..3acbd697f58 100644
--- a/apps/server/src/config.ts
+++ b/apps/server/src/config.ts
@@ -187,7 +187,9 @@ const makeTest = Effect.fn("ServerConfig.makeTest")(function* (
const baseDir =
typeof baseDirOrPrefix === "string"
? baseDirOrPrefix
- : yield* fs.makeTempDirectoryScoped({ prefix: baseDirOrPrefix.prefix });
+ : // macOS temp dirs live under the /var -> /private/var symlink; storage cleanup's
+ // symlink guards compare resolved paths, so generated test dirs must be real paths.
+ yield* fs.realPath(yield* fs.makeTempDirectoryScoped({ prefix: baseDirOrPrefix.prefix }));
const derivedPaths = yield* deriveServerPaths(baseDir, devUrl);
yield* ensureServerDirectories(derivedPaths);
diff --git a/apps/server/src/storageCleanup.test.ts b/apps/server/src/storageCleanup.test.ts
index 33cc1874281..35959d91d9b 100644
--- a/apps/server/src/storageCleanup.test.ts
+++ b/apps/server/src/storageCleanup.test.ts
@@ -244,7 +244,7 @@ const cleanupFixture = (
const fs = yield* FileSystem.FileSystem;
const config = yield* ServerConfig.ServerConfig;
const git = yield* GitVcsDriver.GitVcsDriver;
- const repo = yield* fs.makeTempDirectoryScoped({ prefix: "cleanup-repo-" });
+ const repo = yield* fs.realPath(yield* fs.makeTempDirectoryScoped({ prefix: "cleanup-repo-" }));
const command = (cwd: string, args: string[]) =>
git.execute({ operation: "cleanup-test", cwd, args });
yield* command(repo, ["init", "-b", "main"]);