删除无人消费的认证失败分类字段与 error_kind 映射

- 删除 ClientAuthError::error_kind():该分类由本次改动自行发明,全仓无消费方
- 删除 ClientAuthStateView.error_kind 字段及 4 个赋值点(含 read_client_auth_state 里写死的 "network")
- 删除 clientAuth.ts RustAuthStateView 的 errorKind 声明,该字段从未被读取
- 保留行为不变:失败仍以 error_message 投影,前端只看 status/user/apiBaseUrl/errorMessage
This commit is contained in:
2026-10-01 16:39:14 +08:00
parent 454fbd5e91
commit 5d5aafe251
3 changed files with 0 additions and 22 deletions
@@ -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 {
@@ -49,9 +49,6 @@ pub(crate) struct ClientAuthStateView {
pub(crate) user: Option<AuthUserPayload>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub(crate) api_base_url: Option<String>,
/// 失败分类:`network` / `service` / `response` / `storage` / `runtime` / `auth`;成功或未登录时为 `None`。
#[serde(default, skip_serializing_if = "Option::is_none")]
pub(crate) error_kind: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub(crate) error_message: Option<String>,
}
@@ -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");
@@ -93,7 +93,6 @@ type RustAuthStateView = {
status?: string;
user?: AuthUser | null;
apiBaseUrl?: string | null;
errorKind?: string | null;
errorMessage?: string | null;
};