History: say why an edited feature behind the marker changes nothing (#8100) (#8727)

* claim: #8100

* History: say why an edited feature behind the marker changes nothing (#8100)

Editing a feature that sits after the history marker (double-clicking its
greyed-out item) rolls back to it, previews the change, and on OK puts the
marker back where it was: the feature stays rolled back, so nothing in the
view changes and nothing says why. That is the silent "pattern of a cut
does nothing" in #8100 (the reporter's design has its pattern behind the
marker; on main the pattern itself builds fine once rolled forward).

- timeline.redefine replies `rolled_back` and, when true, a `note`; it also
  carries the feature's `warning` (for a rolled-back feature, the one its
  constructor met building it at its place).
- The window shows that note in the status line after such an edit.
- A rolled-back item's tooltip in both History layouts says it is after
  the history marker and not built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Pending locale: Arabic, Hebrew, Japanese, Vietnamese and Chinese for the rolled-back notes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
This commit is contained in:
authored and GitHub committed 2026-10-29 17:11:10 +00:00
1 parent d0b357d532
commit 6ebfe91661
7 files changed
+138 -2

No files matched your search

@@ -0,0 +1,34 @@
{
"en": {
"timeline.edited_rolled_back": "{name} changed, but it is after the history marker, so it is not built: move the marker past it to see the result",
"timeline.feature_rolled_back": "Rolled back: after the history marker, so not built"
},
"de": {
"timeline.edited_rolled_back": "{name} geändert, liegt aber hinter der Verlaufsmarke und wird daher nicht erzeugt: Marke dahinter ziehen, um das Ergebnis zu sehen",
"timeline.feature_rolled_back": "Zurückgesetzt: hinter der Verlaufsmarke, daher nicht erzeugt"
},
"fr": {
"timeline.edited_rolled_back": "{name} modifié, mais il est après le marqueur d'historique et n'est donc pas construit : déplacez le marqueur au-delà pour voir le résultat",
"timeline.feature_rolled_back": "En retrait : après le marqueur d'historique, donc non construit"
},
"ar": {
"timeline.edited_rolled_back": "تم تغيير {name}، لكنه يقع بعد علامة السجل ولذلك لا يُبنى: انقل العلامة إلى ما بعده لرؤية النتيجة",
"timeline.feature_rolled_back": "تم التراجع: بعد علامة السجل، لذلك لا يُبنى"
},
"he": {
"timeline.edited_rolled_back": "{name} שונה, אך הוא אחרי סמן ההיסטוריה ולכן לא נבנה: הזיזו את הסמן אל מעבר אליו כדי לראות את התוצאה",
"timeline.feature_rolled_back": "בוטל: אחרי סמן ההיסטוריה, ולכן לא נבנה"
},
"ja": {
"timeline.edited_rolled_back": "{name} を変更しましたが、履歴マーカーより後ろにあるため構築されません。結果を見るにはマーカーをその先へ移動してください",
"timeline.feature_rolled_back": "ロールバック中: 履歴マーカーより後ろのため構築されません"
},
"vi": {
"timeline.edited_rolled_back": "{name} đã thay đổi, nhưng nó nằm sau dấu mốc lịch sử nên chưa được dựng: kéo dấu mốc qua nó để xem kết quả",
"timeline.feature_rolled_back": "Đã lùi lại: nằm sau dấu mốc lịch sử nên chưa được dựng"
},
"zh": {
"timeline.edited_rolled_back": "{name} 已更改,但它位于历史标记之后,因此未构建:将标记移到其后即可查看结果",
"timeline.feature_rolled_back": "已回退:位于历史标记之后,因此未构建"
}
}
+16 -2
View File
@@ -67,7 +67,7 @@ pub static COMMANDS: &[CommandSpec] = &[
"features: [id|name], position: insertion slot in the current history; selected features keep their relative order; active?: bool (as timeline.reorder's); refused when a feature that worked would fail, unless allow_errors?: bool (default false): then made, and broken: [{feature, error}] lists the features it broke",
),
CommandSpec::new("timeline.redefine", "Edit Feature", redefine).icon("edit")
.params("feature: id|name, command: the feature's command id, params: its parameters (the feature is rebuilt in place)"),
.params("feature: id|name, command: the feature's command id, params: its parameters (the feature is rebuilt in place) → feature, recomputed, restored, rolled_back: bool (the feature is after the history marker, so the edit is not built yet; `note` then says so), warning?"),
CommandSpec::new("timeline.dependents", "Feature Dependents", dependents).icon("graph")
.noundo()
.params("feature: id|name → features deleted with it, and features that would fail without it"),
@@ -1773,9 +1773,23 @@ fn redefine(s: &mut Session, p: &Value) -> Result<Value> {
if let Some(e) = s.model.result(id).and_then(|r| r.error.clone()) {
return Err(EngineError::Other(e));
}
// A feature behind the history marker is not built, so the edit changes nothing in the model
// yet: the reply says so, or the edit would look as if it had silently failed (#8100). Its
// warning is the one the constructor met building it in the trial, at its place.
let rolled_back = s.doc.marker.is_some_and(|marker| s.doc.feature_index(id).is_some_and(|index| index >= marker));
let warning =
if rolled_back { r.get("warning").and_then(Value::as_str).map(str::to_string) } else { s.model.result(id).and_then(|r| r.warning.clone()) };
// Report the trial's rebuild, plus anything the session still had to compute itself (a kept
// result its budget dropped); `s.model`'s own counters would only report the reuse (#5694).
Ok(json!({"feature": id, "recomputed": rebuilt + s.model.last_recomputed, "restored": reused}))
let mut reply = json!({"feature": id, "recomputed": rebuilt + s.model.last_recomputed, "restored": reused, "rolled_back": rolled_back});
if let Some(warning) = warning {
reply["warning"] = json!(warning);
}
if rolled_back {
let name = s.doc.feature(id).map(|f| f.name.clone()).unwrap_or_default();
reply["note"] = json!(format!("{name} is after the history marker, so it is not built: move the marker past it to build it"));
}
Ok(reply)
}
fn dependents(s: &mut Session, p: &Value) -> Result<Value> {
+38
View File
@@ -1049,3 +1049,41 @@ fn pattern_count_integer_parameters_survive_save_and_reject_fractional_edits() -
assert!(invalid.model.results.iter().any(|r| r.error.as_ref().is_some_and(|e| e.contains("a count must be a whole number;"))));
Ok(())
}
/// Editing a pattern behind the history marker (double-clicking its greyed-out item and pressing
/// OK) changes nothing in the model: the reply says so, where the edit used to look as if it had
/// silently failed, and it still carries what building the copies met (#8100).
#[test]
fn editing_a_rolled_back_pattern_says_it_is_not_built() {
let mut s = Session::default();
run(&mut s, "solid.box", json!({"length":40,"width":30,"height":10,"corner":[0,0,0],"body_name":"Plate"}));
run(&mut s, "solid.cylinder", json!({"radius":2,"height":20,"base":[10,15,-5],"operation":"cut","targets":["Plate"],"name":"Cut"}));
let pattern = |count: u32, origin: [f64; 3]| json!({"features":["Cut"],"axis":{"origin":origin,"dir":[0,0,1]},"count":count});
let redefine = |count, origin| json!({"feature":"Pattern","command":"solid.pattern.circular","params":pattern(count, origin)});
let centre = [20.0, 15.0, 0.0];
let hole = PI * 4.0 * 10.0;
let mut first = pattern(2, centre);
first["name"] = json!("Pattern");
let id = run(&mut s, "solid.pattern.circular", first)["feature"].as_u64().unwrap();
assert!(rel(volume(&mut s), 12000.0 - 2.0 * hole) < 1e-4);
// A pattern that is built: the edit is built at once, with nothing to say.
let reply = run(&mut s, "timeline.redefine", redefine(3, centre));
assert_eq!(reply["rolled_back"], json!(false), "{reply}");
assert!(reply.get("note").is_none(), "{reply}");
assert!(rel(volume(&mut s), 12000.0 - 3.0 * hole) < 1e-4);
// Behind the marker: the edit is kept but not built, and the reply says why nothing changed.
run(&mut s, "timeline.roll_to", json!({"position": 2}));
let reply = run(&mut s, "timeline.redefine", redefine(4, centre));
assert_eq!(reply["rolled_back"], json!(true), "{reply}");
assert_eq!(reply["note"], "Pattern is after the history marker, so it is not built: move the marker past it to build it");
assert!(reply.get("warning").is_none(), "{reply}");
assert!(rel(volume(&mut s), 12000.0 - hole) < 1e-4);
assert!(s.model.result(id).is_some_and(|r| r.skipped && r.error.is_none()));
run(&mut s, "timeline.roll_to", json!({}));
assert!(rel(volume(&mut s), 12000.0 - 4.0 * hole) < 1e-4);
// What building the rolled-back copies met still reaches the reply: here a copy that misses.
run(&mut s, "timeline.roll_to", json!({"position": 2}));
let reply = run(&mut s, "timeline.redefine", redefine(2, [0.0, 0.0, 0.0]));
assert_eq!(reply["rolled_back"], json!(true), "{reply}");
assert_eq!(reply["warning"], "1 of 1 cut copies remove no material", "{reply}");
}
+34
View File
@@ -1139,3 +1139,37 @@ fn align_components_picks_the_placement_under_the_active_component_and_warns_whe
h.frames(4);
assert!(h.widget(ALIGN_SHARED_WARNING).is_some(), "the shared pick is called out");
}
/// OK on the editor of a pattern behind the history marker leaves it rolled back, so the view
/// does not change: the status line says why, where the edit used to look as if it had silently
/// failed (#8100).
#[test]
fn ok_on_a_rolled_back_pattern_editor_says_it_is_not_built() {
let mut h = Harness::new();
h.app.home.open = false;
for (id, params) in [
("solid.box", json!({"length":40,"width":30,"height":10,"corner":[0,0,0],"body_name":"Plate"})),
("solid.cylinder", json!({"radius":2,"height":20,"base":[10,15,-5],"operation":"cut","targets":["Plate"],"name":"Cut"})),
("solid.pattern.circular", json!({"features":["Cut"],"axis":{"origin":[20,15,0],"dir":[0,0,1]},"count":2,"name":"Pattern"})),
("timeline.roll_to", json!({"position":2})),
] {
h.app.run(id, params).unwrap();
}
let pattern = h.app.session.doc.features.last().unwrap().id;
h.app.edit_feature(pattern);
h.settle();
assert!(h.app.dialog.is_some(), "the pattern's editor opens");
h.step(&json!({"click":{"handle":"dialog:OK"}})).unwrap();
for _ in 0..500 {
if h.app.dialog.is_none() {
break;
}
h.frames(1);
std::thread::sleep(std::time::Duration::from_millis(10));
}
assert!(h.app.dialog.is_none(), "the edit is applied");
assert_eq!(h.app.session.doc.marker, Some(2), "the pattern stays behind the marker");
let (text, _, error) = h.app.status.clone().unwrap();
assert!(!error, "{text}");
assert!(text.starts_with("Pattern changed, but it is after the history marker"), "{text}");
}
+7
View File
@@ -1131,6 +1131,13 @@ impl SolveApp {
self.ui.show_navigation_bar = v.get("visible").and_then(Value::as_bool).unwrap_or(!self.ui.show_navigation_bar)
}
"view.next_tab" | "view.previous_tab" => documents::cycle(self, id == "view.next_tab"),
// An edit OK'd on a feature behind the history marker changes nothing in the view:
// say why, or the edit looks as if it had silently failed (#8100).
"timeline.redefine" if v.get("rolled_back").and_then(Value::as_bool) == Some(true) => {
let feature = v.get("feature").and_then(Value::as_u64).and_then(|f| self.session.doc.feature(f));
let name = feature.map(|f| f.name.clone()).unwrap_or_default();
self.set_status(i18n::format("timeline.edited_rolled_back", &[("name", &name)]), false);
}
_ => {}
}
if id == "view.render_inspector" {
+5
View File
@@ -939,6 +939,11 @@ fn timeline_contents(app: &mut SolveApp, ui: &mut egui::Ui, floating: bool) {
p.circle_filled(pos2(br.center().x, br.bottom() + t.space_3), t.space_2, accent.color);
}
let mut tip = status_text(name, ty, err.as_deref(), warn.as_deref());
// Greyed out says only "not shown": say why (#8100).
if rolled {
tip.push('\n');
tip.push_str(crate::i18n::tr("timeline.feature_rolled_back"));
}
if let Some(state) = sketch_state {
tip.push('\n');
tip.push_str(&state.text());
+4
View File
@@ -1519,6 +1519,10 @@ fn feature_row(app: &mut SolveApp, ui: &mut egui::Ui, rows: &mut Rows, index: us
if error.is_some() || warning.is_some() {
tip.push_str(&format!("\n{}", crate::timeline::status_text(name, ty, error.as_deref(), warning.as_deref())));
}
// Greyed out says only "not shown": say why (#8100).
if rolled {
tip.push_str(&format!("\n{}", crate::i18n::tr("timeline.feature_rolled_back")));
}
if let Some(state) = sketch_state {
tip.push_str(&format!("\n{}", state.text()));
}