Regression test for #83 over-triggering on comment-only MODULE.bazel edit (bzlmod analog)#348
Merged
Merged
Conversation
…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
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
WORKSPACEin arules_go+ Gazelle setup caused every external Go dep — and thego_binarydepending on them — to be reported as impacted.MODULE.bazelre-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 rawMODULE.bazelcontent, bazel-diff parsesbazel mod graph --output=jsonand only re-hashes targets when the resolved module graph differs.MODULE.bazelproduces an empty impacted-targets list.module_bazel_commentfixture: minimal bzlmod workspace with a singlebazel_deponrules_shelland twosh_library/sh_binarytargets.@Ignored). If a future change goes back to seeding hashes with rawMODULE.bazelcontent, 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.mod show_repopath), matching the convention used elsewhere.Test plan
bazel build //cli:cli-test-libsucceeds.bazel query '//...'against the new fixture returns//:liband//:bin.bazel test //cli:E2ETest --test_filter=testModuleBazelCommentOnlyChangeDoesNotImpactTargets_regressionForIssue83→ PASSED in 2.7s on Bazel 9.1.MODULE.bazeledit yields an empty impacted-targets list.🤖 Generated with Claude Code