feat(cli): add optional server-side revocation to auth logout#371
Merged
Conversation
Introduce cq auth logout --revoke and --all-devices so users can request backend session invalidation while preserving local credentials on non-recoverable revoke failures.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an optional server-side session revocation flow to cq auth logout, while keeping the default behavior as local-only credential cleanup. This extends the CLI auth client with a /api/v1/auth/logout call and introduces revoke-aware logout semantics and tests across the auth and cobra layers.
Changes:
- Add
cq auth logout --revokeand--all-devicesflags (with validation that--all-devicesrequires--revoke). - Implement auth-layer
Client.Logoutand wire revoke-first logout behavior (including “expired session” handling). - Add tests covering command flag behavior and auth/http client status handling.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/README.md | Documents new logout --revoke / --all-devices usage and semantics. |
| cli/internal/auth/platform_client.go | Extends the auth Client interface with Logout. |
| cli/internal/auth/onboarding_test.go | Updates test stub client to satisfy the extended interface. |
| cli/internal/auth/logout.go | Implements revoke-aware logout flow and local credential clearing semantics. |
| cli/internal/auth/logout_test.go | Adds unit tests for revoke success/failure/expired-session behavior. |
| cli/internal/auth/http_client.go | Adds HTTP implementation of Logout and status-to-error mapping. |
| cli/internal/auth/http_client_test.go | Adds request/response tests for the new logout endpoint behavior. |
| cli/internal/auth/errors.go | Introduces typed ErrLogoutUnsupported. |
| cli/internal/auth/doc.go | Updates package doc to reflect server-side revocation capability. |
| cli/cmd/auth.go | Adds cobra flags and wiring for revoke/all-devices logout. |
| cli/cmd/auth_test.go | Adds command-level tests for new flag semantics and revoke flow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
cq auth logout --revokeandcq auth logout --revoke --all-deviceswhile preserving default local-only logout behavior./api/v1/auth/logout(includingall_devices=true) and map unsupported endpoint statuses to a typedErrLogoutUnsupported.Testing
--all-devicesdependency on--revoke, revoke requiring configured address, and successful revoke+clear flow.make lint-cliandmake test-clifrom repo root.