Drop doubled-package pseudo-labels from RuleInput before hashing - #288
Open
justinwon777 wants to merge 1 commit into
Open
Drop doubled-package pseudo-labels from RuleInput before hashing#288justinwon777 wants to merge 1 commit into
justinwon777 wants to merge 1 commit into
Conversation
Bazel query can render a workspace-relative string attribute (e.g. resource_strip_prefix, used by kt_jvm_library/java_library for resource stripping) as a pseudo-label, naively prepending the current package onto a value that already contains it. The result is a RuleInput entry like //pkg:pkg/resources that never corresponds to a real file, and HashRecursively's fallback for unresolved labels blows up trying to stat the doubled path. Filter such labels out of a rule's deps at proto-to-Target conversion time, since a real Bazel label is never shaped this way. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Bazel query can render a workspace-relative string attribute (e.g. resource_strip_prefix, used by kt_jvm_library/java_library for resource stripping) as a pseudo-label. The result is a RuleInput entry like //pkg:pkg/resources that never corresponds to a real file, and HashRecursively's fallback for unresolved labels fails trying to stat the doubled path.
Filter such labels out of a rule's deps at proto-to-Target conversion time, since it's not a real label.
Real example:
tooling/program-analysis/detekt/BUILD.bazelin Java monorepo:bazel query adds resource_strip_prefix as a label-shaped RuleInput entry, formatted as
//<current-package>:<raw-string>. Since the raw string is already workspace-rooted, the result doubles the package. The actual resource file is already part of the inputsbazel query 'deps(//tooling/program-analysis/detekt:src_main, 1)' --output=label_kind:Test Plan
unit test
Issue
https://linear.app/uber/issue/TANGO-33/fix-hasing-labels-with-package-prefixed