Skip to content

Commit 5498d47

Browse files
committed
fix: treat killed task notifications as informational, not errors
Background commands stopped by the user have <status>killed</status> in task notifications. Previously this was treated as an error (showing warning icon), but killed is a normal lifecycle event. Only failed status is now treated as an error. Entire-Checkpoint: ba9755cbafc1
1 parent 5b89b16 commit 5498d47

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/src/parser/classify.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ pub fn classify(e: Entry) -> Option<ClassifiedMsg> {
251251
return Some(ClassifiedMsg::System(SystemMsg {
252252
timestamp: ts,
253253
output: extract_task_notification(&content_str),
254-
is_error: status == "killed",
254+
is_error: status == "failed",
255255
}));
256256
}
257257
}
@@ -725,12 +725,24 @@ mod tests {
725725
}
726726

727727
#[test]
728-
fn classify_task_notification_killed_is_error() {
729-
let content = "<task-notification><summary>Task failed</summary><status>killed</status></task-notification>";
728+
fn classify_task_notification_killed_not_error() {
729+
let content = "<task-notification><summary>Background command \"Start sso-server\" was stopped</summary><status>killed</status></task-notification>";
730730
let e = make_entry("user", Some(json!(content)));
731731
match classify(e) {
732732
Some(ClassifiedMsg::System(s)) => {
733-
assert!(s.is_error);
733+
assert!(!s.is_error, "killed (user-stopped) should not be an error");
734+
}
735+
other => panic!("Expected System, got {:?}", other),
736+
}
737+
}
738+
739+
#[test]
740+
fn classify_task_notification_failed_is_error() {
741+
let content = "<task-notification><summary>Background command failed</summary><status>failed</status></task-notification>";
742+
let e = make_entry("user", Some(json!(content)));
743+
match classify(e) {
744+
Some(ClassifiedMsg::System(s)) => {
745+
assert!(s.is_error, "failed status should be an error");
734746
}
735747
other => panic!("Expected System with is_error, got {:?}", other),
736748
}

0 commit comments

Comments
 (0)