Skip to content

test: every test script preloads the shared scratch temp directory (#1030) - #1034

Merged
jimhoyd merged 1 commit into
mainfrom
claude/test-scratch-tmp-1030
Sep 30, 2026
Merged

jimhoyd merged 1 commit into
mainfrom
claude/test-scratch-tmp-1030

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1030

What changed

  • Every test / test:* script now preloads test/scratch-tmpdir.ts with --import: the four workspace package suites (packages/{audit,auth,store,mcp}, as ../../test/scratch-tmpdir.ts, the one shared copy), test:addons, test:proof, test:proof:authjs, test:ecosystem, test:multiprocess, test:disk-full, test:project, test:examples:built, test:package:built and test:workerd. Scripts that only chain npm run build / npm run test:* inherit it through those.
  • scripts/create-extension.ts scaffolds a package whose test script preloads it too (asserted in test/create-extension.test.ts, including that the path resolves from the generated package).
  • New check in test/hermetic-hardening.test.ts: every && step of every test/test:* script in the root and each packages/*/package.json is either npm run build, npm run test:*, or a node process whose --import resolves to the root test/scratch-tmpdir.ts. A new script that misses it fails npm test.
  • test/ci-workflow.test.ts and test/workflows.test.ts updated for the new script text; CONTRIBUTING's single-file example uses the same flags and explains the preload.
  • The disk-full harness still fills its own small filesystem (URLCODE_DISK_FULL_DIR); only the OS temp directory moves.

No package boundary change: packages reference the root file by path from a script only (no import), so check-core-boundaries and check-workspace-links are unaffected.

Evidence (macOS, local)

  • npm run verify: green (includes every workspace package suite, test:addons, both proofs, test:ecosystem, test:multiprocess).
  • npm run test:package, npm run test:examples:built, npm run test:project: green.
  • npm run test:disk-full against a 16 MiB HFS+ disk image: pass.
  • Listed urlcode-* entries in the real temp directory before and after all of the above: 0 new.
  • Not run locally: test:workerd (optional workflow; needs workerd). Windows package legs run in this PR's CI because package manifests changed.

🤖 Generated with Claude Code

…1030)

The workspace package suites and the integration, proof, package, example and
workerd scripts now preload test/scratch-tmpdir.ts with --import (packages as
../../test/scratch-tmpdir.ts, one shared copy), so none of them creates
urlcode-* run directories in, or sweeps, the real temporary directory. The
extension scaffold's test script does the same. hermetic-hardening.test.ts
fails any test/test:* step in the root or a package manifest that does not.
The disk-full harness keeps its own small filesystem (URLCODE_DISK_FULL_DIR).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jimhoyd
jimhoyd enabled auto-merge (squash) September 30, 2026 07:23
@jimhoyd
jimhoyd merged commit 5f2efb8 into main Sep 30, 2026
29 checks passed
@jimhoyd
jimhoyd deleted the claude/test-scratch-tmp-1030 branch September 30, 2026 07:35
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.

Workspace and integration test runs still use the real temp directory (only root test scripts preload scratch-tmpdir)

1 participant