api: v3 "deprecated" fields that can never be removed — policy question, and enum-level `deprecated` codegen noise
Context
Removing the global -Wno-deprecated-declarations suppression (carried since ~2020 in both .bazelrc and envoy_copts()) surfaces a flood of warnings from envoy_api generated headers. Tracing the biggest one leads to a policy question rather than a code fix.
Concrete case: RouteAction.InternalRedirectAction
api/envoy/config/route/v3/route_components.proto:
// [#next-major-version: remove this definition - it's defined in the InternalRedirectPolicy message.]
enum InternalRedirectAction {
option deprecated = true;
PASS_THROUGH_INTERNAL_REDIRECT = 0;
HANDLE_INTERNAL_REDIRECT = 1;
}
...
InternalRedirectAction internal_redirect_action = 26
[deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"];
google.protobuf.UInt32Value max_internal_redirects = 31
[deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"];Deprecated at v3.0 (~2020), superseded by internal_redirect_policy = 34. Still wired into source/common/router/config_impl.cc (buildInternalRedirectPolicy fallback switch on internal_redirect_action()).
Two separate problems
1. Enum-level option deprecated = true; — pure codegen noise, zero signal
protoc's C++ generator marks the type enum [[deprecated]] RouteAction_InternalRedirectAction : int; and then references it from its own generated code (_MIN/_MAX constants, ProtobufInternalGetEnumDescriptor ADL hook, _Parse/ParseNamedEnum<>, GetEnumDescriptor<>, the nested using InternalRedirectAction = … alias and value aliases) without wrapping in PROTOBUF_IGNORE_DEPRECATION_*. Result: ~8 -Wdeprecated-declarations in every TU that includes route_components.pb.h, regardless of whether it touches the enum. Upstream has a partial fix (protocolbuffers/protobuf#18205, values only). We can't patch our way out because Envoy uses prebuilt protoc.
Nothing in Envoy's deprecation tooling consumes an enum-level deprecated option — deprecated_at_minor_version, docs badges, runtime envoy.deprecated_features:* guards all key off the field. This and a frozen v2 TcpProxy.DeprecatedV1 message are the only two option deprecated = true; in api/envoy/.
→ Proposal: drop option deprecated = true; from the enum, keep the [#next-major-version: …] comment and the field-level deprecations. Loses nothing.
2. Field-level deprecation with no removal path — the real question
The v3 lifecycle is warn → fail-by-default → hard-reject → delete at next major. If there is no v4, the last step never happens: fields marked deprecated_at_minor_version = "3.0" remain in the schema, remain wired into source/, and remain flagged [[deprecated]] in C++ — permanently. That's not a deprecation, it's a third config path with a warning attached, and the C++ warnings on legitimate fallback code in config_impl.cc are correct-but-permanent.
Options:
- Un-deprecate fields that have no realistic removal path (drop
[deprecated = true, deprecated_at_minor_version = …], reword comments as "legacy form; prefer X", remove any correspondingenvoy.deprecated_features:*runtime guard). - Actually remove within v3 — schema break, currently disallowed by API policy.
- Leave as-is and accept permanent
-Wdeprecated-declarationson the fallback code paths (and therefore keep a suppression somewhere).
Before deciding, a census is worth having:
grep -rc 'deprecated_at_minor_version' api/envoy/ | awk -F: '{s+=$2} END {print s}'
grep -rho 'deprecated_at_minor_version) = "[0-9.]*"' api/envoy/ | sort | uniq -cIf this is hundreds of v3.0-era fields, (1) is a route_components cleanup we should ship now, and (2) is an API-shepherd policy decision on what deprecated means in a no-v4 world.
Ask
- api-shepherds: is un-deprecating fields with no removal path acceptable? If not, what is the intended end state for
deprecated_at_minor_version = "3.0"fields still consumed bysource/in 2026? - Any objection to the enum-only cleanup in (1) as a standalone PR?
/cc @envoyproxy/api-shepherds
Source: envoyproxy/envoy