You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary
This optimizes login scope resolution by deduplicating requested scopes in one pass.
Before this, resolveLoginScopes in internal/auth/oidc.go rescanned the resolved slice for every requested scope, which made repeated or long custom scope lists more expensive than needed.
This PR does not broaden behavior beyond the optimization scope.
What changed
Optimized internal/auth/oidc.go scope deduplication
Removed repeated linear scans during custom scope resolution
Preserved scope order and default-versus-custom base scope behavior
Updated tests for repeated custom scopes
Verification go test ./internal/auth go test ./internal/guard/judge -run TestStartLlamaServerHealthCheckAndStop -count=1 go test ./... go vet ./... git diff --check
When Login is called with a specific custom scope, this branch still prepends openid, email, and profile to the browser authorization request. The gateway fallback calls login(..., "gateway:access") to recover from a missing gateway grant, but the real request becomes openid email profile gateway:access instead of the exact gateway:access scope that flow asks for. An authorization server that constrains this reauth flow to the missing gateway scope can reject the browser login with invalid_scope, so the connect fallback still fails.
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
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
This optimizes login scope resolution by deduplicating requested scopes in one pass.
Before this,
resolveLoginScopesininternal/auth/oidc.gorescanned the resolved slice for every requested scope, which made repeated or long custom scope lists more expensive than needed.Now a small seen-set is the canonical path:
Why
This gives kontext-cli a cheaper runtime path for browser login scope setup:
login input scopes
->
resolveLoginScopes-> stable deduplicated OAuth scope list
This PR does not broaden behavior beyond the optimization scope.
What changed
Optimized
internal/auth/oidc.goscope deduplicationRemoved repeated linear scans during custom scope resolution
Preserved scope order and default-versus-custom base scope behavior
Updated tests for repeated custom scopes
Verification
go test ./internal/authgo test ./internal/guard/judge -run TestStartLlamaServerHealthCheckAndStop -count=1go test ./...go vet ./...git diff --check