From 5075310336ca036243c4caa94d170bff2de35a36 Mon Sep 17 00:00:00 2001 From: dan-claude-bot Date: Tue, 21 Jul 2026 12:35:11 +0000 Subject: [PATCH] test: release.test.ts allocates through tmp(), like everything else under test/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The rebase onto main was textually clean and behaviourally broken, and this PR's own guard is what caught it. This branch removed test/release.test.ts's `mkdtempSync`/`tmpdir` imports when it converted that file's call sites to `tmp()`. While it was open, #133's changelog-monotonic work landed on main and added THREE new `mkdtempSync(join(tmpdir(), ...))` sites to the same file. The two changes never touch the same line, so git merged them without a word — leaving call sites whose imports this branch had deleted. 20 tests died on `ReferenceError: mkdtempSync is not defined`. Converted all three to `tmp()`, which is what the file already imports and what every other test file under test/ uses. Worth noting which test failed and why it matters: test/tmp-guard.test.ts, this PR's own class check, reported `offenders: ["release.test.ts"]`. It was written to stop exactly this — a new raw allocation drifting in — and it did so on a real regression rather than a synthetic one, before the fix existed. That is the guard earning its place on its first genuine encounter. --- test/release.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/release.test.ts b/test/release.test.ts index 7161ef6..a803ec7 100644 --- a/test/release.test.ts +++ b/test/release.test.ts @@ -410,7 +410,7 @@ describe("changelog-monotonic.sh — release headings are append-only (#133)", ( * whose CHANGELOG.md is `head` (unchanged when omitted). */ function repoWith(head?: string): string { - const repo = mkdtempSync(join(tmpdir(), "cast-monotonic-")); + const repo = tmp("cast-monotonic-"); git(repo, "init", "-q"); git(repo, "config", "user.email", "test@example.com"); git(repo, "config", "user.name", "test"); @@ -563,7 +563,7 @@ describe("changelog-monotonic.sh — release headings are append-only (#133)", ( * `exit 0` before uniqueness had run (#133, box#143). */ function repoIntroducing(head: string): string { - const repo = mkdtempSync(join(tmpdir(), "cast-monotonic-new-")); + const repo = tmp("cast-monotonic-new-"); git(repo, "init", "-q"); git(repo, "config", "user.email", "test@example.com"); git(repo, "config", "user.name", "test"); @@ -627,7 +627,7 @@ describe("changelog-monotonic.sh — release headings are append-only (#133)", ( it("a duplicate OUTSIDE a git work tree is caught (#133)", async () => { // No git at all — a tarball, an unpacked release. Uniqueness still has // everything it needs; only containment does not. - const dir = mkdtempSync(join(tmpdir(), "cast-monotonic-nogit-")); + const dir = tmp("cast-monotonic-nogit-"); writeFileSync( join(dir, "CHANGELOG.md"), `# Changelog\n\n${dated("0.1.1")}${body}\n${dated("0.1.1")}${body}`,