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