Skip to content

Update hash to remove any built targets unless we run in update mode#3543

Open
tmjlewis wants to merge 3 commits into
thought-machine:masterfrom
tmjlewis:INFRA-166407
Open

Update hash to remove any built targets unless we run in update mode#3543
tmjlewis wants to merge 3 commits into
thought-machine:masterfrom
tmjlewis:INFRA-166407

Conversation

@tmjlewis

@tmjlewis tmjlewis commented Jul 8, 2026

Copy link
Copy Markdown

Currently run plz hash will build it's targets in the local cache in /plz-out., Even if the target built doesn't match it's hash in the build rule.

It is still tagged with a valid user.plz_build, so the next time we run plz build we don't rebuild that target thinking it's valid based on this rule hash attached to it.

To get around this plz hash now removes any targets built from the cache if it wasn't ran in update mode.

If it's update mode there is no issue because the hash of the target will be used to update the rule, so there is no issue with them falling out of sync.

Comment thread .gitignore Outdated
# The parse perf test repo
/tree

.vscode No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

plz add trailing newline

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

There is a new line now, but it doesn't show in the diff. You can see the new line if you edit the file.

Comment thread src/please.go
Comment thread src/please.go Outdated
Comment on lines +512 to +514
// plz hash was building targets to the cache and tagging it with a valid
// user.plz_build xattr even if the computed hash didn't match the hash in the rule.
// Make sure we clean up any built targets if we aren't updating the hash aswell

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comments in the past tense are generally not a good idea

Suggested change
// plz hash was building targets to the cache and tagging it with a valid
// user.plz_build xattr even if the computed hash didn't match the hash in the rule.
// Make sure we clean up any built targets if we aren't updating the hash aswell
// The code above will build the target(s) and unconditionally write to
// the cache. If we're not updating the hash, we need to clear the target(s)
// from the cache again to ensure that future builds depending on the
// target(s) are not able to proceed despite a potentially mismatched hash.

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.

2 participants