Skip to content

Tests remove their temporary folders; CI fails if any are left - #18

Merged
flujo-app merged 1 commit into
mainfrom
fix/temp-folder-leak
Nov 3, 2026
Merged

flujo-app merged 1 commit into
mainfrom
fix/temp-folder-leak

Conversation

@flujo-app

Copy link
Copy Markdown
Owner

One run of the focused tests used to leave about 100 folders in the temp location. Now it leaves none, and CI fails if that comes back.

  • test/support/temp-dir.mjs: tempDir(prefix) creates a folder and removes it when that test file's process exits, however its tests ended. It retries on Windows file locks and honours FACTORY_TEST_TMP. The eleven leaking test files now use it. Folder names and locations are unchanged, so path-length tests still test the same thing.
  • scripts/test-temp-guard.mjs: runs tests with the temp location pointed at a private empty folder, lists anything left behind and fails if it is not empty. The workflow now runs the focused tests and the evidence regressions through it.

Scope: only the tests in .github/workflows/public-sdk.yml. Test files outside that list are unchanged.

Fixes #17

Proof: items left in the test temp location after one focused run

Measured by scripts/test-temp-guard.mjs over the focused list plus the evidence regressions (205 tests).

Platform Before (origin/main 52428ba) After
Windows 10, Node 22.17.0 102 0
Linux Docker, Node 22.17.0 102 0

The guard also exits non-zero when tests pass but folders remain, which is what the "before" runs did.

Local CI (AGENTS.md)

Same steps as .github/workflows/public-sdk.yml, on a clean git archive export of 7714828 with fresh npm ci:

Platform Node / npm prod audit (high) Focused tests Python settings tests Packed install + verify-public-sdk CLI help + factory-selfhost profiles Installed MCP stdio Evidence regressions Left in temp
Windows 10, portable Node, Python 3.14 22.17.0 / 10.9.2 0 vulnerabilities 198/198 9/9 ok ok 1/1 7/7 0
Windows 10, portable Node, Python 3.14 24.22.2 / 11.19.1 0 vulnerabilities 198/198 9/9 ok ok 1/1 7/7 0
Linux, Docker node:22.17.0-bookworm, Python 3.11 22.17.0 / 10.9.2 0 vulnerabilities 198/198 9/9 ok ok 1/1 7/7 0
Linux, Docker node:24.22.2-bookworm, Python 3.11 24.22.2 / 11.19.1 0 vulnerabilities 198/198 9/9 ok ok 1/1 7/7 0

On Windows, the Windows tar must come before Git's on the PATH; Git's tar reads C: as a remote host and fails five evidence tests. That was already so before this change.

No model or cloud call was made.

Each focused test file now creates its folders through test/support/temp-dir.mjs,
which removes them when that test process exits. scripts/test-temp-guard.mjs runs
tests against a private temp location and fails on leftovers; CI uses it.

Fixes #17
@flujo-app flujo-app added the bug Something isn't working label Nov 3, 2026
@flujo-app
flujo-app merged commit c9336e6 into main Nov 3, 2026
@flujo-app
flujo-app deleted the fix/temp-folder-leak branch November 3, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Focused tests leave hundreds of temporary folders behind

1 participant