Skip to content

Detect impacted targets when MODULE.bazel changes via mod show_repo#322

Open
nollbit wants to merge 1 commit intoTinder:masterfrom
nollbit:bzlmod-show-repo-integration
Open

Detect impacted targets when MODULE.bazel changes via mod show_repo#322
nollbit wants to merge 1 commit intoTinder:masterfrom
nollbit:bzlmod-show-repo-integration

Conversation

@nollbit
Copy link

@nollbit nollbit commented Mar 24, 2026

When running against Bazel 8.6.0+ or 9.0.1+, bazel-diff now queries bzlmod-managed external repo definitions using:

  1. bazel mod dump_repo_mapping to discover apparent→canonical names
  2. bazel mod show_repo @@<canonical>... --output=streamed_proto to get Build.Repository protos for each repo (modules + extensions)

Synthetic //external:<apparent_name> targets are created from these protos and merged into the target hash set. In non-cquery mode, transformRuleInput is now also applied so that external dep changes propagate to dependent targets.

This fixes the issue where MODULE.bazel changes (e.g. adding a new bazel_dep or changing a version) would not produce correct fine-grained diffs, requiring users to fall back to treating everything as affected.

Fixes: #255

When running against Bazel 8.6.0+ or 9.0.1+, bazel-diff now queries
bzlmod-managed external repo definitions using:
  1. `bazel mod dump_repo_mapping` to discover apparent→canonical names
  2. `bazel mod show_repo @@<canonical>... --output=streamed_proto` to
     get Build.Repository protos for each repo (modules + extensions)

Synthetic //external:<apparent_name> targets are created from these
protos and merged into the target hash set. In non-cquery mode,
transformRuleInput is now also applied so that external dep changes
propagate to dependent targets.

This fixes the issue where MODULE.bazel changes (e.g. adding a new
bazel_dep or changing a version) would not produce correct fine-grained
diffs, requiring users to fall back to treating everything as affected.

Fixes: Tinder#255

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

[Feature Request] Bazel diff should honor external repos loaded in MODULE.bazel

1 participant