Repository navigation
Use observed files for literal external aliases - #646
Merged
tinder-maxwellelliott merged 5 commits intoNov 10, 2026
Merged
Conversation
Query mode adds an imported extension repository's hidden siblings to its hash. When a fine-grained alias forwards to a source file in that repository, the file's bytes already enter the alias hash. Its repository dependency still makes an unrelated sibling edit reach the alias. Conversely, a visibility edit can leave the file contents and repository definition unchanged while the alias consumer stops building. Keep the source location and effective visibility returned by the strict alias closure. For an observed regular file, retain the selected repository definition and the visibility in the alias hash. Suppress the shared sibling group only for this operand. Keep the usual repository input when its other dependencies, source identity, or visibility cannot be established. Assisted by Codex.
tamird
marked this pull request as draft
November 9, 2026 23:33
Folding the repository definition into an observed alias moved a real RepoSpec change one dependency level closer to its consumers. Keep the original aggregate for unqualified inputs and route a verified alias through an internal definition node in the external package. Retain that internal kind in hash files for distance traversal and omit it from reported targets. A conflicting helper name keeps the original repository input. Assisted by Codex.
Change an unused repository rule attribute while the exported file, BUILD file and consumer outputs stay identical. Check the ordinary target and package distances for the source alias and its consumer alongside the payload, sibling and visibility cases.
tamird
marked this pull request as ready for review
November 10, 2026 00:16
tamird
marked this pull request as draft
November 10, 2026 01:33
An observed source alias used the original repository node until the extension generated its first unimported sibling, then switched to the definition-only node. The change in the dependency label alone made the alias look directly changed, even with identical file bytes, visibility and repository attributes. Mark the lowering of generated repositories whose only inputs are hidden siblings, including an empty group. A qualified alias can use the same definition node at both revisions. Keep the existing aggregate hashes for other readers and check the roster transition in the existing alias test.
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.
In ordinary Bzlmod queries, #529 makes an imported repository depend on extension siblings that no module imports. A fine-grained hub can forward to a single file in that repository. The alias already hashes the file bytes, but its extra repository dependency can select the consumer when only a sibling changes. Changing a public export to private can leave the consumer’s hash equal even though Bazel rejects the build.
This uses the native alias binding and SourceFile returned by the supplementary query from #630 and #643. For a freshly read regular file, bazel-diff checks the open file against Bazel’s reported location and includes the effective visibility in the alias hash. When the generated source repository has no other dependencies, this operand points to an internal hash row for its definition, even before the extension generates its first hidden sibling. Keeping the definition one dependency away preserves the reported target and package distances. The original repository row still carries the siblings for every other operand. Unresolved bindings, package-group visibility, source overrides, and platforms without the file identity check retain the conservative path.
The regression builds a payload reader and a reader of the generated BUILD file. Changing the payload selects its reader. Changing another spoke, or adding or removing the first hidden sibling, leaves that reader out. Changing the export to private selects the reader and fails its build. Adding an unused rule to the same BUILD file selects the BUILD-file reader alone among those two consumers. Changing an unused attribute of the source repository leaves both products intact and still reports the alias at distance one and its consumer at distance two.
Assisted by Codex.