fix(worktree): init submodules + run prepare:worktree hook per job worktree #27
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/worktree-submodule-and-codegen"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pairs with Scrum4Me PR #53 (adds the prepare:worktree script).
Why
npm run verifyruns inside per-job git worktrees. A freshgit worktree addchecks out the branch tree but NOT submodules, and verify never triggers prebuild codegen. So Scrum4Me job worktrees failed on 12@shared/*errors (alias -> vendor/scrum4me-shared submodule, not checked out) + 4lib/manual.generated.tserrors (gitignored). Toolchain itself works (node_modules symlinked, PR #26).What
prepareWorktree()after the node_modules symlink (both add-paths): (1)git submodule update --init --recursiveguarded on .gitmodules; (2) optionalprepare:worktreenpm script if the repo declares one. Best-effort.Verified
Manual worker worktree: submodule init + manual:build -> verify GREEN (140 files / 1235 tests).
A fresh `git worktree add` checks out the branch tree but not its submodules, and `npm run verify` never triggers the `prebuild` codegen that produces gitignored generated files. So job worktrees failed lint/typecheck/test on every submodule-backed path alias (Scrum4Me's `@shared/*` -> vendor/scrum4me-shared) and on `*.generated` imports (lib/manual.generated.ts) — even though the toolchain itself works (node_modules already symlinked by linkNodeModules). prepareWorktree() now, after the node_modules symlink: - `git submodule update --init --recursive` (guarded on .gitmodules, no-op for repos without submodules) - runs an optional `prepare:worktree` npm script if the repo declares one, so repo-specific codegen stays out of this generic worker code Both are best-effort (never fail worktree creation); a genuine failure surfaces in verify rather than blocking the job. Verified manually in a worker worktree: submodule init + manual:build -> `npm run verify` green (140 files / 1235 tests). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>