Skip to content

fix: targets spuriously returned in cache case#124

Merged
sitaktif merged 1 commit intobazel-contrib:mainfrom
sitaktif:result-cache-spurious-results
Apr 23, 2026
Merged

fix: targets spuriously returned in cache case#124
sitaktif merged 1 commit intobazel-contrib:mainfrom
sitaktif:result-cache-spurious-results

Conversation

@sitaktif
Copy link
Copy Markdown
Collaborator

Avoid returning spurious targets on a result cache hit: the codepath was looking for configured target structs, but when retrieving hashes from the cache, these are not populated (to save significant amounts of space).

Remove the "NewTarget" case, which can never be reached because:
1. beforeMetadata.TransitiveConfiguredTargets is a superset of
   beforeMetadata.MatchingTargets, and
2. at this point in the function, beforeMetadata.MatchingTargets is
   known to contain that same label and configuration.

Doing this also addresses an issue where spurious targets were returned
on a result cache hit: the codepath was looking for configured target
structs, but when retrieving hashes from the cache, these are not
populated in the first place, only the resulting hashes are.
@sitaktif sitaktif force-pushed the result-cache-spurious-results branch from 93b7b69 to 8640bcd Compare April 22, 2026 13:11
Copy link
Copy Markdown

@ma-oli ma-oli left a comment

Choose a reason for hiding this comment

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

LGTM

@sitaktif sitaktif merged commit b4c86d3 into bazel-contrib:main Apr 23, 2026
2 checks passed
@sitaktif sitaktif deleted the result-cache-spurious-results branch May 1, 2026 11:58
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.

3 participants