Conversation
The dashboard only showed the scopes requested at connect time. Add GitHubClient.get_granted_scopes() (reads the X-OAuth-Scopes header from GET /user) and display the scopes GitHub actually granted, falling back to the scopes captured at connect time. When the granted list is known and omits repo, show a warning banner that private repositories will not load, and expose repo_scope_missing on /github/api/status. Scopes remain informational only and are never used for authorization decisions. Closes AyinkxLab#57
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.
Closes #57
What
The GitHub dashboard showed the scopes requested at connect time, not the scopes GitHub actually granted. This shows the granted scopes and warns when
repois absent.Changes
app/services/github.py- newGitHubClient.get_granted_scopes()reads theX-OAuth-Scopesresponse header fromGET /user(the token's current grants).app/github/routes.pyindex()renders the granted scopes (live read preferred, connect-time value as fallback) and arepo_scope_missingflag.callback()prefers the header-reported scopes when storing the account./github/api/statusnow includesrepo_scope_missing.app/templates/github/index.html- displaysgranted scopes: ...and shows arole="alert"warning banner with a Reconnect link whenrepois missing.Scopes are informational only; authorization always depends on the token, not on this list (documented on the new method and helper).
Acceptance criteria
GET /user(and the token-exchange response as a fallback).reposcope is absent.Validation
pytest tests/test_github_service.py tests/test_github_routes.py-> all pass (adds tests for header parsing, the warning banner, the stored-scopes fallback, and the status flag).ruff checkandblack --checkclean on the changed files.