From d3bace229af7c256351678aab0bfbc09fa542df4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 21 Aug 2026 07:03:17 +0300 Subject: [PATCH] fix(ui): the notice plate reads the newest message, not the stalest notice_plate showed notices.front() while the ledger's "last action" already read notices.back() -- and nothing but a keystroke ever calls dismiss_notice(), so a mouse-driven refusal queued behind an earlier, undismissed notice (a ctrl+s "SAVED ...") never reached the plate at all. The plate now reads back(), matching the ledger, so the newest notice is always the one shown; its max width also grows from 360 to 480px so a refusal-plus-remedy sentence gets two or three lines instead of being left to the ledger's single truncated line. --- crates/app/src/notices.rs | 35 +++++++++++++++++++++++++++++++++++ crates/app/src/ui/stance.rs | 26 ++++++++++++++++++++------ 2 files changed, 55 insertions(+), 6 deletions(-) diff --git a/crates/app/src/notices.rs b/crates/app/src/notices.rs index 7a854c0..7368200 100644 --- a/crates/app/src/notices.rs +++ b/crates/app/src/notices.rs @@ -58,3 +58,38 @@ pub(crate) fn audio_notice(session: &PlaybackSession) -> Option { .audio_disabled_reason() .map(|reason| format!(" — NO AUDIO: {reason}")) } + +#[cfg(test)] +mod tests { + use super::*; + + /// The class this guards: a notice queued behind an earlier, undismissed + /// one is never *lost* -- `push_notice` still appends it to the back -- + /// but a reader of `front()` alone (what `stance::notice_plate` read + /// before this fix) would never see it, because nothing but a keystroke + /// ever calls `dismiss_notice`, and most of what fills this queue (a + /// click on a gap, a menu row, a drag) is not one. `back()` is the read + /// that survives that: it always names the newest message, which is why + /// the plate and the ledger's "last action" both read it now. + /// + /// This is a value-level check on the queue only -- this binary has no + /// `TestAppContext`, so it cannot measure what actually painted, and this + /// test does not claim to. + #[test] + fn a_notice_queued_behind_an_unread_one_is_still_reachable_at_the_back() { + let mut notices = std::collections::VecDeque::new(); + push_notice(&mut notices, "SAVED test_h264.edith".into()); + let refusal = "the V1 clip at frame 0 is one take with the A1 clip at frame 0: \ + closing this gap alone would pull the take out of sync — close A1's \ + gap there too, or detach them first"; + push_notice(&mut notices, refusal.into()); + // Nobody dismissed the SAVED notice (no keystroke happened) -- it is + // still sitting at the front, exactly the scenario that froze the + // plate on stale text. + assert_eq!(notices.front().unwrap().as_ref(), "SAVED test_h264.edith"); + // The refusal, remedy clause and all, is reachable at the back -- + // whole, not truncated, because `push_notice` never touches a + // message's text. + assert_eq!(notices.back().unwrap().as_ref(), refusal); + } +} diff --git a/crates/app/src/ui/stance.rs b/crates/app/src/ui/stance.rs index 5a58d5c..7c1041f 100644 --- a/crates/app/src/ui/stance.rs +++ b/crates/app/src/ui/stance.rs @@ -562,9 +562,18 @@ pub(crate) fn notice_bottom_offset(bench_h: f32) -> f32 { /// A notice plate (DESIGN §8): one at a time, rising above the *bench*, its /// severity a 3px left spine rather than a colour flood. Fed by the same /// [`Player::notify_user`]/`notices` queue the legacy bar reads -/// ([`Player::notice_bar`]) -- no second notice channel. Dismissal is -/// already wired: [`render`]'s `on_key_down` calls `dismiss_notice()` on -/// every stroke, the same door the legacy handler uses. +/// ([`Player::notice_bar`]) -- no second notice channel. +/// +/// Reads the *back* of the queue, not the front: dismissal only ever fires +/// on a keystroke ([`render`]'s `on_key_down` calling `dismiss_notice()`), +/// and most of what fills this queue -- a click on a gap, a menu row, a +/// drag -- is not one. A `front()` plate left showing a `ctrl+s` "SAVED" +/// notice sat frozen through an unrelated mouse-driven refusal that queued +/// in behind it: the ledger strip's own "last action" already reads +/// `back()` for exactly this reason, and the plate disagreeing with it is +/// what made the refusal look like it never reached the notice surface at +/// all. `back()` keeps the two in step and guarantees the newest, most +/// actionable message is always the one on screen. /// /// Anchored off `bench_h` rather than a fixed offset off the ledger: at the /// bench's floor a fixed `LEDGER_H + 6.` bottom offset put the plate right @@ -585,9 +594,14 @@ fn notice_plate(message: SharedString, bench_h: f32) -> impl IntoElement { .absolute() .bottom(px(notice_bottom_offset(bench_h))) .left(px(12.)) - .max_w(px(360.)) + // Wide enough to hold a refusal-plus-remedy sentence in two or three + // lines rather than one line cut mid-word: the ledger strip below is + // the one place that must stay a single truncated line (it also + // carries the project identity, export progress and the timecode on + // the same row), so this plate is the surface with room, and it + // takes it. + .max_w(px(480.)) .flex() - .items_center() .px(px(10.)) .py(px(6.)) .rounded(px(2.)) @@ -922,7 +936,7 @@ pub(crate) fn render( .child(divider(Split::Bench, cx)) .child(bench(player, bench_h, cx)) .child(ledger(player, position)) - .when_some(player.notices.front().cloned(), |el, n| { + .when_some(player.notices.back().cloned(), |el, n| { el.child(notice_plate(n, bench_h)) }) .when(player.keys_open, |el| el.child(keys_overlay(player)))