Skip to content

fix(lanes): a dev server on Linux sees edits in directories the copy made - #508

Merged
7schmiede merged 1 commit into
mainfrom
fix/copy-new-dirs-watched
Nov 10, 2026
Merged

7schmiede merged 1 commit into
mainfrom
fix/copy-new-dirs-watched

Conversation

@7schmiede

Copy link
Copy Markdown
Member

What and why

A lane on a Linux pool node kept serving an old build of a native Angular dev server after an edit (#507). Reproduced in a throwaway lane of the same stack on the node:

new file in its fix rebuilt
an existing directory yes
a new directory yes
a new directory inside a new directory (a/b/x.ts, as in the issue) no, the log kept the old line

The edit reached the lane's copy (cat in the lane's container showed the new content). Angular 22 watches with @parcel/watcher, which on Linux puts an inotify watch on each directory and takes a new one in only when it sees it made in a watched one. The copy made a/b/ in one go (create_dir_all), so b existed before a was watched: ng serve held watches on the inodes of a but not of b (read from /proc/<pid>/fdinfo). Windows watches a tree recursively, which is why a lane there never showed it.

In the node's container, against the running dev server: mkdir -p a/b/c left c unwatched; one level at a time with 10 ms or 50 ms between, every level was watched.

Fix: Snapshot::sync makes the directories a sync needs one depth at a time and waits 50 ms after each depth (not per directory: a branch switch costs at most its depth times 50 ms), except on a copy's first sync, when nothing runs from it yet.

Point
Cause New nested directories made in one go, faster than a watcher that follows new directories takes each in.
Bug class unwatched-new-dir
Proof a_watcher_that_follows_new_directories_sees_every_one_the_copy_makes (Linux): a watcher that follows new directories as @parcel/watcher does, with 5 ms to react. Red on main (3 of 3: app/lib/new/inner unseen), green with the fix (5 of 5). A second wrong version, one depth at a time without the wait, is red again (3 of 3).
Siblings The node's mirror (apply_files) is watched by devstack's own watcher (notify), which reads a new directory when it sees it: not affected. A local lane on Linux runs from the same copy and is fixed with it.
Guard The test above, on the Linux CI jobs.

Not seen with the patched binary on the node (a node runs released builds); the mechanism was checked in the node's container against the running dev server, as above. Not in this PR: devstack status noticing a copy no rebuild follows (suggested in the issue).

Closes #507

🤖 Generated with Claude Code

…made

A lane runs from a copy of its worktree. A new directory with another new
one inside (`a/b/`) was made in one go; Angular's dev server watches with
`@parcel/watcher`, which on Linux takes a new directory in only when it
sees it made in a watched one, and so never watched `b`. Edits to a file
created there reached the copy but no rebuild followed (#507, a lane on a
pool node). The copy now makes new directories one depth at a time and
waits 50 ms after each, except on its first sync.

Closes #507

Bug-Class: unwatched-new-dir
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede merged commit 6c14dba into main Nov 10, 2026
@7schmiede
7schmiede deleted the fix/copy-new-dirs-watched branch November 10, 2026 17:25
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.

Pool lane: natively watched dev server keeps building stale file content until restart

1 participant