Skip to content

fix(daemon): the main tree runs prepare when its inputs changed (#630) - #632

Merged
7schmiede merged 1 commit into
mainfrom
fix/prepare-on-restart
Nov 26, 2026
Merged

7schmiede merged 1 commit into
mainfrom
fix/prepare-on-restart

Conversation

@7schmiede

Copy link
Copy Markdown
Member

What and why

Closes #630.

The main tree ran its dev servers in place and never ran prepare there
(ADR-0044 point 5, ADR-0062). After a merge that brought packages, a
restart kept the dev server on the old node_modules; only its import
errors said so, and a hand-made npm ci failed with EPERM on Windows while
the dev server ran.

  • Before a service starts in the main tree (up, start, restart), its
    prepare runs in the tree itself when the files of its inputs changed
    since it last ran there (a mark under .devstack/prepared-tree/) or a
    directory of its outputs is gone. Never prepared there counts as
    changed: the first start after this release prepares once.
  • A restart that prepares stops the running instance first, also behind
    the proxy, instead of starting a candidate beside it: Windows keeps the
    files npm ci replaces locked.
  • While a service runs, in the main tree or a lane, a change to its
    inputs is a notice naming devstack restart and restart_on.
  • The main tree still does not use the store and links nothing.

Review card

# Category Point Beats Cost of reversing
1 concept The main tree remembers per service the key of the inputs of its last prepare (in .devstack/) no knowledge of the state small
2 contract A start with a changed key prepares first; a running service with changed inputs shows a notice the silent start on stale node_modules small
3 contract devstack restart <svc> --prepare dropped: the restart prepares by itself (the owner chose the automatic variant) — —
4 concept The change watch never prepares by itself; restart_on with the lockfile does an npm ci in the middle of work small
5 term ADR-0044 point 5 and ADR-0062 amended: the main tree runs in place, without the store, and prepares there docs that read as "no prepare" small

Approved by the owner on 2026-11-26, points 1, 2, 4, 5, with the
automatic variant: "Breaking changes are accepted as long as we create a
lasting solution; no version = 2. Choose the technically right way."

Verified

  • Unit tests (Windows; prepare runs as a process): red first at the
    expected assertions, green with the fix. In-place prepare, same inputs
    keep what is there, new inputs prepare again, missing outputs prepare
    again, a failing prepare stops the start with its tail.
  • Reproduced with a sample repo: 0.53.0 keeps serving 404 after a lockfile
    change and restart; this build shows the notice, the restart serves the
    new file, and a second restart with the same inputs does not prepare.
  • cargo fmt, cargo clippy --workspace --all-targets -D warnings,
    cargo test --workspace (917 passed), and a_worktree_runs_as_a_lane
    with DEVSTACK_INTEGRATION=1.

Bug-Class: stale-cache

🤖 Generated with Claude Code

The main tree ran its dev servers in place and never ran `prepare` there:
after a merge that brought packages, a restart kept the dev server on the
old node_modules, and only its import errors said so. Now `prepare` runs
in the main tree before a service starts when the files of its `inputs`
changed since it last ran there (a mark under .devstack/prepared-tree/)
or one of its `outputs` is gone. A restart that prepares stops the running
instance first, so `npm ci` can replace files Windows keeps locked. While
a service runs, here or in a lane, a change to its inputs is a notice.

ADR-0062 amended (the main tree prepares in place, without the store);
the first start after this release prepares once.

Bug-Class: stale-cache

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede merged commit 1d1168d into main Nov 26, 2026
14 checks passed
@7schmiede
7schmiede deleted the fix/prepare-on-restart branch November 26, 2026 14:42
@7schmiede 7schmiede mentioned this pull request Nov 26, 2026
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.

Main tree: restart does not re-run prepare after its inputs changed, dev server runs on stale node_modules

1 participant