* claim: #6550 * Crash reports: keep journaling through file.new and doc.open (#6550) `Session::replace_design` swapped in the fresh session without its `crash_journal` flag, and the app turns it back on only at its next frame. So `file.new`/`doc.open` never recorded how they ended, the commands sent after them in the same frame (a control-channel or MCP batch) were not journaled, and a crash report then named `file.new` as the command in flight. `replace_design` now keeps the flag, like the other session-wide fields it keeps; only the design on screen has it set. Test: `commands_right_after_a_new_design_are_journaled` (crash_tests.rs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6f5f64f2d9
commit
19c8eb846e
2 files changed
+34
No files matched your search
@@ -88,6 +88,12 @@ fn child() {
|
||||
s.execute("solid.box", &json!({"length": 4, "width": 4, "height": 4})).unwrap();
|
||||
let _ = s.execute("diagnostics.crash_test", &json!({"mode": "abort"}));
|
||||
}
|
||||
// A new design and commands on it before the app's next frame (a control-channel batch).
|
||||
"new" => {
|
||||
s.execute("file.new", &json!({})).unwrap();
|
||||
s.execute("solid.sphere", &json!({"diameter": 8})).unwrap();
|
||||
let _ = s.execute("diagnostics.crash_test", &json!({"mode": "abort"}));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
end_session();
|
||||
@@ -254,6 +260,30 @@ fn activating_a_component_is_journaled_so_the_replay_builds_in_the_same_componen
|
||||
let _ = fs::remove_dir_all(&d);
|
||||
}
|
||||
|
||||
/// A new design is journaled at once, not from the app's next frame: commands sent right after
|
||||
/// `file.new` are in the replay, and the report names the command in flight, not `file.new`.
|
||||
#[test]
|
||||
fn commands_right_after_a_new_design_are_journaled() {
|
||||
let d = fresh_dir("new");
|
||||
assert!(!run_child(&d, "new").1);
|
||||
assert!(run_child(&d, "none").1);
|
||||
let (s, report) = only_report(&d);
|
||||
assert!(s.message.contains("while running `diagnostics.crash_test`"), "{}", s.message);
|
||||
let replay: Value = serde_json::from_slice(&fs::read(report["replay_path"].as_str().unwrap()).unwrap()).unwrap();
|
||||
let commands = replay["commands"].as_array().unwrap();
|
||||
let ids: Vec<&str> = commands.iter().map(|c| c["command"].as_str().unwrap()).collect();
|
||||
assert_eq!(ids, ["solid.box", "file.new", "solid.sphere", "diagnostics.crash_test"]);
|
||||
let mut recovered = Session::default();
|
||||
for command in commands {
|
||||
let id = command["command"].as_str().unwrap();
|
||||
if id != "diagnostics.crash_test" {
|
||||
recovered.execute(id, &command["params"]).unwrap();
|
||||
}
|
||||
}
|
||||
assert_eq!(recovered.doc.features.len(), 1, "the sphere, on the new design");
|
||||
let _ = fs::remove_dir_all(&d);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_crash_while_starting_up_names_the_step_and_the_renderer() {
|
||||
let d = fresh_dir("startup");
|
||||
|
||||
@@ -538,7 +538,11 @@ impl Session {
|
||||
let render_jobs = self.render_jobs.scratch();
|
||||
let checkpoints = std::mem::take(&mut self.checkpoints);
|
||||
let next_checkpoint = self.next_checkpoint;
|
||||
// The design on screen stays journaled for crash reports at once, not from the app's
|
||||
// next frame, so commands sent right after `doc.open` or `file.new` are kept.
|
||||
let crash_journal = self.crash_journal;
|
||||
*self = fresh;
|
||||
self.crash_journal = crash_journal;
|
||||
self.auto_project = auto_project;
|
||||
self.param_check = param_check;
|
||||
self.render_viewport = render_viewport;
|
||||
|
||||
Reference in new issue
Block a user