fix(tests): remove remaining temp-dir leaks from test suites - #5633
Conversation
Each suite now makes one mktemp root removed by an EXIT trap and creates every fixture under it, and the suites leave the baseline. Refs #5223 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st suites Each suite now makes one mktemp root removed by an EXIT trap and creates every fixture under it, and the suites leave the baseline. Refs #5223 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each suite removes its mktemp paths through an EXIT trap, and the baseline is now header-only. Refs #5223 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pass -o tmp_path_retention_policy=none to the CI pytest run and document the same flag where the repo tells contributors how to run the Python suites. Refs #5223 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Suites that passed the trap check still left entries in TMPDIR: default dry-run manifests and plan files, an async telemetry sink writing after its file was removed, per-call plugin data dirs, vitest and node:test fixtures with no cleanup, and the oracle scratch dir in automode-entry-diff.sh and the ACTION_MAP file in cutover-check.sh on their early-exit paths. Each now cleans up; running with an isolated TMPDIR leaves it empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #5223 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…p-leaks # Conflicts: # plugins/claude-config/CHANGELOG.md
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Claude finished @kyle-sexton's task in 1m 26s —— View job Security reviewReviewed the full diff ( Scope: every file changed is test-only tmp-dir cleanup (added No production/runtime code paths change — only test harnesses and their own scratch-directory handling. Findings: none. Specifically checked and found no issues in:
No action needed from a security standpoint. |
|
Claude finished @kyle-sexton's task in 2m 52s —— View job Code review complete
SummaryReviewed the full diff ( I traced the non-trivial cases specifically for correctness, since a botched cleanup fix can silently stop testing what it used to test, or leave a trap that clobbers state on an early exit:
No correctness or maintainability issues rose to the high-signal bar (nothing a linter/formatter would miss that would actually block this PR). No inline comments posted since there are no findings to anchor. Author-claimed verification (test runs, |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 06a9330b50
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude finished @kyle-sexton's task in 1m 3s —— View job Code review complete
SummaryThis lane already reviewed the full 81-file diff at -python3 -m coverage run -m pytest -q && python3 -m coverage json
+python3 -m coverage run -m pytest -q -o tmp_path_retention_policy=none && python3 -m coverage jsonThis addresses the Codex P2 comment on No other file changed between Findings: none. No inline comments posted. Note: this is a docs-only fix to an already version-bumped plugin (the |
|
Claude finished @kyle-sexton's task in 1m 28s —— View job Security review
Scope: everything already covered by the prior review at Findings: none.
No action needed from a security standpoint. |
Closes #5223
Summary
Test suites kept leaking into
TMPDIRafter the earlier fixes for #5223. This branch finishes that work:scripts/test-tmp-cleanup-baseline.txtis empty, andscripts/check-test-tmp-cleanup.sh --checkpasses with it.AGENTS.mdfixtures, every*.test.sh, and the Python and Node suites that callmkdtempwere run with an isolatedTMPDIR. Each leaves it empty after the fixes below.fix(ci): stop pytest tmp_path directories accumulating).plan/fixture directories are attributed. Thetmp.*/planplus*.manifestdirectories came from the oldclean-batch.shdefault,PLAN_DIR="$(mktemp -d)", whichclean-batch.test.shexercised on every run. feat(repo-hygiene): durable batch plan location and dry-run path listing #5580 moved the default plan location underCLAUDE_PLUGIN_DATA, andclean-batch.test.shnow leavesTMPDIRempty. TheAGENTS.md/CLAUDE.md/.gitfixture directories came from the instruction-placement suites fixed earlier on this branch.Fix
The static trap check cannot see these, so they were found by running each suite with an isolated
TMPDIRand listing what remained:clean-build.test.sh,clean-caches.test.sh,audit-fleet.test.sh: default dry-run manifests and plan files come frommktempinTMPDIR; the suites now pointTMPDIRinside their cleaned directory.actionlint-check.test.sh: four telemetry files were recreated by the asynchronous sink after the suite removed them; they now live under the cleanedWORKdirectory.hook-utils.test.sh:run17bmade a new plugin data directory per call; it now makes it underWORK.cutover-check.sh: theACTION_MAPfile leaked when the release-map parse failed, before the EXIT trap was set.automode-entry-diff.sh: the--oraclescratch directory was never removed; an EXIT trap now removes it.main-module.test.js,cli-entry.test.js(ai-briefing),detect-recoverable-bootstrap.test.js,extract-anchor-frames.test.js,check-watch-outcomes.test.js: fixtures are now removed after the test.run-watch-envelope.test.js,run-watch-degradation.test.js,mixed-source-storage-invariant.test.js:run-watchintentionally keeps its temp directories, so the tests pointTMPDIRinto a directory they remove.Out of scope:
scripts/check-silent-revert.test.shmk_repocommitting into the caller's repository. #4472 is closed and is not closed or reopened here.Not changed, not ours:
surface.test.shleaves Chromium's ownorg.chromium.Chromium.*profile directory throughplaywright-cli, and fails on an existingjsarray error at line 218 unrelated to this change.check-usage-limit-reset.pykeeps a deliberate tzdata cache underTMPDIR.Verification
bash scripts/check-test-tmp-cleanup.sh --check: pass, 535 suites, empty baseline.bash scripts/validate-plugins.sh: pass.check-changelog-parity.sh --check,--check-orderand--check-bump origin/main: pass after a patch bump and a changelog entry for each of the 15 touched plugins.git merge-tree --write-tree origin/main HEAD: no conflicts.TMPDIRrun over all 535*.test.sh, the 40 Node test files that use temp directories, and the Python suites withmkdtemp: every fixed suite leaves it empty and still passes.acquire.test.js"lists files in the real temp directory" times out on this host because/tmpholds about 11,000 entries from these same leaks; it does not write toTMPDIR.Related
clean-batch.shplan location)🤖 Generated with Claude Code