From 3e33b88dfc0980aa678534fbe7199ec152b05218 Mon Sep 17 00:00:00 2001 From: benjamin beres Date: Mon, 27 Jul 2026 15:03:06 +0200 Subject: [PATCH] Add a regression test for resolveSlug Pins both halves of the bug: an extension-less shebang script must resolve on every platform, and a resolution failure must be audible. Verified to fail against the pre-fix function (both cases) and pass after it. The first case is the one that reproduces only on Windows; the second holds everywhere, which is what keeps the silent-fallback regression from returning on any platform. Co-Authored-By: Claude Opus 5 --- test/bin-context-resolve-slug.test.ts | 60 +++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 test/bin-context-resolve-slug.test.ts diff --git a/test/bin-context-resolve-slug.test.ts b/test/bin-context-resolve-slug.test.ts new file mode 100644 index 000000000..52fd3f259 --- /dev/null +++ b/test/bin-context-resolve-slug.test.ts @@ -0,0 +1,60 @@ +/** + * resolveSlug portability guard (free). + * + * `bin/gstack-slug` is an extension-less bash script. On Windows, spawnSync + * without a shell goes through CreateProcess, which does not honour shebangs: + * the direct call fails with ENOENT, stdout is null, and resolveSlug used to + * return the literal "unknown". Both consumers -- gstack-decision-log and + * gstack-decision-search -- then read and write ~/.gstack/projects/unknown/. + * On the write side that is one anonymous bucket shared by every repo on the + * machine; on the read side the directory does not exist, so the search + * returns an empty list and exits 0. The session is told there are no prior + * decisions and re-litigates settled calls in good faith. + * + * Two things are pinned here, because the bug had two halves: + * + * 1. the fallback -- an extension-less shebang script must resolve on every + * platform, which is what the `bash