Skip to content

centralize worktree setup in Node#1115

Merged
TheGreenCedar merged 2 commits into
dev/codestory-nextfrom
codex/1109-node-worktree-setup
Jul 14, 2026
Merged

centralize worktree setup in Node#1115
TheGreenCedar merged 2 commits into
dev/codestory-nextfrom
codex/1109-node-worktree-setup

Conversation

@TheGreenCedar

Copy link
Copy Markdown
Owner

Context

The worktree bootstrap had three owners: a 594-line shell implementation, a 668-line PowerShell implementation, and a Node dispatcher. Ref parsing, CLI selection, builds, rehydrate, index refresh, and readiness behavior could drift by platform. The ref parser also treated every 40-character name as detached, including nonhex branch names.

Base: 2e9352b
Head: 5ffe2d8

What changed

  • made the Node dispatcher the single setup state machine
  • reduced the POSIX and PowerShell entrypoints to argument-forwarding adapters
  • preserved candidate order, exact version checks, current-release install, optional sccache, rehydrate, index refresh, agent repair, and doctor status
  • made the Cargo fallback locked
  • classified only /^[0-9a-f]{40}$/i refs as detached, so nonhex 40-character names remain branches
  • replaced platform behavior duplication with one Node suite and one host-adapter smoke
  • routed shared setup changes to cross-platform proof and run the suite once on Linux x64 and Windows x64 package lanes
  • removed the duplicate Mac CI invocation and updated contributor guidance and the changelog

The production setup surface drops by roughly 625 lines; the complete PR is net -337 lines including the centralized tests and CI wiring.

How to review

Start with scripts/codex-worktree-setup.mjs, especially remoteHeadName, findCli, resolveCli, and runSetup. The shell and PowerShell files should contain no setup decisions. Then review the shared test fixture and the proof-routing change.

Verification

Passed locally on macOS:

  • node --check scripts/codex-worktree-setup.mjs
  • node --test scripts/tests/codex-worktree-setup.test.mjs
  • node scripts/codex-worktree-setup.mjs --self-test
  • live resolve-only dispatcher smoke against this worktree
  • node .github/scripts/route-ci-proof.mjs --self-test
  • node .github/scripts/check-workflow-policy.mjs
  • node .github/scripts/check-doc-links.mjs
  • node --test plugins/codestory/tests/plugin-static.test.mjs
  • node scripts/lint-retrieval-generalization.mjs
  • bash -n scripts/codex-worktree-setup.sh
  • shellcheck scripts/codex-worktree-setup.sh
  • git diff --check

Cargo was intentionally not run because another lane owned the shared Cargo queue and this change is limited to Node, adapters, docs, and workflow routing. The PowerShell adapter cannot execute on this Mac; the promoted Windows x64 lane now runs the same suite and adapter smoke.

Risk

The main risk is process-launch behavior on Windows, especially native and .cmd CLI candidates. Selection and orchestration are covered with injected cross-platform fixtures; real PowerShell forwarding remains a Windows proof claim. Release asset install behavior keeps the existing platform installer boundary on Windows and the checksum-verified tar path on POSIX.

Closes #1109
Refs #899

@TheGreenCedar TheGreenCedar force-pushed the codex/1109-node-worktree-setup branch from 35b89d3 to c714420 Compare July 14, 2026 15:09
@TheGreenCedar TheGreenCedar merged commit 2d2e023 into dev/codestory-next Jul 14, 2026
17 checks passed
@TheGreenCedar TheGreenCedar deleted the codex/1109-node-worktree-setup branch July 14, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant