#9465·grpc-go

xds/clients: future-proof exported interfaces and add non-comparable struct guards

Author: dashpoleCreated Sep 30, 2026Updated Sep 30, 2026

Use case(s) - what problem will this feature solve?

Once internal/xds/clients is moved to a public import path:

  1. Exported interfaces implemented by external callers (ResourceWatcher, Decoder, TransportBuilder, Transport, Stream, MetricsReporter) cannot gain new methods in future v1.x releases without breaking existing implementations.
  2. Exported structs (Config, Authority, ServerConfig, ResourceType, DecodeOptions, DecodeResult) can be compared with == or used as map keys by callers unless explicitly prevented, which makes adding a slice, map, or func field to those structs in a future minor release a breaking change.

Proposed Solution

  1. Follow the pattern used by grpc-go generated server interfaces (Unimplemented...Server) and experimental/stats.MetricsRecorder (UnimplementedMetricsRecorder + internal.Enforce...Embedding): provide an embeddable Unimplemented... struct with no-op default methods and an unexported marker method on interfaces implemented by callers where future methods may be added.
  2. Embed _ [0]func() (zero-size non-comparable field) in exported configuration and parameter structs (Config, Authority, ResourceType, DecodeOptions, DecodeResult) once internal maps no longer key on ResourceType, ensuring callers do not rely on struct comparability.

Alternatives Considered

Relying on documentation comments warning callers not to compare structs or implement interfaces without embedding. Compile-time guards prevent accidental breakage across minor releases.

Additional Context

Part of #9455.