fix: raise error when auth login remote URL is missing - #3
Conversation
Avoid a silent/hanging failure when running 'lore auth login' without a remote URL argument or configured repository remote. Add CLI-side validation and comprehensive unit tests to ensure a clear error is printed to the user. Signed-off-by: euxaristia <euxaristia@users.noreply.github.com>
📝 WalkthroughWalkthroughAdds a Login Remote URL Resolution and Validation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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: 2
🤖 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 `@lore-client/src/cli/commands/auth.rs`:
- Line 41: The LOGIN_REMOTE_REQUIRED message in auth.rs should include the
token-login fallback so users without a remote know the valid remediation.
Update the error path used by the auth command, including the logic around the
token-login branch in the authenticate flow, to mention `--auth-url` alongside
the existing remote URL or repository remote guidance. Make sure the message
still fits both the normal login path and the `--token-type`/`--token` path
handled by the auth command’s login/authentication code.
In `@lore/src/auth.rs`:
- Line 33: The shared missing-remote message in auth handling is too generic for
the guard that accepts either remote_url or auth_url. Update the token-related
branch in lore/src/auth.rs to use a token-specific missing-endpoint message
instead of LOGIN_REMOTE_REQUIRED, so callers are told auth_url is also an
acceptable fix; keep the same behavior for the existing remote URL path and
adjust the other referenced occurrence as well.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: ec81e558-add1-4197-86ed-7b6827d792d1
📒 Files selected for processing (2)
lore-client/src/cli/commands/auth.rslore/src/auth.rs
| use crate::styling::CommonStyles; | ||
| use crate::util; | ||
|
|
||
| const LOGIN_REMOTE_REQUIRED: &str = "No remote URL supplied. Run `lore auth login <remote-url>` or run from a Lore repository with a configured remote."; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Include the token-login --auth-url remediation in this error path.
Lines 149-150 intentionally allow token login without a remote when explicit --auth-url is present, but Line 41 only tells users to provide a remote URL or repo config. For --token-type/--token users missing --auth-url, the error omits a valid fix.
Suggested adjustment
const LOGIN_REMOTE_REQUIRED: &str = "No remote URL supplied. Run `lore auth login <remote-url>` or run from a Lore repository with a configured remote.";
+const LOGIN_TOKEN_REMOTE_OR_AUTH_URL_REQUIRED: &str =
+ "No remote URL or auth URL supplied. Run `lore auth login <remote-url>` or pass `--auth-url` for token login outside a Lore repository.";
@@
- Err(LOGIN_REMOTE_REQUIRED)
+ if args.token_type.is_some() && args.token.is_some() {
+ Err(LOGIN_TOKEN_REMOTE_OR_AUTH_URL_REQUIRED)
+ } else {
+ Err(LOGIN_REMOTE_REQUIRED)
+ }Also applies to: 149-153
🤖 Prompt for 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.
In `@lore-client/src/cli/commands/auth.rs` at line 41, The LOGIN_REMOTE_REQUIRED
message in auth.rs should include the token-login fallback so users without a
remote know the valid remediation. Update the error path used by the auth
command, including the logic around the token-login branch in the authenticate
flow, to mention `--auth-url` alongside the existing remote URL or repository
remote guidance. Make sure the message still fits both the normal login path and
the `--token-type`/`--token` path handled by the auth command’s
login/authentication code.
| use crate::call_delegation::dispatch_call; | ||
| use crate::interface::LoreString; | ||
|
|
||
| const LOGIN_REMOTE_REQUIRED: &str = "No remote URL supplied. Run `lore auth login <remote-url>` or run from a Lore repository with a configured remote."; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Use a token-specific missing-endpoint error here.
This guard accepts either remote_url or auth_url, but the shared message only says the remote URL is missing. Return a token-specific message so API/CLI callers know auth_url is also a supported fix.
Suggested adjustment
const LOGIN_REMOTE_REQUIRED: &str = "No remote URL supplied. Run `lore auth login <remote-url>` or run from a Lore repository with a configured remote.";
+const LOGIN_TOKEN_REMOTE_OR_AUTH_URL_REQUIRED: &str =
+ "No remote URL or auth URL supplied. Provide a remote URL, configured repository remote, or auth_url for token login.";
@@
- return Err(LoginError::internal(LOGIN_REMOTE_REQUIRED));
+ return Err(LoginError::internal(LOGIN_TOKEN_REMOTE_OR_AUTH_URL_REQUIRED));Also applies to: 214-215
🤖 Prompt for 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.
In `@lore/src/auth.rs` at line 33, The shared missing-remote message in auth
handling is too generic for the guard that accepts either remote_url or
auth_url. Update the token-related branch in lore/src/auth.rs to use a
token-specific missing-endpoint message instead of LOGIN_REMOTE_REQUIRED, so
callers are told auth_url is also an acceptable fix; keep the same behavior for
the existing remote URL path and adjust the other referenced occurrence as well.
|
Closing in favor of upstream PR EpicGames#84. |
Avoid a silent/hanging failure when running
lore auth loginwithout a remote URL argument or configured repository remote.lore-client/src/cli/commands/auth.rs.lore/src/auth.rsfor non-interactive login paths.Summary by CodeRabbit