fix(#1926): bug-1367 builds hooks/dist precondition in before() (#1927)

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
This commit is contained in:
Tom Boucher
2026-07-02 12:42:10 -04:00
committed by GitHub
parent 5657994702
commit 8751379cfc
2 changed files with 17 additions and 0 deletions

View File

@@ -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)

View File

@@ -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-<cmd>.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);
});