Repository navigation
refactor(agent): gamma and l4route reconcilers share referencegrant.ResolveBackends - #1172
Merged
Merged
Conversation
bpalermo
changed the base branch from
refactor/consolidate-backendref-helpers
to
main
October 3, 2026 22:19
…esolveBackends The two reconcilers each had a backendsResolve method with the same body. It never used its receiver or context. It is now one function, referencegrant.ResolveBackends, which both call. TestBackendsResolve_Shapes moved with it as TestResolveBackends_Shapes, with every case kept. Pure refactor: no behaviour change, no binary gains a module. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo
force-pushed
the
refactor/consolidate-backends-resolve
branch
from
October 4, 2026 01:28
d4b985d to
6dcdf89
Compare
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.
What
The node agent's two route reconcilers each had a
backendsResolvemethod with the same body:agent/internal/gamma/reconciler.go:428(HTTPRoute/GRPCRoute)agent/internal/l4route/reconciler.go:342(TCPRoute/TLSRoute/UDPRoute)Neither copy used its receiver or its
context.Context. The logic is the ReferenceGrant-plus-shape check for a route's ResolvedRefs condition, and both packages already importcommon/referencegrant. It now lives there once asreferencegrant.ResolveBackends(routeNamespace, routeKind, refs, grants) (bool, reason, message). The doc comment is merged from both copies. Both reconcilers call the shared function.The edge reconciler's
backendsResolveL4is not the same function, so it is left alone. It adds a registry/k8s existence check (backendExists) after the grant check.Tests:
TestBackendsResolve_Shapesmoved fromagent/internal/gamma/reconciler_test.gotocommon/referencegrant/backendref_test.goasTestResolveBackends_Shapes. All five cases are kept. The only change is that the calls go to the function instead ofr.backendsResolve(ctx, ...). l4route had no direct test of its copy.Proof the copies were identical
Signatures and bodies on
origin/main, compared with a function-extracting diff:The doc comments differ only in the last sentence, which lists the route kinds each caller passes.
Module counts (
bazel query 'deps(<bin>)', external repos / external labels)Verification
bazel test --config=raceon//common/referencegrant,//agent/internal/gammaand//agent/internal/l4route: all pass.bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...: clean.make format-check: clean.make gazelle: done.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr