From c1b168e522a0cb337fdc7addcb117b30d0cd5730 Mon Sep 17 00:00:00 2001 From: cliffhall Date: Fri, 10 Jul 2026 18:25:10 -0400 Subject: [PATCH] chore(pack-verify): retain tarball on failure (fix dead cleanup flag) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review follow-up: `cleanupTarball` was always true (set true at init and again in the catch), so the finally guard was dead logic. Make it meaningful — retain the packed tarball on failure so a packaging problem can be inspected, and log where it is; the happy path still removes it. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01BrihGWcrM9JGRyu41nzZYw --- scripts/pack-and-verify.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/pack-and-verify.mjs b/scripts/pack-and-verify.mjs index 758d2525..a49e5e7a 100644 --- a/scripts/pack-and-verify.mjs +++ b/scripts/pack-and-verify.mjs @@ -151,6 +151,8 @@ console.log( // runs the package's postinstall). // --------------------------------------------------------------------------- const work = mkdtempSync(join(tmpdir(), "pack-verify-")); +// Remove the packed tarball on success; retain it on failure so a packaging +// problem can be inspected (unpack it, diff the file list). let cleanupTarball = true; try { ensureTestServer(); @@ -253,7 +255,9 @@ try { "web (prod / served dist), cli (stdio tools/list), and tui (help) end to end.", ); } catch (err) { - cleanupTarball = true; + // Keep the tarball around for post-mortem inspection of the packaging failure. + cleanupTarball = false; + console.error(`pack:verify — tarball retained for inspection at ${tarball}`); fail(err instanceof Error ? err.message : String(err)); } finally { rmSync(work, { recursive: true, force: true });