Skip to content

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
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

srujzs
Copy link
Contributor

@srujzs srujzs commented Aug 20, 2025

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-based stat. Instead, it just rounds to the nearest second. We use this to determine what files were modified in a recompile whereas we use DateTime.now (which does have millisecond precision) to mark the timestamp of the previous compile. This then potentially leads to frontend_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 use innerHTML, document.body.append, and the pageSource 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 with hot_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.

srujzs added 2 commits August 18, 2025 14:30
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.
@srujzs
Copy link
Contributor Author

srujzs commented Aug 20, 2025

Hmm, dds_port_test seems to be flaky but unrelated to this PR.

Copy link
Contributor

@nshahan nshahan left a 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.

@srujzs
Copy link
Contributor Author

srujzs commented Aug 22, 2025

Thanks, PTAL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants