Repository navigation
refactor(compat): drop proto, field_mask, longrunning, health, metadata, uuid, flag, and google shims - #1124
Merged
VLukiantsev merged 5 commits intoOct 8, 2026
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes legacy compatibility packages under internal/compat and replaces them with standard public packages (such as standard protobuf, UUID, and gRPC libraries) across the codebase. It also moves the Modify test helper to a new internal/prototest package. The review feedback recommends adding defensive nil checks to the Modify helper to prevent potential panics when handling nil inputs, as well as expanding unit tests to cover these edge cases.
VLukiantsev
marked this pull request as ready for review
October 7, 2026 10:44
pachopepe
previously approved these changes
Oct 7, 2026
Collaborator
There was a problem hiding this comment.
197 files :O, At a glance LGTM. Some AI comments
VLukiantsev
force-pushed
the
refactor/drop-compat-proto-aliases
branch
from
October 8, 2026 07:26
4d6b06a to
cdcd0c6
Compare
pachopepe
previously approved these changes
Oct 8, 2026
…ta, uuid, flag, and google shims Eliminates 8 internal/compat wrapper/alias packages (proto, field_mask, longrunning, health, metadata, uuid, flag, google) and extracts proto.Modify into a dedicated test-only package internal/prototest. Refs #1066 TAG=agy
Add nil guards for typed-nil base proto messages (!base.ProtoReflect().IsValid()) and nil mutation functions in prototest.Modify, along with corresponding unit tests. Comment link: #1124 (comment) Comment link: #1124 (comment) Part of #1066 TAG=agy CONV=4d3b3bec-3d31-4d4a-a440-8e4bd19b2cf3
VLukiantsev
force-pushed
the
refactor/drop-compat-proto-aliases
branch
from
October 8, 2026 09:07
4784b1d to
f309965
Compare
pachopepe
approved these changes
Oct 8, 2026
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
Extracts
proto.Modifyinto a dedicatedtestonlyhelper packageinternal/prototest(xmanager_cloud/internal/prototest) and eliminates 8internal/compatshim packages (proto,field_mask,longrunning,health,metadata,uuid,flag, andgoogle), migrating all callers directly to their canonical upstream open-source Go packages.Motivation & Context
Part of the google3 compatibility layer elimination effort (#1066), stacked on
refactor/drop-compat-test-shims-spanner. All functions ininternal/compat/protoexcept the test helperModifyare natively provided bygoogle.golang.org/protobuf/proto, andfield_mask,longrunning,health,metadata,uuid,flag, andgooglewere pass-through shims for legacy google3 import paths.Key Changes
internal/prototest(xmanager_cloud/internal/prototest):internal/prototest/prototest.gowithprototest.Modify[T proto.Message](base T, fn func(T)) T, unit tests ininternal/prototest/prototest_test.go(100.0% line coverage), andinternal/prototest/BUILD.bazel(testonly = True)..agents/AGENTS.md,.agents/rules/core_engineering.md,.agents/rules/languages/golang.md,.agents/skills/xmc_feature_development/SKILL.md,.agents/skills/xmc_review_pr/SKILL.md,docs/architecture/components.md,docs/developer.md) to referenceprototest.Modify.internal/compatShim Packages:internal/compat/proto(golang/protobuf/v2/proto/proto) ->google.golang.org/protobuf/proto(@org_golang_google_protobuf//proto) andxmanager_cloud/internal/prototest(//internal/prototest) forModify.internal/compat/field_mask(protobuf/field_mask_go_proto) ->google.golang.org/protobuf/types/known/fieldmaskpb(@org_golang_google_protobuf//types/known/fieldmaskpb).internal/compat/longrunning(longrunning/operations_go_proto) ->cloud.google.com/go/longrunning/autogen/longrunningpb(@com_google_cloud_go_longrunning//autogen/longrunningpb).internal/compat/health(grpc/health) ->google.golang.org/grpc/health(@org_golang_google_grpc//health).internal/compat/metadata(golang/grpc/metadata/metadata) ->google.golang.org/grpc/metadata(@org_golang_google_grpc//metadata).internal/compat/uuid(golang/uuid/uuid) ->github.com/google/uuid(@com_github_google_uuid//:uuid).internal/compat/flagandinternal/compat/google(go/google) -> deleted unused shims and removed remaining blank imports/deps.# gazelle:resolvelines from rootBUILD.bazel,IMPORT_MAPentries fromcompat.bzl, and blank imports frominternal/compat/imports.go.tools/lint/legacy_imports_baseline.json:gazelle_resolve_directives(80->75, -5) andgo_legacy_root_imports(689->515, -174).Assumptions
prototest.Modifyin atestonly = Truepackage (internal/prototest) enforces at the Bazel build graph level that test-mutation helpers cannot be imported by production binaries.uuid.NewString()/uuid.New().String()fromgithub.com/google/uuidis functionally identical to the removedinternal/compat/uuid.New()wrapper.Verification & Testing
bazel build //...across all 1,082 targets (passed).bazel test --test_env=SPANNER_EMULATOR_HOST=localhost:9010 //...andbazel coverage //internal/prototest/...(100.0% line coverage: 5/5 lines)../.githooks/pre-commit(passed)../tools/analyze_diff_size.py --base-ref refactor/drop-compat-test-shims-spanner(prod_code_lines: 194/400,total_code_lines: 522/1000,doc_lines: 9/1000).Related Issues / Bugs
TAG=agy
CONV=4d3b3bec-3d31-4d4a-a440-8e4bd19b2cf3