From cc980267fe9b53ff10e0569b5d98a3b2324378ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Mon, 21 Sep 2026 22:45:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E4=BE=8B=E6=94=B9=E4=B8=BA=E6=8C=89?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E5=8F=A3=E5=BE=84=E4=BC=A0=E5=85=A5=E5=B7=B2?= =?UTF-8?q?=E8=84=B1=E6=95=8F=20detail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 原用例直接传带 token=secret 的原文,与函数「detail 已是 sidecar 脱敏文本」的前置条件不符,测的不是真实数据流 - 改为先按 8 KiB 口径 redact 出 safe_detail 再传入,metadata 仍按生产原样传未脱敏 JSON,保留脱敏覆盖 - 验证:cargo test runtime_error(7 passed) --- .../src-tauri/src/agent/runtime_error.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_error.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_error.rs index b6bfab1fc..8b1f7d6dc 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_error.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_error.rs @@ -264,6 +264,13 @@ mod tests { let root = parent.path().join("project"); crate::project::init_local_game_project_at(&root, "runtime-error", "错误事件") .expect("init project"); + // 生产路径传进来的是已经脱敏的 safe_detail(8 KiB 口径),这里按同一口径造输入; + // metadata 在生产里从未脱敏,仍按原文传。 + let safe_detail = redact_agent_runtime_error( + &root, + "C:\\Users\\private\\project https://provider.example/a?token=secret\n第二行诊断", + AGENT_RUNTIME_ERROR_MAX_DETAIL_CHARS, + ); let lines = agent_runtime_error_app_log_lines( &root, "error-1-1", @@ -275,7 +282,7 @@ mod tests { "本轮没有收到完成事件\n附带换行", "查看诊断后重试", ".agent/runtime/errors/error-1-1.json", - "C:\\Users\\private\\project https://provider.example/a?token=secret\n第二行诊断", + &safe_detail, Some(1200), &serde_json::json!({"authorization": "Bearer secret"}), );