test: E2E reproducer for remote proto module version bumps#372
Merged
Conversation
Adds testRemoteProtoVersionBumpImpactsConsumer plus a hermetic `proto_external_version_bump` fixture that validates bazel-diff invalidates main-repo targets when a remote dependency shipping .proto files and exposing java_proto_library targets is version bumped. The fixture wires up a `proto_dep` module (resolved via local_path_override, standing in for any remote/BCR module) that ships greeting.proto and exposes @proto_dep//:greeting_java_proto, plus a //:consumer java_library depending on it. The test simulates a 1.0.0 -> 2.0.0 release (bumps the module version and adds a proto field) and asserts that, with --fineGrainedHashExternalRepos @proto_dep, both //:consumer and @proto_dep//:greeting_java_proto are reported impacted. This locks in end-to-end tracking of remote proto targets: if fine-grained external hashing ever stops descending into proto / java_proto_library targets, //:consumer would silently stop being impacted and this test would fail. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Adds an E2E reproducer,
testRemoteProtoVersionBumpImpactsConsumer, plus a hermeticproto_external_version_bumpfixture, that validates a question we wanted answered directly: when a remote dependency that ships.protofiles and exposesjava_proto_librarytargets is version bumped, do the main-repo targets that consume those Java protos get invalidated?Fixture shape
cli/src/test/resources/workspaces/proto_external_version_bump/:proto_dep— a module resolved vialocal_path_override(hermetic, but standing in for any remote/BCR module) that shipsgreeting.protoand exposes@proto_dep//:greeting_java_proto(loaded via@protobuf//bazel:java_proto_library.bzl, same as the repo itself).//:consumer— a main-repojava_librarydepending on@proto_dep//:greeting_java_proto.What the test does
Copies the workspace twice and simulates a
proto_dep1.0.0 → 2.0.0release the way a real version bump looks: it bumps the moduleversion(root + depMODULE.bazel) and adds a field to the shipped proto. It then runsgenerate-hashes(A vs B) with--fineGrainedHashExternalRepos @proto_depandget-impacted-targets, asserting that both//:consumerand@proto_dep//:greeting_java_protoare reported impacted.Result
bazel-diff correctly propagates the invalidation. Hand-verified with the locally built CLI — the bump impacts
//:consumer,@proto_dep//:greeting.proto,@proto_dep//:greeting_proto, and@proto_dep//:greeting_java_proto, while the unchanged@proto_dep//:BUILDkeeps its hash (genuine hash-change detection, not an artifact). So this lands as a positive regression lock, like the existinggo_mod_changetest — not a bug repro.Notes
E2ETest.ktchange is a clean addition (no reformatting of surrounding code); the file isn't ktfmt-formatted onmaster, so the addition matches the existing hand-formatted style.MODULE.bazel.lock(verified free of absolute-path leakage). E2E tests run on the Bazel 8.x/9.x bzlmod matrix, so no version-gatingAssumewas needed.--fineGrainedHashExternalRepospointed at the proto repo; without it an external repo content change isn't picked up.🤖 Generated with Claude Code