Repository navigation
refactor(common): one copy of the backendRef key / ReferenceGrant / namespace helpers, in common/referencegrant - #1168
Merged
Conversation
…amespace helpers, in common/referencegrant backendServiceKey, backendPermitted and derefBackendNamespace were byte-identical in common/l4project and common/gammaproject, and derefBackendNamespace was copied a further two times into the agent's gamma and l4route reconcilers. They now live once in common/referencegrant (which every one of those packages already imported) as BackendKey, BackendPermitted and BackendNamespace. Their unit tests moved with them. 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
…ackendNamespace attachment.BackendPermitted and attachment.DerefBackendNamespace were further copies of the same two helpers (same bodies). Their callers in the edge reconciler now use referencegrant.BackendPermitted and BackendNamespace. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo
force-pushed
the
refactor/consolidate-backendref-helpers
branch
from
October 4, 2026 01:18
c662d43 to
d75dc79
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
backendServiceKey,backendPermittedandderefBackendNamespaceexisted as identical copies in two shared projectors, andderefBackendNamespacewas copied twice more into the agent's route reconcilers. The edgeattachmentpackage carried exported copies of two of them as well. They now live once incommon/referencegrant, which every caller already imported:backendServiceKey(l4project, gammaproject)referencegrant.BackendKeybackendPermitted(l4project, gammaproject),attachment.BackendPermitted(edge)referencegrant.BackendPermittedderefBackendNamespace(l4project, gammaproject, agent/internal/gamma, agent/internal/l4route),attachment.DerefBackendNamespace(edge)referencegrant.BackendNamespaceSites:
common/l4project/l4project.go(was lines 115-140)common/gammaproject/project.go(was lines 249-270)agent/internal/gamma/reconciler.goandagent/internal/l4route/reconciler.go(derefBackendNamespaceonly)agent/internal/edge/gatewayapi/attachment/refs.go(BackendPermitted+DerefBackendNamespace, exported copies used by the edge reconciler; second commit)The only new import edge is
common/referencegrant -> common/serviceref.servicerefis stdlib-only, and every package that importsreferencegrantalready imported it.Tests:
TestBackendServiceKey,TestBackendPermittedandTestDerefBackendNamespacemoved froml4project_test.gotocommon/referencegrant/backendref_test.go. Every assertion is kept. The grant fixture is now built with that package's existinggrant/from/tohelpers, and it is the same object as l4project'scrossNSGrant("TCPRoute").Proof the copies were identical
Signatures and bodies on
origin/main, compared with a function-extracting diff:The edge
attachmentcopies differ only in their exported names:Module counts (
bazel query 'deps(<bin>)', external repos / external labels)Verification
bazel test --config=raceon//common/referencegrant,//common/l4project,//common/gammaproject,//agent/internal/gamma,//agent/internal/l4routeand//agent/internal/edge/gatewayapi/...: 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