Semantic Diff

#9305 Skip watch rebuilds for files whose content didn't change

1 commit

1efa212d3594fafe30d2c46f25e2201fdbb9aed7..pr-9305

b5f76a2cf · cknitt + Claude · Nov 14, 2026, 10:14 UTC

Skip watch rebuilds for files whose content didn't change

Why

macOS can report one write twice, the second time after the 50 ms drain window. The native watch loop re-read the file and rebuilt even when nothing differed from its snapshot, so a parse error was printed twice. This made the quiet-watch case of check_command_validation.sh fail on macOS in about 4% of CI runs. The test's filter for repeated reports had stopped working with the new report format in #9238.

modifiedDiagnostic repeated content event in watch mode

let value =
diagnostic
Before
rescript watch --quiet after one save on macOS
  Syntax error!  <ROOT>/src/A.res:1:12-2:0…  This let-binding misses an expression   Syntax error!  <ROOT>/src/A.res:1:12-2:0…  This let-binding misses an expression
diagnostic
After
  Syntax error!  <ROOT>/src/A.res:1:12-2:0…  This let-binding misses an expression

Review

  • Does a read error still rebuild? Yes. update_entries counts a kept entry as a change, as before, so the build reports the problem.
  • Does touching a file still rebuild? Yes. The entry holds the modification time, as in the polling loop, so only an event for a file that is exactly as the snapshot recorded it is skipped.