Bugfix: Scope macro digest cache to each hash invocation - #446
Open
dgollahon-plaid wants to merge 1 commit into
Open
Bugfix: Scope macro digest cache to each hash invocation#446dgollahon-plaid wants to merge 1 commit into
dgollahon-plaid wants to merge 1 commit into
Conversation
The query service reuses RuleHasher across base and head checkouts. Its path-only .bzl cache could therefore reuse a base digest at head and hide macro-only changes from impacted targets. Make the cache invocation-local while retaining within-run parallel deduplication. Add unit coverage for cache lifetime and a two-commit query-service regression.
Author
|
This was discovered by A/B testing old/new Thanks for a valuable tool! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The query service can omit targets affected by a macro-only
.bzlchange. It hashes the base and head revisions in one process, whileRuleHasheris a singleton. PR #436 added a.bzldigest cache keyed only by workspace-relative path, so hashing the head revision could reuse the base revision’s digest and produce identical target hashes.Move revision-derived
.bzlcache state into aHashInvocationContextcreated for eachBuildGraphHasherinvocation. The context is shared across parallel target hashing, which preserves same-run digest deduplication, but it cannot leak across base and head checkouts. This also avoids an unbounded process-lifetime cache and remains safe if hash generation becomes concurrent.The regression was introduced by
700780ain #436. The same two-revision query-service reproduction:07b6d54, where//:generatedis impacted;700780a, where the service returns no impacted targets;The regression coverage also verifies that
.bzldigests are recalculated between hash invocations and still deduplicated within one parallel invocation.