From dc51e6efdab22220b0d7323ba20d7309078c7722 Mon Sep 17 00:00:00 2001 From: Linghong Date: Mon, 24 Aug 2026 06:04:40 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=8E=89=20Repository=20checks=20?= =?UTF-8?q?=E6=8B=A6=E4=B8=8B=E7=9A=84=E8=A1=8C=E5=B0=BE=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=E4=B8=8E=20rustfmt=20=E6=BC=82=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI #4304 挂在 trailing whitespace 检查(exit 2),其余全绿(appSurface 421/421、web 与 admin-web 两个 build 都过)。 cli.rs:2203/2210 —— reads_plan_gdd_approval_comment_from_stdin 用多行字符串 字面量喂 stdin fixture,「前后带空格的正文」和「纯空白行」这两个待测输入的 空格正好落在源码行尾,被 git diff --check 判掉。改成 \n 转义写成单行: 字符串字节一个都没变(仍是 " 把核心循环写具体 \n" 和 " \n"),只是不再 把空格摆在行尾。测试照旧通过。 顺带 cargo fmt。四处漂移全是我这几个提交带进来的(provider_tool_plan、 main_loop、agent_db 三处新增代码,加上 cli.rs 这次改动让 rustfmt 可以把 Cursor::new 收成一行),本仓库其余部分没有既有 fmt 漂移,所以整包 fmt 是 安全的。 delegation::tests 19/19、plan_envelope_repair_tests 6/6、 tool_plan_audit_finish_reason 2/2、cli 那条 1/1。 Co-Authored-By: Claude Opus 5 --- .../runtime_actions/provider_tool_plan.rs | 5 ++++- .../src/agent/runtime_driver/main_loop.rs | 5 ++++- .../ai-game-creator-shell/src-tauri/src/cli.rs | 13 +++---------- .../src-tauri/src/project/agent_db.rs | 18 +++++++----------- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_tool_plan.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_tool_plan.rs index 3db3cb2e1..fd1564dbb 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_tool_plan.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_tool_plan.rs @@ -1426,7 +1426,10 @@ mod tool_plan_audit_finish_reason_tests { Some("incomplete") ); assert_eq!(agent_runtime_tool_plan_audit_finish_reason(None), None); - assert_eq!(agent_runtime_tool_plan_audit_finish_reason(Some(" ")), None); + assert_eq!( + agent_runtime_tool_plan_audit_finish_reason(Some(" ")), + None + ); } /// 兼容网关会在这个字段里发自定义值甚至整段文案。审计不是转发通道:越界字符 diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver/main_loop.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver/main_loop.rs index df76a2380..15c861adb 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver/main_loop.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver/main_loop.rs @@ -30,7 +30,10 @@ fn game_creator_agent_runtime_plan_envelope_parse_error( /// attempt 0 是工具计划直出那一发被拒(stream=false 时 plan.response 充当最终回复, /// 它不经过重取回路),1..=N 是最终回复请求上的第几次重取。两处必须用同一条正文, /// 否则模型会以为是两种不同的失败。 -fn plan_envelope_repair_observation(parse_error: &str, attempt: u32) -> AgentRuntimeToolObservation { +fn plan_envelope_repair_observation( + parse_error: &str, + attempt: u32, +) -> AgentRuntimeToolObservation { let stage = if attempt == 0 { "工具计划直出,改由最终回复重出".to_string() } else { diff --git a/apps/ai-game-creator-shell/src-tauri/src/cli.rs b/apps/ai-game-creator-shell/src-tauri/src/cli.rs index f8f5571dd..00ad60a35 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/cli.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/cli.rs @@ -2199,18 +2199,11 @@ mod tests { #[test] fn reads_plan_gdd_approval_comment_from_stdin() { assert_eq!( - read_cli_plan_gdd_approval_comment(&mut Cursor::new( - " 把核心循环写具体 -" - )) - .expect("read approval comment"), + read_cli_plan_gdd_approval_comment(&mut Cursor::new(" 把核心循环写具体 \n")) + .expect("read approval comment"), "把核心循环写具体" ); - assert!(read_cli_plan_gdd_approval_comment(&mut Cursor::new( - " -" - )) - .is_err()); + assert!(read_cli_plan_gdd_approval_comment(&mut Cursor::new(" \n")).is_err()); assert!( read_cli_plan_gdd_approval_comment(&mut Cursor::new("a".repeat(9 * 1024))).is_err() ); diff --git a/apps/ai-game-creator-shell/src-tauri/src/project/agent_db.rs b/apps/ai-game-creator-shell/src-tauri/src/project/agent_db.rs index 39868c2f5..7a26ef189 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/project/agent_db.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/project/agent_db.rs @@ -2272,18 +2272,14 @@ pub(crate) fn append_agent_db_tool_plan_audit_idempotent( Some(serde_json::Value::String(value)) => { if value.is_empty() || value.chars().count() > 32 - || !value - .chars() - .all(|character| { - character.is_ascii_lowercase() - || character.is_ascii_digit() - || character == '_' - || character == '-' - }) + || !value.chars().all(|character| { + character.is_ascii_lowercase() + || character.is_ascii_digit() + || character == '_' + || character == '-' + }) { - return Err( - "Agent DB tool-plan 幂等审计字段无效:finishReason".to_string() - ); + return Err("Agent DB tool-plan 幂等审计字段无效:finishReason".to_string()); } } _ => {