修正附件状态映射判断
Project CI / Repository checks (pull_request) Successful in 3m6s
Project CI / Frontend tests (pull_request) Successful in 3m24s
Project CI / Backend tests (pull_request) Successful in 6m4s
Project CI / Native shell tests (pull_request) Successful in 15m57s

仅将 imported 和 failed 视为项目附件状态

未知状态继续使用首页附件元数据格式

补充未知状态回归测试
This commit is contained in:
2026-08-31 06:44:14 +00:00
parent 2f2fa035f3
commit 1cb8e92e17
@@ -110,10 +110,7 @@ fn attachments_use_project_mapping(attachments: &[DirectCodexTurnAttachment]) ->
.local_path
.as_deref()
.is_some_and(|value| !value.trim().is_empty())
|| attachment
.status
.as_deref()
.is_some_and(|value| !value.trim().is_empty())
|| sanitize_attachment_status(attachment.status.as_deref()).is_some()
})
}
@@ -421,4 +418,19 @@ mod tests {
assert!(!prompt.contains("secret boom"));
assert!(!prompt.contains("error"));
}
#[test]
fn unknown_status_keeps_home_attachment_metadata_shape() {
let attachment = project_attachment(
"pending.md",
"text/markdown",
1,
None,
Some("pending"),
);
let prompt = render_direct_codex_user_prompt("x", &[attachment]).expect("render");
assert!(prompt.contains(HOME_ATTACHMENT_HEADER));
assert!(!prompt.contains(PROJECT_ATTACHMENT_HEADER));
assert!(!prompt.contains("状态:"));
}
}