From 1baae50cfe1995a972aa6548f25066f3b2f24493 Mon Sep 17 00:00:00 2001 From: jlewis Date: Wed, 8 Jul 2026 16:17:01 +0100 Subject: [PATCH 1/3] updated hash to remove any built targets if we don't run in update mode --- .gitignore | 2 ++ src/please.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 37a8049e2a..d8d5936b3c 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ __pycache__ # The parse perf test repo /tree + +.vscode \ No newline at end of file diff --git a/src/please.go b/src/please.go index 5eda69dfed..fda5505d27 100644 --- a/src/please.go +++ b/src/please.go @@ -508,6 +508,8 @@ var buildFunctions = map[string]func() int{ } if opts.Hash.Update { hashes.RewriteHashes(state, state.ExpandOriginalLabels()) + } else { + clean.Targets(state, state.ExpandOriginalLabels()) } } return toExitCode(success, state) From 6dae8bca980d89c7c885da2bda3fd79ad55eb31f Mon Sep 17 00:00:00 2001 From: jlewis Date: Wed, 8 Jul 2026 17:05:16 +0100 Subject: [PATCH 2/3] Added comment to clean.Targets() --- .gitignore | 2 +- src/please.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d8d5936b3c..154280d0d5 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,4 @@ __pycache__ # The parse perf test repo /tree -.vscode \ No newline at end of file +.vscode diff --git a/src/please.go b/src/please.go index fda5505d27..4642997694 100644 --- a/src/please.go +++ b/src/please.go @@ -509,6 +509,9 @@ var buildFunctions = map[string]func() int{ if opts.Hash.Update { hashes.RewriteHashes(state, state.ExpandOriginalLabels()) } else { + // 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 clean.Targets(state, state.ExpandOriginalLabels()) } } From 2471c28da9d3238b61f4877f2bc6f91ac0fc9f54 Mon Sep 17 00:00:00 2001 From: jlewis Date: Thu, 9 Jul 2026 10:06:57 +0100 Subject: [PATCH 3/3] updated comment for hash cleaning --- src/please.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/please.go b/src/please.go index 4642997694..9757c50244 100644 --- a/src/please.go +++ b/src/please.go @@ -509,9 +509,10 @@ var buildFunctions = map[string]func() int{ if opts.Hash.Update { hashes.RewriteHashes(state, state.ExpandOriginalLabels()) } else { - // 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. clean.Targets(state, state.ExpandOriginalLabels()) } }