Repository navigation
Reuse local input hashes when lowering Bzlmod repositories - #594
Merged
tinder-maxwellelliott merged 1 commit intoOct 31, 2026
Merged
tinder-maxwellelliott merged 1 commit into
tinder-maxwellelliott merged 1 commit into
Conversation
A module's synthetic target and the definition inherited by its extension repositories both hashed the same workspace inputs. For a local_repository this meant walking the same directory tree twice. Additional apparent names and extension views repeated the target preparation. Read local inputs from the original attribute paths, then normalize the owned attributes in place. Keep each module record's two local digests for its target and build one rule for its apparent names and views. Use the input position so separate records with the same canonical name still read their own inputs. Test the boundary by changing a patch after module definitions have been computed. Both aliases and their extension views use the first digest, and a later independent repository reads the changed patch.
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.
Generating hashes walked a local module's directory tree twice. The module definition and its synthetic target both needed the same digest. Workspace files named by repository attributes, such as override patches, were also read twice. Multiple apparent names or extension views repeated the target work.
The module definition and target now share the two local digests for their repository record. The lowerer reads the original attribute paths, normalizes the owned attributes once, and moves the prepared rule into its last output. A separate record still reads its own inputs, even if its canonical name matches an earlier record.
In four paired local generate-hashes runs, median repository lowering went from 2.59 s to 1.64 s and median generator wall time from 4.72 s to 3.65 s. Each binary ran first in two pairs, after one warm-up. The runs replayed a complete show_repo response with 144,774 records, including 432 modules, and a bounded ordinary query. Module graph and mapping responses were reacquired at the same checkout revision and replayed identically. The generators read the local files from that checkout. The timings exclude live Bazel discovery. All eight outputs agreed byte for byte across 192,065 target hashes and 3,002,048 ordered dependency edges.
The regression changes a workspace patch after the module-definition pass and before the module's first target. It checks the original digest on both apparent names and their extension views, and the changed digest on a later independent repository.
Prepared by Codex on behalf of Tamir Duberstein.