Skip to content

Refuse to clean while a watcher of the project runs - #9247

Open
cknitt wants to merge 1 commit into
masterfrom
rewatch-state-fixes
Open

cknitt wants to merge 1 commit into
masterfrom
rewatch-state-fixes

Conversation

@cknitt

@cknitt cknitt commented Nov 6, 2026

Copy link
Copy Markdown
Member

Fixes #9241.

  • Failed first build cleans every later build: already fixed on master by Replace lib/bs and lib/ocaml with a flat lib/rescript #9245, which writes compiler-info.json as soon as the clean decision is made; run.sh covers it.
  • clean during watch: rescript clean now takes the watch lock of the folder it cleans, as rescript watch does, and refuses while a watcher runs:
    Could not clean while rescript watch or another clean is running. The process ID (PID) is 4242
    
    A watcher still takes its lock before reading the configuration, so a clean of a whole workspace does not see a watcher started in one of its members.

New test: check_command_validation.sh runs clean against a running watcher, expects the refusal with the artifacts left in place, and checks that the watcher still rebuilds.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kbf3gGBR9g3DD93vrWbYzU

Why:
    rescript clean took only the build lock, which a watcher holds only
    while it builds, so a clean during rescript watch removed the artifacts
    the watcher kept reading, and every later rebuild failed (#9241).

Diagnostic added (rescript clean while rescript watch runs):
Before (text): Cleaning x, exit 0; the watcher then fails with Sys_error("<root>/lib/rescript/A.ast: No such file or directory")
After (diagnostic):
    Could not clean while rescript watch or another clean is running. The process ID (PID) is 4242
After (text): exit 1; the artifacts and the watcher are left as they were

Clean now takes the watch lock of the folder it cleans, as rescript watch
does, before the build lock.

Review: Does a clean of a workspace see a watcher of one of its members? No: each takes the watch lock of the folder it was given, and a watcher takes it before it reads the configuration, which a test requires.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gGBR9g3DD93vrWbYzU
Signed-off-by: Christoph Knittel <ck@cca.io>
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Changelog

🐛 Bug fix

  • rescript clean refuses while rescript watch runs for the same project, instead of removing the artifacts the watcher keeps reading.

Semantic Diff

1 commit · Full page

Refuse to clean while a watcher of the project runs

323c05f · cknitt + Claude · Nov 06, 2026, 20:31 UTC

Why

rescript clean took only the build lock, which a watcher holds only while it builds, so a clean during rescript watch removed the artifacts the watcher kept reading, and every later rebuild failed (#9241).

Diagnostic added (rescript clean while rescript watch runs)

text

-Cleaning x, exit 0; the watcher then fails with Sys_error("<root>/lib/rescript/A.ast: No such file or directory")
+exit 1; the artifacts and the watcher are left as they were

diagnostic · After

Could not clean while rescript watch or another clean is running. The process ID (PID) is 4242

Clean now takes the watch lock of the folder it cleans, as rescript watch does, before the build lock.

Review

  • Does a clean of a workspace see a watcher of one of its members? No: each takes the watch lock of the folder it was given, and a watcher takes it before it reads the configuration, which a test requires.

@cknitt
cknitt added this pull request to stack #9251 November 6, 2026 21:14
@cknitt

cknitt commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T21:16:58.301220Z 323c05f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 323c05facf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@pkg-pr-new

pkg-pr-new Bot commented Nov 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@9247

@rescript/belt

npm i https://pkg.pr.new/@rescript/belt@9247

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@9247

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@9247

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@9247

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@9247

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@9247

commit: 323c05f

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

@cknitt
cknitt marked this pull request as ready for review November 7, 2026 06:08
@cknitt
cknitt requested a review from cristianoc November 7, 2026 06:08

This branch has not been deployed

No deployments
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.

Build system: a failed first build forces full rebuilds, and clean breaks a running watch

1 participant