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

* claim: #5377

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

With no dialog open the report was always labelled "Modeling" and its
summary pre-filled as "unexpected result", so every such report arrived
titled "Modeling: unexpected result" and the fallback to the first line
of "What happened?" never applied.

Label the report from the active workspace (Part, Sketch, Surface, Sheet
Metal, Plastic, Mesh, or Render), leave the summary empty so the title
becomes "<workspace>: <first line of the description>", and keep
"operation failed" when an error was recorded. The summary field now
hints that a short title is optional.

The triage script that asks for an empty in-app report to be pasted
recognises the new titles.
This commit is contained in:
raykholo
2026-10-25 03:03:08 +00:00
committed by GitHub
parent 1ceab2ed4c
commit dbe7dfa4bc
8 changed files with 50 additions and 9 deletions
+1
View File
@@ -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",
+1
View File
@@ -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": "加速度",
+1
View File
@@ -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": "加速度",
+31 -4
View File
@@ -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();
+8 -1
View File
@@ -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;
}
+4 -3
View File
@@ -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;
+2
View File
@@ -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', () => {
+2 -1
View File
@@ -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) {