[Bug]: storageCleanup test fails on macOS with the default TMPDIR
Before submitting
- [x] I searched existing issues and did not find a duplicate.
- [x] I included enough detail to reproduce or investigate the problem.
Area
Build, CI, or release tooling
Steps to reproduce
- On macOS, keep the default
TMPDIR(/var/folders/...). - Run
vp test run apps/server/src/storageCleanup.test.ts.
Expected behavior
All storage cleanup tests pass.
Actual behavior
storage cleanup reports and local file policies > aggregates expired artifacts and rotated logs while retaining current logs fails (1 failed, 55 passed). Browser artifacts and rotated logs are reported as kept / No expired files instead of removed.
Likely cause: ServerConfig.layerTest with a prefix creates the test home with makeTempDirectoryScoped, which returns a /var/folders/... path. On macOS /var is a symlink to /private/var, so storage cleanup's symlink protection keeps the files instead of deleting them. Resolving the generated directory with fs.realPath in makeTest (explicit test paths unchanged) makes all 56 tests pass.
Same root cause class as #9388 and #9389.
Impact
Cosmetic issue
Version or commit
main @ 107f6024ea
Environment
macOS 26.7.1 (arm64), default TMPDIR
Logs or stack traces
AssertionError: expected [ { …(8) }, { kind: 'logs', …(7) } ] to match object [ { …(5) }, { kind: 'logs', …(4) } ]
expected: browser-artifacts removed (2 files, 14 bytes), logs removed (2 files, 6 bytes)
actual: browser-artifacts kept 'No expired files', logs kept 'No expired files'
at apps/server/src/storageCleanup.test.ts:712
Screenshots, recordings, or supporting files
No response
Workaround
Run the tests with TMPDIR=/private/tmp, or any TMPDIR that is not behind a symlink.
[!NOTE] Grok responding on behalf of Julius.
This is a test-harness bug, not a product bug: it only affects running the server tests locally on macOS. CI runs the server suite on Ubuntu (plus the Windows job), where TMPDIR has no symlink, so main stays green.
Confirmed on main: makeTest in apps/server/src/config.ts passes the raw fs.makeTempDirectoryScoped({ prefix }) path to deriveServerPaths without resolving it. On macOS that path is under /var/folders/..., and /var is a symlink to /private/var, so storage cleanup's symlink guard keeps the files and storageCleanup.test.ts fails at the "aggregates expired artifacts…" case. This is the same class as #9388 and #9389, which were fixed by resolving temp paths in the tests (see #9570 and #9573).
The fix you describe is the right size: call fs.realPath on the generated directory in makeTest only, and leave explicit baseDir arguments alone. A small PR doing just that is welcome. Until then, TMPDIR=/private/tmp works around it.