Skip to content

Add regression test for #228 external go deps appear in bzlmod hashes#349

Merged
tinder-maxwellelliott merged 1 commit into
masterfrom
claude/reproducer-issue-228
May 13, 2026
Merged

Add regression test for #228 external go deps appear in bzlmod hashes#349
tinder-maxwellelliott merged 1 commit into
masterfrom
claude/reproducer-issue-228

Conversation

@tinder-maxwellelliott
Copy link
Copy Markdown
Collaborator

Summary

The user in #228 asked:

Trying to understand if bazel-diff still works for go deps brought in via the new gazelle/rules_go bzlmod mechanism ... Our hashes file does not include any of the external go dependencies since migrating to the new mechanism.

This is a different signal from the propagation check covered by testGoModUpdateImpactsGoTargets_regressionForIssue266 (#266). That existing test confirms a go.mod version bump changes the hash of the dependent //:lib target, but it does not assert the per-module external entry is itself in the hashes JSON. #228 is exactly that question.

I reused the existing go_mod_change workspace fixture and verified by hand against the locally built CLI:

$ java -jar bazel-bin/cli/bazel-diff_deploy.jar generate-hashes \
    -w <workspace> -b bazel /tmp/hashes.json
$ jq '.hashes | keys' /tmp/hashes.json
[
  "//:BUILD",
  "//:lib",
  "//:lib.go",
  "//:lib_test",
  "//:lib_test.go",
  "//external:com_github_pkg_errors",
  "//external:gazelle",
  "//external:rules_go"
]

The //external:<apparent_name> entries are the synthetic labels BazelClient produces by querying bazel mod show_repo --output=streamed_proto (the mechanism added for #255). They give a per-bzlmod-module hash that changes when the module's resolved version changes — exactly the surface #228 was asking about.

This regression-protection test (not @Ignore'd) locks in that behaviour. It parses the hashes JSON, asserts //:lib is present (sanity), and asserts that an entry whose label contains com_github_pkg_errors exists and equals //external:com_github_pkg_errors.

Skipped on Bazel < 8.6.0 and on 9.0.0 (which had a broken mod show_repo path), matching the existing convention.

Test plan

  • bazel test //cli:E2ETest --test_filter=testExternalGoDepsAppearInHashes_regressionForIssue228 passes on Bazel 9.1
  • CI green

Refs #228

🤖 Generated with Claude Code

The user asked: "Trying to understand if bazel-diff still works for go
deps brought in via the new gazelle/rules_go bzlmod mechanism ... Our
hashes file does not include any of the external go dependencies since
migrating to the new mechanism."

This is a separate signal from the propagation behaviour covered by
testGoModUpdateImpactsGoTargets_regressionForIssue266: that one verifies
a `go.mod` version bump changes the hash of the dependent //:lib target,
but it does not assert the per-module external entry is itself in the
hashes JSON. #228 is exactly that question.

I reused the `go_mod_change` workspace and verified by hand with the
locally built CLI:

  $ java -jar bazel-bin/cli/bazel-diff_deploy.jar generate-hashes \
      -w <workspace> -b bazel /tmp/hashes.json
  $ jq '.hashes | keys' /tmp/hashes.json
  [
    "//:BUILD",
    "//:lib",
    "//:lib.go",
    "//:lib_test",
    "//:lib_test.go",
    "//external:com_github_pkg_errors",
    "//external:gazelle",
    "//external:rules_go"
  ]

The `//external:<apparent_name>` entries are the synthetic labels
BazelClient produces by querying `bazel mod show_repo
--output=streamed_proto` (the mechanism added for #255). They give a
per-bzlmod-module hash that changes when the module's resolved version
changes -- exactly the surface #228 was asking about.

This regression-protection test (not @ignore'd) locks in that behaviour.
It parses the hashes JSON, asserts //:lib is present (sanity), and
asserts that an entry whose label contains `com_github_pkg_errors`
exists and equals `//external:com_github_pkg_errors`.

Skipped on Bazel < 8.6.0 and on 9.0.0 (which had a broken mod show_repo
path), matching the existing convention.

Verified on Bazel 9.1:
  //cli:E2ETest                                       PASSED in 3.1s

Refs #228

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tinder-maxwellelliott tinder-maxwellelliott force-pushed the claude/reproducer-issue-228 branch from 5194a9d to 1c5fc8a Compare May 13, 2026 19:47
@tinder-maxwellelliott tinder-maxwellelliott merged commit e110834 into master May 13, 2026
15 checks passed
@tinder-maxwellelliott tinder-maxwellelliott deleted the claude/reproducer-issue-228 branch May 13, 2026 20:24
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