-
Notifications
You must be signed in to change notification settings - Fork 86
Delay edits to work around lack of millisecond precision in stat
and migrate pageSource
tests to use console logs
#2670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
srujzs
wants to merge
5
commits into
dart-lang:main
Choose a base branch
from
srujzs:fixwindowstests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
dart:io does not have millisecond-level precision on file stats and instead, the modified time is rounded to the nearest second. If edits and recompiles are done within the same second as the previous compile, frontend_server_common can't tell that the files have changed. Instead, wait a second before editing. In order to support this, edits are staged at once. Without this, we'd be waiting multiple seconds for several edits.
Hmm, |
nshahan
reviewed
Aug 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for discovering the issue here. This will push us closer to reliability on the windows bots.
Thanks, PTAL. |
nshahan
approved these changes
Aug 22, 2025
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.
Currently, CI is red due to two issues on Windows:
hot_reload_breakpoints_test
: On Windows,dart:io
doesn't have enough precision to provide a millisecond-basedstat
. Instead, it just rounds to the nearest second. We use this to determine what files were modified in a recompile whereas we useDateTime.now
(which does have millisecond precision) to mark the timestamp of the previous compile. This then potentially leads tofrontend_server_common
mistakenly not recompiling some files.To fix this, we stage all the edits at once (if possible) and delay for 1 second to guarantee that
stat
will always give a time after the previous compile if the file was modified.hot_reload_test
: This and a number of tests useinnerHTML
,document.body.append
, and thepageSource
API to modify the page text and then read it. A previous race condition where we tried to compute the page before main was done executing was resolved by waiting for a log at the end of main. However, this is insufficient, because the changes to the page still may not bubble up by the time we try to calculate the page source, which was the issue withhot_reload_test
.We could do a busy-loop calculating the page until we get the text we want, but that's erroneous and a better solution is to just use console logs, which fixes the original issue. As part of this, a
WebkitDebugger
is always initialized in the test context so we can inspect console logs regardless of whether DWDS debugging is enabled.