Rewatch: use a single timestamp per compile pass#8428
Merged
Conversation
cknitt
commented
May 17, 2026
| match dependent_module.source_type { | ||
| SourceType::SourceFile(_) => { | ||
| match (module.last_compiled_cmt, module.last_compiled_cmt) { | ||
| match (module.last_compiled_cmt, module.last_compiled_cmi) { |
Member
Author
There was a problem hiding this comment.
Unrelated typo that Codex detected
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
Signed-off-by: Jaap Frolich <jfrolich@gmail.com>
jfrolich
approved these changes
May 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8412
Summary
Fix unnecessary recompilation/touching of downstream output files in rewatch incremental builds.
The DAG scheduler introduced by #8374 buffers completed module results and then processes them in deterministic module-name order. During that result processing, each successful module previously received fresh
last_compiled_cmi/last_compiled_cmtvalues viaSystemTime::now().That made the in-memory compile timestamps depend on result processing order rather than dependency order. If a dependency was processed after one of its dependents, the next incremental build could observe:
mark_modules_with_expired_deps_dirtyinterprets that as a stale dependent and marks it dirty. In watch mode this caused unrelated downstream modules, such as app startup/root modules, to be recompiled and their generated.mjsfiles touched. Tools like Vite then saw those touched files and performed a full reload instead of fast refresh.Fix
Use a single shared
compile_timestampfor all successful modules processed in a single compile pass.This preserves the existing behavior that successful modules are marked current after the pass, including modules that were checked but short-circuited as clean, while removing artificial ordering between modules completed in the same pass.
With a single timestamp, modules processed during the same build no longer make each other look stale on the next incremental rebuild.