fix(review): custom provider login comments, doc placement, subagent scheme test

The subagent auth-scheme lookup is now a function with a test. The failed-login
span carries the same method id as the successful one. README order matches the
code: the provider is saved, then the key is checked.
This commit is contained in:
雷电芽衣 committed 2026-09-29 16:50:03 -04:00
1 parent c4ef8a3779
commit c9855c4bb6
14 files changed
+77 -52

No files matched your search

+3 -4
View File
@@ -570,9 +570,9 @@ pub enum Action {
/// under the platform-id scope, then authenticate with the platform's
/// method id. The key must never be logged.
SubmitPlatformApiKey(String),
/// A custom provider row was picked: start the URL, name, key steps.
/// Custom provider row picked: open the URL step.
BeginCustomProviderEntry(kigi_shell::models::custom::CustomApi),
/// Enter in a custom provider step, with the trimmed input.
/// Enter in a custom provider step.
SubmitCustomProviderInput(String),
/// Copy the auth URL to the clipboard during authentication.
CopyAuthUrl,
@@ -1618,8 +1618,7 @@ pub enum Effect {
target: crate::app::app_view::PlatformLogin,
key: String,
},
/// Save a custom provider (config.toml and auth.json), then send
/// AuthenticateRequest with `custom:<name>`. SECURITY: never log the key.
/// Saves the provider, then authenticates; never log the key.
PersistCustomProviderAndAuthenticate {
request_seq: u64,
provider: kigi_shell::models::custom::CustomProvider,
+1 -1
View File
@@ -262,7 +262,7 @@ pub enum AuthMode {
/// Open-platform API-key entry: paste box for a Moonshot key selected
/// from the welcome login picker. Esc returns to the picker (no quit).
ApiKeyEntry(PlatformLogin),
/// Custom provider login: one field per step; Esc returns to the picker.
/// Custom provider login, one field per step.
CustomProviderEntry(crate::app::custom_entry::CustomEntryStep),
}
/// API-key platform login target, selected from the welcome picker. Wraps a
@@ -1,4 +1,4 @@
//! The base URL, name, and key steps of the custom provider login.
//! Custom provider login steps: base URL, name, key.
use kigi_shell::models::custom::{
CustomApi, CustomProvider, default_name, normalize_base_url, validate_name,
@@ -26,7 +26,7 @@ impl CustomEntryStep {
}
}
/// Only the key is a secret; URL and name show as typed.
/// Only the key is masked.
pub fn masks_input(self) -> bool {
self.field == CustomEntryField::Key
}
@@ -43,9 +43,9 @@ impl CustomEntryStep {
/// What one Enter press did.
#[derive(Debug, PartialEq, Eq)]
pub enum CustomEntryOutcome {
/// The input stays; `CustomEntryDraft::error` says why, if it does.
/// The input stays; the draft error says why.
Stay,
/// Move to the next field with this text in the box.
/// Next field, with this text in the box.
Next {
field: CustomEntryField,
prefill: String,
@@ -326,7 +326,7 @@ pub(super) fn dispatch_begin_platform_key_entry(
vec![]
}
/// A custom provider row was selected: open the first step (base URL).
/// Custom provider row selected: open the URL step.
pub(super) fn dispatch_begin_custom_provider_entry(
app: &mut AppView,
api: kigi_shell::models::custom::CustomApi,
@@ -344,7 +344,7 @@ pub(super) fn dispatch_begin_custom_provider_entry(
vec![]
}
/// Enter in a custom provider step: advance, stay with a reason, or save.
/// Enter in a custom provider step.
pub(super) fn dispatch_submit_custom_provider_input(
app: &mut AppView,
input: String,
@@ -582,8 +582,7 @@ fn custom_field(app: &AppView) -> crate::app::custom_entry::CustomEntryField {
}
}
/// The custom provider flow: URL, then name (prefilled from the host), then
/// key; the last Enter emits ONE persist+authenticate effect for the provider.
/// URL, name, key; the last Enter emits one persist effect.
#[test]
fn custom_provider_steps_end_in_one_persist_effect() {
use crate::app::custom_entry::CustomEntryField;
@@ -649,7 +648,7 @@ fn custom_provider_steps_end_in_one_persist_effect() {
assert!(app.auth_code_input.is_empty());
}
/// A refused field keeps the user on it and does not emit an effect.
/// A refused field keeps the user on it.
#[test]
fn custom_provider_refusals_stay_on_the_field() {
use crate::app::custom_entry::CustomEntryField;
@@ -687,7 +686,7 @@ fn custom_provider_refusals_stay_on_the_field() {
assert!(app.custom_entry.error.is_some());
}
/// Esc at any step returns to the picker and drops the draft.
/// Esc returns to the picker and drops the draft.
#[test]
fn cancel_custom_provider_entry_returns_to_picker() {
use kigi_shell::models::custom::CustomApi;