Repository navigation
refactor(registrar,agent): reduce cognitive complexity to ≤15 in registrar + route reconcilers - #558
Merged
Conversation
…istrar + route reconcilers (part of #556) Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR
bpalermo
added a commit
that referenced
this pull request
Jul 19, 2026
The #556 campaign (PRs #558-#563) refactored all 65 production functions over 15. This flips the ratchet from 109 to the 15 target, scopes the aspect to go_library/go_binary (complexity-gating validated e2e and conformance test harnesses adds churn risk for no production value), and fixes the one offender the lane partition missed: RegistryRefresher.Start (23 -> extracted refreshLoop helpers, semantics byte-identical). Closes #556 Claude-Session: https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR Co-authored-by: Claude Fable 5 <[email protected]>
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
Structure-only refactoring to reduce gocognit cognitive complexity to ≤15 in all non-test functions across the Lane 5 scope. Zero behavior change — guard clauses and helper extractions only. Part of #556.
Per-function extraction summary
gamma (*Reconciler).ReconcilelistGammaResources,listHTTPFilters,buildScopedFilters,resolveTargetRefFilters,projectAllRoutes,buildRouteTargetPorts,writeHTTPRouteStatuses,writeGRPCRouteStatusesconfigexport (*Controller).ReconcilelistExportResources,buildExportedSet,projectHTTPRoutes,projectGRPCRoutes,resolveChainFilters,ownCurrentProjections,applyDesired,pruneStalel4route (*Reconciler).ReconcilelistL4Resources,projectTCPRoutes,projectTLSRoutes,projectUDPRoutes,writeTCPRouteStatuses,writeTLSRouteStatuses,writeUDPRouteStatusesserver (*RegistrarServer).WatchEndpointsbuildWatchFilter,sendFilteredSnapshot,sendServiceCatalog,streamEventsconfigimport (*Importer).materializeselectProjections,buildRouteOutputs,chosenProjectiontypeserver (*WriteBehindQueue).flushDuecollectDueOps,flushOpservices (*Generator).reconcilebuildDesiredServices,pruneServicesserver (*Broadcaster).BroadcastcloseDroppedWatchers, package-leveldroppedWatchertypereplicator (*Replicator).mirrorPeerrunSyncWatchLoopreplicator (*Replicator).watchMirrormirrorEventserver (*Snapshot).ReplacecomputeTransitionsCaution zones preserved
sendServiceCatalogsends to all watchers regardless of filter;server_test"catalog bypasses the filter" assertion still passes.runSyncWatchLoop, keepalive goroutine wires the sameconnCtx; no revoke on shutdown.Verification
gocognit -over 15 <all scope dirs>(excl_test.go) → no outputbazel test //registrar/... //agent/...→ 33/33 PASSEDmake gazelle && make format→ clean🤖 Generated with Claude Code
https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR