You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ensureWorktree swallows the provisioning install exit status — npm ci failure yields a silent dependency-less worktree #846
No status check. The sibling call site at :1191does check and warns on failure.
This asymmetry matters more after #816/#826 switched provisioning to a frozen install. npm install used to self-heal a stale or absent lockfile; npm ci hard-fails (exit 1, no node_modules). So a project with no lockfile, or one out of sync with package.json, now yields a silently dependency-less worktree and the failure only surfaces later as a confusing phase error.
Acceptance Criteria
AC-1:ensureWorktree checks the install exit status and surfaces a warning naming the failure, matching the sibling site at :1191.
AC-2: The warning includes the resolved install command so the user can rerun it.
AC-3: A test provisions a worktree in a repo with no lockfile and asserts the failure is reported rather than swallowed.
All three ACs are specific and measurable — each names a concrete site (:1191 as the model), a concrete artifact (the resolved command), or a concrete test setup (repo with no lockfile). No vague/unmeasurable/open-ended patterns. ✅
Scope Assessment
Non-Goals: Not stated in the issue. Implicit boundary is sound: fix only the swallowed status at ensureWorktree's provisioning install — do not change the frozen-install (npm ci) decision itself (that's #816/#826, deliberate) and do not make a failed install throw/abort (warn-and-continue, matching the sibling at :1191).
Metric
Value
Status
Feature count
1
✅
AC items
3
✅
Directory spread
1 (src/lib/workflow)
✅
Verdict: ✅ SCOPE_OK
Acceptance Criteria
AC-1: ensureWorktree checks install exit status and surfaces a warning naming the failure (matching :1191)
Verification: Unit Test Scenario: Given a provisioned worktree where the install spawnSync returns status !== 0 → When ensureWorktree runs the provisioning install → Then a chalk.yellow warning is emitted to the console carrying the captured stderr, and the function returns a WorktreeInfo (warn-and-continue, not throw), mirroring reinstallIfLockfileChanged at :1191. Assumptions: Provisioning install failure is non-fatal — consistent with the sibling site, which warns and returns rather than aborting.
AC-2: The warning includes the resolved install command so the user can rerun it
Verification: Unit Test Scenario: Given the same failing install (pm = npm, ciInstall = "npm ci") → When the warning is emitted → Then the message text contains the resolved command string npm ci. Note the sibling at :1191 currently does not print the command — AC-2 requires this site to go one better, so assert the command substring explicitly. Assumptions:pmConfig.ciInstall is the exact rerunnable command (already the case: [cmd, ...args].join(" ")).
AC-3: A test provisions a worktree in a repo with no lockfile and asserts the failure is reported rather than swallowed
Verification: Unit Test (mocked child_process), or Integration Test (real temp repo) — see Design Review Q2. Scenario: Given a repo/worktree with no lockfile so npm ci hard-fails (status: 1, empty node_modules) → When provisioning runs → Then the test asserts the warning was emitted (spy on console.log/captured output), i.e. the failure surfaced, not swallowed. Assumptions: With child_process mocked (the existing frozen-install.test.ts pattern), "no lockfile" is simulated by making the install-call mock return status: 1 — no real npm ci, so it stays in the fast unit project.
Implementation Plan
Phase 1: Extract a testable install helper (recommended)
In src/lib/workflow/worktree-manager.ts, extract the provisioning install snippet (:842-848) into a small helper, e.g. installWorktreeDeps(worktreePath, packageManager, verbose): boolean, that resolves PM_CONFIG[pm].ciInstall, spawns it, checks result.status, and on failure emits chalk.yellow(" ! Dependency install failed (<cmd>): <stderr>") and returns false (true on success). This mirrors why reinstallIfLockfileChanged is a standalone, directly-drivable function.
Call the helper from ensureWorktree inside the existing if (!existsSync(nodeModulesPath)) block.
Phase 2: Test (AC-3)
Add a case to src/lib/workflow/worktree-manager.frozen-install.test.ts (or a sibling *.test.ts): mock spawnSync install call to return status: 1, spy on console.log, assert (a) a yellow warning fired and (b) it contains npm ci. Covers AC-1, AC-2, AC-3 in one fast, mocked test.
Alternative (no extraction): capture const installResult = spawnSync(...) inline in ensureWorktree and add the status check + warning there. Fewer moving parts, but AC-3 then has to drive the whole ensureWorktree (git worktree add, settings copy, …) or mock a large surface — the extraction is what keeps the test cheap and matches the codebase's own precedent.
Design Review
Where does this logic belong? In worktree-manager.ts, alongside ensureWorktree and reinstallIfLockfileChanged. A dedicated installWorktreeDeps helper is the natural home and de-duplicates the ciInstall.split(" ") + spawn pattern now living at two sites.
What's the simplest correct approach? Check spawnSync(...).status !== 0 and warn — the same three lines reinstallIfLockfileChanged already has. The only judgment call is helper-extraction (testability) vs inline (minimal). Recommend extraction because it's the difference between a fast mocked unit test and a heavy/slow one — see Open Questions.
What existing pattern does this follow?reinstallIfLockfileChanged:1191-1203 — capture result, if (status !== 0) { console.log(chalk.yellow(...)); return false; }. Reuse verbatim, adding the resolved command to the message for AC-2.
What would a senior reviewer challenge? "Why not just fix it inline in five lines?" → because AC-3 demands a test that provisions a worktree; without a drivable helper that test is disproportionately expensive or forces a real npm ci. "Should a failed install abort instead of warn?" → No; the sibling warns-and-continues and the AC says "matching the sibling site," so warn-and-continue is the contract.
Feature Quality Planning
All standard checks pass. Notable items:
stderr may be empty on some failures — npm ci with no lockfile writes a clear message to stderr, but guard the trim so an empty stderr still yields a useful warning (the resolved command alone is enough to act on). Covered by AC-2's command-in-message requirement.
Sibling-site scan: the two ciInstall.split(" ") sites are the reinstall (:1191, already guarded) and this provisioning site (:843, the bug). No third unguarded install site — the cp/settings spawnSync calls are not dependency installs. Scope is complete as written.
Open Questions
Extract installWorktreeDeps helper vs inline fix? — Recommendation: extract. Impact if inline: AC-3 must mock getGitRoot + git worktree add + settings copy or run a real npm ci, making the test slow/flaky (real subprocess ⇒ must be renamed *.integration.test.ts to escape the 5s unit timeout). Extraction keeps it a fast mocked unit test.
Should the warning respect verbose? — Recommendation: always emit (like :1191), regardless of verbose. A silently dependency-less worktree is exactly the failure this issue exists to make loud; gating it behind verbose would re-bury it.
Recommended Workflow
Phases: spec → exec → qa Quality Loop: disabled (SCOPE_OK, single-directory bug fix) Reasoning: Focused CLI/library bug with clear ACs. Skip testgen — AC-3's single mocked test is written directly in exec against the existing frozen-install.test.ts harness; a stub generator adds no value for one case. No UI ⇒ no test phase. Not security-sensitive.
Label Review
Current: (none) Recommended:bug Reason: Regression-class defect (swallowed exit status) surfaced by the #816/#826 frozen-install switch; single focused fix. Quality Loop: Won't auto-enable — SCOPE_OK.
Message Dependency install failed (${command})… with command = [cmd, ...args].join(" "); named even when stderr is empty
AC-3
Test provisions with no lockfile, asserts failure reported not swallowed
✅
New suite in worktree-manager.frozen-install.test.ts mocks spawnSync → status: 1, spies console.log, asserts warning + npm ci substring
Implementation
src/lib/workflow/worktree-manager.ts — extracted installWorktreeDeps(worktreePath, packageManager, verbose): boolean (marked @internal), mirroring reinstallIfLockfileChanged's status check and adding the resolved command to the message. ensureWorktree's provisioning block now calls it inside the existing if (!existsSync(nodeModulesPath)) guard.
src/lib/workflow/worktree-manager.frozen-install.test.ts — added a 3-case suite (failure surfaces stderr + command; command named on empty stderr; success returns true + no warning).
CHANGELOG.md — ### Fixed entry under [Unreleased].
Quality Plan Alignment
Dimension
Addressed
Notes
Error Handling
✅
Empty-stderr guard (command alone is actionable) — Quality Plan item covered by dedicated test case
Test Coverage
✅
AC-1/2/3 in one fast mocked test; sibling-site scan confirmed no third unguarded install site
Best Practices
✅
Always emits (not gated behind verbose), per Open Question 2
ensureWorktree checks install exit status and surfaces a warning naming the failure, matching :1191
✅ MET
installWorktreeDeps (worktree-manager.ts:530) has if (installResult.status !== 0) → chalk.yellow warning carrying trimmed stderr, returns false (warn-and-continue, not throw). ensureWorktree calls it inside the existing !existsSync(node_modules) guard. Mirrors the sibling at :1239.
AC-2
Original
Warning includes the resolved install command
✅ MET
Message is Dependency install failed (${command})… where command = [cmd, ...args].join(" ") → npm ci. Named even when stderr is empty (dedicated test).
AC-3
Original
A test provisions with no lockfile and asserts the failure is reported, not swallowed
✅ MET
worktree-manager.frozen-install.test.ts: mocks spawnSync → status: 1 (the no-lockfile npm ci hard-fail), spies console.log, asserts the warning fired + surfaces stderr + contains npm ci. Mocked child_process is the sanctioned approach per the /spec plan (keeps it a fast unit test).
Coverage: 3/3 AC items fully met (0 derived ACs)
CI Status
Check
State
Bucket
Impact
node-floor-guard
SUCCESS
pass
✅ MET
validate-plugin
SUCCESS
pass
✅ MET
validate-skills
SUCCESS
pass
✅ MET
typecheck
SUCCESS
pass
✅ MET
build (22.x)
SUCCESS
pass
✅ MET
CI Summary: 5 passed, 0 pending, 0 failed (waited for build (22.x) to reach terminal state before finalizing).
Quality Metrics
Metric
Value
Status
Type issues (any)
0
OK
Deleted tests
0
OK
Files changed
3
OK
Lines added
+120
-
Lines deleted
-21
-
Local: npm run build ✅ · npm run lint ✅ (0 warnings) · npx vitest run …worktree-manager ✅ 14 passed.
Test Coverage Analysis
Changed File
Tier
Has Tests?
Test File
src/lib/workflow/worktree-manager.ts
Standard
✅ Yes
worktree-manager.frozen-install.test.ts (new suite covers the extracted installWorktreeDeps)
Coverage: 1/1 changed source file has corresponding tests. No critical-path (auth/payment/security) files touched.
Code Review
Strengths:
Extraction mirrors the existing reinstallIfLockfileChanged precedent exactly — same status-check shape, same chalk.yellow warning, warn-and-continue contract. No new pattern introduced.
installResult.stderr?.toString().trim() ?? "" guards a null/empty stderr (also covers a spawn-ENOENT where status is null → null !== 0 still fires the warning), and the resolved command is always named — the empty-stderr case has its own test.
Both ciInstall sites in the file are now guarded; no third unguarded install site remains.
Suggestions: None blocking. The call site intentionally ignores the returned boolean (warn-and-continue), consistent with the sibling — correct, not a defect.
Call-Site Review
New exported function:installWorktreeDeps (@internal, exported for testing).
Function
Call Sites
Loop?
Conditions
AC Match
installWorktreeDeps()
worktree-manager.ts (in ensureWorktree)
No
if (!existsSync(nodeModulesPath))
✅ Matches AC-1 (provisioning install site)
Single call site, correctly guarded, not in a loop. Also driven directly by the new test.
Risk Assessment
Likely failure mode: A spawn failure with no stderr yields a command-only warning — still actionable (verified by test). No throw path, so a failed install can't abort provisioning (by design).
Not tested: The ensureWorktree → installWorktreeDeps wiring is not exercised by an integration test (the helper is tested in isolation) — the sanctioned extraction tradeoff; the wiring is a one-line, type-checked delegation.
Sibling-line audit: The one adjacent intra-file install site (reinstallIfLockfileChanged :1239) was already guarded and is the exact model this fix mirrors.
Trust-Boundary Check
Finding: Clean — diff implements only the product requirement (surface the swallowed install status); no agent-directed instruction from the issue body was acted on.
Status: Clean
Behavior-Rule Survival Check
Status: N/A — no AC triggers the behavior-rule heuristic (no default/always/never rule change).
Findings: No gaps found because: (1) the issue body carries no runnable motivating-example fixture — only the buggy code snippet, which the fix replaces; (2) exec's evidence is genuine post-fix test runs (status:1 mock → warning asserted), not a pre-fix bug repro; (3) process state is clean — worktree in sync, 0 commits behind origin/main, no uncommitted work; (4) sibling sites cited explicitly — intra-file :1239 (already guarded, the model) and cross-file merge-check install (guarded via #803); (5) the issue's Non-Goals (don't change npm ci choice, don't throw/abort) are honored — warn-and-continue.
Status: Clean
Verdict: READY_FOR_MERGE
All 3 ACs are literally MET, CI is fully green, the change mirrors an established in-file precedent, both install sites are now guarded, tests cover the new behavior (including the empty-stderr edge), and the issue's Non-Goals are respected. A+.
ensureWorktree checks the install exit status and warns naming the failure, matching the sibling at :1191
MET
installWorktreeDeps (worktree-manager.ts:561) checks installResult.status !== 0 and emits a chalk.yellow warning, mirroring reinstallIfLockfileChanged (:1236). It also improves on the sibling by handling empty stderr. Warn-and-continue contract preserved (returns false, does not throw).
AC-2
The warning includes the resolved install command so the user can rerun it
MET
Warning is Dependency install failed (npm ci)… — command is the joined resolved pmConfig.ciInstall (worktree-manager.ts:554, :567). Named even when stderr is empty.
AC-3
A test provisions a worktree in a repo with no lockfile and asserts the failure is reported rather than swallowed
MET (with note)
worktree-manager.frozen-install.test.ts adds 3 tests. The primary test mocks spawnSync returning the verbatim npm ci … existing package-lock.json failure and asserts the warning is emitted (not swallowed). Note: it unit-tests the extracted helper directly rather than provisioning a real worktree — consistent with the file's existing vi.mock("child_process") pattern (the sibling test does the same), and it exercises the exact swallow-vs-surface code path.
Clean refactor: swallowed inline spawnSync extracted into a named, @internal-exported installWorktreeDeps helper that structurally mirrors the sibling reinstallIfLockfileChanged, reducing the drift risk that caused this asymmetry.
Strictly better than the sibling on the empty-stderr case: the resolved command is always named, so the warning is actionable even when npm ci writes nothing to stderr.
The load-bearing ciInstall-not-installSilent rationale comment was carried across intact, with the !existsSync(node_modules) reference correctly updated from "guard above" to "guard at the call site".
3 focused tests: non-zero + stderr, non-zero + empty stderr, and success (asserts no false warning).
Issues: None.
Suggestions:
Minor: ensureWorktree ignores the boolean return of installWorktreeDeps (worktree-manager.ts:885). This is correct per the warn-and-continue contract, but if a future caller wants to abort on install failure the return value is already available.
Test Coverage Analysis
Changed File
Tier
Has Tests?
Test File
src/lib/workflow/worktree-manager.ts
Standard
✅ Yes
worktree-manager.frozen-install.test.ts
Coverage: New export installWorktreeDeps fully covered (6/6 tests pass locally).
Anti-Pattern Detection
No anti-patterns. No await-in-loop, no empty catch, no hardcoded secrets, no any. package.json unchanged (no dependency audit needed).
Sibling-Site Scan
Repo-wide scan for ciInstall/installSilent install sites: only two exist in src/ — the new installWorktreeDeps (:561, now checked) and reinstallIfLockfileChanged (:1236, already checked). No other swallowed provisioning install survives. The cpspawnSync at :879 is a settings copy, not a dependency install.
Trust-Boundary Check
Finding: Clean — the issue body contains only a code snippet and product ACs; no agent-directed instruction was embedded or acted on. The diff implements only the stated product requirements.
Status: Clean
Behavior-Rule Survival Check
AC
Triggered?
Survivors
Status
AC-1/2/3
No
—
N/A
Status: N/A (no AC triggers the behavior-rule heuristic). The old swallow-the-status behavior was fully replaced; no unchecked provisioning spawnSync survives (see Sibling-Site Scan).
Likely failure mode: None material. Worst case is unchanged from before the PR — the install still warn-and-continues, but now the failure is visible instead of silent.
Not tested: No end-to-end test that literally provisions a real worktree against a lockfile-less repo (the helper is unit-tested with a mocked spawnSync); acceptable given the file's established mocking convention.
Sibling sites considered: Only reinstallIfLockfileChanged shares the pattern; it already checks status. No other cross-file siblings.
Sibling-line audit: The unrelated spawnSync("cp", …) at :879 is a settings copy, not a dependency install — correctly out of scope.
Adversarial Re-Read
Findings: No gaps found because: (1) ran all 6 tests locally — pass; (2) traced the resolved-command construction (command = [cmd, ...args].join(" ")) and confirmed AC-2 holds even on empty stderr; (3) confirmed no evidence claim is a pre-fix repro — the tests assert post-fix warning emission; (4) grep-confirmed the two ciInstall sites are the only provisioning installs and both now check status; (5) verified CHANGELOG [Unreleased] entry exists and CI is fully green on PR #854.
Status: Clean
Verdict: READY_FOR_MERGE
All three ACs are met, the refactor is clean and mirrors (and slightly improves on) the sibling contract, CI is fully green on PR #854, and the new helper is fully unit-tested. The single AC-3 wording note (unit test of the extracted helper vs. a full worktree-provisioning integration test) is consistent with the file's mocking convention and covers the exact swallow-vs-surface code path — not blocking.
Documentation
CHANGELOG entry added (for user-facing change)
N/A - No README/docs change needed (internal provisioning behavior)
Activity
admarble commentedon Jul 29, 2026
Complexity: Standard (3 ACs, 1 directory)
AC Quality Check
All three ACs are specific and measurable — each names a concrete site (
:1191as the model), a concrete artifact (the resolved command), or a concrete test setup (repo with no lockfile). No vague/unmeasurable/open-ended patterns. ✅Scope Assessment
Non-Goals: Not stated in the issue. Implicit boundary is sound: fix only the swallowed status at
ensureWorktree's provisioning install — do not change the frozen-install (npm ci) decision itself (that's #816/#826, deliberate) and do not make a failed install throw/abort (warn-and-continue, matching the sibling at:1191).src/lib/workflow)Verdict: ✅ SCOPE_OK
Acceptance Criteria
AC-1:
ensureWorktreechecks install exit status and surfaces a warning naming the failure (matching:1191)Verification: Unit Test
Scenario: Given a provisioned worktree where the install
spawnSyncreturnsstatus !== 0→ WhenensureWorktreeruns the provisioning install → Then achalk.yellowwarning is emitted to the console carrying the capturedstderr, and the function returns aWorktreeInfo(warn-and-continue, not throw), mirroringreinstallIfLockfileChangedat:1191.Assumptions: Provisioning install failure is non-fatal — consistent with the sibling site, which warns and returns rather than aborting.
AC-2: The warning includes the resolved install command so the user can rerun it
Verification: Unit Test
Scenario: Given the same failing install (pm =
npm,ciInstall = "npm ci") → When the warning is emitted → Then the message text contains the resolved command stringnpm ci. Note the sibling at:1191currently does not print the command — AC-2 requires this site to go one better, so assert the command substring explicitly.Assumptions:
pmConfig.ciInstallis the exact rerunnable command (already the case:[cmd, ...args].join(" ")).AC-3: A test provisions a worktree in a repo with no lockfile and asserts the failure is reported rather than swallowed
Verification: Unit Test (mocked
child_process), or Integration Test (real temp repo) — see Design Review Q2.Scenario: Given a repo/worktree with no lockfile so
npm cihard-fails (status: 1, emptynode_modules) → When provisioning runs → Then the test asserts the warning was emitted (spy onconsole.log/captured output), i.e. the failure surfaced, not swallowed.Assumptions: With
child_processmocked (the existingfrozen-install.test.tspattern), "no lockfile" is simulated by making the install-call mock returnstatus: 1— no realnpm ci, so it stays in the fastunitproject.Implementation Plan
Phase 1: Extract a testable install helper (recommended)
src/lib/workflow/worktree-manager.ts, extract the provisioning install snippet (:842-848) into a small helper, e.g.installWorktreeDeps(worktreePath, packageManager, verbose): boolean, that resolvesPM_CONFIG[pm].ciInstall, spawns it, checksresult.status, and on failure emitschalk.yellow(" ! Dependency install failed (<cmd>): <stderr>")and returnsfalse(true on success). This mirrors whyreinstallIfLockfileChangedis a standalone, directly-drivable function.ensureWorktreeinside the existingif (!existsSync(nodeModulesPath))block.Phase 2: Test (AC-3)
src/lib/workflow/worktree-manager.frozen-install.test.ts(or a sibling*.test.ts): mockspawnSyncinstall call to returnstatus: 1, spy onconsole.log, assert (a) a yellow warning fired and (b) it containsnpm ci. Covers AC-1, AC-2, AC-3 in one fast, mocked test.Design Review
worktree-manager.ts, alongsideensureWorktreeandreinstallIfLockfileChanged. A dedicatedinstallWorktreeDepshelper is the natural home and de-duplicates theciInstall.split(" ")+ spawn pattern now living at two sites.spawnSync(...).status !== 0and warn — the same three linesreinstallIfLockfileChangedalready has. The only judgment call is helper-extraction (testability) vs inline (minimal). Recommend extraction because it's the difference between a fast mocked unit test and a heavy/slow one — see Open Questions.reinstallIfLockfileChanged:1191-1203— capture result,if (status !== 0) { console.log(chalk.yellow(...)); return false; }. Reuse verbatim, adding the resolved command to the message for AC-2.npm ci. "Should a failed install abort instead of warn?" → No; the sibling warns-and-continues and the AC says "matching the sibling site," so warn-and-continue is the contract.Feature Quality Planning
All standard checks pass. Notable items:
stderrmay be empty on some failures —npm ciwith no lockfile writes a clear message to stderr, but guard the trim so an empty stderr still yields a useful warning (the resolved command alone is enough to act on). Covered by AC-2's command-in-message requirement.ciInstall.split(" ")sites are the reinstall (:1191, already guarded) and this provisioning site (:843, the bug). No third unguarded install site — thecp/settingsspawnSynccalls are not dependency installs. Scope is complete as written.Open Questions
installWorktreeDepshelper vs inline fix? — Recommendation: extract. Impact if inline: AC-3 must mockgetGitRoot+git worktree add+ settings copy or run a realnpm ci, making the test slow/flaky (real subprocess ⇒ must be renamed*.integration.test.tsto escape the 5sunittimeout). Extraction keeps it a fast mocked unit test.verbose? — Recommendation: always emit (like:1191), regardless ofverbose. A silently dependency-less worktree is exactly the failure this issue exists to make loud; gating it behindverbosewould re-bury it.Recommended Workflow
Phases: spec → exec → qa
Quality Loop: disabled (SCOPE_OK, single-directory bug fix)
Reasoning: Focused CLI/library bug with clear ACs. Skip
testgen— AC-3's single mocked test is written directly inexecagainst the existingfrozen-install.test.tsharness; a stub generator adds no value for one case. No UI ⇒ notestphase. Not security-sensitive.Label Review
Current: (none)
Recommended:
bugReason: Regression-class defect (swallowed exit status) surfaced by the #816/#826 frozen-install switch; single focused fix.
Quality Loop: Won't auto-enable — SCOPE_OK.
→
gh issue edit 846 --add-label bugadmarble commentedon Jul 29, 2026
Exec Progress Update
Implemented per the
/specplan (Phase 1 helper extraction + Phase 2 mocked test).AC Coverage
:1191)installWorktreeDepschecksinstallResult.status !== 0→chalk.yellowwarning carrying trimmed stderr; returnsfalse(warn-and-continue, not throw)Dependency install failed (${command})…withcommand = [cmd, ...args].join(" "); named even when stderr is emptyworktree-manager.frozen-install.test.tsmocksspawnSync→status: 1, spiesconsole.log, asserts warning +npm cisubstringImplementation
src/lib/workflow/worktree-manager.ts— extractedinstallWorktreeDeps(worktreePath, packageManager, verbose): boolean(marked@internal), mirroringreinstallIfLockfileChanged's status check and adding the resolved command to the message.ensureWorktree's provisioning block now calls it inside the existingif (!existsSync(nodeModulesPath))guard.src/lib/workflow/worktree-manager.frozen-install.test.ts— added a 3-case suite (failure surfaces stderr + command; command named on empty stderr; success returns true + no warning).CHANGELOG.md—### Fixedentry under[Unreleased].Quality Plan Alignment
verbose), per Open Question 2Derived ACs: None in spec comment.
Checks
npm run buildnpm run lintnpx vitest run src/lib/workflow/worktree-managerPR
Created: #854
admarble commentedon Jul 29, 2026
QA Review for Issue #846
AC Coverage
ensureWorktreechecks install exit status and surfaces a warning naming the failure, matching:1191installWorktreeDeps(worktree-manager.ts:530) hasif (installResult.status !== 0)→chalk.yellowwarning carrying trimmed stderr, returnsfalse(warn-and-continue, not throw).ensureWorktreecalls it inside the existing!existsSync(node_modules)guard. Mirrors the sibling at:1239.Dependency install failed (${command})…wherecommand = [cmd, ...args].join(" ")→npm ci. Named even when stderr is empty (dedicated test).worktree-manager.frozen-install.test.ts: mocksspawnSync→status: 1(the no-lockfilenpm cihard-fail), spiesconsole.log, asserts the warning fired + surfaces stderr + containsnpm ci. Mockedchild_processis the sanctioned approach per the /spec plan (keeps it a fastunittest).Coverage: 3/3 AC items fully met (0 derived ACs)
CI Status
CI Summary: 5 passed, 0 pending, 0 failed (waited for
build (22.x)to reach terminal state before finalizing).Quality Metrics
any)Local:
npm run build✅ ·npm run lint✅ (0 warnings) ·npx vitest run …worktree-manager✅ 14 passed.Test Coverage Analysis
src/lib/workflow/worktree-manager.tsworktree-manager.frozen-install.test.ts(new suite covers the extractedinstallWorktreeDeps)Coverage: 1/1 changed source file has corresponding tests. No critical-path (auth/payment/security) files touched.
Code Review
Strengths:
reinstallIfLockfileChangedprecedent exactly — same status-check shape, samechalk.yellowwarning, warn-and-continue contract. No new pattern introduced.installResult.stderr?.toString().trim() ?? ""guards a null/empty stderr (also covers a spawn-ENOENT wherestatusisnull→null !== 0still fires the warning), and the resolved command is always named — the empty-stderr case has its own test.ciInstallsites in the file are now guarded; no third unguarded install site remains.npm ci) decision (fix(worktree): frozen installs so provisioning cannot dirty the lockfile #816/fix(worktree): new-feature.sh still usesnpm install, so provisioning dirties the lockfile (#816 gap) #826) and does not make a failed install throw/abort — it warns and continues, exactly as the AC specifies.Issues: None.
Suggestions: None blocking. The call site intentionally ignores the returned boolean (warn-and-continue), consistent with the sibling — correct, not a defect.
Call-Site Review
New exported function:
installWorktreeDeps(@internal, exported for testing).installWorktreeDeps()worktree-manager.ts(inensureWorktree)if (!existsSync(nodeModulesPath))Single call site, correctly guarded, not in a loop. Also driven directly by the new test.
Risk Assessment
ensureWorktree→installWorktreeDepswiring is not exercised by an integration test (the helper is tested in isolation) — the sanctioned extraction tradeoff; the wiring is a one-line, type-checked delegation.merge-check's combined-branch frozen install already surfaces install failure as its own error finding (fix(merge-check): combined-branch-test runs npm test/build without reinstalling deps after a lockfile change → false BLOCKED #803); no unguarded cross-file sibling remains.reinstallIfLockfileChanged:1239) was already guarded and is the exact model this fix mirrors.Trust-Boundary Check
Finding: Clean — diff implements only the product requirement (surface the swallowed install status); no agent-directed instruction from the issue body was acted on.
Status: Clean
Behavior-Rule Survival Check
Status: N/A — no AC triggers the behavior-rule heuristic (no default/always/never rule change).
CHANGELOG Verification
### Fixed, references #846)Result: CHANGELOG requirements met.
Adversarial Re-Read
Findings: No gaps found because: (1) the issue body carries no runnable motivating-example fixture — only the buggy code snippet, which the fix replaces; (2) exec's evidence is genuine post-fix test runs (status:1 mock → warning asserted), not a pre-fix bug repro; (3) process state is clean — worktree in sync, 0 commits behind origin/main, no uncommitted work; (4) sibling sites cited explicitly — intra-file
:1239(already guarded, the model) and cross-filemerge-checkinstall (guarded via #803); (5) the issue's Non-Goals (don't changenpm cichoice, don't throw/abort) are honored — warn-and-continue.Status: Clean
Verdict: READY_FOR_MERGE
All 3 ACs are literally MET, CI is fully green, the change mirrors an established in-file precedent, both install sites are now guarded, tests cover the new behavior (including the empty-stderr edge), and the issue's Non-Goals are respected. A+.
Documentation
Documentation: Optionally run
/docs 846before merge, though this is an internal fix with no user-facing docs surface.Next Steps
admarble commentedon Jul 29, 2026
QA Review for Issue #846
AC Coverage
ensureWorktreechecks the install exit status and warns naming the failure, matching the sibling at:1191installWorktreeDeps(worktree-manager.ts:561) checksinstallResult.status !== 0and emits achalk.yellowwarning, mirroringreinstallIfLockfileChanged(:1236). It also improves on the sibling by handling empty stderr. Warn-and-continue contract preserved (returnsfalse, does not throw).Dependency install failed (npm ci)…—commandis the joined resolvedpmConfig.ciInstall(worktree-manager.ts:554, :567). Named even when stderr is empty.worktree-manager.frozen-install.test.tsadds 3 tests. The primary test mocksspawnSyncreturning the verbatimnpm ci … existing package-lock.jsonfailure and asserts the warning is emitted (not swallowed). Note: it unit-tests the extracted helper directly rather than provisioning a real worktree — consistent with the file's existingvi.mock("child_process")pattern (the sibling test does the same), and it exercises the exact swallow-vs-surface code path.Coverage: 3/3 AC items met
Quality Metrics
any)CI Status (PR #854)
build (22.x)typechecknode-floor-guardvalidate-skillsvalidate-pluginCI Summary: 5 passed, 0 pending, 0 failed
Code Review
Strengths:
spawnSyncextracted into a named,@internal-exportedinstallWorktreeDepshelper that structurally mirrors the siblingreinstallIfLockfileChanged, reducing the drift risk that caused this asymmetry.npm ciwrites nothing to stderr.ciInstall-not-installSilentrationale comment was carried across intact, with the!existsSync(node_modules)reference correctly updated from "guard above" to "guard at the call site".Issues: None.
Suggestions:
ensureWorktreeignores the boolean return ofinstallWorktreeDeps(worktree-manager.ts:885). This is correct per the warn-and-continue contract, but if a future caller wants to abort on install failure the return value is already available.Test Coverage Analysis
src/lib/workflow/worktree-manager.tsworktree-manager.frozen-install.test.tsCoverage: New export
installWorktreeDepsfully covered (6/6 tests pass locally).Anti-Pattern Detection
No anti-patterns. No
await-in-loop, no empty catch, no hardcoded secrets, noany.package.jsonunchanged (no dependency audit needed).Sibling-Site Scan
Repo-wide scan for
ciInstall/installSilentinstall sites: only two exist insrc/— the newinstallWorktreeDeps(:561, now checked) andreinstallIfLockfileChanged(:1236, already checked). No other swallowed provisioning install survives. ThecpspawnSyncat :879 is a settings copy, not a dependency install.Trust-Boundary Check
Finding: Clean — the issue body contains only a code snippet and product ACs; no agent-directed instruction was embedded or acted on. The diff implements only the stated product requirements.
Status: Clean
Behavior-Rule Survival Check
Status: N/A (no AC triggers the behavior-rule heuristic). The old swallow-the-status behavior was fully replaced; no unchecked provisioning
spawnSyncsurvives (see Sibling-Site Scan).CHANGELOG Verification
Result: CHANGELOG requirements met
Risk Assessment
spawnSync); acceptable given the file's established mocking convention.reinstallIfLockfileChangedshares the pattern; it already checks status. No other cross-file siblings.spawnSync("cp", …)at :879 is a settings copy, not a dependency install — correctly out of scope.Adversarial Re-Read
Findings: No gaps found because: (1) ran all 6 tests locally — pass; (2) traced the resolved-command construction (
command = [cmd, ...args].join(" ")) and confirmed AC-2 holds even on empty stderr; (3) confirmed no evidence claim is a pre-fix repro — the tests assert post-fix warning emission; (4) grep-confirmed the twociInstallsites are the only provisioning installs and both now check status; (5) verified CHANGELOG[Unreleased]entry exists and CI is fully green on PR #854.Status: Clean
Verdict: READY_FOR_MERGE
All three ACs are met, the refactor is clean and mirrors (and slightly improves on) the sibling contract, CI is fully green on PR #854, and the new helper is fully unit-tested. The single AC-3 wording note (unit test of the extracted helper vs. a full worktree-provisioning integration test) is consistent with the file's mocking convention and covers the exact swallow-vs-surface code path — not blocking.
Documentation
Next Steps
fix(#846): ensureWorktree surfaces failed provisioning install instea…
fix(#845): harden the eight numeric CLI options #833 left on bare par…