Skip to content

fix(#846): ensureWorktree surfaces failed provisioning install instead of swallowing it - #854

Merged
admarble merged 1 commit into
mainfrom
feature/846-ensureworktree-swallows-the-provisioning-install-e
Jul 29, 2026
Merged

admarble merged 1 commit into
mainfrom
feature/846-ensureworktree-swallows-the-provisioning-install-e

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • ensureWorktree ran the frozen provisioning install and discarded the result with no status check, while the sibling reinstallIfLockfileChanged already warned on failure. After fix(worktree): frozen installs so provisioning cannot dirty the lockfile #816/fix(worktree): new-feature.sh still uses npm install, so provisioning dirties the lockfile (#816 gap) #826 switched provisioning to a frozen npm ci, a repo with no/stale lockfile hard-fails (exit 1, no node_modules) and the swallowed status left a silently dependency-less worktree whose breakage only surfaced later as a confusing phase error.
  • Extract the install into an installWorktreeDeps helper that mirrors the sibling's status check and, on a non-zero exit, emits a chalk.yellow warning naming the resolved command (Dependency install failed (npm ci): …) so the user can rerun it — warn-and-continue, matching the sibling's contract.
  • Adds a mocked unit test to worktree-manager.frozen-install.test.ts.

Pre-PR AC Verification

AC Description Status Evidence
AC-1 Check install exit status, surface a warning naming the failure, matching :1191 ✅ Implemented installWorktreeDeps in worktree-manager.ts — if (installResult.status !== 0) → chalk.yellow warning carrying trimmed stderr; returns false (warn-and-continue)
AC-2 Warning includes the resolved install command ✅ Implemented Message reads Dependency install failed (${command})… where command = [cmd, ...args].join(" "); command named even when stderr is empty
AC-3 A test provisions with no lockfile and asserts the failure is reported, not swallowed ✅ Implemented New installWorktreeDeps surfaces a failed provisioning install (#846) suite: mocks spawnSync → status: 1, spies console.log, asserts warning fired + contains npm ci

Test plan

  • npm run build — passes
  • npm run lint — passes (0 warnings)
  • npx vitest run src/lib/workflow/worktree-manager — 14 passed (6 in frozen-install file)

Closes #846

🤖 Generated with Claude Code

…d of swallowing it

Extract the frozen provisioning install into installWorktreeDeps, which
mirrors reinstallIfLockfileChanged's status check: on a non-zero exit it
warns (chalk.yellow) naming the resolved command so the user can rerun it,
and warn-and-continues rather than aborting. Previously ensureWorktree ran
the install and discarded the result, so after #816/#826 switched to a
frozen npm ci a repo with no/stale lockfile yielded a silently
dependency-less worktree whose breakage only surfaced later as a confusing
phase error.

Adds a mocked unit test (no lockfile => npm ci exit 1) asserting the
failure is reported, the stderr is surfaced, and the command is named even
when stderr is empty.

Entire-Checkpoint: 8e84f0faf466
@admarble
admarble merged commit 5ae2aa0 into main Jul 29, 2026
5 checks passed
@admarble
admarble deleted the feature/846-ensureworktree-swallows-the-provisioning-install-e branch July 29, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ensureWorktree swallows the provisioning install exit status — npm ci failure yields a silent dependency-less worktree

1 participant