Repository navigation
test(helpers): add a test-scoped temporaryDirectory helper - #3174
Conversation
…ackaging tests/helpers/temporary-directory.mjs gains temporaryDirectory(t, prefix): a new directory under TMPDIR removed when the owning test ends. First batch of the temp-dir cluster, the images-packaging suite (fewest open PRs among suites with copies): container-publication-workflow, repository-runtime-volume, production-image-qualification (3 sites) and oidc-ca-trust (its private copy).
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesAdds a test-scoped temporary-directory helper and replaces eight equivalent setup-and-cleanup sequences across four integration files. Example: A publication-summary test needs an oce-publication-summary- temporary directory.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR is a focused test refactor with no actionable correctness findings. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe helper belongs to the test infrastructure: callers supply a Node test context and directory prefix, receive a temporary path, and remove that directory through the owning test's teardown. flowchart LR
A[Integration test] --> B[Temporary directory helper]
B --> C[Directory under TMPDIR]
C --> D[Test fixture operations]
B --> E[Test teardown hook]
E --> F[Recursive directory removal]
Technical reviewBest possible solution: Keep the focused extraction in the existing helper module while preserving test-scoped and file-scoped lifetimes. Do we have a high-confidence way to reproduce the issue? This is a refactor rather than a bug report; source inspection verifies the duplicated sequences and their equivalent replacements. Is this the best way to solve the issue? The extraction is appropriately small, uses the existing helper owner, and retains the separate container-isolation fixture whose mounted filesystem excludes shared helpers. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c8e5e2a9d412. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 22, 2026, 12:02 AM ET / 04:02 UTC. |
Problem
The most copied test setup is a temporary directory:
mkdtemp(join(tmpdir(), prefix))plust.after(() => rm(directory, { recursive: true, force: true })), with its three imports, in about 110 files.tests/helpers/temporary-directory.mjsonly offers a file-scoped directory, so tests with a context keepwriting the pair by hand, and two files carry a private
temporaryDirectory(t, ...).Change
Test-only.
tests/helpers/temporary-directory.mjsgainstemporaryDirectory(t, prefix): a new directory underTMPDIR, removed when the test (or suite) that owns
tends.First batch, one suite: images-packaging (the fewest open PRs among suites with copies). Migrated:
container-publication-workflow, repository-runtime-volume, production-image-qualification (3 sites) and
oidc-ca-trust's private copy. Later batches go suite by suite.
Not migrated:
tests/fixtures/repository-credentials/process.mjskeeps its owntemporaryDirectory, because theisolation fixture mounts that directory alone into containers where
tests/helpersis absent.Verification
Run on a remote test VM; "main" is the PR's merge base.
accepting two platforms (production-image-qualification), publication summary dropping the image result
(container-publication-workflow), CA bundle assembly accepting a private key (oidc-ca-trust); a Harness trust-bundle
mutant survives on both.
image, as on main).
Risks
Test-only and mechanical: the same directory prefixes, the same removal on
t.after.