Skip to content

test: one temp folder per test run, removed when the run ends - #24

Merged
siyabendoezdemir merged 3 commits into
mainfrom
lead/tmp
Oct 11, 2026
Merged

siyabendoezdemir merged 3 commits into
mainfrom
lead/tmp

Conversation

@siyabendoezdemir

@siyabendoezdemir siyabendoezdemir commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Test runs now clean up the temp folders their tests make. Before this, the e2e harness and the unit tests never removed theirs.

Why

  • Each e2e test left its app's user data in /tmp, about 2.7 MB a test. That's over 1 GB for a full suite run.
  • After two days of lane and gate runs, /tmp held about 47,000 orbit-e2e-* folders, about 124 GB, with 77 GB left on the disk.
  • A unit run left 49 small folders.
  • For now, the lead removes these folders once they're 3 hours old. This PR stops new ones from piling up.

What changes

  • tests/run-tmp.ts is the global setup for both Playwright and Vitest. On Linux it makes one folder per run (orbit-run-*) and points TMPDIR at it.
    • Workers inherit TMPDIR, and so do the apps they launch. So every mkdtempSync(join(tmpdir(), …)) in a test goes under that folder, and so do the apps' own temp files.
    • The setup's teardown removes the folder when the run ends. A run that is killed leaves just its one folder.
  • No test changes. Every test that makes a temp folder already uses tmpdir().
  • Linux only:
    • On Windows, tmpdir() reads TEMP and TMP, not TMPDIR, so the setup would do nothing there.
    • On macOS it would likely work, but nothing runs the suite there now (D42), so it stays off and untested.

Checks

Each run below points TMPDIR at an empty scratch folder first, then counts what's left in it afterwards:

  • Unit (./node_modules/.bin/vitest run, 580 passed): nothing left with the change, and 49 folders without it (orbit-history-*, orbit-downloads-*, orbit-archive-* and others).
  • E2E (smoke.spec.ts and core.spec.ts, 26 passed): nothing left with the change except Playwright's own transform cache, which it keeps between runs.
  • E2E without the change (smoke.spec.ts, 4 passed): 4 orbit-e2e-* folders, 7.1 MB in all.
  • Typecheck and lint exit 0.

Merge gate (D42), run locally on Linux

On 600e03e, in this PR's worktree. That head has the review fix (cb30e1a) with main 332fb99 merged in, which brings import (PR #22) and keys (PR #23).

  • Static checks: npm run build, npm run typecheck, npm run lint and ./node_modules/.bin/vitest run all exit 0. Unit: 850 passed of 850, in 83 files.
  • E2E: xvfb-run -a -s "-screen 0 1440x900x24" ./node_modules/.bin/playwright test --workers 1 --retries 0 ran 589 tests in 28.0 min: 585 passed, 4 skipped, 0 failed, and it exited 0.
    • TB-22's ✘ is an expected test.fail().
    • The load average was 5–8.
  • The run cleaned up after itself: no orbit-run-* folder was left in /tmp afterwards.
  • The first gate, on b7b1dcc before main moved: 499 passed, 4 skipped, 0 failed, and it left no folder either.
  • Unverified: the change does nothing on macOS or Windows, so nothing there needs a check.

Review

APPROVE, no must-fix (reviews/lead-tmp.md, on b7b1dcc).

  • With and without the change, with TMPDIR pointed at an empty folder each time:
    • unit: nothing left with it, and 49 folders (584 KB) without it;
    • smoke and onboarding e2e: only Playwright's transform cache with it, and 16 MB of app folders without it.
  • Killed runs: Ctrl+C (SIGINT) still removes the run's folder. A SIGTERM to the whole process group leaves just that one folder.
  • Two runs at once each remove only their own folder. --list leaves nothing, and no socket appeared under TMPDIR.
  • Also checked:
    • Playwright 1.64 and Vitest 5 both run the teardown the setup returns, and their workers see the new TMPDIR.
    • scripts/perf and scripts/capture aren't affected.
  • Its two follow-ups are done:
    • T1: the lead's sweep now also removes a killed run's orbit-run-* folder (D63 (2)).
    • T2: tests/run-tmp.ts's comment now gives the right reason for Linux only (cb30e1a).

🤖 Generated with Claude Code


Note

Low Risk
Test-harness-only change with no production paths; Linux-specific behavior and a no-op elsewhere.

Overview
Adds shared global setup for Playwright and Vitest via tests/run-tmp.ts. On Linux, each run creates a single orbit-run-* directory, sets TMPDIR so workers and launched Electron apps put all tmpdir()-based paths and app temp files under it, and recursively deletes that folder when the run finishes (killed runs may leave one folder).

No test edits—existing e2e/unit code already uses tmpdir(). On non-Linux platforms the setup is a no-op.

Reviewed by Cursor Bugbot for commit 600e03e. Bugbot is set up for automated code reviews on this repo. Configure here.

On Linux, Playwright's and Vitest's global setup make one folder per run
and point TMPDIR at it. Workers and the apps they launch inherit it, so
every tmpdir() folder a test makes goes under it, and the teardown removes
it. Before, each e2e test left about 3 MB of user data in /tmp (over 1 GB a
full run, about 124 GB after two days), and a unit run left 49 folders.

Checked against a scratch TMPDIR: smoke + core e2e (26 passed) and the
unit suite (580 passed) leave nothing but Playwright's transform cache;
without the change, smoke leaves 4 orbit-e2e folders and a unit run 49.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Oct 10, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 7b1287f7-8d3d-4a45-97e5-e95a3ab16a3d)

siyabendoezdemir and others added 2 commits October 11, 2026 02:08
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Oct 11, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 9a39b9ad-8b0c-4a5d-8b9e-0945c337667f)

@siyabendoezdemir
siyabendoezdemir merged commit 592096b into main Oct 11, 2026
1 check passed
siyabendoezdemir added a commit that referenced this pull request Oct 11, 2026
…to lane/feel

Conflicts, both sides kept:
- OverlayApp.tsx, PeekLayer.tsx, SidebarItems.tsx: import lines only (keys' ShortcutSheet,
  useKeymap and useShortcutLabel beside the motion imports).
- feature-status.json: keys' KS-09 and the lane's FL-15; FEATURES.md regenerated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant