Skip to content

fix(worktree): TS provisioning runs npm ci / pip install -q in repos with no manifest to install from — the shell path guards, TS doesn't #1196

Closed

Description

@admarble

Epic: field-2026-09-28 (downstream non-Node adoption) Tier: mechanical Graph: tracker #1203

Problem.

AC

  • AC-1: Worktree provisioning skips install (and logs why) when no manifest for the resolved package manager exists: package.json for JS, requirements*.txt/pyproject.toml for Python. Evidence: npx vitest run src/lib/workflow/worktree-manager.test.ts
  • AC-2: A pip stack's install command names its requirements file, or is skipped. It never runs a bare pip install -q. Evidence: npx vitest run src/lib/stacks.test.ts
  • AC-3: merge-check skips the test/build step, rather than erroring, when the repo defines no such script. Evidence: npx vitest run src/lib/merge-check/combined-branch-test.test.ts

Related: #846, #847, #870, #871, #932.

Graph metadata

  • No dependency edges; frontier from wave 1.

May touch

  • src/lib/workflow/worktree-manager.ts
  • src/lib/stacks.ts
  • src/lib/merge-check/combined-branch-test.ts
  • .claude/skills/exec/SKILL.md
  • skills/exec/SKILL.md
  • templates/skills/exec/SKILL.md
  • .claude/skills/qa/SKILL.md
  • skills/qa/SKILL.md
  • templates/skills/qa/SKILL.md

File overlap (don't run in the same wave; merge one first):

Activity

  1. added
    bug
    graph-2026-09-field
    on Sep 28, 2026
  2. admarble commented on Sep 29, 2026

    @admarble
    ContributorAuthor

    Runner context (graph-run, tracker #1203, wave 1) — read before planning. Applies to the spec, exec, and qa phases by name.

  3. admarble commented on Sep 29, 2026

    @admarble
    ContributorAuthor

    /spec plan — #1196

    Complexity: Standard (3 ACs, 3 directories) · Scope: ✅ SCOPE_OK

    Non-Goals (not in issue body — proposing explicitly): no new stack/PM types, no change to new-feature.sh's shell path (already guards on package.json per #847), no change to non-Python stacks.

    Conflict check: worktree for #1196 exists, clean, at origin/main tip. Confirmed file overlap with #1197 and #1199 (both touch worktree-manager.ts, neither started yet) — don't run in the same wave; merge #1196 first.

    AC checklist

    • AC-1 — Worktree provisioning skips install (and logs why) when no manifest exists for the resolved PM (package.json for JS; pyproject.toml/requirements*.txt for Python). Root cause: resolvePackageManager's fallback (detectPackageManagerSync, stacks.ts:242-250) is JS-lockfile-only and defaults to "npm" even in a pure-Python worktree, so installWorktreeDeps (worktree-manager.ts:632) always attempts npm ci. Fix: add hasManifestForPackageManager(pm, root) to stacks.ts; gate installWorktreeDeps and (defensively) reinstallIfLockfileChanged on it before building the install command. Evidence: npx vitest run src/lib/workflow/worktree-manager.test.ts
    • AC-2 — A pip stack's install command names its requirements file, or is skipped — never a bare pip install -q. Fix: extend resolvePackageManagerConfig (stacks.ts:465) with a pip-specific branch, parallel to the existing yarn classic/berry override — find requirements*.txt in root; found → pip install -q -r <file>; absent → shared skip sentinel. Update the 3 ciInstall consumers (installWorktreeDeps, reinstallIfLockfileChanged, combined-branch-test.ts) to check the sentinel before spawnSync. Note: this requires editing the existing stacks.test.ts test "leaves every non-yarn package manager untouched" — it currently asserts pip's config is untouched by identity (.toBe(PM_CONFIG.pip)); that's precisely what this AC changes, so pip needs its own dedicated cases instead of riding in that shared loop. Evidence: npx vitest run src/lib/stacks.test.ts
    • AC-3 — merge-check skips (not errors) the test/build step when the repo defines no such script. Fix: add a hasScript(root, scriptName) helper in combined-branch-test.ts (reads package.json, false on missing file or missing scripts[name]); gate the test/build blocks (:366, :387) independently — missing script → info-severity skip finding instead of error-severity BLOCKED. Evidence: npx vitest run src/lib/merge-check/combined-branch-test.test.ts

    Design notes

    • All three fixes extend the existing resolvePackageManagerConfig(pm, root) directory-dependent-override pattern already proven for yarn classic/berry (PM_CONFIG.yarn.ciInstall uses Yarn 2+ --immutable, which Yarn 1 rejects — no berry detection exists #871), rather than teaching detectPackageManagerSync about Python (bigger blast radius — that detector has other callers beyond install).
    • The reinstallIfLockfileChanged guard (part of AC-1) is currently unreachable in practice — its lockfile list is JS-only, so a Python fixture can't exercise it. Cheap insurance per the issue's "Also exposed" callout; call this out in the PR rather than claiming test coverage for it.
    • The .claude/skills/{exec,qa}/SKILL.md files listed as "may touch" on the issue appear to be graph file-overlap accounting, not files this fix needs — no worktree-install-skip documentation found there to go stale. Treating skill edits as out of scope unless implementation says otherwise.

    Open questions

    1. Tie-break when multiple requirements*.txt exist → recommend exact requirements.txt first, else first match; low impact either way.
    2. Whether AC-3's skip check needs to be pip/poetry/uv-aware → recommend no; the path is inherently JS-lockfile-gated already, so "no package.json" already covers the Python case by construction.

    Recommended workflow

    Phases: exec → qa · Quality Loop: disabled
    Reasoning: bug-labeled, mechanical-tier, SCOPE_OK, with 3 pre-named target test files — targeted vitest run additions during /exec beat stub generation.

  4. added
    planned
    on Sep 29, 2026
  5. admarble commented on Sep 29, 2026

    @admarble
    ContributorAuthor

    QA Verdict: NEEDS_VERIFICATION

    AC coverage: 3/3 met

    Gaps:

    • Required CI check test still pending
    • Assertion can never fail because the skip path logs no command
    • Requirements filename with spaces is split into multiple argv entries
    • poetry install needs pyproject.toml; requirements.txt alone would still attempt a failing install
  6. admarble commented on Sep 29, 2026

    @admarble
    ContributorAuthor

    Runner verification (graph-run #1203, wave 1): QA verdict was NEEDS_VERIFICATION. This comment discharges it against PR #1212 @ b9ca87ab.

    Executed in the worktree:

    QA gaps, assessed:

    • AC-2 not.toContain("pip install -q\n") is vacuous as QA says. The case still gates through its positive Skipping dependency install assertion, so this is not an AC hole.
    • Poetry with requirements*.txt and no pyproject.toml: poetry is only resolved from poetry.lock, which implies a pyproject.toml, so this is theoretical.
    • Not covered, follow-up candidate: uv has the same bare-install shape (PM_CONFIG.uv.ciInstall = "uv pip install -q", no -r). AC-2 names the pip stack only, so this issue is not grown for it. A uv.lock repo should probably get uv sync --frozen.
  7. added a commit that references this issue on Sep 29, 2026
  8. added a commit that references this issue on Oct 8, 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

    buggraph-2026-09-fieldplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions