Skip to content

emrg: the GUI state test leaves three temp directories behind on every run #1916

Closed

Description

@argszero

What is wrong

emrg/gui/test/gui-state.test.js creates a temp home per calling test and never removes it, so every GUI harness run leaves three directories and ~2.7 KB in os.tmpdir() for good. mkdtemp() never reuses a name, so nothing ever reclaims them: the count grows by three per run, without bound, on every developer machine and every CI checkout that runs the harness.

Measured on this host (macOS), os.tmpdir() = /var/folders/…/T:

36 stale `emrg-gui-state-*` directories / 96 KB      (before this cycle)
+3 after one `cd emrg/gui && npm test`               → 39
+3 after the next run                                → 42

Scope — it is this one file, and the measurement says so

Four files under emrg/gui/test/ call fs.mkdtempSync:

daemon_client.test.js:86,198,209    integration.test.js:63    conn-manager.test.js:54    gui-state.test.js:11

Per-prefix counts taken immediately before and after one full harness run — only one prefix moves:

prefix              before   after
emrg-gui-test-           0       0
emrg-gui-state-         39      42     ← the only growth
emrg-gui-integ-          0       0
emrg-conn-test-          0       0
emrg-venv-               0       0

The other three already hand their directories back — daemon_client.test.js:103 and conn-manager.test.js:72 remove theirs in a teardown, integration.test.js:167 has an after() hook. So this is not a new convention being proposed: it is one file out of step with the three beside it in its own directory.

Why it matters beyond tidiness

A test that creates host state owes the removal of it, exactly as it owes its assertions. The failure mode is quiet by construction — a green run and a lengthening ls of os.tmpdir() look identical — so nothing in CI reports it, and the cost is paid on machines that run the suite most.

Acceptance

  • After cd emrg/gui && npm test, the count of emrg-gui-state-* directories under os.tmpdir() is unchanged by the run.
  • The cleanup is asserted rather than assumed: an arm that removes the hook must go red (a silently failing removal would otherwise be the same litter with a tidier story).
  • No other test file's temp handling changes — the three above are already correct and are left alone.

Named limit

Only the emrg-gui-state-* prefix is asserted. The Python suite's temp handling and the landing-tree gates' worktrees are a different surface and are not claimed here.

Activity

  1. argszero commented on Oct 8, 2026

    @argszero
    OwnerAuthor

    Handled by #1917

  2. argszero commented on Oct 8, 2026

    @argszero
    OwnerAuthor

    handled by #1917

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions