diff --git a/crates/app/src/player/cards.rs b/crates/app/src/player/cards.rs index 4b35920..19e03db 100644 --- a/crates/app/src/player/cards.rs +++ b/crates/app/src/player/cards.rs @@ -1542,8 +1542,22 @@ impl Player { }; let params = (!self.eq_params.is_identity()).then(|| self.eq_params.clone()); if let Some(session) = &mut self.session { - session.set_eq(lane, idx, params); - self.mark_dirty(); + // `set_eq` answers "the index was there and the curve is finite" + // -- it snapshots and rewrites the very slot it already holds for + // a curve that is already in force -- so on its own bool a + // re-commit of the same curve armed autosave, the ledger's + // `unsaved` ghost and the close prompt over a project whose bytes + // had not moved. The arm rides the curve having moved, the + // comparison `apply_fit` reads for `set_fit` + // ([`Player::apply_fit`]), and then the door's own answer. + let moved = session.eq_of(lane, idx).cloned() != params; + if moved && session.set_eq(lane, idx, params) { + self.mark_dirty(); + // `set_eq` reseeks inside the engine -- that is what makes the + // change audible at once -- and a reseek is what these flags + // are about. Nothing was written, so nothing was reseeked. + self.reset_after_reseek(); + } } cx.notify(); } diff --git a/crates/app/src/tests/cards.rs b/crates/app/src/tests/cards.rs index 5f1c6e1..246ad07 100644 --- a/crates/app/src/tests/cards.rs +++ b/crates/app/src/tests/cards.rs @@ -1739,6 +1739,39 @@ fn every_click_door_that_writes_the_project_arms_autosave() { "nudge_mix still arms ahead of the door, so a clamped no-op nudge \ leaves the project looking edited" ); + // The equalizer card's commit, the same rule against a door whose bool is + // the WEAKER of the two shapes: `set_eq` answers "the index was there and + // the curve is finite" and rewrites the very slot it already holds for a + // curve already in force, so the arm needs the comparison too -- the same + // pair of conditions `apply_fit` rides. + let body = fn_body("commit_eq"); + let arm = body + .split_once("if moved && session.set_eq(lane, idx, params) {") + .expect("the EQ commit no longer rides the curve having moved and then the door") + .1; + assert!( + arm.contains("mark_dirty()"), + "commit_eq arms outside its gate, so re-committing the curve already \ + in force would dirty the project" + ); + assert!( + body.contains("session.eq_of(lane, idx).cloned() != params"), + "commit_eq rides the engine's bool alone, which is true for a \ + re-commit of the curve already in force" + ); + // ...and the reseek bookkeeping rides with the arm, not instead of it. + assert!( + arm.contains("reset_after_reseek()"), + "commit_eq's reseek flags no longer clear on a write that took" + ); + let before = body + .split_once("if moved && session.set_eq(lane, idx, params) {") + .unwrap() + .0; + assert!( + !before.contains("mark_dirty()"), + "commit_eq still arms ahead of the door" + ); } /// The transition doors, which are the class's other shape: both engine