Skip to content

[Bug]: storageCleanup test fails on macOS with the default TMPDIR #19532

Closed

Description

@nbrosei

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

Build, CI, or release tooling

Steps to reproduce

  1. On macOS, keep the default TMPDIR (/var/folders/...).
  2. 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 @ 107f602

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.

Activity

  1. added
    bugSomething is broken or behaving incorrectly.
    needs-triageIssue needs maintainer review and initial categorization.
    on Oct 14, 2026
  2. juliusmarminge commented on Oct 14, 2026

    @juliusmarminge
    Member

    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.

  3. added
    acceptedfeature request accepted
    via-triageFiled through npx t3 triage
    and removed
    needs-triageIssue needs maintainer review and initial categorization.
    on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedfeature request acceptedbugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions