Repository navigation
Fix #612: main-repository aliases dropped under --useCquery - #617
Merged
Merged
Conversation
Adds the cquery_main_repo_alias fixture (a genrule whose only src is an alias of a filegroup in another package) and two e2e cases. The query-mode control passes; the cquery case fails on master because the compatible-target cquery names the alias by repr(target), which Bazel prints as the apparent label //:tool while the target is named @@//:tool, so the alias is filtered out as if it were platform-incompatible and //:wrapper loses its edge through it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…target cquery The compatible-target cquery names an alias by repr(target), and Bazel prints a main-repository alias with its apparent label (//:tool) even under --consistent_labels, while every other target is canonical (@@//:tool). The compatible set therefore never contained the alias's canonical label and query_compatible_labels filtered it out as if it were platform-incompatible, dropping every edge through it. Prefix @@ to apparent main-repository labels so the alias matches. Co-Authored-By: Claude Fable 5.1 <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.
Fixes #612.
Reproducer
New fixture
tests/resources/workspaces/cquery_main_repo_alias: agenrule//:wrapperwhose onlysrcsentry is//:tool, analiasof//bar:baz(afilegroupoverbar/baz.txt). Two e2e cases intests/e2e/regressions.rschangebar/baz.txtbetween two copies of the workspace:main_repo_alias_change_reaches_consumer_queryis the query-mode control. It passes on master.main_repo_alias_change_reaches_consumer_cqueryruns with--useCqueryand asserts that@@//:toolis in the hashes, that@@//:wrapperhas a dep edge to it, and that//:wrapperis impacted. On master (Bazel 8.8.2) it fails on the first assertion: the hash file has no//:toolentry at all, matching the report.Fix
The compatible-target cquery in
query_compatible_labelsnames an alias byrepr(target). Bazel prints a main-repository alias with its apparent label (//:tool) even under--consistent_labels, while every other target comes back canonical (@@//:tool). The compatible set never contained the alias's canonical label, so the alias was filtered out as if it were platform-incompatible and every edge through it went with it. The Starlark formatter now prefixes@@to apparent main-repository labels, as suggested in the issue.Verification
With the fix, the new cquery case passes, and the existing cquery cases (
cquery_keeps_dependencies_of_every_configured_instance,hidden_wrapper_external_repo_change_reaches_main_consumer_cquery,single_version_override_patch_change_reaches_consumer_cquery,extension_repo_patch_edit_impacts_toolchain_user_cquery,external::fine_grained_bzlmod_repo_cquery) and//src/...unit tests still pass locally.The reproducer and the fix are separate commits, so the first commit alone shows the failure.
🤖 Generated with Claude Code