From 2895955c5959b0da658bf17cf763b73ace74268b Mon Sep 17 00:00:00 2001 From: Mohamed Mansour Date: Thu, 29 Oct 2026 16:06:20 -0700 Subject: [PATCH 1/2] fix: retarget the dev-server watcher instead of replacing it Press replaced its file watcher after every rebuild. Dropping the old notify-debouncer-mini watcher discards events still inside its 50 ms debounce window, and the replacement only sees writes made after it registers. A source edit landing just before the swap was lost, so markdown-state-serve.test.ts intermittently waited 30 s for a rebuild that never came. - Add WatcherHandle::retarget, which updates subscriptions in place. Unchanged recursive roots and the debouncer stay registered; content baselines restart as for a new watcher. - Re-register exact-file parents on every retarget so deleted and recreated generated directories are watched again. They use a separate notify backend so FSEvents stream restarts cannot interrupt source roots. - Register remaining paths when one cannot be watched, then report the first failure. - Retarget the Press watcher after each rebuild instead of replacing it. Validation: on main, an edit just before a swap was lost 5/5 times on both Windows and Linux. The e2e test failed 3/60 under parallel CPU load; with the fix it passed 210/210, and the full Press suite passed 118/118. cargo xtask check passes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- crates/webui-dev-server/README.md | 4 +- crates/webui-dev-server/src/lib.rs | 5 +- crates/webui-dev-server/src/watch.rs | 423 +++++++++++------- crates/webui-dev-server/src/watch_backend.rs | 92 ++++ .../src/watch_subscriptions.rs | 355 +++++++++++++++ crates/webui-press/src/serve.rs | 153 +++++-- 6 files changed, 837 insertions(+), 195 deletions(-) create mode 100644 crates/webui-dev-server/src/watch_backend.rs create mode 100644 crates/webui-dev-server/src/watch_subscriptions.rs diff --git a/crates/webui-dev-server/README.md b/crates/webui-dev-server/README.md index 8bf4a9869..6089e269a 100644 --- a/crates/webui-dev-server/README.md +++ b/crates/webui-dev-server/README.md @@ -8,7 +8,9 @@ This crate provides primitives that any WebUI dev server can compose: its own actix handler, generates the matching browser-side `