Repository navigation
refactor(xds): reduce cognitive complexity to <=15 in snapshot cache (lane 2, part of #556) - #562
Merged
Merged
Conversation
…che (part of #556) Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR
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
Reduces gocognit cognitive complexity of all non-test functions in
agent/internal/xds/cache/to ≤15. This is Lane 2 of the parallel campaign tracking issue #556.Per-function extraction summary
LoadClustersFromRegistrycoldFillHTTPEndpoints,coldFillTCPEndpoints(package-level),buildHTTPClustersLocked,buildHTTPServiceEntryLocked,buildHTTPEndpointBuckets,endpointSANNamespaces,endpointSubsetKeys,buildTCPClustersLocked,retainAbsentClustersLockedrebuildEdgeDependenciescollectVhostDepsmethod +collectEdgeTCPDeps/collectEdgeTLSDepspackage-level functions; replaced inlineaddVhostclosurebuildEdgeVhostsLockedadmitVhostRoutes,buildEnvoyRouteLocked,buildEnvoyWeightedRouteLocked; introduceddomainRouteGroupstructdependencySetLockedpopulateStaticDepsLocked,populatePodDepsLocked,populateObservedDepsLocked,populateRouteDepsLockededgeTCPClusterscollectEdgeTCPServicesedgeK8sBackendClusterscollectK8sBackends,buildK8sClustersLocked,addK8sBackend,collectK8sRoutesBackends; introducedk8sBackendstructequalGammaHeaderMutationequalGammaHMutationLengths,equalGammaHeaderKVs,equalGammaHeaderStringsequalRoutesequalRouteper-element comparatorequalEdgeTLSRoutesequalEdgeTLSRulesedgeClusterNameLockededgeMeshClusterNameLockedreturning(string, bool)equalGammaRouteequalGammaMatchescaptureVhostsappendSABackedCaptureVhosts,appendRouteOnlyCaptureVhosts,captureVhostDomainsedgeGatewayListenersappendGatewayListenerLockedListenersedgeListeners,appendEdgePhase1Listeners,meshListenersAll extractions are pure structure-preserving refactors: verbatim code movement, guard clauses, and named helpers. No behavior was changed. The
clusterMuouter /localMuinner lock ordering (mtls.go #548), depGen memos (#549), gamma/capture memos (#551), and snapshot semantics (snapshot.go) are all preserved exactly.Test plan
gocognit -over 15 agent/internal/xds/cache/(excluding_test.go) outputs nothingbazel test --test_output=errors //agent/...— 26/26 passbazel test --test_output=errors --@rules_go//go/config:race=true //agent/internal/xds/cache/...— 3/3 pass (race-clean)make gazelle— no BUILD.bazel changesmake format— cleanPart of #556
🤖 Generated with Claude Code
https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR