修正附件状态映射判断
仅将 imported 和 failed 视为项目附件状态 未知状态继续使用首页附件元数据格式 补充未知状态回归测试
This commit is contained in:
@@ -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("状态:"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user