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
rescript watch --quiet after one save on macOSSyntax 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
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.