Skip to content

Centralize file update handling, handle concurrent deletes.#4865

Merged
davidmorgan merged 2 commits intodart-lang:masterfrom
davidmorgan:centralize-updates
Apr 2, 2026
Merged

Centralize file update handling, handle concurrent deletes.#4865
davidmorgan merged 2 commits intodart-lang:masterfrom
davidmorgan:centralize-updates

Conversation

@davidmorgan
Copy link
Copy Markdown
Contributor

@davidmorgan davidmorgan commented Mar 27, 2026

Fix dart-lang/webdev#2795

Pull initial reads of primary inputs and files that are known to be inputs into one place in build.dart.

Stop handling "updates" as a map from path to "add"/"modify"/"remove": just pass around the list of changed files, read the filesystem state to determine if they are "add"/"modify"/"remote". This removes the race that was happening if a file was changed after "updates" was constructed.

Files that are primary inputs or known from the previous build to be inputs are read at the start of the build and cached. So changes to these file during the build do nothing. This covers most cases.

Files that are not yet known to be inputs are still read+digested only if/when they are first used.

Add a new codepath for handling deletion of files after the start of the build if they were not read to cache. We already have a mechanism for restarting a command from scratch for recompiling builders, use the same mechanism for concurrent delete. The whole build will be retried.

Because files are no longer read before the start of the build a "modify file" event that does not change the file contents now causes a no-op build instead of the build being skipped. Update tests accordingly.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 27, 2026

PR Health

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

@davidmorgan davidmorgan force-pushed the centralize-updates branch 3 times, most recently from fecd1fe to 0398b5d Compare March 30, 2026 11:46
@davidmorgan davidmorgan marked this pull request as ready for review March 30, 2026 11:59
@davidmorgan davidmorgan requested a review from Markzipan March 31, 2026 09:36
@davidmorgan
Copy link
Copy Markdown
Contributor Author

@Markzipan not sure if you want to review this, it's pretty huge :) Jens who usually reviews is away this week so it might have to wait until next week otherwise, nothing urgent from my side. Thanks.

@Markzipan
Copy link
Copy Markdown
Contributor

I'm back from leave, so lemme give the a browse! Jens can give it a double-check as well though.

Copy link
Copy Markdown
Contributor

@Markzipan Markzipan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on my end!

@davidmorgan davidmorgan merged commit 37396be into dart-lang:master Apr 2, 2026
40 checks passed
@davidmorgan davidmorgan deleted the centralize-updates branch April 2, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Webdev automatically terminates

2 participants