-
Notifications
You must be signed in to change notification settings - Fork 0
fix: raise error when auth login remote URL is missing #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ use lore_credential::UserInfo; | |
| use lore_error_set::prelude::*; | ||
| use lore_macro::LoreArgs; | ||
| use lore_revision::auth; | ||
| use lore_revision::auth::login::InteractiveLoginError; | ||
| use lore_revision::auth::login::LoginError; | ||
| use lore_revision::auth::userinfo::LoreAuthIdentityEventData; | ||
| use lore_revision::auth::userinfo::LoreAuthUserInfoEventData; | ||
|
|
@@ -29,6 +30,8 @@ use crate::call::setup_execution; | |
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Use a token-specific missing-endpoint error here. This guard accepts either 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 |
||
|
|
||
| #[error_set] | ||
| pub enum AuthStoreError { | ||
| TokenNotFound, | ||
|
|
@@ -206,19 +209,19 @@ async fn login_with_token_local( | |
|
|
||
| let auth_url: Option<String> = args.auth_url.into(); | ||
|
|
||
| LORE_CONTEXT | ||
| .scope(execution, async move { | ||
| let result = async move { | ||
| login_with_token_impl( | ||
| remote_url.as_str(), | ||
| args.token.as_str(), | ||
| args.token_type.as_str(), | ||
| auth_url.as_deref(), | ||
| ) | ||
| .await | ||
| if let Err(err) = LORE_CONTEXT | ||
| .scope(execution.clone(), async move { | ||
| if remote_url.is_empty() && auth_url.as_deref().unwrap_or_default().is_empty() { | ||
| return Err(LoginError::internal(LOGIN_REMOTE_REQUIRED)); | ||
| } | ||
| .await; | ||
| execution_context().dispatcher.complete_result(result).await | ||
|
|
||
| login_with_token_impl( | ||
| remote_url.as_str(), | ||
| args.token.as_str(), | ||
| args.token_type.as_str(), | ||
| auth_url.as_deref(), | ||
| ) | ||
| .await | ||
| }) | ||
| .await | ||
| } | ||
|
|
@@ -291,15 +294,16 @@ async fn login_interactive_local( | |
|
|
||
| let execution = setup_execution(globals, callback); | ||
|
|
||
| LORE_CONTEXT | ||
| .scope(execution, async move { | ||
| let result = async move { | ||
| match auth::login::interactive(remote_url.as_str(), args.no_browser != 0).await { | ||
| Ok(user_info) => { | ||
| send_user_info(user_info); | ||
| Ok(()) | ||
| } | ||
| Err(err) => Err(err), | ||
| if let Err(err) = LORE_CONTEXT | ||
| .scope(execution.clone(), async move { | ||
| if remote_url.is_empty() { | ||
| return Err(InteractiveLoginError::internal(LOGIN_REMOTE_REQUIRED)); | ||
| } | ||
|
|
||
| match auth::login::interactive(remote_url.as_str(), args.no_browser != 0).await { | ||
| Ok(user_info) => { | ||
| send_user_info(user_info); | ||
| Ok(()) | ||
| } | ||
| } | ||
| .await; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Include the token-login
--auth-urlremediation in this error path.Lines 149-150 intentionally allow token login without a remote when explicit
--auth-urlis present, but Line 41 only tells users to provide a remote URL or repo config. For--token-type/--tokenusers missing--auth-url, the error omits a valid fix.Suggested adjustment
Also applies to: 149-153
🤖 Prompt for AI Agents