feat(backend,frontend): lot utilisateur #310 #311 #312 #313 — horodatage conversation, stop agent robuste, préférence terminal par défaut, paramètres projet (QA verte)
- #310: horodatage de tous les messages et événements de conversation visibles — composant partagé EntryTimestamp, timestamps propagés dans le transcript chat, les annonces inter-agent et le viewer de conversation, normalisation côté domain/adapters (conversation_log, paginate). - #311: stop d'agent robuste pour PTY non monté, sessions headless et CLI custom — lifecycle/orchestrator durcis, ponts chat app-tauri/web-server alignés, arrêt fiable sans session orpheline. - #312: préférence globale d'interface terminal par défaut — nouveau store settings (domain/application/infrastructure + tests), DTO et commandes backend, adapter frontend userSettings, panneau TerminalSettings dans les paramètres globaux. - #313: Paramètres du projet — contexte de projet éditable et couleur de thème par projet (ProjectSettingsPanel + projectTheme), teinte des onglets projet, persistance via DTO projet. QA verte (GO QA sur feature/batch-310-311-312-313-chat-stop-prefs-theme) — vérifications Git: git diff --cached --check OK; staging borné à crates/ et frontend/ (74 fichiers, +2105/-531), commit unique de lot conforme à la convention des lots (précédents batch-151/158/159, batch-210/211/212) car les fichiers partagés (dto.rs, commands.rs, CustomAgentChatView) entrelacent les 4 tickets. fichiers .ideai/* (agents/test.md, chat-drafts.json, system-permissions.json, tickets/counter.json, tickets/index.json, tickets/308-313/), attachments/ et scripts/ hors périmètre et préservés en worktree ; aucun push. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -26,17 +26,22 @@ use uuid::Uuid;
|
||||
#[test]
|
||||
fn reply_chunk_user_prompt_serialises_exact_camel_case() {
|
||||
let v = serde_json::to_value(ReplyChunk::UserPrompt {
|
||||
at_ms: None,
|
||||
text: "run tests".into(),
|
||||
attachments: Vec::new(),
|
||||
attachment_refs: Vec::new(),
|
||||
})
|
||||
.unwrap();
|
||||
assert_eq!(v, json!({ "kind": "userPrompt", "text": "run tests" }));
|
||||
assert_eq!(
|
||||
v,
|
||||
json!({ "kind": "userPrompt", "text": "run tests", "atMs": null })
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reply_chunk_user_prompt_serialises_attachment_labels() {
|
||||
let v = serde_json::to_value(ReplyChunk::UserPrompt {
|
||||
at_ms: None,
|
||||
text: "describe this".into(),
|
||||
attachments: vec!["clipboard.png".into()],
|
||||
attachment_refs: vec![ChatPromptAttachmentDto {
|
||||
@ -52,6 +57,7 @@ fn reply_chunk_user_prompt_serialises_attachment_labels() {
|
||||
v,
|
||||
json!({
|
||||
"kind": "userPrompt",
|
||||
"atMs": null,
|
||||
"text": "describe this",
|
||||
"attachments": ["clipboard.png"],
|
||||
"attachmentRefs": [{
|
||||
@ -68,25 +74,50 @@ fn reply_chunk_user_prompt_serialises_attachment_labels() {
|
||||
#[test]
|
||||
fn reply_chunk_text_delta_serialises_exact_camel_case() {
|
||||
let v = serde_json::to_value(ReplyChunk::TextDelta {
|
||||
at_ms: None,
|
||||
text: "hello".into(),
|
||||
})
|
||||
.unwrap();
|
||||
assert_eq!(v, json!({ "kind": "textDelta", "text": "hello" }));
|
||||
assert_eq!(
|
||||
v,
|
||||
json!({ "kind": "textDelta", "text": "hello", "atMs": null })
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn legacy_reply_chunk_without_timestamp_deserialises_as_none() {
|
||||
let chunk: ReplyChunk = serde_json::from_value(json!({
|
||||
"kind": "final",
|
||||
"content": "legacy"
|
||||
}))
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
chunk,
|
||||
ReplyChunk::Final {
|
||||
at_ms: None,
|
||||
content: "legacy".into()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reply_chunk_tool_activity_serialises_exact_camel_case() {
|
||||
let v = serde_json::to_value(ReplyChunk::ToolActivity {
|
||||
at_ms: None,
|
||||
label: "reads file".into(),
|
||||
})
|
||||
.unwrap();
|
||||
assert_eq!(v, json!({ "kind": "toolActivity", "label": "reads file" }));
|
||||
assert_eq!(
|
||||
v,
|
||||
json!({ "kind": "toolActivity", "label": "reads file", "atMs": null })
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reply_chunk_progress_serialises_exact_camel_case() {
|
||||
let v = serde_json::to_value(ReplyChunk::Progress {
|
||||
progress: ReplyProgressDto {
|
||||
occurred_at_ms: None,
|
||||
progress_id: Some("codex:item:tool0".into()),
|
||||
source: ReplyProgressSourceDto::IdeaLocal,
|
||||
kind: ReplyProgressKindDto::Mcp,
|
||||
@ -105,6 +136,7 @@ fn reply_chunk_progress_serialises_exact_camel_case() {
|
||||
"kind": "progress",
|
||||
"progress": {
|
||||
"source": "ideaLocal",
|
||||
"occurredAtMs": null,
|
||||
"kind": "mcp",
|
||||
"progressId": "codex:item:tool0",
|
||||
"stage": "started",
|
||||
@ -119,21 +151,26 @@ fn reply_chunk_progress_serialises_exact_camel_case() {
|
||||
#[test]
|
||||
fn reply_chunk_final_serialises_exact_camel_case() {
|
||||
let v = serde_json::to_value(ReplyChunk::Final {
|
||||
at_ms: None,
|
||||
content: "done".into(),
|
||||
})
|
||||
.unwrap();
|
||||
assert_eq!(v, json!({ "kind": "final", "content": "done" }));
|
||||
assert_eq!(
|
||||
v,
|
||||
json!({ "kind": "final", "content": "done", "atMs": null })
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reply_chunk_error_serialises_exact_camel_case() {
|
||||
let v = serde_json::to_value(ReplyChunk::Error {
|
||||
at_ms: None,
|
||||
message: "Réponse vide du modèle.".into(),
|
||||
})
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
v,
|
||||
json!({ "kind": "error", "message": "Réponse vide du modèle." })
|
||||
json!({ "kind": "error", "message": "Réponse vide du modèle.", "atMs": null })
|
||||
);
|
||||
}
|
||||
|
||||
@ -141,6 +178,7 @@ fn reply_chunk_error_serialises_exact_camel_case() {
|
||||
fn reply_chunk_round_trips_through_json_for_every_variant() {
|
||||
for chunk in [
|
||||
ReplyChunk::UserPrompt {
|
||||
at_ms: None,
|
||||
text: "u".into(),
|
||||
attachments: vec!["clipboard.png".into()],
|
||||
attachment_refs: vec![ChatPromptAttachmentDto {
|
||||
@ -152,12 +190,17 @@ fn reply_chunk_round_trips_through_json_for_every_variant() {
|
||||
.into(),
|
||||
}],
|
||||
},
|
||||
ReplyChunk::TextDelta { text: "x".into() },
|
||||
ReplyChunk::TextDelta {
|
||||
at_ms: None,
|
||||
text: "x".into(),
|
||||
},
|
||||
ReplyChunk::ToolActivity {
|
||||
at_ms: None,
|
||||
label: "runs".into(),
|
||||
},
|
||||
ReplyChunk::Progress {
|
||||
progress: ReplyProgressDto {
|
||||
occurred_at_ms: None,
|
||||
progress_id: None,
|
||||
source: ReplyProgressSourceDto::ProviderNative,
|
||||
kind: ReplyProgressKindDto::Turn,
|
||||
@ -170,9 +213,11 @@ fn reply_chunk_round_trips_through_json_for_every_variant() {
|
||||
},
|
||||
},
|
||||
ReplyChunk::Final {
|
||||
at_ms: None,
|
||||
content: "y".into(),
|
||||
},
|
||||
ReplyChunk::Error {
|
||||
at_ms: None,
|
||||
message: "empty".into(),
|
||||
},
|
||||
] {
|
||||
@ -190,6 +235,7 @@ fn reply_chunk_deserialises_from_camel_case_wire_payload() {
|
||||
assert_eq!(
|
||||
back,
|
||||
ReplyChunk::UserPrompt {
|
||||
at_ms: None,
|
||||
text: "hi".into(),
|
||||
attachments: Vec::new(),
|
||||
attachment_refs: Vec::new()
|
||||
@ -366,12 +412,17 @@ fn reattach_chat_dto_serialises_camel_case_with_typed_scrollback() {
|
||||
conversation_id: Some("conv-1".into()),
|
||||
scrollback: vec![
|
||||
ReplyChunk::UserPrompt {
|
||||
at_ms: None,
|
||||
text: "Hi".into(),
|
||||
attachments: Vec::new(),
|
||||
attachment_refs: Vec::new(),
|
||||
},
|
||||
ReplyChunk::TextDelta { text: "Hi".into() },
|
||||
ReplyChunk::TextDelta {
|
||||
at_ms: None,
|
||||
text: "Hi".into(),
|
||||
},
|
||||
ReplyChunk::Final {
|
||||
at_ms: None,
|
||||
content: "Hi".into(),
|
||||
},
|
||||
],
|
||||
@ -383,9 +434,9 @@ fn reattach_chat_dto_serialises_camel_case_with_typed_scrollback() {
|
||||
"sessionId": "sess-1",
|
||||
"conversationId": "conv-1",
|
||||
"scrollback": [
|
||||
{ "kind": "userPrompt", "text": "Hi" },
|
||||
{ "kind": "textDelta", "text": "Hi" },
|
||||
{ "kind": "final", "content": "Hi" },
|
||||
{ "kind": "userPrompt", "text": "Hi", "atMs": null },
|
||||
{ "kind": "textDelta", "text": "Hi", "atMs": null },
|
||||
{ "kind": "final", "content": "Hi", "atMs": null },
|
||||
],
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user