From 5d5aafe251542e2b1ef7a0ae91558ad75ec936dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Thu, 1 Oct 2026 16:39:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E4=BA=BA=E6=B6=88?= =?UTF-8?q?=E8=B4=B9=E7=9A=84=E8=AE=A4=E8=AF=81=E5=A4=B1=E8=B4=A5=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E5=AD=97=E6=AE=B5=E4=B8=8E=20error=5Fkind=20=E6=98=A0?= =?UTF-8?q?=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除 ClientAuthError::error_kind():该分类由本次改动自行发明,全仓无消费方 - 删除 ClientAuthStateView.error_kind 字段及 4 个赋值点(含 read_client_auth_state 里写死的 "network") - 删除 clientAuth.ts RustAuthStateView 的 errorKind 声明,该字段从未被读取 - 保留行为不变:失败仍以 error_message 投影,前端只看 status/user/apiBaseUrl/errorMessage --- .../src-tauri/src/auth_error.rs | 14 -------------- .../src-tauri/src/auth_session.rs | 7 ------- .../src/services/clientAuth.ts | 1 - 3 files changed, 22 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/auth_error.rs b/apps/ai-game-creator-shell/src-tauri/src/auth_error.rs index a64308628..172a7372c 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/auth_error.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/auth_error.rs @@ -102,20 +102,6 @@ impl ClientAuthError { Self::SessionAuthorityRejected { .. } | Self::PermissionDenied { .. } ) } - - /// 登录态投影里 `errorKind` 的取值:只描述"哪一类失败",不参与任何前端分支。 - pub(crate) fn error_kind(&self) -> &'static str { - match self { - Self::AuthNetworkUnavailable { .. } => "network", - Self::AuthServiceUnavailable { .. } | Self::UnexpectedRejection { .. } => "service", - Self::AuthResponseMalformed { .. } => "response", - Self::ClientSessionPersistFailed { .. } => "storage", - Self::RuntimeSessionInstallFailed { .. } | Self::AuthClientInitFailed { .. } => { - "runtime" - } - _ => "auth", - } - } } impl fmt::Display for ClientAuthError { diff --git a/apps/ai-game-creator-shell/src-tauri/src/auth_session.rs b/apps/ai-game-creator-shell/src-tauri/src/auth_session.rs index a1b76d1a9..c0f247999 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/auth_session.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/auth_session.rs @@ -49,9 +49,6 @@ pub(crate) struct ClientAuthStateView { pub(crate) user: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub(crate) api_base_url: Option, - /// 失败分类:`network` / `service` / `response` / `storage` / `runtime` / `auth`;成功或未登录时为 `None`。 - #[serde(default, skip_serializing_if = "Option::is_none")] - pub(crate) error_kind: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub(crate) error_message: Option, } @@ -785,7 +782,6 @@ fn auth_state_view( status: status.to_string(), user, api_base_url, - error_kind: None, error_message: None, } } @@ -1045,7 +1041,6 @@ pub(crate) async fn read_client_auth_state( status: "unavailable".to_string(), user: None, api_base_url: Some(session.api_base_url), - error_kind: Some("network".to_string()), error_message: refresh.error_message, }), }, @@ -1053,7 +1048,6 @@ pub(crate) async fn read_client_auth_state( status: "unavailable".to_string(), user: None, api_base_url: Some(session.api_base_url), - error_kind: Some(error.error_kind().to_string()), error_message: Some(error.message().to_string()), }), } @@ -1472,7 +1466,6 @@ mod tests { wechat_account: None, }), api_base_url: Some(DEVELOPMENT_ORIGIN.to_string()), - error_kind: None, error_message: None, }; let serialized = serde_json::to_string(&view).expect("serialize auth state"); diff --git a/apps/ai-game-creator-shell/src/services/clientAuth.ts b/apps/ai-game-creator-shell/src/services/clientAuth.ts index 04c60af19..183730522 100644 --- a/apps/ai-game-creator-shell/src/services/clientAuth.ts +++ b/apps/ai-game-creator-shell/src/services/clientAuth.ts @@ -93,7 +93,6 @@ type RustAuthStateView = { status?: string; user?: AuthUser | null; apiBaseUrl?: string | null; - errorKind?: string | null; errorMessage?: string | null; };