From 8751379cfc02e8f48f613ffed30e91ed1505f0fb Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Thu, 2 Jul 2026 12:42:10 -0400 Subject: [PATCH] fix(#1926): bug-1367 builds hooks/dist precondition in before() (#1927) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bug-1367 install test ran install.js without building hooks/dist (a gitignored build artifact). The unit lane's ensureBuiltArtifacts() builds only bin/lib, not hooks — so on a lane without pre-built hooks the installer's verifyInstalled(hooks) found the dir empty and hard-failed 'directory is empty', throwing in before() → hookFailed → L0-L5 cancelledByParent cascade on the Windows CI lane. Build hooks in before() via scripts/build-hooks.js (mirrors golden-install-parity's BUILD_SCRIPT pattern). Self-contained — no lane-ordering dependency. Closes #1926 --- .changeset/graceful-wasps-caper.md | 5 +++++ ...ug-1367-claude-local-flat-command-layout.test.cjs | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 .changeset/graceful-wasps-caper.md diff --git a/.changeset/graceful-wasps-caper.md b/.changeset/graceful-wasps-caper.md new file mode 100644 index 000000000..a0eadf8dd --- /dev/null +++ b/.changeset/graceful-wasps-caper.md @@ -0,0 +1,5 @@ +--- +type: Fixed +pr: 1927 +--- +**bug-1367 install test no longer fails on Windows CI when hooks/dist isn't pre-built** — the test ran install.js without building its hooks/dist precondition (a gitignored build artifact the unit lane doesn't build), so on a lane without pre-built hooks the installer hit "Failed to install hooks: directory is empty" and the before-hook threw. The test now builds hooks in its own before() (mirroring golden-install-parity). (#1926) diff --git a/tests/bug-1367-claude-local-flat-command-layout.test.cjs b/tests/bug-1367-claude-local-flat-command-layout.test.cjs index 02ab787fc..e333139ca 100644 --- a/tests/bug-1367-claude-local-flat-command-layout.test.cjs +++ b/tests/bug-1367-claude-local-flat-command-layout.test.cjs @@ -33,6 +33,11 @@ const { cleanup } = require('./helpers.cjs'); const REPO_ROOT = path.resolve(__dirname, '..'); const INSTALL_PATH = path.join(REPO_ROOT, 'bin', 'install.js'); +// hooks/dist/ is a gitignored build artifact; the test must ensure it exists before +// invoking the installer (mirrors golden-install-parity's BUILD_SCRIPT pattern). Without +// this, the unit lane — whose ensureBuiltArtifacts() builds only bin/lib, not hooks — +// leaves hooks/dist empty and install.js hard-fails "directory is empty" (#1926). +const BUILD_HOOKS = path.join(REPO_ROOT, 'scripts', 'build-hooks.js'); // --------------------------------------------------------------------------- // Helpers @@ -61,6 +66,13 @@ describe('bug #1367 — Claude local install uses flat gsd-.md command layo let tmpDir; before(() => { + // #1926: build hooks/dist/ so the installer's verifyInstalled(hooks) doesn't hit an + // empty directory. Self-contained — no dependency on the lane having pre-built hooks. + execFileSync(process.execPath, [BUILD_HOOKS], { + cwd: REPO_ROOT, + encoding: 'utf-8', + stdio: ['pipe', 'pipe', 'pipe'], + }); tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-1367-')); runClaudeLocalInstall(tmpDir); });