Repository navigation
refactor(auth): declare each OAuth scope in a single list - #329
Open
jpage-godaddy wants to merge 1 commit into
Open
jpage-godaddy wants to merge 1 commit into
jpage-godaddy wants to merge 1 commit into
Conversation
Each scope used to be declared in three places: a constant, a separate description-and-default table, and the login scope list derived from it. A single declaration per scope now generates the constants, the registry behind `gddy auth scope`, and the login request, so a scope can't be added without a description and a login policy. Scopes are grouped by policy: `default` scopes are requested at login, `step_up` scopes only when a command that needs them runs. The scope module is split into a declarations file, the macro that expands it, the command-tree lookup, the `gddy auth scope` command and tests. The only visible change is that `gddy auth scope` lists default scopes first, then step-up scopes. The maintainer guide now points at the new declarations file and states the default/step-up rule. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
jpage-godaddy
requested review from
axburgess-godaddy,
jpearlman-godaddy,
mguerrero3-godaddy,
qcai-godaddy and
rts1-godaddy
as code owners
October 14, 2026 23:27
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
Static review found no blocking issues in the generated scope data, preserved consent policy, or updated command wiring.
0 open findings
What changed in this PR
Centralizes OAuth scope declarations in the CLI, preserving scope values, descriptions, login order, and consent policy.
Changes:
- Generates scope constants, registry entries, and login defaults from one declaration list.
- Splits scope handling into focused modules and updates command wiring.
- Updates tests and maintainer guidance; scope listings now group entries by login policy.
| File | Description |
|---|---|
| rust/src/spec_cmd.rs | Updates the scope command reference. |
| rust/src/scopes/tests.rs | Consolidates registry and login-policy checks. |
| rust/src/scopes/mod.rs | Wires and exports scope modules. |
| rust/src/scopes/declare.rs | Generates scope data through one macro. |
| rust/src/scopes/declarations.rs | Defines scopes, descriptions, and login policies. |
| rust/src/scopes/command_tree.rs | Houses command-to-scope and alias mappings. |
| rust/src/scopes/auth_scope.rs | Houses scope listing and command tests. |
| rust/src/scopes.rs | Removes the superseded monolithic module. |
| rust/src/main.rs | Updates scope command registration. |
| rust/src/auth.rs | Uses the constant login-scope slice. |
| docs/maintainers.md | Documents declarations and login-policy rules. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Summary
Each OAuth scope was declared in three places: a constant, a separate description-and-default table, and the login scope list derived from it. This replaces them with one declaration per scope.
///line is the scope's description (whatgddy auth scopeshows) and its rustdoc.defaultscopes are requested at login;step_upscopes are requested only when a command that needs them runs.ALL,DIRECTIVES,SCOPE_REGISTRYandDEFAULT_OAUTH_SCOPES(now a plainconstinstead of aLazyLock), so a scope can't exist without a description and a login policy.src/scopes.rsandsrc/scopes_cmd.rsmove into asrc/scopes/module:declarations.rs(the list),declare.rs(the macro),command_tree.rs,auth_scope.rs(gddy auth scope) andtests.rs.docs/maintainers.mdnow points at the declarations file and states the default/step-up rule.Behavior
The scopes, descriptions, default flags and login request order are unchanged (the 30
gddy auth scopeentries were compared againstmain). The one visible difference:gddy auth scopelists default scopes first, then step-up scopes, then the OIDC directives, rather than grouping by product area.Test plan
cargo check --workspacecargo clippy --workspace -- -D warningscargo test --workspacecargo fmt --check./rust/scripts/check-module-size.sh🤖 Generated with Claude Code