Skip to content

new-feature.sh hardcodes npm ci while the TS path is package-manager aware — pnpm/yarn/bun provisioning fails misleadingly #847

Closed

Description

@admarble

Found during pre-2.10.0 release verification.

templates/scripts/new-feature.sh hardcodes npm ci --silent in its frozen_install(), while the TypeScript provisioning path uses the package-manager-aware pmConfig.ciInstall.

Consequence: on a pnpm/yarn/bun project the shell path runs npm ci, which fails against a non-npm lockfile with the misleading message "The committed package-lock.json is out of sync with package.json" — pointing the user at a file their project does not use.

Acceptance Criteria

  • AC-1: new-feature.sh resolves the install command from the project's detected package manager rather than hardcoding npm.
  • AC-2: A pnpm project provisions successfully through the shell path.
  • AC-3: When no lockfile matches the detected package manager, the error names the actual expected lockfile.

Activity

  1. admarble commented on Jul 29, 2026

    @admarble
    ContributorAuthor

    #847 — new-feature.sh hardcodes npm ci while the TS path is package-manager aware — pnpm/yarn/bun provisioning fails misleadingly
    Open
    ────────────────────────────────────────────────────────────────

    → PROCEED — new-feature.sh hardcodes npm ci while the TS path is PM-aware; ACs are clear and testable

    Commands:
    sequant run 847 -Q

    spec → exec → qa · 3 ACs
    ────────────────────────────────────────────────────────────────
    ⚠ scripts/new-feature.sh is a symlink to templates/scripts/ — edit the template, never scripts/dev/
    ────────────────────────────────────────────────────────────────

  2. admarble commented on Jul 29, 2026

    @admarble
    ContributorAuthor

    Decision: package-manager detection (research summary)

    Chosen design: a ~20-line POSIX-sh lockfile scan inside new-feature.sh, mirroring detectPackageManagerSync exactly, plus a CI drift-guard test. No manifest read, no node/sequant shell-out.

    Detection order (must match LOCKFILE_PRIORITY, src/lib/stacks.ts:156-162): bun.lockb → bun.lock → yarn.lock → pnpm-lock.yaml → package-lock.json → npm fallback. Install commands from PM_CONFIG (stacks.ts:83/93/103/113): npm ci, bun install --frozen-lockfile, yarn install --immutable, pnpm install --frozen-lockfile.

    Why this option

    • The TS detector is lockfile-existence only — it never reads package.json's packageManager field — so the shell port is four [ -f ] tests plus a case table, and conflict behavior (multiple lockfiles) matches TS by construction.
    • Shelling out to node/sequant rejected: no TS code ever spawns this script; sequant isn't guaranteed on PATH in user projects (script ships via npm files → scripts/dev/ symlinks, src/lib/templates.ts:629-649); it would add a node prerequisite to a script that today needs only git/gh/jq.
    • Manifest-first rejected (considered: read .sequant-manifest.json via jq for parity with worktree-manager.ts:541): the manifest's packageManager is only ever a snapshot of this same lockfile detection taken at sequant init (init.ts:370) — there is no override mechanism — so it carries no information a fresh scan doesn't, while adding a staleness failure mode (npm→pnpm migration after init). Live lockfile detection is what merge-check already does (combined-branch-test.ts:139-140).
    • Drift containment: add a vitest test that imports PM_CONFIG and asserts each JS ciInstall string appears verbatim in the shell script's case table — converts drift from silent to failing. Harness precedent: __tests__/cleanup-worktree-branch-resolution.integration.test.ts:24-48 (drives the real script in a throwaway repo with stubbed binaries on PATH; stub pnpm the same way for AC-2).

    Scope beyond frozen_install() — required or AC-2 still fails

    • The SEQUANT_NPM_CACHE branch hashes ${MAIN_REPO_DIR}/package-lock.json (lines 216/218). On a pnpm project with the cache enabled: macOS aborts at line 218 under set -e (md5 -q, no pipe); Linux continues with an empty hash and fails later in frozen_install (the | cut masks md5sum's failure). Hash the resolved lockfile instead.
    • Gate the install on [ -f package.json ] in addition to the node_modules check (line 208), so non-JS projects skip it instead of running npm ci.
    • AC-3: derive the error text from the same PM→lockfile map so it names the actual expected lockfile (e.g. pnpm-lock.yaml), and the suggested fix command matches the PM.

    Follow-ups (separate from this issue)

    1. worktree-manager.ts:541's bare || "npm" fallback should become detectPackageManagerSync(worktreePath) so the TS path and shell path agree on uninitialized/manifest-less projects — same dual-producer drift class as fix(cli): bare parseInt on run --timeout lets a malformed value abort every phase instantly (sibling of #818) #833.
    2. Do not port yarn install --immutable blindly: it is Yarn 2+ syntax and Yarn 1.x does not honor it. The defect exists in the TS side today (stacks.ts:103, no berry detection anywhere) — fix in both paths or file separately.
  3. admarble commented on Jul 29, 2026

    @admarble
    ContributorAuthor

    📋 Spec: Plan & Verification Criteria

    Complexity: Standard (3 ACs, 1 primary directory)

    AC Quality Check

    All three ACs are measurable and testable. No vague/unmeasurable/open-ended patterns. ✅

    Scope Assessment

    Non-Goals: ⚠️ Not stated in the issue. Implicit boundary confirmed below (Open Questions): fix the shell provisioning path only; do not re-architect PM detection.

    Metric Value Status
    Feature count 1 ✅
    AC items 3 ✅
    Directory spread 1 (templates/scripts/) ✅

    Verdict: ✅ SCOPE_OK


    Root Cause

    templates/scripts/new-feature.sh:194 hardcodes npm ci --silent in frozen_install(), and the failure message (:196-198) hardcodes package-lock.json. The TypeScript provisioning path (worktree-manager.ts, #816) already resolves the frozen install from PM_CONFIG[pm].ciInstall via lockfile detection (stacks.ts LOCKFILE_PRIORITY / detectPackageManagerSync). The shell path was missed by that fix, so on a pnpm/yarn/bun project it runs npm ci against a non-npm lockfile and prints a misleading "package-lock.json out of sync" error naming a file the project doesn't use.


    Acceptance Criteria

    AC-1: new-feature.sh resolves the install command from the detected package manager rather than hardcoding npm.

    • Verification: Integration Test
    • Scenario: Given a worktree checked out from a pnpm project → When frozen_install() runs → Then it invokes pnpm install --frozen-lockfile (not npm ci).
    • Assumptions: Bash lockfile-priority detection mirrors stacks.ts:156 LOCKFILE_PRIORITY (bun.lockb → bun.lock → yarn.lock → pnpm-lock.yaml → package-lock.json), falling back to npm.

    AC-2: A pnpm project provisions successfully through the shell path.

    • Verification: Integration Test
    • Scenario: Given a fixture repo with pnpm-lock.yaml and pnpm available → When new-feature.sh provisions a worktree → Then the frozen install completes and the worktree is left clean (no rewritten lockfile).
    • Assumptions: CI/test env can invoke pnpm, or the install command is asserted without a real network install (command-capture harness).

    AC-3: When no lockfile matches the detected package manager, the error names the actual expected lockfile.

    • Verification: Integration Test
    • Scenario: Given a pnpm project whose frozen install fails → When frozen_install() aborts → Then stderr names pnpm-lock.yaml and the recovery hint uses the pnpm-appropriate command, not package-lock.json / npm install --package-lock-only.
    • Assumptions: Each PM maps to its {lockfile, recovery-command} pair in the shell path.

    Implementation Plan

    Phase 1 — Bash PM resolution helper

    1. Add a detect_package_manager() bash function in templates/scripts/new-feature.sh that checks lockfiles in the same priority order as stacks.ts:156 (bun.lockb, bun.lock, yarn.lock, pnpm-lock.yaml, package-lock.json) and echoes the PM name, defaulting to npm. Add a comment cross-referencing stacks.ts LOCKFILE_PRIORITY as the source of truth.
    2. Map each PM → its frozen ciInstall command and expected lockfile name, matching PM_CONFIG (npm ci, pnpm install --frozen-lockfile, yarn install --immutable, bun install --frozen-lockfile).

    Phase 2 — Wire into frozen_install()
    3. Replace the hardcoded npm ci --silent at :194 with the resolved command; keep the quiet behavior per PM where applicable.
    4. Update the failure block (:195-199) to name the resolved lockfile and the PM-appropriate recovery command (AC-3).

    Phase 3 — Tests + sync
    5. Add an integration test that provisions a pnpm fixture (or captures the invoked command) covering AC-1/AC-2, plus a no-lockfile/failure case for AC-3. Mirror the assertion style of worktree-manager.frozen-install.test.ts.
    6. Confirm the runtime script location: scripts/new-feature.sh is a symlink → templates/scripts/, so a single edit suffices — verify no plugin/.claude copy drifts.


    Design Review

    1. Where does this logic belong? In new-feature.sh itself — the provisioning hot path runs before the worktree's node_modules exists, so shelling out to the TS detector is undesirable. A small self-contained bash table is the right layer.
    2. Simplest correct approach? Replicate the 5-entry lockfile-priority table in bash rather than invoking node/tsx. Rejected: calling detectPackageManagerSync via node (adds a node dependency to the pre-install path and a build/dist requirement).
    3. Existing pattern? Directly parallels the fix(worktree): frozen installs so provisioning cannot dirty the lockfile #816 TypeScript fix (ciInstall from PM_CONFIG) and reuses the exact same lockfile priority.
    4. What a senior reviewer would challenge? "Now lockfile priority lives in two places (bash + stacks.ts) — they can drift." Mitigation: a cross-reference comment in the script + the existing PM_CONFIG frozen-install invariant test; consider a follow-up to assert bash/TS parity if drift risk grows.

    Sibling Site (Open Question)

    The opt-in SEQUANT_NPM_CACHE branch (:210-244) also hardcodes package-lock.json (hashing ${MAIN_REPO_DIR}/package-lock.json at :216-218). On a non-npm project CURRENT_HASH is empty, so the cache silently no-ops and falls back to frozen_install — it degrades gracefully rather than failing, so it is out of the 3 ACs. Recommend: fix the hash source to the detected lockfile in the same PR (trivially co-located) or file a follow-up. Leaning toward folding it in since we are already in the file.


    Open Questions

    1. Test strategy for AC-2 — Recommendation: a command-capture harness (assert the resolved command string) rather than a real pnpm network install, to keep the test hermetic and fast. Impact if wrong: a real-install test is slow/flaky in the shared integration worker.
    2. Fold in the SEQUANT_NPM_CACHE sibling? — Recommendation: yes (trivially co-located). Impact if deferred: pnpm/yarn/bun users silently get no cache benefit.

    Recommended Workflow

    Phases: exec → qa
    Quality Loop: disabled (SCOPE_OK, single-file focused fix)
    Reasoning: Focused shell bug fix mirroring an established TS pattern. No testgen (shell path — no TS unit stubs; verification is integration-level assertions added during exec). No test phase (no UI). No security-review.

    Label Review

    Current: none
    Recommended: bug
    Reason: Release-verification defect (misleading provisioning failure). bug keeps the workflow lean and skips testgen.


  4. added
    bug
    planned
    on Jul 29, 2026
  5. admarble commented on Jul 30, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #847

    PR #859 · branch feature/847-new-feature-sh-hardcodes-npm-ci-while-the-ts-path- · HEAD 05bb6674 · 3 files, +355/-22

    Reviewed inline (diff < 600 lines) rather than via worktree sub-agents, per the worktree-hallucination rule.

    AC Coverage

    AC Source Description Status Notes
    AC-1 Original Resolve install command from detected PM, not hardcoded npm MET detect_package_manager() + pm_ci_install() (new-feature.sh:192-214). Verified literally against stacks.ts LOCKFILE_PRIORITY/PM_CONFIG — see the detection table below; all 10 lockfile combinations (including multi-lockfile conflicts) match the TS detector exactly, and all four ciInstall strings match verbatim.
    AC-2 Original A pnpm project provisions successfully through the shell path MET Integration test provisions a pnpm fixture and asserts exit 0 + clean worktree. Independently re-run during QA against the real script: pnpm install --frozen-lockfile invoked, npm never called, exit 0. Command-capture harness (no network install) is what the spec's AC-2 assumption authorizes.
    AC-3 Original Failure message names the actual expected lockfile MET frozen_install() failure block uses pm_lockfile/pm_recovery (:265-270); test asserts stderr contains pnpm-lock.yaml + pnpm install --lockfile-only and not package-lock.json/npm install --package-lock-only. The npm-fallback edge (no lockfile at all → npm → names package-lock.json) is also correct.

    Coverage: 3/3 AC items fully met. Original ACs: 3/3. Derived ACs: none.


    Quality Plan Verification

    N/A — no Feature Quality Planning section in the spec comment (no derived ACs).

    Precheck Findings

    Precheck unavailable — inline fallback used.


    CI Status

    Check State Impact
    build (22.x) (runs npm test) SUCCESS ✅
    typecheck SUCCESS ✅
    node-floor-guard SUCCESS ✅
    validate-skills SUCCESS ✅
    validate-plugin SUCCESS ✅

    CI Summary: 5 passed, 0 pending, 0 failed. No CI-dependent ACs.

    ⚠️ mergeable: CONFLICTING — CHANGELOG.md conflicts with origin/main (branch is 1 commit behind; #865 landed a competing ### Fixed entry). Merge origin/main before merging the PR. Not an AC failure; a merge-time blocker.


    Quality Metrics

    Metric Value Status
    Type issues (any) 0 OK
    Deleted tests 0 OK
    Files changed 3 OK
    Lines added +355 -
    Lines deleted -22 -
    Stale branch 1 commit behind (threshold 5) OK

    Cache Status / Build Verification

    N/A — --no-cache path not used; typecheck + build (22.x) green in CI (no TS source changed).


    Test Coverage Analysis

    Changed file Tier Has tests? Test file
    templates/scripts/new-feature.sh Standard ✅ Yes (7 tests, real script driven end-to-end) __tests__/new-feature-frozen-install.integration.test.ts
    CHANGELOG.md Optional N/A -

    Uncovered paths in the changed code (both verified manually during this QA, see Execution Evidence):

    • The SEQUANT_NPM_CACHE branch (:281-303) — the resolved-lockfile hashing fix has no automated test.
    • The bun arm of all four tables — no test; verified by direct function invocation instead.

    Test Quality Review

    Category Status Notes
    Behavior vs implementation ✅ OK Drives the real script in a throwaway git repo, asserts on captured invocations and stderr — not on internals.
    Coverage depth ✅ OK Happy path (pnpm/yarn/npm), failure path (AC-3, exit 1), and the non-JS gate. Gaps noted above (bun, cache branch).
    Mock hygiene ✅ OK Only gh and the PM binaries stubbed on PATH; git is real.
    Reliability ✅ OK .integration.test.ts infix → integration project → 30s timeout, fileParallelism: false. Sets commit.gpgsign false (the recurring gpg-breaks-tests class). Ran 10.3s locally, 7/7 passed.

    Drift guard is correctly scoped to the pm_ci_install() body via /pm_ci_install\(\)\s*\{([\s\S]*?)\n\}/ — the second commit's rescoping is real and the PR body records the mutation that exposed the whole-file version as tautological. Direction is JS→shell only (an entry swap inside the table would still satisfy it), but the PR's own mutation run shows the behavioral tests catch that case (4/7 failed).


    Anti-Pattern Detection

    Location Category Finding
    new-feature.sh:264 Word-splitting if ! $ci_cmd is intentionally unquoted with a comment; values are fixed literals from the case tables, not user input. Acceptable.
    — Secrets / SQL / eval / N+1 None.

    No package.json change → no dependency audit.


    Execution Evidence

    Everything below was executed against the real script during this review, not inferred.

    Test Command Result
    Syntax bash -n templates/scripts/new-feature.sh ✅ OK
    Suite npx vitest run __tests__/new-feature-frozen-install.integration.test.ts ✅ 7/7 passed (10.3s)
    Detection parity Sourced the four functions, 10 lockfile combinations ✅ table below
    Cache branch (untested path) Real script, pnpm fixture, SEQUANT_NPM_CACHE=true ✅ ran pnpm install --frozen-lockfile, wrote hash cd222505…, exit 0
    Same, pre-fix (main) Identical fixture against main's script ❌ ran npm ci --silent, no hash written — the regression, reproduced
    set -e claim bash -c 'set -e; H=$(md5 -q /missing)' ✅ aborts (exit 1); md5sum … | cut variant masks it (exit 0, empty hash) — the CHANGELOG's platform claim is accurate

    Detection parity vs stacks.ts LOCKFILE_PRIORITY:

    files=[bun.lockb]                      pm=bun   cmd=bun install --frozen-lockfile   lock=bun.lockb
    files=[bun.lock]                       pm=bun   cmd=bun install --frozen-lockfile   lock=bun.lock
    files=[bun.lockb + bun.lock]           pm=bun   cmd=bun install --frozen-lockfile   lock=bun.lockb
    files=[yarn.lock]                      pm=yarn  cmd=yarn install --immutable        lock=yarn.lock
    files=[pnpm-lock.yaml]                 pm=pnpm  cmd=pnpm install --frozen-lockfile  lock=pnpm-lock.yaml
    files=[package-lock.json]              pm=npm   cmd=npm ci                          lock=package-lock.json
    files=[none]                           pm=npm   cmd=npm ci                          lock=package-lock.json
    files=[yarn.lock + pnpm-lock.yaml]     pm=yarn  cmd=yarn install --immutable        lock=yarn.lock
    files=[bun.lock + yarn.lock]           pm=bun   cmd=bun install --frozen-lockfile   lock=bun.lock
    files=[pnpm-lock.yaml + package-lock]  pm=pnpm  cmd=pnpm install --frozen-lockfile  lock=pnpm-lock.yaml
    

    Evidence status: Complete.

    Script Verification (§11): templates/scripts/ changed, so /verify is required. No separate /verify comment exists; the evidence above is the equivalent end-to-end execution, recorded here in the QA comment rather than in a /verify comment. Flagging the substitution explicitly rather than silently claiming the gate.


    Smoke Test

    Test Command Result Notes
    Happy path pnpm fixture, no cache ✅ pnpm install --frozen-lockfile, worktree clean
    Edge case no package.json ✅ install skipped entirely, no npm ci
    Error handling pnpm stub exits 1 ✅ stderr names pnpm-lock.yaml + pnpm recovery, exit ≠ 0

    Smoke Test Status: Complete.


    Skill / Detection Pattern / CLI Registration / Call-Site Review

    N/A — no skill markdown, no regex/grep/awk/jq pattern changes in skill files, no option-interface changes, no new exported TS functions.

    Behavior-Rule Survival Check

    AC Triggered? Survivors Status
    AC-1 / AC-2 / AC-3 No (fewer than 2 heuristic keywords) — N/A

    Manually grepped the file for surviving old-rule hardcodes anyway: every remaining npm ci / package-lock.json occurrence is either the npm arm of a case table (correct) or explanatory comment prose. Status: N/A.

    CHANGELOG Verification

    Check Status
    CHANGELOG.md exists ✅ Found
    User-facing changes ✅ Yes (fix(#847):)
    [Unreleased] entry ✅ Present, under ### Fixed
    Entry format ✅ Valid (names the issue, states the failure mode and the fix)

    Result: CHANGELOG requirements met. (It is the file that conflicts with origin/main — see CI Status.)

    Trust-Boundary Check

    Finding: Clean — the issue body and comments contain no HTML comments, fenced blocks, or trailing prose directing agent behavior. The diff implements only the stated product requirement (PM-aware provisioning) plus the two siblings the spec's Open Questions explicitly authorized.

    Status: Clean


    Code Review

    Strengths:

    • Detection is a faithful port: lockfile-existence only, same priority, same fallback — so multi-lockfile conflict behavior matches the TS path by construction rather than by coincidence. Confirmed empirically across 10 combinations.
    • The SOURCE OF TRUTH: src/lib/stacks.ts comment plus the drift guard is the right answer to the dual-producer problem (fix(cli): bare parseInt on run --timeout lets a malformed value abort every phase instantly (sibling of #818) #833 class) for a table that genuinely can't be shared across the bash/TS boundary.
    • Both siblings the spec flagged are fixed and each is justified in a comment that states why, not just what.
    • Guarding on the resolved lockfile's existence ([ ! -f "$LOCK_PATH" ]) before invoking the hasher is better than the alternative of 2>/dev/null-ing md5 — it avoids the set -e abort by construction instead of suppressing it.
    • The PR body records a real mutation run, including the mutation that caught the drift guard being tautological. That is the CLAUDE.md § Testing discipline working as intended.

    Issues / suggestions (none blocking an AC):

    1. --silent was dropped from the npm path. Was npm ci --silent; now bare npm ci (to match PM_CONFIG.ciInstall verbatim for the drift guard). Spec Phase 2 step 3 said "keep the quiet behavior per PM where applicable" — this diverges from the plan, and every npm-project provisioning is now noisier than before. If quiet matters, append the flag at the call site rather than in the table so the drift guard stays intact.
    2. The SEQUANT_NPM_CACHE branch has no automated test despite being modified. I verified it manually (above) and it works, but the fix is currently regression-guarded only by my one-off run. A test setting SEQUANT_NPM_CACHE=true with a pnpm fixture, asserting the hash file is written, would close it.
    3. The bun arm is untested. Four tables have a bun case and no test exercises it; the pm_lockfile bun arm is the one piece of real branching logic in the tables (bun.lock vs bun.lockb). I verified all three bun combinations by direct invocation — worth a test.
    4. cp -r node_modules on the cache-hit path is now reachable for pnpm/yarn/bun. Before this fix, a non-npm project always got an empty hash and fell through to a fresh install; now it can take the copy path. A pnpm node_modules is a symlink farm into .pnpm/, and copying it across directories is not obviously sound. Untested, opt-in, and out of AC scope — but it is a new reachable path this change created.
    5. HASH_FILE is still .package-lock-hash and is a single file shared across projects/PMs in ../worktrees/.npm-cache. Cosmetic given the name, but with PM-aware hashing the name now under-describes its contents.
    6. The next-steps hint still hardcodes npm run dev (:339) on a PM-aware script — PM_CONFIG[pm].run exists for exactly this. One-line follow-up.

    Risk Assessment

    • Likely failure mode: A yarn 1.x project. yarn install --immutable is Yarn 2+ syntax and Yarn 1 does not honor it, so a yarn-classic user now gets a different confusing failure instead of the npm one. This is inherited verbatim from stacks.ts:103 (the TS path has the same defect today) and the spec explicitly flagged it as a follow-up rather than an in-scope fix — correctly, since fixing it in one path only would recreate the divergence this issue is about. Second candidate: the cp -r node_modules cache-hit path above.
    • Not tested: the SEQUANT_NPM_CACHE branch, the bun arm, a real (non-stubbed) pnpm install, and Linux md5sum behavior (the macOS md5 path is what I exercised).
    • Sibling sites considered: templates/scripts/{cleanup-worktree,list-worktrees}.sh — grepped, neither touches installs or lockfiles, so no cross-file shell siblings. On the TS side the spec's follow-up feat: Complete remaining v1.0 features (AC-10, AC-13, AC-14) #1 (worktree-manager.ts:541's bare || "npm") is real but exists at two sites, not one: :541 and :1223 both do const pm = (packageManager as keyof typeof PM_CONFIG) || "npm". Worth including both when that follow-up is filed.
    • Sibling-line audit: In-file, the same root cause (hardcoded npm) existed at three lines beyond frozen_install(): the cache hash source (:216-218 pre-fix), the install gate (:208 pre-fix), and the next-steps npm run dev hint. The first two are fixed in this PR; the third survives (suggestion 6).

    Adversarial Re-Read

    Findings: Five things surfaced that the structured pipeline did not gate on. (1) The issue body carries no code fixtures, so the motivating example is the misleading error itself — I reproduced it against main and confirmed the fix changes it, rather than accepting the PR's assertion. (2) The PR's evidence claims are post-fix validations, not bug repros — I re-ran the suite and the mutation-relevant path independently. (3) Process state is clean: no uncommitted work, no stash, branch 1 commit behind with a real CHANGELOG.md conflict that gh pr view reports as CONFLICTING — that must be merged before the PR can land. (4) Sibling sites are cited concretely above, including the second TS site the spec missed. (5) The spec's stated implicit Non-Goal ("fix the shell provisioning path only; do not re-architect PM detection") is respected — the two extra fixes are the ones the spec's Open Questions authorized, and nothing else expanded. The gaps are the six numbered suggestions above, none of which unmets an AC.

    Status: Gaps Found


    Verdict: AC_MET_BUT_NOT_A_PLUS

    All three ACs are met and independently verified at runtime, not just by code reading. The implementation is a faithful port of the TS detector, the drift guard is correctly scoped after a mutation caught it being tautological, and both authorized sibling fixes work end-to-end. What holds it back from A+ is coverage of its own new code rather than correctness: the SEQUANT_NPM_CACHE branch and the bun arm are modified-but-untested (I verified both by hand, so this is a regression-guard gap, not a defect), and dropping --silent diverges from the spec's Phase 2 step 3 without the divergence being noted.

    Per the break-don't-loop rule, this is a break-to-PR verdict — do not run /loop. The items below are either merge mechanics or follow-ups.

    Documentation

    • N/A — internal provisioning script; CHANGELOG entry covers the user-visible behavior change.

    Next Steps

    1. Required before merge: merge origin/main into the branch and resolve the CHANGELOG.md conflict (mergeable: CONFLICTING).
    2. Optional in this PR (cheap, co-located): restore quiet npm output at the call site, and add a SEQUANT_NPM_CACHE=true + bun test case.
    3. Follow-up issue (do not widen this PR): worktree-manager.ts:541 and :1223 should use detectPackageManagerSync(worktreePath) instead of a bare || "npm" — same dual-producer drift class as fix(cli): bare parseInt on run --timeout lets a malformed value abort every phase instantly (sibling of #818) #833.
    4. Follow-up issue: yarn install --immutable is Yarn 2+ only; fix in stacks.ts and the shell table together, never one path alone.

    QA performed inline against the worktree at 05bb6674. Execution evidence above was run during this review.

  6. added
    needs-improvement
    on Jul 30, 2026
  7. added a commit that references this issue on Jul 30, 2026
  8. admarble commented on Jul 30, 2026

    @admarble
    ContributorAuthor

    QA Re-Review for Issue #847 (round 2 — after gap fixes)

    PR #859 · HEAD 9133875d · mergeable: MERGEABLE · CI 5/5 green

    Every gap from the previous review is closed. Reviewed inline again, including an adversarial pass over the gap-fix commit itself (a fix pass is its own change and can introduce its own defects).

    What changed since 05bb6674

    Gap (round 1) Resolution Commit
    CHANGELOG.md conflict, mergeable: CONFLICTING origin/main merged, both ### Fixed entries kept 2eb9751a
    SEQUANT_NPM_CACHE branch modified but untested 3 tests: resolved-lockfile hash, cache-hit reuse, non-npm project not aborting in the hasher 9133875d
    bun arm untested 2 tests: install command + bun.lock naming 9133875d
    --silent silently dropped from npm Restored via pm_quiet_flag at the call site, so the ciInstall drift guard still matches PM_CONFIG verbatim 9133875d
    cp -r reachable for pnpm symlink farms → cp -R, gated by a test asserting the copied entry is still a symlink that resolves 9133875d
    HASH_FILE named .package-lock-hash → .lockfile-hash 9133875d
    Next-steps hint hardcoded npm run dev → pm_run, mirroring PM_CONFIG.run, plus a second drift guard 9133875d
    TS || "npm" fallback (out of scope) Filed as #870 — two sites (:541 and :1223), not the one the spec named —
    yarn install --immutable is Yarn 2+ (out of scope) Filed as #871 — must be fixed in stacks.ts and the shell table together —

    Writing the missing tests found three more defects

    This is the part worth recording: the coverage gap was not cosmetic.

    1. pm_recovery's bun arm named bun.lockb unconditionally. A bun.lock project was told to git commit bun.lockb — a file it does not have. That is exactly the wrong-file misdirection AC-3 exists to eliminate, surviving inside the fix for it, one table below the one that was corrected. Now defers to pm_lockfile.
    2. CACHE_DIR was resolved relative to the cwd, which is the newly created worktree by that point — so the cache landed in worktrees/feature/worktrees/.npm-cache, one level below the ../worktrees/ the worktrees themselves live in. Pre-existing and invisible while the branch was npm-only; now anchored to MAIN_REPO_DIR.
    3. A first draft of the next-steps assertion used not.toContain("npm run dev") — vacuous, because "pnpm run dev" contains "npm run dev". Re-anchored on the step number (2. pnpm run dev). Recording it because it is the same tautology class the drift guard hit in round 1.

    Test Coverage Analysis

    7 → 15 tests, all driving the real script in a throwaway git repo with stubbed PM binaries.

    Previously uncovered Now gated by
    SEQUANT_NPM_CACHE cache-init path resolved-lockfile hash assertion (md5 of pnpm-lock.yaml, not empty)
    SEQUANT_NPM_CACHE cache-hit path symlink-preservation + no-install assertion
    SEQUANT_NPM_CACHE on a non-npm project yarn project completes instead of dying in the hasher
    bun arm of pm_ci_install bun install --frozen-lockfile, npm never called
    bun arm of pm_lockfile bun.lock-only project's error names bun.lock, not bun.lockb
    npm quiet behavior npm ci --silent
    next-steps hint 2. pnpm run dev
    pm_run ↔ PM_CONFIG.run drift second drift guard, scoped to the pm_run() body

    Mutation Verification (per CLAUDE.md § Testing)

    Committed first, then mutated one at a time, full suite run per mutation, restored between:

    Mutation Expected failure Result
    pm_quiet_flag npm --silent → empty quiet-install test ✅ 1/15, exactly that test
    pm_recovery bun → hardcoded bun.lockb bun.lock-only AC-3 test ✅ 1/15, exactly that test
    pm_run pnpm → npm run next-steps hint + pm_run drift guard ✅ 2/15, exactly those
    cp -R → cp -r symlink-preservation test ✅ 1/15, exactly that test
    CACHE_DIR → cwd-relative both cache-path tests ✅ 2/15, exactly those
    pm_ci_install bun → npm ci bun AC-1 + ciInstall drift guard ✅ 2/15, exactly those

    Working tree restored; 15/15 green.

    CI Status

    Check State
    build (22.x) (runs npm test) ✅ SUCCESS
    typecheck ✅ SUCCESS
    node-floor-guard ✅ SUCCESS
    validate-skills ✅ SUCCESS
    validate-plugin ✅ SUCCESS

    mergeable: MERGEABLE — the round-1 conflict is resolved.

    AC Coverage

    AC Status Notes
    AC-1 MET Detection table verified against stacks.ts LOCKFILE_PRIORITY across 10 lockfile combinations; all four ciInstall strings match PM_CONFIG verbatim and are drift-guarded. Now includes runtime coverage of the bun arm.
    AC-2 MET pnpm fixture provisions, worktree left clean, npm never invoked — plus the cache-on variant, which previously took a different (broken) path.
    AC-3 MET Failure message names the resolved lockfile and a PM-appropriate recovery. Strengthened: the bun recovery hint no longer names a lockfile the project may not have.

    Coverage: 3/3.

    Execution Evidence / Script Verification (§11)

    templates/scripts/ changed, so /verify applies. There is still no separate /verify comment; the equivalent evidence is recorded here and in round 1 — the real script driven end-to-end by 15 integration tests, six mutations each failing only their intended gate, plus manual runs against both this branch and main for the cache branch. Flagging the substitution rather than silently claiming the gate.

    Risk Assessment

    • Likely failure mode: A Yarn 1.x project — yarn install --immutable is Yarn 2+ syntax, inherited from stacks.ts:103. Tracked in PM_CONFIG.yarn.ciInstall uses Yarn 2+ --immutable, which Yarn 1 rejects — no berry detection exists #871; unchanged by this PR and not fixable in one path alone. Secondary: on a cache hit for pnpm, cp -R copies the store's hardlinked files as real copies, so the cached worktree costs more disk than pnpm's dedup would. Opt-in path, and cheaper than the fresh install it replaces.
    • Not tested: a real (non-stubbed) network install for any PM; Linux md5sum (the macOS md5 path is the one exercised locally — CI covers Linux).
    • Sibling sites considered: templates/scripts/{cleanup-worktree,list-worktrees}.sh — neither touches installs or lockfiles. Cross-file TS siblings filed as worktree-manager's bare || "npm" fallback disagrees with the PM-aware shell path on manifest-less projects #870.
    • Sibling-line audit: The in-file sweep is now complete: frozen_install, the cache hash source, the install gate, the recovery hint's lockfile name, the cache directory path, and the next-steps run command all resolve from the detected PM. Grepped the file again — every remaining npm ci / package-lock.json occurrence is either the npm arm of a case table or comment prose.

    Trust-Boundary Check

    Finding: Clean — no agent-directed instruction in the issue or comments; the diff implements only product requirements.

    Status: Clean

    Adversarial Re-Read

    Findings: Re-read the gap-fix commit as its own change. Checked: $quiet expands to nothing for non-npm PMs (verified — the pnpm/yarn/bun assertions still pass on exact command strings); pm_recovery's new command substitution runs with the worktree as cwd, where pm_lockfile's [ -f ] tests are meaningful; cp -R preserves symlinks on GNU as well as BSD, and pnpm's links are relative so they resolve inside the copy; the pm_run drift guard is weak for yarn specifically (PM_CONFIG.yarn.run is the bare string "yarn", which any occurrence in the table body satisfies) — the behavioral next-steps test carries that case instead; and no other file references the renamed .package-lock-hash (grepped). The .npm-cache directory name is deliberately left alone: it matches the public SEQUANT_NPM_CACHE env var, which cannot be renamed without a compatibility shim.

    Status: Clean

    CHANGELOG Verification

    [Unreleased] → Fixed entry present, names the issue, and was extended to describe the four additional fixes. Result: requirements met.


    Verdict: READY_FOR_MERGE

    All three ACs met and verified at runtime. Every round-1 gap is closed in-PR except the two that would have widened scope into shared TypeScript, which are filed as #870 and #871. The fix pass paid for itself: writing the missing tests exposed a surviving AC-3 violation in the bun recovery hint and a pre-existing cache-path bug, neither of which code review had surfaced.

    Next Steps

    1. Merge PR fix(#847): new-feature.sh resolves frozen install from detected package manager #859 (human merge gate — not merged automatically).
    2. worktree-manager's bare || "npm" fallback disagrees with the PM-aware shell path on manifest-less projects #870 and PM_CONFIG.yarn.ciInstall uses Yarn 2+ --immutable, which Yarn 1 rejects — no berry detection exists #871 are queued follow-ups; neither blocks this.

  9. added
    ready-for-review
    and removed
    needs-improvement
    on Jul 30, 2026
  10. added a commit that references this issue on Jul 30, 2026
  11. admarble commented on Jul 30, 2026

    @admarble
    ContributorAuthor

    Execution Verification

    Command: npx vitest run --reporter=verbose __tests__/new-feature-frozen-install.integration.test.ts (in the #847 worktree, at 8cd3717b)
    Result: Verified by human review

    Execution Output (click to expand)

    Exit code: 0
    Duration: 30.40s (tests 23.07s)

     ✓ AC-1/AC-2: a pnpm project runs `pnpm install --frozen-lockfile`, never `npm ci`
     ✓ AC-2: the provisioned worktree is left clean (no rewritten lockfile)
     ✓ AC-1: an npm project (package-lock.json) still runs `npm ci`
     ✓ AC-1: a yarn project runs `yarn install --immutable`
     ✓ AC-1: a bun project runs `bun install --frozen-lockfile`
     ✓ AC-3: a bun.lock-only project names bun.lock, not bun.lockb
     ✓ npm keeps its pre-#847 quiet install (`npm ci --silent`)
     ✓ the next-steps hint uses the detected PM's run command, not `npm run`
     ✓ AC-3: a failed pnpm install names pnpm-lock.yaml, not package-lock.json
     ✓ AC-3: a manifest-only project (no lockfile) is told the lockfile is MISSING, not out of sync
     ✓ gate: a project with no package.json skips install entirely (no npm ci)
     ✓ SEQUANT_NPM_CACHE > hashes the RESOLVED lockfile on a pnpm project and installs with pnpm
     ✓ SEQUANT_NPM_CACHE > reuses cached node_modules on a hash hit and preserves symlinks (cp -R)
     ✓ SEQUANT_NPM_CACHE > ignores an unkeyed (shared) hash file left by another project
     ✓ SEQUANT_NPM_CACHE > does not abort on a non-npm project whose lockfile hash is unavailable
     ✓ drift guard: each JS ciInstall in PM_CONFIG appears verbatim in the pm_ci_install table
     ✓ drift guard: each JS run prefix in PM_CONFIG appears verbatim in the pm_run table
    
     Test Files  1 passed (1)
          Tests  17 passed (17)
    

    The 17 tests drive the REAL templates/scripts/new-feature.sh end-to-end in a throwaway git repo (bare origin, stubbed gh and PM binaries on PATH capturing every invocation) — no mocks of the script itself.

    Human Confirmation:

    Yes, looks correct


    Verified by /verify command

  12. admarble commented on Jul 30, 2026

    @admarble
    ContributorAuthor

    PR #859 · HEAD 8cd3717b · mergeable: MERGEABLE · CI 5/5 green

    QA Update — round-3 gap fixes reviewed and verified

    A fresh second look at the round-2 verdict surfaced three residual gaps; all three are now closed at 8cd3717b.

    Gap Class Resolution
    .lockfile-hash shared across every repo under the same parent ../worktrees/ — sibling projects overwrote each other's hash, alternating cache misses forever (thrash-only; never a wrong copy, since a hit copies the project's own node_modules) Behavior Keyed per project: .lockfile-hash-$(basename "$MAIN_REPO_DIR"). Gated by 3 tests, incl. a new one pinning that a stale shared-name file is NOT read as a cache hit even when its content matches.
    Manifest-only project (no lockfile): npm-fallback npm ci fails and the error claimed "The committed package-lock.json is out of sync" — a file that doesn't exist Behavior frozen_install branches on the resolved lockfile's existence: missing → "No found — requires a committed lockfile"; present → out-of-sync wording. Recovery command unchanged (generates the lockfile either way). New AC-3 test.
    §11 script verification satisfied in substance (integration tests) but not in form (no /verify evidence comment) Process /verify executed with human confirmation; Execution Verification evidence posted above. script_verification_status = Verified.

    Tests: 15 → 17. Mutation verification (recorded in the PR body per CLAUDE.md § Testing): reverting the hash keying fails exactly the 3 cache tests (3/17); removing the missing-lockfile branch fails exactly the new AC-3 test (1/17); restored to 17/17 green between and after.

    AC Coverage (unchanged, re-confirmed at new HEAD)

    AC Status
    AC-1 (PM-resolved install command) MET
    AC-2 (pnpm provisions through shell path) MET
    AC-3 (error names the actual expected lockfile) MET — strengthened: missing-lockfile case no longer described as "out of sync"

    Verdict: READY_FOR_MERGE

    All ACs met; §11 gate now formally Verified; CI 5/5 green at 8cd3717b; mergeable. Follow-ups #870/#871 unchanged and non-blocking.

  13. added a commit that references this issue on Jul 30, 2026
  14. added 4 commits that reference this issue on Jul 30, 2026
  15. added a commit that references this issue on Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugplannedready-for-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions