Clarify delayed detection in unclean-exit reports (#3640)
This commit is contained in:
1 parent
59cd55f531
commit
5305d7c82d
8 files changed
+117
-12
No files matched your search
@@ -682,6 +682,9 @@
|
||||
"coupling.rack": "Rack",
|
||||
"coupling.radius_1": "Radius 1",
|
||||
"coupling.radius_2": "Radius 2",
|
||||
"crash.detected_time": "Detected {time} UTC",
|
||||
"crash.previous_session": "An earlier SolidCraft session ended unexpectedly or hit an internal error. Reports from unclean exits are detected at startup. See Help > Crash Reports… for details.",
|
||||
"crash.unclean_explanation": "Detected on a later launch; the exact exit time was not recorded. A system shutdown or forced stop can also cause an unclean exit.",
|
||||
"dialog.bodies_count": "{count} bodies",
|
||||
"dialog.clearance_invalid": "the clearance must be a length of 0 or more",
|
||||
"dialog.compute": "Compute",
|
||||
|
||||
@@ -682,6 +682,9 @@
|
||||
"coupling.rack": "ラック",
|
||||
"coupling.radius_1": "半径 1",
|
||||
"coupling.radius_2": "半径 2",
|
||||
"crash.detected_time": "検出日時: {time} UTC",
|
||||
"crash.previous_session": "以前の SolidCraft セッションが予期せず終了したか、内部エラーが発生しました。正常終了が記録されていないセッションは起動時に検出されます。詳細は ヘルプ > クラッシュレポート… を参照してください。",
|
||||
"crash.unclean_explanation": "次回以降の起動時に検出されました。正確な終了時刻は記録されていません。システムのシャットダウンや強制停止によっても、正常終了が記録されない場合があります。",
|
||||
"dialog.bodies_count": "{count} ボディ",
|
||||
"dialog.clearance_invalid": "クリアランスは 0 以上の長さにしてください",
|
||||
"dialog.compute": "計算",
|
||||
|
||||
@@ -635,6 +635,9 @@
|
||||
"coupling.rack": "Cremalheira",
|
||||
"coupling.radius_1": "Raio 1",
|
||||
"coupling.radius_2": "Raio 2",
|
||||
"crash.detected_time": "Detectado em {time} UTC",
|
||||
"crash.previous_session": "Uma sessão anterior do SolidCraft terminou inesperadamente ou teve um erro interno. Encerramentos sem confirmação são detectados ao iniciar o aplicativo. Consulte Ajuda > Relatórios de falha… para ver os detalhes.",
|
||||
"crash.unclean_explanation": "Detectado em uma inicialização posterior; o horário exato do encerramento não foi registrado. Um desligamento do sistema ou uma parada forçada também pode causar um encerramento sem confirmação.",
|
||||
"dialog.computing": "Calculando… {seconds} s",
|
||||
"dialog.custom_axis": "↖ Eixo personalizado",
|
||||
"dialog.edit_title": "EDITAR {title}",
|
||||
|
||||
@@ -682,6 +682,9 @@
|
||||
"coupling.rack": "齿条",
|
||||
"coupling.radius_1": "半径 1",
|
||||
"coupling.radius_2": "半径 2",
|
||||
"crash.detected_time": "检测时间:{time} UTC",
|
||||
"crash.previous_session": "较早的 SolidCraft 会话意外结束或发生了内部错误。未正常结束的会话会在启动时被检测到。详情请参阅 帮助 > 崩溃报告…。",
|
||||
"crash.unclean_explanation": "在后续启动时检测到;未记录确切的退出时间。系统关机或强制停止也可能导致会话未正常结束。",
|
||||
"dialog.bodies_count": "{count} 个实体",
|
||||
"dialog.clearance_invalid": "间隙必须是 0 或更大的长度",
|
||||
"dialog.compute": "计算",
|
||||
|
||||
@@ -76,7 +76,8 @@ pub struct Summary {
|
||||
pub id: String,
|
||||
/// `command_panic`, `panic`, `kernel_panic_recovered` or `unclean_exit`.
|
||||
pub kind: String,
|
||||
/// When it first happened (UTC).
|
||||
/// When the report was first recorded (UTC). Unclean exits are recorded at a later launch,
|
||||
/// which may be days after the session ended, rather than at the exact exit time.
|
||||
pub time: String,
|
||||
pub message: String,
|
||||
/// The command running when it happened, if one was.
|
||||
|
||||
@@ -41,6 +41,14 @@ fn kind_label(kind: &str) -> &'static str {
|
||||
}
|
||||
}
|
||||
|
||||
fn report_heading(r: &Summary) -> String {
|
||||
let time = r.time.replace('T', " ");
|
||||
let time = time.trim_end_matches('Z');
|
||||
let time = if r.kind == "unclean_exit" { crate::i18n::format("crash.detected_time", &[("time", time)]) } else { format!("{time} UTC") };
|
||||
let times = if r.count > 1 { format!(" ×{}", r.count) } else { String::new() };
|
||||
format!("{time} {}{times}", kind_label(&r.kind))
|
||||
}
|
||||
|
||||
/// The host found these new reports at startup: tell the user about real crashes (recovered
|
||||
/// kernel errors stay quiet; they are listed in the window).
|
||||
pub fn announce(app: &mut SolveApp, fresh: &[Summary]) {
|
||||
@@ -50,7 +58,8 @@ pub fn announce(app: &mut SolveApp, fresh: &[Summary]) {
|
||||
}
|
||||
app.crashes.open = true;
|
||||
app.crashes.refresh();
|
||||
app.set_status("SolidCraft closed unexpectedly or hit an internal error last time. A crash report was saved (Help > Crash Reports…).", true);
|
||||
let locale = crate::i18n::Locale::for_language(&app.preferences.language);
|
||||
app.set_status(locale.text("crash.previous_session"), true);
|
||||
}
|
||||
|
||||
pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
|
||||
@@ -89,15 +98,15 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
|
||||
egui::ScrollArea::vertical().max_height(320.0).show(ui, |ui| {
|
||||
for r in &app.crashes.reports {
|
||||
ui.horizontal(|ui| {
|
||||
let times = if r.count > 1 { format!(" ×{}", r.count) } else { String::new() };
|
||||
ui.label(
|
||||
RichText::new(format!("{} {}{times}", r.time.replace('T', " ").trim_end_matches('Z'), kind_label(&r.kind))).strong(),
|
||||
);
|
||||
ui.label(RichText::new(report_heading(r)).strong());
|
||||
if let Some(c) = &r.command {
|
||||
ui.label(RichText::new(c).monospace().size(11.0).color(t.text_dim));
|
||||
}
|
||||
});
|
||||
ui.label(RichText::new(&r.message).size(12.0));
|
||||
if r.kind == "unclean_exit" {
|
||||
ui.label(RichText::new(crate::i18n::tr("crash.unclean_explanation")).size(12.0).color(t.text_dim));
|
||||
}
|
||||
ui.horizontal(|ui| {
|
||||
if ui.small_button("Report…").clicked() {
|
||||
report = Some(r.id.clone());
|
||||
@@ -171,6 +180,48 @@ mod tests {
|
||||
d
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_old_unclean_exit_is_shown_as_detected_on_a_later_launch() {
|
||||
let d = folder("old-session");
|
||||
let mut h = crate::scenario::Harness::new();
|
||||
h.app.preferences.language = "en".into();
|
||||
h.app.crashes.folder = Some(d.clone());
|
||||
let id = "20261012-162341-bb60791ed6692f1d";
|
||||
let path = d.join(id).join("report.json");
|
||||
let mut report: serde_json::Value = serde_json::from_slice(&std::fs::read(&path).unwrap()).unwrap();
|
||||
report["message"] = json!("SolidCraft 0.3.2 (started 2026-10-01T10:00:00Z) ended without a clean exit between commands");
|
||||
report["command"] = serde_json::Value::Null;
|
||||
std::fs::write(&path, report.to_string()).unwrap();
|
||||
super::announce(&mut h.app, &solidcraft_engine::crash::list(&d));
|
||||
h.frames(6);
|
||||
assert!(h.app.crashes.open, "unclean exits still alert the user");
|
||||
let status = &h.app.status.as_ref().unwrap().0;
|
||||
assert!(status.contains("earlier SolidCraft session"), "{status}");
|
||||
assert!(status.contains("detected at startup"), "{status}");
|
||||
assert!(h.widget("Detected 2026-10-12 16:23:41 UTC Closed unexpectedly ×2").is_some());
|
||||
assert!(h.widget(report["message"].as_str().unwrap()).is_some(), "keep the original session start visible");
|
||||
assert!(h.widget(crate::i18n::tr("crash.unclean_explanation")).is_some());
|
||||
let _ = std::fs::remove_dir_all(&d);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_panic_keeps_its_event_time_without_the_unclean_exit_explanation() {
|
||||
let d = folder("panic-time");
|
||||
let mut h = crate::scenario::Harness::new();
|
||||
h.app.preferences.language = "en".into();
|
||||
h.app.crashes.folder = Some(d.clone());
|
||||
let path = d.join("20261012-162341-bb60791ed6692f1d").join("report.json");
|
||||
let mut report: serde_json::Value = serde_json::from_slice(&std::fs::read(&path).unwrap()).unwrap();
|
||||
report["kind"] = json!("command_panic");
|
||||
std::fs::write(&path, report.to_string()).unwrap();
|
||||
super::announce(&mut h.app, &solidcraft_engine::crash::list(&d));
|
||||
h.frames(6);
|
||||
assert!(h.app.crashes.open);
|
||||
assert!(h.widget("2026-10-12 16:23:41 UTC Internal error in a command ×2").is_some());
|
||||
assert!(h.widget(crate::i18n::tr("crash.unclean_explanation")).is_none());
|
||||
let _ = std::fs::remove_dir_all(&d);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_crash_report_opens_a_reviewed_issue_draft_and_can_be_deleted() {
|
||||
let d = folder("draft");
|
||||
@@ -192,7 +243,7 @@ mod tests {
|
||||
"solid.box",
|
||||
"solidcraft-cli crashes replay 20261012-162341-bb60791ed6692f1d",
|
||||
"Renderer: test",
|
||||
"Happened 2 time(s)",
|
||||
"Recorded 2 time(s)",
|
||||
] {
|
||||
assert!(draft.body.contains(want), "missing {want:?} in {}", draft.body);
|
||||
}
|
||||
|
||||
@@ -295,12 +295,18 @@ pub fn draft_for(app: &SolveApp, dialog: Option<&dialogs::Dialog>, error: Option
|
||||
/// and how to replay it. The design stays on this computer; the draft says how to share it.
|
||||
pub fn crash_draft(report: &serde_json::Value) -> Draft {
|
||||
let s = |k: &str| report.get(k).and_then(serde_json::Value::as_str).unwrap_or("?").to_string();
|
||||
let what = match report.get("kind").and_then(serde_json::Value::as_str) {
|
||||
let kind = report.get("kind").and_then(serde_json::Value::as_str);
|
||||
let what = match kind {
|
||||
Some("command_panic") => "An internal error stopped a command (the design was left unchanged)",
|
||||
Some("kernel_panic_recovered") => "The geometry kernel hit an internal error (caught; the operation failed)",
|
||||
Some("unclean_exit") => "SolidCraft closed unexpectedly (abort, stack overflow, a crash in a graphics driver or the process was killed)",
|
||||
Some("unclean_exit") => "An earlier SolidCraft session ended without recording a clean exit",
|
||||
_ => "SolidCraft hit an internal error",
|
||||
};
|
||||
let detection = if kind == Some("unclean_exit") {
|
||||
"\n\nDetected on a later launch; the exact exit time was not recorded. A system shutdown or forced stop can also cause an unclean exit."
|
||||
} else {
|
||||
""
|
||||
};
|
||||
let command = report.get("command").and_then(|c| c.get("command")).and_then(serde_json::Value::as_str);
|
||||
let frames: Vec<&str> =
|
||||
report.get("backtrace").and_then(serde_json::Value::as_array).into_iter().flatten().filter_map(serde_json::Value::as_str).take(25).collect();
|
||||
@@ -318,7 +324,7 @@ pub fn crash_draft(report: &serde_json::Value) -> Draft {
|
||||
let field = |o: Option<&serde_json::Value>, k: &str| o.and_then(|o| o.get(k)).and_then(serde_json::Value::as_str).unwrap_or("?").to_string();
|
||||
let system = report.get("system");
|
||||
let mut body = format!(
|
||||
"## What happened\n{what}{}.\n\nMessage: {}\nLocation: {}\nThread: {}\nHappened {} time(s), first {}\n\n## Backtrace\n{}\n## Command\n{}\n## Recent commands\n{}\n\n## Reproduction\nCrash report `{}` on the reporter's computer holds {}. Replay it with `solidcraft-cli crashes replay {}`.\nOnly attach the design if it can be shared publicly.\n\n## Environment\n{}\n",
|
||||
"## What happened\n{what}{}.{detection}\n\nMessage: {}\nLocation: {}\nThread: {}\nRecorded {} time(s), first recorded {}\n\n## Backtrace\n{}\n## Command\n{}\n## Recent commands\n{}\n\n## Reproduction\nCrash report `{}` on the reporter's computer holds {}. Replay it with `solidcraft-cli crashes replay {}`.\nOnly attach the design if it can be shared publicly.\n\n## Environment\n{}\n",
|
||||
command.map(|c| format!(" while running `{c}`")).unwrap_or_default(),
|
||||
limited(&s("message"), 2000),
|
||||
s("location"),
|
||||
@@ -674,6 +680,40 @@ mod tests {
|
||||
dialog.inputs.get_mut(1).unwrap().items = vec![Sel::Body { name: "Cutter".into() }];
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn crash_draft_marks_later_detection_without_losing_native_evidence() {
|
||||
let message =
|
||||
"SolidCraft 0.3.2 (started 2026-10-01T10:00:00Z) crashed with ACCESS_VIOLATION (0xc0000005) in driver.dll+0x1234 between commands";
|
||||
let frame = "0xc0000005 ACCESS_VIOLATION at driver.dll+0x1234";
|
||||
let report = json!({
|
||||
"kind": "unclean_exit", "count": 2, "first_seen": "2026-10-12T16:23:41Z",
|
||||
"message": message, "location": "native exception in driver.dll+0x1234",
|
||||
"backtrace": [frame], "native": {"code": "0xc0000005", "module": "driver.dll", "offset": "0x1234"},
|
||||
});
|
||||
let draft = crash_draft(&report);
|
||||
for expected in [
|
||||
"Recorded 2 time(s), first recorded 2026-10-12T16:23:41Z",
|
||||
"Detected on a later launch; the exact exit time was not recorded.",
|
||||
"A system shutdown or forced stop can also cause an unclean exit.",
|
||||
message,
|
||||
frame,
|
||||
] {
|
||||
assert!(draft.body.contains(expected), "missing {expected}: {}", draft.body);
|
||||
}
|
||||
assert!(!draft.body.contains("Happened 2 time(s)"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn crash_draft_only_explains_later_detection_for_unclean_exits() {
|
||||
for kind in ["command_panic", "panic", "kernel_panic_recovered"] {
|
||||
let report = json!({"kind": kind, "count": 1, "first_seen": "2026-10-12T16:23:41Z"});
|
||||
let draft = crash_draft(&report);
|
||||
assert!(draft.body.contains("Recorded 1 time(s), first recorded 2026-10-12T16:23:41Z"), "{kind}: {}", draft.body);
|
||||
assert!(!draft.body.contains("Detected on a later launch"), "{kind}: {}", draft.body);
|
||||
assert!(!draft.body.contains("exact exit time was not recorded"), "{kind}: {}", draft.body);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_report_actual_pending_boolean_settings_and_failure_are_read_only() {
|
||||
let mut app = app();
|
||||
|
||||
@@ -58,14 +58,15 @@ A folder `crashes/<YYYYMMDD-HHMMSS>-<signature>/`:
|
||||
- `command_panic`: a command hit an internal error; it was caught and the design was left unchanged
|
||||
- `kernel_panic_recovered`: the third-party geometry kernel panicked and was caught. This is harmless on the desktop, but it would crash the web build.
|
||||
- `panic`: an internal error outside any command
|
||||
- `unclean_exit`: the app ended without a hook seeing it (an abort, a stack overflow, a segfault, a crash inside a graphics driver, or the process being killed). It is found at the next start. When the app died while starting up, the message and `location` name the startup step (see below). On Windows, a crash in native code also says the exception, the module it happened in and the offset into it.
|
||||
- `unclean_exit`: a previous session ended without recording a clean exit. It is detected at the next start, which may be days later. Possible causes include an abort, a stack overflow, a segfault, a crash inside a graphics driver, a system shutdown, or the process being forcibly stopped. This kind alone does not identify the cause. When the app died while starting up, the message and `location` name the startup step (see below). On Windows, a captured native exception also says the exception, the module it happened in and the offset into it.
|
||||
- `message`, `location` (file:line), `thread`
|
||||
- `backtrace`: frames `symbol (file:line)`, without the panic machinery, std internals or the user's home folder
|
||||
- `app` (version, commit, build date), `system` (OS, architecture, renderer and GPU), `session.uptime_s`
|
||||
- `command`: the command that crashed, with its parameters
|
||||
- `recent_commands`: up to 32, with ok or error
|
||||
- `base`: what the replay starts from (the design before the command, an autosave, a saved file or a new design)
|
||||
- `count`, `first_seen`, `last_seen`: the same crash repeats only increase `count`
|
||||
- `count`: how many matching reports have been recorded; repeats update the existing report.
|
||||
- `first_seen`, `last_seen`: UTC timestamps when the report was first and most recently recorded. For `unclean_exit`, these are detection times at a later launch, not the exact times the sessions ended. The session start in `message` may be much earlier; the report does not imply a failure in the currently open design.
|
||||
- `notes`: what is missing and why, for example a design too large to copy
|
||||
- `startup_phase`: `{step, ms}` when the app died before it drew its first frame: the step it
|
||||
was in (`window`, `graphics instance`, `window surface`, `adapter request`, `adapter chosen`,
|
||||
|
||||
Reference in new issue
Block a user