修掉 Repository checks 拦下的行尾空白与 rustfmt 漂移
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 <noreply@anthropic.com>
This commit is contained in:
+4
-1
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
/// 兼容网关会在这个字段里发自定义值甚至整段文案。审计不是转发通道:越界字符
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
);
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
|
||||
Reference in New Issue
Block a user