Repository navigation
fix(alias): dedupe merged oauth-model-alias entries on (name, alias), not alias alone #5440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SamGu-NRX
wants to merge
9
commits into
router-for-me:dev
Choose a base branch
from
SamGu-NRX:fix/oauth-alias-dedupe-pair
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3fcd0df
fix(alias): dedupe merged oauth-model-alias entries on (name, alias),…
SamGu-NRX 9aa0aab
fix(alias): key the merge on a struct pair and drop shadowed global r…
SamGu-NRX 7efb11d
fix(alias): keep a shadowed global fork only when the per-auth source…
SamGu-NRX ac2af5f
fix(alias): an excluded per-auth source does not count as a hidden model
SamGu-NRX 9e27241
fix(alias): pass the effective exclusion list into the alias merge
SamGu-NRX 58f7cee
fix(alias): an excluded client-visible alias also drops the shadowed …
SamGu-NRX c564190
fix(alias): count plugin-supplied sources as present when deciding a …
SamGu-NRX 6f07047
Merge router-for-me/dev into fix/oauth-alias-dedupe-pair
SamGu-NRX 3bc7edb
fix(antigravity): keep the per-auth upstream in the reverse alias map
SamGu-NRX File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| package cliproxy | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| coreauth "github.com/router-for-me/CLIProxyAPI/v7/sdk/cliproxy/auth" | ||
| "github.com/router-for-me/CLIProxyAPI/v7/sdk/config" | ||
| ) | ||
|
|
||
| func antigravityAuth(aliases string) *coreauth.Auth { | ||
| return &coreauth.Auth{ | ||
| ID: "antigravity-alias-test", | ||
| Provider: "antigravity", | ||
| Attributes: map[string]string{ | ||
| "auth_kind": coreauth.AuthKindOAuth, | ||
| "model_aliases": aliases, | ||
| }, | ||
| } | ||
| } | ||
|
|
||
| // The capability probe maps a registered id back to the upstream the credential is actually | ||
| // sent. The (name, alias) merge can return a per-auth rename and a global fork under one | ||
| // alias; request-time resolution consults the per-auth entry, so the reverse map must too. | ||
| func TestBuildAntigravityReverseAliasMapPrefersPerAuthEntry(t *testing.T) { | ||
| cfg := &config.Config{OAuthModelAlias: map[string][]config.OAuthModelAlias{ | ||
| "antigravity": {{Name: "gemini-3-pro", Alias: "gemini-3-pro-preview", Fork: true}}, | ||
| }} | ||
| auth := antigravityAuth(`[{"name":"gemini-3-pro-internal","alias":"gemini-3-pro-preview"}]`) | ||
| got := (&Service{cfg: cfg}).buildAntigravityReverseAliasMap(auth) | ||
| if got["gemini-3-pro-preview"] != "gemini-3-pro-internal" { | ||
| t.Fatalf("alias resolved to %q, want the per-auth upstream gemini-3-pro-internal", got["gemini-3-pro-preview"]) | ||
| } | ||
| } | ||
|
|
||
| // A global fork with no per-auth entry for its alias must stay in the map: the id exists only | ||
| // because the fork registered it. | ||
| func TestBuildAntigravityReverseAliasMapKeepsUnshadowedGlobalFork(t *testing.T) { | ||
| cfg := &config.Config{OAuthModelAlias: map[string][]config.OAuthModelAlias{ | ||
| "antigravity": {{Name: "gemini-3-pro", Alias: "gemini-3-pro-preview", Fork: true}}, | ||
| }} | ||
| auth := antigravityAuth(`[{"name":"gemini-3-flash-internal","alias":"gemini-3-flash"}]`) | ||
| got := (&Service{cfg: cfg}).buildAntigravityReverseAliasMap(auth) | ||
| if got["gemini-3-pro-preview"] != "gemini-3-pro" { | ||
| t.Fatalf("forked alias resolved to %q, want gemini-3-pro", got["gemini-3-pro-preview"]) | ||
| } | ||
| if got["gemini-3-flash"] != "gemini-3-flash-internal" { | ||
| t.Fatalf("per-auth alias resolved to %q, want gemini-3-flash-internal", got["gemini-3-flash"]) | ||
| } | ||
| // resolveAntigravityUpstreamModelID strips the credential prefix before the lookup. | ||
| if id := resolveAntigravityUpstreamModelID("ag/gemini-3-pro-preview", "ag", got); id != "gemini-3-pro" { | ||
| t.Fatalf("prefixed id resolved to %q, want gemini-3-pro", id) | ||
| } | ||
| } |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.