Skip to content

feat(prepare): link a lane's prepared directories into its worktree (ADR-0044) - #160

Merged
7schmiede merged 4 commits into
mainfrom
feat/prepare-link
Oct 21, 2026
Merged

7schmiede merged 4 commits into
mainfrom
feat/prepare-link

Conversation

@7schmiede

Copy link
Copy Markdown
Member

Closes #159.

A lane runs from a copy of its worktree, so the worktree has no node_modules; a pre-commit hook with npx eslint failed in every lane worktree.

What

  • prepare.link = ["web/node_modules"]. After prepare, a lane on this machine links each listed directory from its worktree to its copy. On Windows that is a junction, which needs no privilege; elsewhere a symbolic link.
  • The developer's own wins: a path the worktree already has is never touched.
  • Git has to ignore the link. If it doesn't, devstack removes the link at once and logs prepare_not_linked with the reason. On Linux and macOS, node_modules/ does not ignore a symbolic link, so the rule there is node_modules.
  • Removed on stop. The links go when the lane stops, is removed, moves to a node, or the daemon stops. Only links that point into the copy are removed.
  • Re-prepared if gone. A linked directory missing from the copy runs prepare again.
  • The main tree and lanes on a node make no links.

ADR

ADR-0044 is Proposed. Set it to Accepted on merge if you agree. It records the alternative from the issue (devstack lane path), and the one consequence I don't like:

git worktree remove while the lane runs follows the junction and empties the copy's directory. I measured this with Git for Windows 2.43. The docs therefore say to stop the lane first, and the next start prepares the directory again.

Not done

  • No linked marker in status or the dashboard yet; the diagnostic log has prepare_linked, prepare_not_linked and prepare_unlinked.
  • The real eslint pre-commit hook from the acceptance criteria is not tested.

Tests

  • cargo clippy --workspace --all-targets and cargo fmt --check are clean.
  • Unit tests:
    • config validation of link
    • a junction is created, recognised and removed with its target left intact (Windows)
    • the git-ignore check
  • a_worktree_runs_as_a_lane (DEVSTACK_INTEGRATION=1, Windows) now checks that lane start creates the link and lane stop removes it while the copy keeps the directory. It passed three times in a row. A fourth run failed while another build was running alongside it; the panic message was not captured.
  • Linux and macOS: not run locally (CI).

🤖 Generated with Claude Code

7schmiede and others added 4 commits October 21, 2026 10:51
…ADR-0044)

A lane runs from a copy of its worktree, and `prepare` installs there, so
the worktree has no `node_modules`; git runs its hooks in the worktree, and
a pre-commit hook with `npx eslint` failed in every lane until `npm ci` ran
there by hand (#159).

- `prepare.link = ["web/node_modules"]`: after `prepare`, a lane on this
  machine links each directory from its worktree to its copy (a junction on
  Windows, a symbolic link elsewhere). Only where the worktree has nothing of
  that name; a link git does not ignore is removed again and logged with why
  (`node_modules/` does not ignore a symbolic link).
- The links go when the lane stops, is removed or moved, or the daemon
  stops: `git worktree remove` follows a junction on Windows (measured), and
  must not find one. Only links into the copy are removed.
- A linked directory gone from the copy runs `prepare` again.
- ADR-0044 (Proposed), stack-file reference, config skill, changelog.

Closes #159

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ree goes while it runs

A newer Git for Windows (CI) left the worktree of a running lane behind with
its junction in it; ADR-0044 and the docs say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lane is forgotten after its services stop and its containers are
removed; the test read the list in between (seen on Ubuntu CI, on main too).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

prepare: let a lane's prepared node_modules be used in the worktree (git hooks run there)

1 participant