修 CI:补跑 AGC src-tauri 的 rustfmt,修正本批遗留的 8 处格式偏差
Project CI / Repository checks (pull_request) Successful in 2m52s
Project CI / Frontend tests (pull_request) Successful in 3m30s
Project CI / Backend tests (pull_request) Successful in 5m44s
Project CI / Native shell tests (pull_request) Successful in 19m31s

- 只做格式重排(应合成长行/应拆多行),无语义改动
- 命中 agent/direct_project_history.rs、agent/direct_runtime.rs、main.rs、project/conversation.rs、project/conversation/tests.rs
- 分别来自 bfb928295 / 2b44b6259 / 458a65cb5 / f0d5687ab 四笔提交的新增行
- 成因:pre-commit 的 lint-staged 只覆盖 *.{js,mjs,cjs,ts,tsx},Rust 格式本地无守卫
This commit is contained in:
2026-09-11 21:09:09 +08:00
parent 47c88809b6
commit 15660a98b2
5 changed files with 35 additions and 26 deletions
@@ -560,13 +560,9 @@ mod tests {
#[test]
fn legacy_conversation_rows_project_into_responses_message_items() {
let root = init_history_project("legacy-projection");
write_history_lines(
root.path(),
&[LEGACY_USER_ROW, LEGACY_ASSISTANT_ROW],
);
write_history_lines(root.path(), &[LEGACY_USER_ROW, LEGACY_ASSISTANT_ROW]);
let items =
read_direct_project_history_items_at(root.path()).expect("read legacy history");
let items = read_direct_project_history_items_at(root.path()).expect("read legacy history");
assert_eq!(
items,
vec![
@@ -611,7 +607,11 @@ mod tests {
.iter()
.map(|item| item.get("id").and_then(Value::as_str))
.collect::<Vec<_>>(),
vec![Some("direct-codex:turn-0001:user"), Some("codex-item-2"), None]
vec![
Some("direct-codex:turn-0001:user"),
Some("codex-item-2"),
None
]
);
assert_eq!(
items[1],
@@ -622,7 +622,10 @@ mod tests {
"content": [{"type": "input_text", "text": "再加一个按钮"}],
})
);
assert_eq!(items[2]["content"][0]["text"], json!("已完成 第一行\n第二行 "));
assert_eq!(
items[2]["content"][0]["text"],
json!("已完成 第一行\n第二行 ")
);
let chat = read_direct_project_chat_history_at(root.path()).expect("read mixed chat");
assert_eq!(
@@ -4571,7 +4571,8 @@ mod tests {
#[test]
fn direct_project_history_shape_failure_has_explicit_non_retryable_guidance() {
let error = "DirectProject 历史记录类型无效:$PROJECT_ROOT/.agent/conversations/project.jsonl";
let error =
"DirectProject 历史记录类型无效:$PROJECT_ROOT/.agent/conversations/project.jsonl";
assert!(direct_project_history_shape_failure(error));
assert_eq!(
direct_codex_failure_recovery_hint(DirectCodexFailureStage::CodeGeneration, error),
@@ -30,8 +30,8 @@ use shared_contracts::game_creation_app::{
game_creation_app_asset_effective_category, new_game_creation_app_manifest,
new_game_creation_app_seed_tasks, normalize_game_creation_app_asset_tags,
validate_game_iteration_versions, GameCreationAgentArtifactTrace,
GameCreationAgentCapabilityDescriptor,
GameCreationAgentPassPlanTrace, GameCreationAgentRepairRouteTrace, GameCreationAgentRunStep,
GameCreationAgentCapabilityDescriptor, GameCreationAgentPassPlanTrace,
GameCreationAgentRepairRouteTrace, GameCreationAgentRunStep,
GameCreationAgentRunTaskGraphTrace, GameCreationAgentRunTrace, GameCreationAgentToolCallTrace,
GameCreationAppAgentGroup, GameCreationAppAssetManifestEntry, GameCreationAppAssetSource,
GameCreationAppAssetSourceKind, GameCreationAppCommandRunState,
@@ -958,19 +958,18 @@ fn read_persisted_local_conversation_records_unlocked(
if line.is_empty() {
continue;
}
let record = match serde_json::from_str::<PersistedLocalConversationMessageRecord>(
line,
) {
Ok(record) => record,
// 项目主对话(agent_id=None)与 DirectProject 共用同一份
// `project.jsonl`DirectProject 写的是 Codex rollout 的
// `response_item` 行。通用对话链只认自己的 legacy 行,遇到对方那种
// 行就跳过;其余任何坏行继续失败关闭。
Err(_) if is_direct_project_history_row(line) => continue,
Err(error) => {
return Err(format!("解析对话记录失败:{}: {error}", path.display()))
}
};
let record =
match serde_json::from_str::<PersistedLocalConversationMessageRecord>(line) {
Ok(record) => record,
// 项目主对话(agent_id=None)与 DirectProject 共用同一份
// `project.jsonl`DirectProject 写的是 Codex rollout 的
// `response_item` 行。通用对话链只认自己的 legacy 行,遇到对方那种
// 行就跳过;其余任何坏行继续失败关闭。
Err(_) if is_direct_project_history_row(line) => continue,
Err(error) => {
return Err(format!("解析对话记录失败:{}: {error}", path.display()))
}
};
records.push(record);
}
}
@@ -293,7 +293,10 @@ fn mixed_project_history_rows_stay_readable_from_both_sides() {
let history = std::fs::read_to_string(project_conversation_path(&root)).expect("read history");
assert_eq!(history.lines().count(), 3, "{history}");
assert!(history.contains("模式切换后由通用写入器补写的回复"), "{history}");
assert!(
history.contains("模式切换后由通用写入器补写的回复"),
"{history}"
);
// 通用对话链只读自己的 legacy 行,跳过 DirectProject 的行。
let conversation = read_local_conversation_at(&root, None).expect("read project conversation");
@@ -332,7 +335,10 @@ fn project_history_keeps_accepting_legacy_rows_while_no_direct_project_row_exist
append_project_message(&root, "非 direct 模式的项目对话回复").expect("append legacy row");
let conversation = read_local_conversation_at(&root, None).expect("read legacy conversation");
assert_eq!(conversation.messages.len(), 1);
assert_eq!(conversation.messages[0].content, "非 direct 模式的项目对话回复");
assert_eq!(
conversation.messages[0].content,
"非 direct 模式的项目对话回复"
);
std::fs::remove_dir_all(root).ok();
}