Skip to content

fix(itg): wire bzlmod external-target collapse into incremental graph updates - #324

Draft
yushan8 wants to merge 1 commit into
yushan/bzlmod-apparent-repo-collapsefrom
yushan/itg-bzlmod-external-collapse
Draft

yushan8 wants to merge 1 commit into
yushan/bzlmod-apparent-repo-collapsefrom
yushan/itg-bzlmod-external-collapse

Conversation

@yushan8

@yushan8 yushan8 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Why?

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.

What?

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.

Stacked on #322, which adds the repo-mapping argument to HashExternalTargetsBzlmod.

Issue

None.

🤖 Generated with Claude Code

Test Plan

Adds unit tests in core/itg/graph/update_test.go. Not exercised against a real repository.

Issue

None.

🤖 Generated with Claude Code

Issues

Stack

  1. fix(targethasher): collapse apparent-name bzlmod external files via repo mapping #322
  2. @ fix(itg): wire bzlmod external-target collapse into incremental graph updates #324

… 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
yushan8 force-pushed the yushan/itg-bzlmod-external-collapse branch from b106ba4 to 8fc0ae4 Compare October 2, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant