Repository navigation
refactor(constants): split common/constants into domain packages (#542) - #552
Merged
Merged
Conversation
Split common/constants (maximal fan-in, ~21 importers, most using a small slice) into domain sub-packages to narrow what each tree links: - common/constants/annotations — cross-tree pod/service/node annotation keys and their accepted values (endpoint, capture, topology, health-check-mode, protocol). - common/constants/labels — cross-tree label + mesh-service/clusterset label/annotation domain. - common/constants/mesh — cross-tree data-plane ports, paths, mesh domain, and netfilter mark. - common/constants — genuinely basic cross-tree scalars only (endpoint defaults, registry defaults, CNI registry path, ignored namespaces). - agent/internal/xds/xdsconst — annotations consumed only by the agent's xDS proxy config generation (AnnotationConfigUpstreams, AnnotationSpiffeID, AnnotationEndpointHealthPath). - AnnotationGatewayHTTPRedirect moved into agent/internal/edge/gatewayapi (its sole consumer). Purely mechanical: exported identifier names and values are unchanged (wire / annotation contracts); importers change only their import path/prefix. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR
This was referenced Jul 19, 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.
Fixes #542.
Splits
common/constants(zero deps but maximal fan-in — ~21 importers, most using a small slice) into domain sub-packages so each tree links only the constants it actually uses. Purely mechanical: consts moved, imports fixed,make gazelle+make format. No exported names or values changed — these are wire/annotation contracts (aether.io/prefixes, ports).Final layout (per-package constant counts)
common/constants(base)DefaultEndpointPort,DefaultEndpointWeight,DefaultDynamoDBServiceTableName,DefaultEtcdKeyPrefix,CNIDefaultRegistryPath,IgnoredNamespaces,IsIgnoredNamespacecommon/constants/annotationsHealthCheckMode*,Protocol*)common/constants/labelscommon/constants/meshProxyOutboundPort,ProxyCapturePort,ProxyDNSResolverPort,ProxyReadinessPath,CapturePassthroughFwMark,DefaultMeshDomainagent/internal/xds/xdsconstAnnotationConfigUpstreams,AnnotationSpiffeID,AnnotationEndpointHealthPath(agent xDS-only)agent/internal/edge/gatewayapiAnnotationGatewayHTTPRedirect(moved into its sole consumer)Importer narrowing (before → after)
Before, all ~21 importer packages linked the single
common/constantsblob. After, each package's group touch is:mesh: 17 importers,labels: 15,annotations: 12, base: 9,xdsconst: 7, edge-const: 1.registrar/internal/{mcs,services}file →labelsonly; everycni/internal/plugindns/capture file →meshonly; agent xDS test files →xdsconstonly).registry/internal/k8s/*,agent/internal/xds/proxy/{cluster,listener}.go), which genuinely span domains.common/constantsat all — they link the agent-internalxdsconst(visibility scoped to//agent:__subpackages__).Dead constants found (NOT deleted per task)
DefaultEtcdKeyPrefix— zero references anywhere in the tree (kept incommon/constants/registry.go).(
IgnoredNamespaceshas no externalconstants.IgnoredNamespacesrefs but is consumed internally byIsIgnoredNamespace, so it is not dead.)Tests
bazel build //...— success (264 targets)bazel test --test_output=errors //...— 74/74 passmake format-check— clean🤖 Generated with Claude Code
https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR