Skip to content

Commit 3eb1d71

Browse files
committed
simplify: drop the tmpdir ratchet guard, keep the leak check local-only
Two guards were more than this needed: - check:test-tmpdir-helper (ratchet on raw fs.mkdtemp call counts) protects nothing a bug could actually trigger — the leak is already fixed architecturally regardless of call-site count, so this was pure style/discoverability nudging. Dropped the script and its check:tooling/CI wiring; kept mkdtempForTest/mkdtempForTestSync in tmp-dir.ts as the documented option without enforcing it. - check:tmpdir-leaks in CI added little: GitHub-hosted runners are destroyed after each job, so a leftover directory there is harmless by construction, and a worker getting killed mid-run would already surface as a job failure some other way. Its real value is local, on the long-lived dev machines where the original leak actually accumulated — kept it wired into check:unit, dropped the CI step.
1 parent b74f84a commit 3eb1d71

4 files changed

Lines changed: 2 additions & 59 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,6 @@ jobs:
212212
- name: Check for production-unused exports
213213
run: pnpm check:production-exports
214214

215-
- name: Check test tmpdir helper adoption
216-
run: pnpm check:test-tmpdir-helper
217-
218215
replay-compat-provenance:
219216
# The frozen replay-compat corpus (#1417) claims each entry was published by
220217
# a released tag. Only a full-history checkout can re-derive that claim, so
@@ -266,13 +263,6 @@ jobs:
266263
OUTPUT_ECONOMY_BASE: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
267264
run: pnpm test:coverage:ci
268265

269-
# Each vitest run redirects TMPDIR to one run-scoped directory and
270-
# removes it in globalTeardown; anything left here means the run was
271-
# killed before that could happen.
272-
- name: Check tmpdir leaks
273-
if: always()
274-
run: pnpm check:tmpdir-leaks
275-
276266
- name: Upload contention-retry envelope
277267
if: always()
278268
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2

‎package.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,12 @@
136136
"check:command-docs": "vitest run --project unit-core src/__tests__/command-doc-coverage.test.ts",
137137
"check:replay-compat": "node --experimental-strip-types scripts/check-replay-compat-provenance.ts",
138138
"check:tmpdir-leaks": "node --experimental-strip-types scripts/check-tmpdir-leaks.ts",
139-
"check:test-tmpdir-helper": "node --experimental-strip-types scripts/check-test-tmpdir-helper.ts",
140139
"check:freerange": "fr",
141140
"check:quick": "pnpm lint && pnpm typecheck",
142141
"sync:mcp-metadata": "node scripts/sync-mcp-metadata.mjs",
143142
"check:mcp-metadata": "node scripts/sync-mcp-metadata.mjs --check",
144143
"version": "pnpm sync:mcp-metadata && git add server.json",
145-
"check:tooling": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm check:layering && pnpm depgraph:test && pnpm check:production-exports && pnpm check:test-tmpdir-helper && pnpm check:mcp-metadata && pnpm build && pnpm check:bundle-owner-files && pnpm check:package",
144+
"check:tooling": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm check:layering && pnpm depgraph:test && pnpm check:production-exports && pnpm check:mcp-metadata && pnpm build && pnpm check:bundle-owner-files && pnpm check:package",
146145
"check:unit": "pnpm check:contention-retry && pnpm test:unit && pnpm check:tmpdir-leaks && pnpm test:smoke",
147146
"check": "pnpm check:tooling && pnpm check:fallow && pnpm check:unit",
148147
"prepack": "pnpm check:mcp-metadata && pnpm package:npm",

‎scripts/check-test-tmpdir-helper.ts‎

Lines changed: 0 additions & 43 deletions
This file was deleted.

‎src/__tests__/test-utils/tmp-dir.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ import path from 'node:path';
77
* Creates a fresh scratch directory for one test. Cleanup is automatic: the
88
* unit suite redirects TMPDIR to a per-run directory (scripts/vitest-tmpdir-global-setup.ts)
99
* that gets removed in one recursive rm after every worker finishes, so
10-
* individual tests never need their own afterEach/afterAll for this. Prefer
11-
* this over calling fs.mkdtemp(path.join(os.tmpdir(), ...)) directly — a
12-
* lint guard (check:test-tmpdir-helper) caps how many raw call sites remain
13-
* outside this file.
10+
* individual tests never need their own afterEach/afterAll for this.
1411
*/
1512
export async function mkdtempForTest(prefix: string): Promise<string> {
1613
return fsPromises.mkdtemp(path.join(os.tmpdir(), prefix));

0 commit comments

Comments
 (0)