From 862959edcaf3543c7f63b5285c9f4e59f771b505 Mon Sep 17 00:00:00 2001 From: "chenghan.ying" Date: Wed, 1 Jul 2026 18:44:16 +0000 Subject: [PATCH 1/3] add gazelle:proto disable_global to root BUILD.bazel and remove the resolve directives --- BUILD.bazel | 15 +++++++-------- api/base/change/proto/BUILD.bazel | 1 - api/base/mergestrategy/proto/BUILD.bazel | 1 - api/base/messagequeue/proto/BUILD.bazel | 1 - api/runway/messagequeue/proto/BUILD.bazel | 2 -- api/runway/proto/BUILD.bazel | 1 - api/stovepipe/proto/BUILD.bazel | 1 - api/submitqueue/gateway/proto/BUILD.bazel | 2 -- api/submitqueue/orchestrator/proto/BUILD.bazel | 1 - stovepipe/core/messagequeue/proto/BUILD.bazel | 2 -- 10 files changed, 7 insertions(+), 20 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 14ef5680..ad24082c 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -6,14 +6,13 @@ load("@gazelle//:def.bzl", "gazelle") # index them as duplicate rule definitions and corrupt the canonical BUILD files. # gazelle:exclude .claude -# Resolve protobuf import ambiguities - use the actual protopb packages, not the proto aliases -# gazelle:resolve go github.com/uber/submitqueue/api/base/change/protopb //api/base/change/protopb -# gazelle:resolve go github.com/uber/submitqueue/api/base/mergestrategy/protopb //api/base/mergestrategy/protopb -# gazelle:resolve go github.com/uber/submitqueue/api/runway/messagequeue/protopb //api/runway/messagequeue/protopb -# gazelle:resolve go github.com/uber/submitqueue/api/runway/protopb //api/runway/protopb -# gazelle:resolve go github.com/uber/submitqueue/api/submitqueue/gateway/protopb //api/submitqueue/gateway/protopb -# gazelle:resolve go github.com/uber/submitqueue/api/submitqueue/orchestrator/protopb //api/submitqueue/orchestrator/protopb -# gazelle:resolve go github.com/uber/submitqueue/api/stovepipe/protopb //api/stovepipe/protopb +# Disable Gazelle proto rule generation globally. We rely on the checked-in +# .pb.go files in protopb/ dirs (plain go_library) rather than Bazel proto +# compilation. This avoids proto_library → @protobuf// transitive loads that +# break in consumers using newer Bazel versions (e.g. go-code's Bazel 8.5.1 +# removed native.java_proto_library), and eliminates the duplicate-importpath +# aliases that required gazelle:resolve workarounds. +# gazelle:proto disable_global # Export marker files for test data dependencies (used by FindRepoRoot in tests) exports_files( diff --git a/api/base/change/proto/BUILD.bazel b/api/base/change/proto/BUILD.bazel index 972f2c7c..bb228557 100644 --- a/api/base/change/proto/BUILD.bazel +++ b/api/base/change/proto/BUILD.bazel @@ -13,7 +13,6 @@ proto_library( visibility = ["//visibility:public"], ) -# keep go_proto_library( name = "changepb_go_proto", compilers = [ diff --git a/api/base/mergestrategy/proto/BUILD.bazel b/api/base/mergestrategy/proto/BUILD.bazel index cedde92c..d5665348 100644 --- a/api/base/mergestrategy/proto/BUILD.bazel +++ b/api/base/mergestrategy/proto/BUILD.bazel @@ -13,7 +13,6 @@ proto_library( visibility = ["//visibility:public"], ) -# keep go_proto_library( name = "mergestrategypb_go_proto", compilers = [ diff --git a/api/base/messagequeue/proto/BUILD.bazel b/api/base/messagequeue/proto/BUILD.bazel index 09d957d3..7f81d36c 100644 --- a/api/base/messagequeue/proto/BUILD.bazel +++ b/api/base/messagequeue/proto/BUILD.bazel @@ -14,7 +14,6 @@ proto_library( deps = ["@protobuf//:descriptor_proto"], ) -# keep go_proto_library( name = "messagequeuepb_go_proto", compilers = [ diff --git a/api/runway/messagequeue/proto/BUILD.bazel b/api/runway/messagequeue/proto/BUILD.bazel index 56b0ce76..4516acca 100644 --- a/api/runway/messagequeue/proto/BUILD.bazel +++ b/api/runway/messagequeue/proto/BUILD.bazel @@ -18,7 +18,6 @@ proto_library( ], ) -# keep go_proto_library( name = "mergepb_go_proto", compilers = [ @@ -28,7 +27,6 @@ go_proto_library( importpath = "github.com/uber/submitqueue/api/runway/messagequeue/proto", proto = ":mergepb_proto", visibility = ["//visibility:public"], - # keep deps = [ "//api/base/change/proto:changepb_go_proto", "//api/base/mergestrategy/proto:mergestrategypb_go_proto", diff --git a/api/runway/proto/BUILD.bazel b/api/runway/proto/BUILD.bazel index 4fd905cf..c83b822c 100644 --- a/api/runway/proto/BUILD.bazel +++ b/api/runway/proto/BUILD.bazel @@ -13,7 +13,6 @@ proto_library( visibility = ["//visibility:public"], ) -# keep go_proto_library( name = "runwaypb_go_proto", compilers = [ diff --git a/api/stovepipe/proto/BUILD.bazel b/api/stovepipe/proto/BUILD.bazel index 6a26d753..1d06eea5 100644 --- a/api/stovepipe/proto/BUILD.bazel +++ b/api/stovepipe/proto/BUILD.bazel @@ -13,7 +13,6 @@ proto_library( visibility = ["//visibility:public"], ) -# keep go_proto_library( name = "stovepipepb_go_proto", compilers = [ diff --git a/api/submitqueue/gateway/proto/BUILD.bazel b/api/submitqueue/gateway/proto/BUILD.bazel index 9ccb5a7f..07adc8d3 100644 --- a/api/submitqueue/gateway/proto/BUILD.bazel +++ b/api/submitqueue/gateway/proto/BUILD.bazel @@ -17,7 +17,6 @@ proto_library( ], ) -# keep go_proto_library( name = "gatewaypb_go_proto", compilers = [ @@ -27,7 +26,6 @@ go_proto_library( importpath = "github.com/uber/submitqueue/api/submitqueue/gateway/proto", proto = ":gatewaypb_proto", visibility = ["//visibility:public"], - # keep deps = [ "//api/base/change/proto:changepb_go_proto", "//api/base/mergestrategy/proto:mergestrategypb_go_proto", diff --git a/api/submitqueue/orchestrator/proto/BUILD.bazel b/api/submitqueue/orchestrator/proto/BUILD.bazel index 6eb1b53b..93267567 100644 --- a/api/submitqueue/orchestrator/proto/BUILD.bazel +++ b/api/submitqueue/orchestrator/proto/BUILD.bazel @@ -13,7 +13,6 @@ proto_library( visibility = ["//visibility:public"], ) -# keep go_proto_library( name = "orchestratorpb_go_proto", compilers = [ diff --git a/stovepipe/core/messagequeue/proto/BUILD.bazel b/stovepipe/core/messagequeue/proto/BUILD.bazel index 047be015..af3e9ced 100644 --- a/stovepipe/core/messagequeue/proto/BUILD.bazel +++ b/stovepipe/core/messagequeue/proto/BUILD.bazel @@ -16,7 +16,6 @@ proto_library( ], ) -# keep go_proto_library( name = "processpb_go_proto", compilers = [ @@ -26,7 +25,6 @@ go_proto_library( importpath = "github.com/uber/submitqueue/stovepipe/core/messagequeue/proto", proto = ":processpb_proto", visibility = ["//visibility:public"], - # keep deps = [ "//api/base/messagequeue/proto:messagequeuepb_go_proto", ], From 3515fd52b894e84726810d565271bd53bf92eb6e Mon Sep 17 00:00:00 2001 From: "chenghan.ying" Date: Wed, 1 Jul 2026 18:47:58 +0000 Subject: [PATCH 2/3] remove legacy proto rules --- api/base/change/proto/BUILD.bazel | 35 --------------- api/base/mergestrategy/proto/BUILD.bazel | 35 --------------- api/base/messagequeue/proto/BUILD.bazel | 36 --------------- api/runway/messagequeue/proto/BUILD.bazel | 45 ------------------- api/runway/proto/BUILD.bazel | 35 --------------- api/stovepipe/proto/BUILD.bazel | 35 --------------- api/submitqueue/gateway/proto/BUILD.bazel | 43 ------------------ .../orchestrator/proto/BUILD.bazel | 35 --------------- stovepipe/core/messagequeue/proto/BUILD.bazel | 41 ----------------- 9 files changed, 340 deletions(-) diff --git a/api/base/change/proto/BUILD.bazel b/api/base/change/proto/BUILD.bazel index bb228557..f7d1e4cf 100644 --- a/api/base/change/proto/BUILD.bazel +++ b/api/base/change/proto/BUILD.bazel @@ -1,39 +1,4 @@ -load("@rules_go//go:def.bzl", "go_library") -load("@rules_go//proto:def.bzl", "go_proto_library") -load("@rules_proto//proto:defs.bzl", "proto_library") - exports_files( ["change.proto"], visibility = ["//tool/proto:__pkg__"], ) - -proto_library( - name = "changepb_proto", - srcs = ["change.proto"], - visibility = ["//visibility:public"], -) - -go_proto_library( - name = "changepb_go_proto", - compilers = [ - "@rules_go//proto:go_proto", - "@rules_go//proto:go_grpc_v2", - ], - importpath = "github.com/uber/submitqueue/api/base/change/proto", - proto = ":changepb_proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "proto", - embed = [":changepb_go_proto"], - importpath = "github.com/uber/submitqueue/api/base/change/proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "protopb", - embed = [":changepb_go_proto"], - importpath = "github.com/uber/submitqueue/api/base/change/protopb", - visibility = ["//visibility:public"], -) diff --git a/api/base/mergestrategy/proto/BUILD.bazel b/api/base/mergestrategy/proto/BUILD.bazel index d5665348..cca226af 100644 --- a/api/base/mergestrategy/proto/BUILD.bazel +++ b/api/base/mergestrategy/proto/BUILD.bazel @@ -1,39 +1,4 @@ -load("@rules_go//go:def.bzl", "go_library") -load("@rules_go//proto:def.bzl", "go_proto_library") -load("@rules_proto//proto:defs.bzl", "proto_library") - exports_files( ["mergestrategy.proto"], visibility = ["//tool/proto:__pkg__"], ) - -proto_library( - name = "mergestrategypb_proto", - srcs = ["mergestrategy.proto"], - visibility = ["//visibility:public"], -) - -go_proto_library( - name = "mergestrategypb_go_proto", - compilers = [ - "@rules_go//proto:go_proto", - "@rules_go//proto:go_grpc_v2", - ], - importpath = "github.com/uber/submitqueue/api/base/mergestrategy/proto", - proto = ":mergestrategypb_proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "proto", - embed = [":mergestrategypb_go_proto"], - importpath = "github.com/uber/submitqueue/api/base/mergestrategy/proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "protopb", - embed = [":mergestrategypb_go_proto"], - importpath = "github.com/uber/submitqueue/api/base/mergestrategy/protopb", - visibility = ["//visibility:public"], -) diff --git a/api/base/messagequeue/proto/BUILD.bazel b/api/base/messagequeue/proto/BUILD.bazel index 7f81d36c..aba01d8a 100644 --- a/api/base/messagequeue/proto/BUILD.bazel +++ b/api/base/messagequeue/proto/BUILD.bazel @@ -1,40 +1,4 @@ -load("@rules_go//go:def.bzl", "go_library") -load("@rules_go//proto:def.bzl", "go_proto_library") -load("@rules_proto//proto:defs.bzl", "proto_library") - exports_files( ["messagequeue.proto"], visibility = ["//tool/proto:__pkg__"], ) - -proto_library( - name = "messagequeuepb_proto", - srcs = ["messagequeue.proto"], - visibility = ["//visibility:public"], - deps = ["@protobuf//:descriptor_proto"], -) - -go_proto_library( - name = "messagequeuepb_go_proto", - compilers = [ - "@rules_go//proto:go_proto", - "@rules_go//proto:go_grpc_v2", - ], - importpath = "github.com/uber/submitqueue/api/base/messagequeue/proto", - proto = ":messagequeuepb_proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "proto", - embed = [":messagequeuepb_go_proto"], - importpath = "github.com/uber/submitqueue/api/base/messagequeue/proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "protopb", - embed = [":messagequeuepb_go_proto"], - importpath = "github.com/uber/submitqueue/api/base/messagequeue/protopb", - visibility = ["//visibility:public"], -) diff --git a/api/runway/messagequeue/proto/BUILD.bazel b/api/runway/messagequeue/proto/BUILD.bazel index 4516acca..6a0c6c85 100644 --- a/api/runway/messagequeue/proto/BUILD.bazel +++ b/api/runway/messagequeue/proto/BUILD.bazel @@ -1,49 +1,4 @@ -load("@rules_go//go:def.bzl", "go_library") -load("@rules_go//proto:def.bzl", "go_proto_library") -load("@rules_proto//proto:defs.bzl", "proto_library") - exports_files( ["merge.proto"], visibility = ["//tool/proto:__pkg__"], ) - -proto_library( - name = "mergepb_proto", - srcs = ["merge.proto"], - visibility = ["//visibility:public"], - deps = [ - "//api/base/change/proto:changepb_proto", - "//api/base/mergestrategy/proto:mergestrategypb_proto", - "//api/base/messagequeue/proto:messagequeuepb_proto", - ], -) - -go_proto_library( - name = "mergepb_go_proto", - compilers = [ - "@rules_go//proto:go_proto", - "@rules_go//proto:go_grpc_v2", - ], - importpath = "github.com/uber/submitqueue/api/runway/messagequeue/proto", - proto = ":mergepb_proto", - visibility = ["//visibility:public"], - deps = [ - "//api/base/change/proto:changepb_go_proto", - "//api/base/mergestrategy/proto:mergestrategypb_go_proto", - "//api/base/messagequeue/proto:messagequeuepb_go_proto", - ], -) - -go_library( - name = "proto", - embed = [":mergepb_go_proto"], - importpath = "github.com/uber/submitqueue/api/runway/messagequeue/proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "protopb", - embed = [":mergepb_go_proto"], - importpath = "github.com/uber/submitqueue/api/runway/messagequeue/protopb", - visibility = ["//visibility:public"], -) diff --git a/api/runway/proto/BUILD.bazel b/api/runway/proto/BUILD.bazel index c83b822c..b87fb49e 100644 --- a/api/runway/proto/BUILD.bazel +++ b/api/runway/proto/BUILD.bazel @@ -1,39 +1,4 @@ -load("@rules_go//go:def.bzl", "go_library") -load("@rules_go//proto:def.bzl", "go_proto_library") -load("@rules_proto//proto:defs.bzl", "proto_library") - exports_files( ["runway.proto"], visibility = ["//tool/proto:__pkg__"], ) - -proto_library( - name = "runwaypb_proto", - srcs = ["runway.proto"], - visibility = ["//visibility:public"], -) - -go_proto_library( - name = "runwaypb_go_proto", - compilers = [ - "@rules_go//proto:go_proto", - "@rules_go//proto:go_grpc_v2", - ], - importpath = "github.com/uber/submitqueue/api/runway/proto", - proto = ":runwaypb_proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "proto", - embed = [":runwaypb_go_proto"], - importpath = "github.com/uber/submitqueue/api/runway/proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "protopb", - embed = [":runwaypb_go_proto"], - importpath = "github.com/uber/submitqueue/api/runway/protopb", - visibility = ["//visibility:public"], -) diff --git a/api/stovepipe/proto/BUILD.bazel b/api/stovepipe/proto/BUILD.bazel index 1d06eea5..ac3261c9 100644 --- a/api/stovepipe/proto/BUILD.bazel +++ b/api/stovepipe/proto/BUILD.bazel @@ -1,39 +1,4 @@ -load("@rules_go//go:def.bzl", "go_library") -load("@rules_go//proto:def.bzl", "go_proto_library") -load("@rules_proto//proto:defs.bzl", "proto_library") - exports_files( ["stovepipe.proto"], visibility = ["//tool/proto:__pkg__"], ) - -proto_library( - name = "stovepipepb_proto", - srcs = ["stovepipe.proto"], - visibility = ["//visibility:public"], -) - -go_proto_library( - name = "stovepipepb_go_proto", - compilers = [ - "@rules_go//proto:go_proto", - "@rules_go//proto:go_grpc_v2", - ], - importpath = "github.com/uber/submitqueue/api/stovepipe/proto", - proto = ":stovepipepb_proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "proto", - embed = [":stovepipepb_go_proto"], - importpath = "github.com/uber/submitqueue/api/stovepipe/proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "protopb", - embed = [":stovepipepb_go_proto"], - importpath = "github.com/uber/submitqueue/api/stovepipe/protopb", - visibility = ["//visibility:public"], -) diff --git a/api/submitqueue/gateway/proto/BUILD.bazel b/api/submitqueue/gateway/proto/BUILD.bazel index 07adc8d3..eae77201 100644 --- a/api/submitqueue/gateway/proto/BUILD.bazel +++ b/api/submitqueue/gateway/proto/BUILD.bazel @@ -1,47 +1,4 @@ -load("@rules_go//go:def.bzl", "go_library") -load("@rules_go//proto:def.bzl", "go_proto_library") -load("@rules_proto//proto:defs.bzl", "proto_library") - exports_files( ["gateway.proto"], visibility = ["//tool/proto:__pkg__"], ) - -proto_library( - name = "gatewaypb_proto", - srcs = ["gateway.proto"], - visibility = ["//visibility:public"], - deps = [ - "//api/base/change/proto:changepb_proto", - "//api/base/mergestrategy/proto:mergestrategypb_proto", - ], -) - -go_proto_library( - name = "gatewaypb_go_proto", - compilers = [ - "@rules_go//proto:go_proto", - "@rules_go//proto:go_grpc_v2", - ], - importpath = "github.com/uber/submitqueue/api/submitqueue/gateway/proto", - proto = ":gatewaypb_proto", - visibility = ["//visibility:public"], - deps = [ - "//api/base/change/proto:changepb_go_proto", - "//api/base/mergestrategy/proto:mergestrategypb_go_proto", - ], -) - -go_library( - name = "proto", - embed = [":gatewaypb_go_proto"], - importpath = "github.com/uber/submitqueue/api/submitqueue/gateway/proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "protopb", - embed = [":gatewaypb_go_proto"], - importpath = "github.com/uber/submitqueue/api/submitqueue/gateway/protopb", - visibility = ["//visibility:public"], -) diff --git a/api/submitqueue/orchestrator/proto/BUILD.bazel b/api/submitqueue/orchestrator/proto/BUILD.bazel index 93267567..987e78cf 100644 --- a/api/submitqueue/orchestrator/proto/BUILD.bazel +++ b/api/submitqueue/orchestrator/proto/BUILD.bazel @@ -1,39 +1,4 @@ -load("@rules_go//go:def.bzl", "go_library") -load("@rules_go//proto:def.bzl", "go_proto_library") -load("@rules_proto//proto:defs.bzl", "proto_library") - exports_files( ["orchestrator.proto"], visibility = ["//tool/proto:__pkg__"], ) - -proto_library( - name = "orchestratorpb_proto", - srcs = ["orchestrator.proto"], - visibility = ["//visibility:public"], -) - -go_proto_library( - name = "orchestratorpb_go_proto", - compilers = [ - "@rules_go//proto:go_proto", - "@rules_go//proto:go_grpc_v2", - ], - importpath = "github.com/uber/submitqueue/api/submitqueue/orchestrator/proto", - proto = ":orchestratorpb_proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "proto", - embed = [":orchestratorpb_go_proto"], - importpath = "github.com/uber/submitqueue/api/submitqueue/orchestrator/proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "protopb", - embed = [":orchestratorpb_go_proto"], - importpath = "github.com/uber/submitqueue/api/submitqueue/orchestrator/protopb", - visibility = ["//visibility:public"], -) diff --git a/stovepipe/core/messagequeue/proto/BUILD.bazel b/stovepipe/core/messagequeue/proto/BUILD.bazel index af3e9ced..3a783684 100644 --- a/stovepipe/core/messagequeue/proto/BUILD.bazel +++ b/stovepipe/core/messagequeue/proto/BUILD.bazel @@ -1,45 +1,4 @@ -load("@rules_go//go:def.bzl", "go_library") -load("@rules_go//proto:def.bzl", "go_proto_library") -load("@rules_proto//proto:defs.bzl", "proto_library") - exports_files( ["process.proto"], visibility = ["//tool/proto:__pkg__"], ) - -proto_library( - name = "processpb_proto", - srcs = ["process.proto"], - visibility = ["//visibility:public"], - deps = [ - "//api/base/messagequeue/proto:messagequeuepb_proto", - ], -) - -go_proto_library( - name = "processpb_go_proto", - compilers = [ - "@rules_go//proto:go_proto", - "@rules_go//proto:go_grpc_v2", - ], - importpath = "github.com/uber/submitqueue/stovepipe/core/messagequeue/proto", - proto = ":processpb_proto", - visibility = ["//visibility:public"], - deps = [ - "//api/base/messagequeue/proto:messagequeuepb_go_proto", - ], -) - -go_library( - name = "proto", - embed = [":processpb_go_proto"], - importpath = "github.com/uber/submitqueue/stovepipe/core/messagequeue/proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "protopb", - embed = [":processpb_go_proto"], - importpath = "github.com/uber/submitqueue/stovepipe/core/messagequeue/protopb", - visibility = ["//visibility:public"], -) From 4a274969dc55aefd7548821c663f04f9fff0859a Mon Sep 17 00:00:00 2001 From: "chenghan.ying" Date: Wed, 1 Jul 2026 21:05:45 +0000 Subject: [PATCH 3/3] justify change purpose --- BUILD.bazel | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index ad24082c..04b8de11 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -8,10 +8,17 @@ load("@gazelle//:def.bzl", "gazelle") # Disable Gazelle proto rule generation globally. We rely on the checked-in # .pb.go files in protopb/ dirs (plain go_library) rather than Bazel proto -# compilation. This avoids proto_library → @protobuf// transitive loads that -# break in consumers using newer Bazel versions (e.g. go-code's Bazel 8.5.1 -# removed native.java_proto_library), and eliminates the duplicate-importpath -# aliases that required gazelle:resolve workarounds. +# compilation. Rationale: +# - The checked-in .pb.go is the single source of truth. Generating proto +# via Bazel duplicates the same types under the same importpath, causing +# duplicate-importpath ambiguity that required gazelle:resolve workarounds. +# - Non-Bazel consumers (plain go build/go get, including OSS users) can only +# use the checked-in .pb.go, so that path must work regardless. The Bazel +# proto rules are a redundant second path that serves no one the checked-in +# files don't already serve. +# - proto_library forces a transitive load of @protobuf//, which breaks in +# consumers on newer Bazel versions (e.g. go-code's Bazel 8.5.1 removed +# native.java_proto_library). # gazelle:proto disable_global # Export marker files for test data dependencies (used by FindRepoRoot in tests)