[client] Don't ask for an SSO login when the login never reached management - #6983
[client] Don't ask for an SSO login when the login never reached management#6983lixmal wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe server adds an injectable login-attempt seam and updates login outcome handling. Tests verify unreachable Management errors are returned directly, while permission-denied refusals proceed toward SSO flow setup. ChangesLogin outcome handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant Login
participant Management
participant StateRecorder
participant SSOFlow
Client->>Login: Login request
Login->>Management: attempt login
Management-->>Login: status and error
alt Management unreachable
Login->>StateRecorder: set StatusLoginFailed
Login-->>Client: return transport error
else authentication refusal
Login->>SSOFlow: start SSO flow
SSOFlow-->>Client: return flow setup result
end
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@client/server/login_outcome_test.go`:
- Around line 63-66: Strengthen the Login test around the
StatusNeedsLogin/refusal branch by asserting that the SSO setup transitions to
StatusLoginFailed when the deliberately invalid key is processed. Keep the
existing error and NotErrorIs assertions, and verify the resulting login status
through the state or outcome symbol exposed by the test flow.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 915d27f0-8b0e-432b-b5a1-50e594fc7aee
📒 Files selected for processing (2)
client/server/login_outcome_test.goclient/server/server.go
Release artifactsBuilt for PR head
GHCR images (amd64)
This comment is updated by the Release workflow. Artifact links expire according to the workflow retention policy. |
|



Describe your changes
The daemon treated every failed login attempt as "this peer needs to log in", so a login that never reached the management server (unreachable, restarting, dial timeout) surfaced as an SSO prompt with a device code instead of a retryable error. A
netbird upthat happened to run while management was briefly away asked the user to re-authenticate, even though the session was still valid.Issue ticket number and link
Stack
Checklist
Documentation
Select exactly one:
Docs PR URL (required if "docs added" is checked)
Paste the PR link from https://github.com/netbirdio/docs here:
https://github.com/netbirdio/docs/pull/__
Summary by CodeRabbit