Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

Report a bug: title from the workspace and the reporter's words (#5377) (#5445)

raykholodbe7dfa4bc31
diff --git a/assets/locales/en.json b/assets/locales/en.json
index cb4fdd90cc..a537448609 100644
--- a/assets/locales/en.json
+++ b/assets/locales/en.json
@@ -8,6 +8,7 @@
"A Single hole snaps to the middle of its face and to the centres of its round edges": "A Single hole snaps to the middle of its face and to the centres of its round edges",
"A new configuration, a copy of the active one": "A new configuration, a copy of the active one",
"A placed Single hole has a handle to drag it, and picking its face again moves the hole there instead of taking it out": "A placed Single hole has a handle to drag it, and picking its face again moves the hole there instead of taking it out",
+ "A short title for the problem (optional)": "A short title for the problem (optional)",
"ARRANGE": "ARRANGE",
"About SolidCraft": "About SolidCraft",
"Acceleration": "Acceleration",
diff --git a/assets/locales/ja.json b/assets/locales/ja.json
index 44f6a226d1..e7186a93de 100644
--- a/assets/locales/ja.json
+++ b/assets/locales/ja.json
@@ -8,6 +8,7 @@
"A Single hole snaps to the middle of its face and to the centres of its round edges": "単一の穴を面の中心と丸いエッジの中心にスナップします",
"A new configuration, a copy of the active one": "アクティブな構成をコピーして新しい構成を作成",
"A placed Single hole has a handle to drag it, and picking its face again moves the hole there instead of taking it out": "配置した単一の穴にドラッグ用のハンドルを付け、面をもう一度選ぶと穴を削除せずにそこへ移動します",
+ "A short title for the problem (optional)": "問題の短いタイトル(省略可)",
"ARRANGE": "配置",
"About SolidCraft": "SolidCraft について",
"Acceleration": "加速度",
diff --git a/assets/locales/zh.json b/assets/locales/zh.json
index 85a5bd7bd4..7577f95fb2 100644
--- a/assets/locales/zh.json
+++ b/assets/locales/zh.json
@@ -8,6 +8,7 @@
"A Single hole snaps to the middle of its face and to the centres of its round edges": "单个孔捕捉到其所在面的中心和圆形边的中心",
"A new configuration, a copy of the active one": "新建配置,为当前配置的副本",
"A placed Single hole has a handle to drag it, and picking its face again moves the hole there instead of taking it out": "已放置的单个孔带有可拖动的控点,再次选择该面会将孔移到该处而不是删除它",
+ "A short title for the problem (optional)": "问题的简短标题(可选)",
"ARRANGE": "排列",
"About SolidCraft": "关于 SolidCraft",
"Acceleration": "加速度",
diff --git a/crates/ui-egui/src/issue_report.rs b/crates/ui-egui/src/issue_report.rs
index 5ed16c95c2..93a9b8457c 100644
--- a/crates/ui-egui/src/issue_report.rs
+++ b/crates/ui-egui/src/issue_report.rs
@@ -109,6 +109,7 @@ pub struct ReportState {
pub struct Draft {
pub title: String,
+ title_prefix: String,
/// Collected technical context, separately reviewable and editable.
pub body: String,
description: String,
@@ -127,6 +128,7 @@ impl Draft {
fn new(title: String, body: String, source_signature: u64) -> Self {
Self {
title,
+ title_prefix: String::new(),
body,
description: String::new(),
steps: String::new(),
@@ -143,7 +145,8 @@ impl Draft {
fn report_title(&self) -> String {
if self.title.trim().is_empty() {
- limited(self.description.trim().lines().next().unwrap_or_default(), 160)
+ let summary = limited(self.description.trim().lines().next().unwrap_or_default(), 160);
+ limited(&format!("{}{summary}", self.title_prefix), 160)
} else {
limited(&self.title, 160)
}
@@ -302,7 +305,7 @@ fn feature_context(feature: &solidcraft_engine::doc::Feature) -> String {
/// Read-only context excludes whole documents, sketch geometry and imported file contents.
pub fn draft_for(app: &SolveApp, dialog: Option<&dialogs::Dialog>, error: Option<&str>) -> Draft {
let mut context = String::new();
- let label = dialog.map(dialogs::report_title).unwrap_or_else(|| "Modeling".into());
+ let label = dialog.map(dialogs::report_title).unwrap_or_else(|| crate::mouse_gesture::Studio::of(app).label().into());
if let Some(d) = dialog {
match dialogs::apply_commands(app, d) {
Ok(commands) => context.push_str(&block(&json_context(&commands, 10_000))),
@@ -352,9 +355,11 @@ pub fn draft_for(app: &SolveApp, dialog: Option<&dialogs::Dialog>, error: Option
truncate(&mut body, MAX_BODY - 32);
body.push_str("\n[report context truncated]\n");
}
- let mut title = format!("{label}: {}", if error.is_some() { "operation failed" } else { "unexpected result" });
+ let mut title = if error.is_some() { format!("{label}: operation failed") } else { String::new() };
truncate(&mut title, 160);
- Draft::new(title, body, source_signature(app, dialog))
+ let mut draft = Draft::new(title, body, source_signature(app, dialog));
+ draft.title_prefix = format!("{label}: ");
+ draft
}
/// A draft from a crash report (`solidcraft_engine::crash`): what happened, where, the command
@@ -640,6 +645,28 @@ mod tests {
commands
}
+ #[test]
+ fn issue_report_title_uses_sketch_workspace_and_description() {
+ let mut app = app();
+ app.run("sketch.create", json!({"plane":"XY"})).unwrap();
+ let mut draft = draft_for(&app, None, None);
+ assert!(draft.title.is_empty());
+ draft.description = " Line disappears after drawing\nMore details".into();
+ assert_eq!(draft.report_title(), "Sketch: Line disappears after drawing");
+ assert!(!draft.report_title().contains("unexpected result"));
+ draft.title = "Custom summary".into();
+ assert_eq!(draft.report_title(), "Custom summary");
+ }
+
+ #[test]
+ fn issue_report_title_preserves_recorded_failure() {
+ let mut app = app();
+ app.run("sketch.create", json!({"plane":"XY"})).unwrap();
+ let mut draft = draft_for(&app, None, Some("Synthetic command error"));
+ draft.description = "Line could not be drawn".into();
+ assert_eq!(draft.report_title(), "Sketch: operation failed");
+ }
+
#[test]
fn issue_report_form_separates_user_answers_from_technical_context() {
let mut h = crate::scenario::Harness::new();
diff --git a/crates/ui-egui/src/issue_report/form.rs b/crates/ui-egui/src/issue_report/form.rs
index 4783303902..55d1697196 100644
--- a/crates/ui-egui/src/issue_report/form.rs
+++ b/crates/ui-egui/src/issue_report/form.rs
@@ -136,7 +136,14 @@ pub(super) fn show(app: &mut SolveApp, draft: &mut Draft, ctx: &egui::Context) -
ui_kit::text(ui, tr_label("Reports are public. A GitHub account is required."), ui_kit::Text::Note("public"));
ui_kit::divider(ui, "report");
ui_kit::text(ui, tr_label("Summary"), ui_kit::Text::Heading("Summary"));
- let response = ui_kit::bounded_cell_editor(ui, Id::new("issue_report_title"), &mut draft.title, "", false, 160);
+ let response = ui_kit::bounded_cell_editor(
+ ui,
+ Id::new("issue_report_title"),
+ &mut draft.title,
+ "A short title for the problem (optional)",
+ false,
+ 160,
+ );
if response.changed() {
draft.opened_github = false;
}
diff --git a/scripts/triage/needs-info.js b/scripts/triage/needs-info.js
index 0676447e61..eebb5f05a9 100644
--- a/scripts/triage/needs-info.js
+++ b/scripts/triage/needs-info.js
@@ -24,9 +24,10 @@ function fromApp(body) {
// Requests and plans, which aren't reproduced. Crash reports carry the crash folder's contents.
const NOT_A_BUG = /^\s*\[(feat|feature|change|enhancement)|feature request|suggestion|\?\s*$|^\s*(tracker|refactor|support|add|allow|crash|how|why|request|missing)\b/i;
-// The app's report title. A long report opens the browser without its body and is copied to
-// the clipboard instead (crates/ui-egui/src/issue_report.rs, draft_url), so an empty one wasn't pasted.
-const APP_TITLE = /^[A-Z][A-Z ]+:\s*(operation failed|unexpected result)\b|^Modeling: unexpected result/;
+// The app's report title: the open dialog (`EXTRUDE: …`) or the workspace (`Sketch: …`), then the
+// reporter's summary. A long report opens the browser without its body and is copied to the
+// clipboard instead (crates/ui-egui/src/issue_report.rs, draft_url), so an empty one wasn't pasted.
+const APP_TITLE = /^([A-Z][A-Z ]+|Modeling|Part|Sketch|Surface|Sheet Metal|Plastic|Mesh|Render):\s*\S/;
// A report this long describes what it saw; only short ones are asked.
const SHORT = 300;
const ATTACHMENT = /user-attachments\/|\.solidcraft\b|repro\.json|\.(step|stp|3mf|stl)\b/i;
diff --git a/scripts/triage/needs-info.test.js b/scripts/triage/needs-info.test.js
index e838e14c39..d23adf6862 100644
--- a/scripts/triage/needs-info.test.js
+++ b/scripts/triage/needs-info.test.js
@@ -48,6 +48,8 @@ test('missing: short reports without steps are asked, with the version when it i
test('missing: empty app reports are asked to paste the copied report', () => {
assert.deepEqual(info.missing('EXTRUDE: operation failed', ''), ['paste']);
assert.deepEqual(info.missing('Modeling: unexpected result', ' '), ['paste']);
+ assert.deepEqual(info.missing('Sketch: line vanishes after trimming', ''), ['paste']);
+ assert.deepEqual(info.missing('Sheet Metal: operation failed', ''), ['paste']);
});
test('missing: reproducible, long, app-filed and non-bug issues are left alone', () => {
diff --git a/scripts/triage/triage.js b/scripts/triage/triage.js
index 3928d1aa71..3711e172f8 100644
--- a/scripts/triage/triage.js
+++ b/scripts/triage/triage.js
@@ -59,7 +59,8 @@ const WORD_AREAS = [
const CRASH = /^\s*crash\b|\bpanic(ked)?\b|\bcaught panic\b/i;
const FEATURE = /^\s*\[?feature( request)?\]?\b/i;
-// The in-app reports: `<COMMAND>: operation failed` / `Modeling: unexpected result`.
+// The in-app reports of a failed command: `<COMMAND>: operation failed` (older ones also
+// `Modeling: unexpected result`). Other in-app reports carry an `## Actual behavior` section.
const IN_APP_FAILURE = /:\s*(operation failed|unexpected result)\b/i;
function repoArgs(context) {