[Repo Assist] refactor: remove deprecated API key alias functions#7150
Merged
lpcox merged 2 commits intoJun 7, 2026
Merged
Conversation
The Agent ID rename (PR #7114) introduced four deprecated one-liner wrapper functions that forward calls to the new AgentID-named functions. These create a maintenance burden and IDE confusion (autocomplete suggests the old names). All callers have been migrated: - Remove ValidateAPIKey(): no non-test callers; remove TestValidateAPIKeyAlias - Remove GetAPIKey() on Config: no callers outside its own definition - Remove GetGatewayAPIKeyFromEnv(): no callers outside its own definition - Rename GenerateRandomAPIKey() → GenerateRandomAgentID(): update the single production caller in internal/cmd/root.go and rename all tests in internal/auth/apikey_test.go Also update the stale ValidateAPIKey() reference in the authMiddleware doc comment in internal/server/middleware.go. Closes #7136 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR continues the Agent ID terminology migration by removing deprecated “API key” alias wrapper functions that were left behind for backwards compatibility, and by renaming the remaining generator helper to the Agent ID name to reduce IDE/autocomplete confusion.
Changes:
- Removed deprecated alias wrappers:
ValidateAPIKey,(*Config).GetAPIKey, andGetGatewayAPIKeyFromEnv. - Renamed
GenerateRandomAPIKey()→GenerateRandomAgentID()and updated the single production call site plus tests. - Updated a stale doc comment reference from
ValidateAPIKey()toValidateAgentID().
Show a summary per file
| File | Description |
|---|---|
| internal/auth/header.go | Removes deprecated validation alias and renames random generator to GenerateRandomAgentID. |
| internal/auth/header_test.go | Deletes the alias-only test for ValidateAPIKey. |
| internal/auth/apikey_test.go | Renames tests and call sites to GenerateRandomAgentID. |
| internal/cmd/root.go | Updates the production caller to use GenerateRandomAgentID. |
| internal/config/config_core.go | Removes deprecated GetAPIKey() accessor alias. |
| internal/config/config_env.go | Removes deprecated GetGatewayAPIKeyFromEnv() alias. |
| internal/server/middleware.go | Updates comment to reference the new validation function name. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 7/7 changed files
- Comments generated: 1
Comment on lines
+88
to
+90
| // For header parsing logic, see internal/auth package which provides: | ||
| // - ParseAuthHeader() for extracting API keys and agent IDs | ||
| // - ValidateAPIKey() for key validation | ||
| // - ValidateAgentID() for key validation |
Collaborator
|
@copilot address review feedback |
Contributor
Addressed in commit |
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
PR #7114 renamed the gateway's "API key" surface to "Agent ID" but left four deprecated one-liner wrapper functions in place as backwards-compat aliases. These create IDE confusion (autocomplete surfaces the old names) and an ongoing maintenance burden. This PR removes them.
Changes
internal/auth/header.goValidateAPIKey()deprecated alias; renameGenerateRandomAPIKey()→GenerateRandomAgentID()internal/auth/header_test.goTestValidateAPIKeyAlias(tests a now-deleted function)internal/auth/apikey_test.goGenerateRandomAgentIDinternal/cmd/root.goGenerateRandomAgentID()internal/config/config_core.goGetAPIKey()deprecated alias (no non-definition callers)internal/config/config_env.goGetGatewayAPIKeyFromEnv()deprecated alias (no non-definition callers)internal/server/middleware.goValidateAPIKey()reference in doc commentVerification
Confirmed no remaining references to the removed/renamed symbols via
grepacross the full source tree.Test Status
Build and tests could not be run —
proxy.golang.orgis blocked in this environment (pre-existing infrastructure limitation). The changes are syntactically verified by inspection:Closes #7136
Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
proxy.golang.orgreleaseassets.githubusercontent.comSee Network Configuration for more information.
Add this agentic workflows to your repo
To install this agentic workflow, run