Conversation
|
@codex review |
💡 Codex Reviewrescript/rewatch/src/watcher.rs Lines 589 to 593 in 2c247a8 This new startup path performs an initial compile inside rescript/rewatch/src/watcher.rs Lines 598 to 600 in 2c247a8
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
Motivation
rewatch watchcan start while anotherrewatch buildis running, and the two commands intentionally use separatewatch.lockandbuild.lockfiles. However, watch startup still had a gap in its build locking.The watcher acquired
build.lockwhile runninginitialize_build, then released it before enteringasync_watch, where the initial compile happened through a second lock acquisition. That left a window where another build process could start between watch initialization and the watcher’s initial compile. Since initialization and compilation both mutate build artifacts, that gap could allow concurrent artifact writes and trigger inconsistent build output.Changes
build.lock.initial_buildstate from the async watch loop.Covered cases
This now protects the startup path where:
rewatch watchperformsinitialize_buildrewatch buildis already running or starts at the same timeThe existing full rebuild path remains protected by
build.lock, including rebuilds triggered by config changes, rename events, and editor atomic-save behavior.