Skip to content

Regression test for #83 over-triggering on comment-only MODULE.bazel edit (bzlmod analog)#348

Merged
tinder-maxwellelliott merged 2 commits into
masterfrom
claude/reproducer-issue-83
May 13, 2026
Merged

Regression test for #83 over-triggering on comment-only MODULE.bazel edit (bzlmod analog)#348
tinder-maxwellelliott merged 2 commits into
masterfrom
claude/reproducer-issue-83

Conversation

@tinder-maxwellelliott

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a passing regression-protection test for #83. The 2021 report was that a comment-only edit to WORKSPACE in a rules_go + Gazelle setup caused every external Go dep — and the go_binary depending on them — to be reported as impacted.
  • The bzlmod-era analog of that bug is a comment-only edit to MODULE.bazel re-hashing the entire dep graph. This is exactly the over-triggering shape PR #314 was designed to prevent: rather than seed every target's hash with the raw MODULE.bazel content, bazel-diff parses bazel mod graph --output=json and only re-hashes targets when the resolved module graph differs.
  • I verified by hand with the locally built CLI: prepending a comment to MODULE.bazel produces an empty impacted-targets list.
  • New module_bazel_comment fixture: minimal bzlmod workspace with a single bazel_dep on rules_shell and two sh_library/sh_binary targets.
  • This is a passing regression test (not @Ignored). If a future change goes back to seeding hashes with raw MODULE.bazel content, the test will fail. WORKSPACE mode is no longer supported in current Bazel, so a WORKSPACE-comment reproducer would need a legacy-Bazel fixture; the bzlmod equivalent is the right shape going forward.
  • Test skips itself on Bazel < 8.6.0 (and on the 9.0.0 release that had the broken mod show_repo path), matching the convention used elsewhere.

Test plan

  • bazel build //cli:cli-test-lib succeeds.
  • bazel query '//...' against the new fixture returns //:lib and //:bin.
  • bazel test //cli:E2ETest --test_filter=testModuleBazelCommentOnlyChangeDoesNotImpactTargets_regressionForIssue83PASSED in 2.7s on Bazel 9.1.
  • Manual run with locally built CLI confirms a comment-only MODULE.bazel edit yields an empty impacted-targets list.

🤖 Generated with Claude Code

tinder-maxwellelliott and others added 2 commits May 12, 2026 10:57
…PACE comment edit

Issue #83 (2021) reported that a comment-only edit to WORKSPACE in a
rules_go + Gazelle setup caused every external Go dep -- and the
go_binary depending on them -- to be reported as impacted.

The bzlmod-era analog of that bug would be a comment-only edit to
MODULE.bazel re-hashing the entire dep graph. This is exactly the
over-triggering shape PR #314 was designed to prevent: rather than
seed every target's hash with the raw MODULE.bazel content, bazel-diff
parses `bazel mod graph --output=json` and only re-hashes targets when
the resolved module graph differs.

Verified by hand with the locally built CLI: prepending a comment to
MODULE.bazel produces an empty impacted-targets list (correct).

New `module_bazel_comment` fixture: minimal bzlmod workspace with a
single bazel_dep on rules_shell and two sh_library/sh_binary targets.

This passing regression test (not @ignore'd) locks in the behaviour.
If a future change goes back to seeding hashes with raw MODULE.bazel
content, the test will fail. WORKSPACE mode is no longer supported in
current Bazel, so a WORKSPACE-comment reproducer would need a
legacy-Bazel fixture; the bzlmod equivalent is the right shape going
forward.

Test skips itself on Bazel < 8.6.0 (and on the 9.0.0 release that had
the broken mod show_repo path), matching the convention in
testBzlmodShowRepoDetectsModuleBazelChanges.

Verified by running the new test on Bazel 9.1:
  //cli:E2ETest                  PASSED in 2.7s

Refs #83

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ssue-83

# Conflicts:
#	cli/src/test/kotlin/com/bazel_diff/e2e/E2ETest.kt
@tinder-maxwellelliott tinder-maxwellelliott merged commit e765b56 into master May 13, 2026
15 checks passed
@tinder-maxwellelliott tinder-maxwellelliott deleted the claude/reproducer-issue-83 branch May 13, 2026 15:02
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