Skip to content

Fix watch tests that flake on duplicate change events - #8902

Merged
cknitt merged 2 commits into
masterfrom
fix-retained-parse-flake
Oct 18, 2026
Merged

cknitt merged 2 commits into
masterfrom
fix-retained-parse-flake

Conversation

@cknitt

@cknitt cknitt commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

macOS and Windows can report a single write as several change events. Both watchers rebuild for each one, and each rebuild of a source that fails to parse reports its error again. Two tests counted those reports:

Retained parse (OCaml focused tests, Windows). The Windows build-compiler job failed in #8900 and #8894 at:

run.sh: line 1929 failed: test "$(grep -c '^parse.*A\.res' "$retained_parse/calls.log")" -gt "$failed_parses"

The test makes A.res fail to parse, counts A's parses, edits B.res, waits for a second error report and expects another parse of A. A duplicate rebuild of A can log its parse before the count and print its error before the build for B parses A, so the "second" error isn't B's. The test now waits until A's parse count has been unchanged for a second before counting, expects one more error than was reported by then, and polls for A's re-parse instead of checking once.

Quiet-watch parity check (macOS). The check compares the stderr of Rust and OCaml rewatch after a parse error. On macOS in this PR, Rust printed the identical error twice and OCaml once. The check now collapses consecutive identical error reports before comparing.

New checks: locally I rewrote A.res with the same content 0.3 s after the failing edit, which forces a duplicate rebuild, and the retained-parse test still passed. On the stderr pair from the failing macOS log, the collapsed outputs are identical.

🤖 Generated with Claude Code

https://claude.ai/code/session_0193XhTJFgkaaGZTNw9Uqd5v

@pkg-pr-new

pkg-pr-new Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

rescript

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

@rescript/belt

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

@rescript/darwin-arm64

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

@rescript/darwin-x64

npm i https://pkg.pr.new/@rescript/darwin-x64@8902

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/runtime

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

@rescript/win32-x64

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

commit: de050bf

@github-actions

Copy link
Copy Markdown

@cknitt cknitt added the changelog:skip No release notes needed label Oct 18, 2026
@cknitt
cknitt requested a review from fhammerschmidt October 18, 2026 15:24
@cknitt
cknitt marked this pull request as ready for review October 18, 2026 15:24
@cknitt

cknitt commented Oct 18, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T15:26:42.381694Z 06dd6eb 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. Hooray!

Reviewed commit: 06dd6eb6af

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

@cknitt
cknitt enabled auto-merge (squash) October 18, 2026 15:30
Windows can report one write as several change events, each rebuilding and
re-reporting A. Wait for those rebuilds before counting, then poll for A's
re-parse after the edit of B.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0193XhTJFgkaaGZTNw9Uqd5v
Signed-off-by: Christoph Knittel <ck@cca.io>
@cknitt
cknitt force-pushed the fix-retained-parse-flake branch from 06dd6eb to 44018a2 Compare October 18, 2026 15:32
The quiet-watch parity check compares the stderr of Rust and OCaml rewatch
after a parse error. macOS and Windows can report one write as several
change events, and each rebuild prints the error again, so the check now
collapses consecutive identical error reports before comparing.

Review: Where did this fail? On macOS in #8902: Rust printed the parse
error twice, OCaml once, with identical text.

Area: rewatch tests
Output: unchanged
Tests: ~rewatch-ocaml/tests/check_command_validation.sh
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0193XhTJFgkaaGZTNw9Uqd5v
Signed-off-by: Christoph Knittel <ck@cca.io>
@cknitt cknitt changed the title Fix flaky retained-parse watch test on Windows Fix watch tests that flake on duplicate change events Oct 18, 2026
@github-actions

Copy link
Copy Markdown

@cknitt
cknitt merged commit 2df3504 into master Oct 18, 2026
31 checks passed
@cknitt
cknitt deleted the fix-retained-parse-flake branch October 18, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:skip No release notes needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants