Skip to content

feat(worktree): symlink the repo's node_modules into the coder worktree (v0.24.0)#58

Merged
mabry1985 merged 1 commit into
mainfrom
feat/worktree-link-node-modules
Jun 22, 2026
Merged

feat(worktree): symlink the repo's node_modules into the coder worktree (v0.24.0)#58
mabry1985 merged 1 commit into
mainfrom
feat/worktree-link-node-modules

Conversation

@mabry1985

Copy link
Copy Markdown
Contributor

What

A fresh git worktree is a bare checkout with no node_modules, so an npm/pnpm pre-PR gate (local_gate_cmd) — or the coder running a build — can't resolve deps, and the gate fails in the worktree even though it passes in the main repo. (Surfaced dispatching a DS fix to a pnpm monorepo: pnpm -C packages/ui build had no deps in the worktree.)

create_worktree now symlinks every node_modules dir from the main repo into the worktree at the same relative path (root + each monorepo workspace package), so the worktree shares the repo's installed deps without a slow/offline per-worktree install.

  • Best-effort: a non-node repo is a no-op; symlink failures are skipped.
  • Build output (dist/) still lands in the worktree — only deps are shared.
  • Worktree removal unlinks the symlink, never the target (safe — rm/git worktree remove don't recurse through symlinks).

Tests

+3 (root + monorepo-package symlinks; non-node no-op; no descent into nested node_modules). 196 pass; ruff clean.

🤖 Generated with Claude Code

…ee (v0.24.0)

A fresh `git worktree` is a bare checkout with NO node_modules, so an npm/pnpm pre-PR gate
(local_gate_cmd) — or the coder running a build — couldn't resolve deps, and the gate
failed in the worktree even though it passes in the main repo. (Surfaced dispatching a DS
fix to a pnpm monorepo: `pnpm -C packages/ui build` had no deps in the worktree.)

create_worktree now symlinks every node_modules dir from the main repo into the worktree
at the same relative path (root + each monorepo workspace package), so the worktree shares
the repo's installed deps without a slow/offline per-worktree install. Best-effort: a
non-node repo is a no-op; symlink failures are skipped. Build output (dist/) still lands in
the worktree — only the deps are shared. Worktree removal unlinks the symlink, never the
target (safe).

+3 tests (root + monorepo package symlinks; non-node no-op; no descent into node_modules).
196 pass; ruff clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@protoquinn

protoquinn Bot commented Jun 22, 2026

Copy link
Copy Markdown

👀 Quinn is reviewing — verdict (PASS / WARN / FAIL) + findings to follow.

@protoquinn protoquinn Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA Audit — PR #58 | feat(worktree): symlink the repo's node_modules into the coder worktree (v0.24.0)

VERDICT: WARN (CI test still queued — formal PASS/FAIL deferred)


CI Status

  • test: queued
  • No unresolved CodeRabbit threads

Diff Review

  • Version bumps 0.23.0→0.24.0 in protoagent.plugin.yaml + pyproject.toml — clean
  • create_worktree (worktree.py:113): calls link_node_modules via asyncio.to_thread after worktree add — correct, won't block the event loop
  • link_node_modules (worktree.py:117-140): walks repo, symlinks each node_modules at matching relative path; prunes descent into node_modules/.git/.worktrees; double OSError: pass for best-effort semantics — design matches spec
  • os.path.lexists guard (worktree.py:131) prevents clobbering existing paths; minor TOCTOU window if two worktrees race on same path, but practical risk is negligible
  • Removal safety: git worktree remove + rm do not recurse through symlinks — target node_modules in main repo is safe
  • +3 tests cover root+workspace symlinks, non-node no-op, and nested-node_modules pruning — 196 pass, ruff clean per PR description

Observations

  • LOW: clawpatch structural review unavailable (repo not in project registry) — reviewed from diff alone
  • LOW: CI test still queued at review time — formal PASS/FAIL will land when checks are terminal
  • No correctness, security, or design concerns identified

— Quinn, QA Engineer

@protoquinn

protoquinn Bot commented Jun 22, 2026

Copy link
Copy Markdown

Submitted COMMENT review on protoLabsAI/projectBoard-plugin#58.

@mabry1985 mabry1985 merged commit c4a2133 into main Jun 22, 2026
1 check passed
@mabry1985 mabry1985 deleted the feat/worktree-link-node-modules branch June 22, 2026 05:45
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.

1 participant