fix(itg): wire bzlmod external-target collapse into incremental graph updates - #323
Merged
yushan8 merged 2 commits intoOct 2, 2026
Merged
Conversation
…collapse Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… updates core/itg/graph.UpdateGraph always called the legacy HashExternalTargets helper, which matches on //external:* rule names and is a no-op for bzlmod repos (no such rules exist under bzlmod). Every bzlmod external source file then fell through to computeAvailableHashes, which unconditionally re-hashed it from disk, reintroducing the per-file hashing cost that #312's marker-based collapse was meant to eliminate for the full-graph path. Branch on UseBzlmod and call targethasher.HashExternalTargetsBzlmod with the repo marker hashes/mapping, and make computeAvailableHashes skip source files that already have a hash (e.g. from the collapse) instead of overwriting it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
yushan8
merged commit Oct 2, 2026
0d14495
into
yushan/bzlmod-apparent-repo-collapse
10 checks passed
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.
Summary
Stacked on #322.
core/itg/graph.UpdateGraph(the incremental/ITG graph update path) alwayscalled the legacy
targethasher.HashExternalTargetshelper regardless ofUseBzlmod. That helper filters on//external:*rule names, which don'texist under bzlmod, so it silently did nothing for bzlmod repos — every
bzlmod external source/generated file target then fell through to
computeAvailableHashes, which unconditionally re-hashed it from disk. Thisreintroduces the per-file hashing cost that #312's marker-based collapse
fixed for the full-graph (
fromProto) path.Changes
UpdateGraphInputgainsExcludedRegex,RepoMarkerHashes, andRepoMapping, mirroringtargethasher.HashConfig.UpdateGraphbranches onUseBzlmod: legacy WORKSPACE repos keep callingHashExternalTargets; bzlmod repos calltargethasher.HashExternalTargetsBzlmodwith the marker hashes, same as the full-graph path.
computeAvailableHashesnow skips re-hashing aSourceFileTypetarget thatalready has a hash set (e.g. by the bzlmod collapse), instead of
unconditionally overwriting it with a disk-based hash.
targethasher.CompileExcludedRegex(shared byFromProtoand thenew itg call site) to avoid duplicating the regex-compile-with-wrapped-error
logic.
Test plan
go test ./core/itg/graph/... ./core/targethasher/...TestUpdateGraph_BzlmodCollapsesExternalFiles, an end-to-end testthat fails loudly (via a hasher returning an error) if the itg path ever
falls back to disk hashing for a bzlmod external file.
computeAvailableHashessubtest asserting a pre-set hash isn'tclobbered.