Skip to content

Immediately invalidate written files in write_digest (Cherry-pick of #19903) - #19948

Merged
huonw merged 1 commit into
2.18.xfrom
cherry-pick-19903-to-2.18.x
Sep 28, 2023
Merged

Immediately invalidate written files in write_digest (Cherry-pick of #19903)#19948
huonw merged 1 commit into
2.18.xfrom
cherry-pick-19903-to-2.18.x

Conversation

@WorkerPants

Copy link
Copy Markdown
Member

This ensures that files changed by write_digest are immediately flagged as changed/invalidated, for any follow-on processing, by invalidating them in the graph as part of the write.

Previously, write_digest just changed files directly, and we were relying on file-change notifications to make the graph aware of those changes, but this is racy: a command like pants fmt lint :: will write any formatting changes as part of fmt and immediately run lint, hopefully on those files... if the lint call happens soon enough, it'll run before the graph is aware of the changed files, and give incorrect results.

This fixes #19897

This ensures that files changed by `write_digest` are immediately
flagged as changed/invalidated, for any follow-on processing, by
invalidating them in the graph as part of the write.

Previously, `write_digest` just changed files directly, and we were
relying on file-change notifications to make the graph aware of those
changes, but this is racy: a command like `pants fmt lint ::` will write
any formatting changes as part of `fmt` and immediately run `lint`,
hopefully on those files... if the `lint` call happens soon enough,
it'll run before the graph is aware of the changed files, and give
incorrect results.

This fixes #19897
@WorkerPants WorkerPants added this to the 2.18.x milestone Sep 27, 2023
@WorkerPants WorkerPants added the category:bugfix Bug fixes for released features label Sep 27, 2023
@huonw
huonw merged commit 054919d into 2.18.x Sep 28, 2023
@huonw
huonw deleted the cherry-pick-19903-to-2.18.x branch September 28, 2023 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:bugfix Bug fixes for released features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants