diff --git a/crates/app/src/oracle.rs b/crates/app/src/oracle.rs index b913e9c..d7f026d 100644 --- a/crates/app/src/oracle.rs +++ b/crates/app/src/oracle.rs @@ -253,7 +253,7 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable { .split_at(clip.len(), ctx.playhead - clip.start) .is_none() => { - Enable::No("this speed holds one frame here — step to the next") + Enable::No("this speed holds one frame here") } _ => Enable::Yes, }, @@ -282,14 +282,14 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable { // words itself. ActionId::Group => match ctx.picks { 2.. if ctx.pick_lanes == ctx.picks => Enable::Yes, - 2.. => Enable::No("a group is one clip per lane: keep one pick per track"), + 2.. => Enable::No("a lane is picked twice"), _ => Enable::Yes, }, // The three that act on the marked clip and on nothing else: with none // marked they would silently do nothing, which is what the Delete // button's own dimming has always said. ActionId::Copy | ActionId::Delete | ActionId::Lift if ctx.clip.is_none() => { - Enable::No("click a clip first") + Enable::No("nothing selected") } // The cut machinery (DESIGN.md §6): the odometer, the trim pair and // the loop-trim all act on the subject cut, and with none marked @@ -335,7 +335,7 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable { // nothing: the transport says so by being dim, which is what its own // ad-hoc boolean used to say before the oracle knew the question. ActionId::Play | ActionId::Loop if !ctx.playable => { - Enable::No("put a clip on a lane first") + Enable::No("the timeline is empty") } // A rate applies to a clip of either kind and to its whole group, so // there is no lane it means nothing on, and the engine words the one diff --git a/crates/app/src/player/actions.rs b/crates/app/src/player/actions.rs index 452dc74..2037557 100644 --- a/crates/app/src/player/actions.rs +++ b/crates/app/src/player/actions.rs @@ -20,7 +20,7 @@ impl Player { // A state refusal is spoken: the thing exists and cannot happen // *now*, which is exactly what a silent key press fails to say. Enable::No(why) => { - self.notify_user(format!("{} — {why}", action.label()).into()); + self.notify_user(format!("{} — {why}", action.label().to_uppercase()).into()); cx.notify(); return; } @@ -216,7 +216,7 @@ impl Player { match enable_lane(action, lane, self.ctx(None)) { Enable::Yes => {} Enable::No(why) => { - self.notify_user(format!("{} — {why}", action.label()).into()); + self.notify_user(format!("{} — {why}", action.label().to_uppercase()).into()); cx.notify(); return; } diff --git a/crates/app/src/player/cards.rs b/crates/app/src/player/cards.rs index 114ad2f..d9245b5 100644 --- a/crates/app/src/player/cards.rs +++ b/crates/app/src/player/cards.rs @@ -244,7 +244,7 @@ impl Player { return; } let Some(session) = &self.session else { - self.notify_user("no timeline to grade — no file open".into()); + self.notify_user("NOTHING TO GRADE — no file open".into()); cx.notify(); return; }; @@ -289,7 +289,7 @@ impl Player { self.pending_color = None; self.context_menu = None; } - None => self.notify_user("no clip under the playhead to grade".into()), + None => self.notify_user("NOTHING TO GRADE — no clip under the playhead".into()), } cx.notify(); } @@ -399,7 +399,7 @@ impl Player { return; } let Some(session) = &self.session else { - self.notify_user("no timeline to place — no file open".into()); + self.notify_user("NOTHING TO PLACE — no file open".into()); cx.notify(); return; }; @@ -430,7 +430,7 @@ impl Player { self.pending_transform = None; self.context_menu = None; } - None => self.notify_user("no clip under the playhead to place".into()), + None => self.notify_user("NOTHING TO PLACE — no clip under the playhead".into()), } cx.notify(); } @@ -531,7 +531,7 @@ impl Player { return; } let Some(session) = &self.session else { - self.notify_user("no timeline to re-time — no file open".into()); + self.notify_user("NOTHING TO RE-TIME — no file open".into()); cx.notify(); return; }; @@ -569,7 +569,7 @@ impl Player { self.pending_speed = None; self.context_menu = None; } - None => self.notify_user("no clip under the playhead to re-time".into()), + None => self.notify_user("NOTHING TO RE-TIME — no clip under the playhead".into()), } cx.notify(); } @@ -693,7 +693,7 @@ impl Player { return; } let Some(session) = &self.session else { - self.notify_user("no timeline to scan — no file open".into()); + self.notify_user("NOTHING TO SCAN — no file open".into()); cx.notify(); return; }; @@ -774,7 +774,7 @@ impl Player { ScanPlan::Wait => {} } } - None => self.notify_user("no clip under the playhead to scan".into()), + None => self.notify_user("NOTHING TO SCAN — no clip under the playhead".into()), } cx.notify(); } @@ -1196,7 +1196,7 @@ impl Player { if self.silence_marks.is_empty() { self.notify_user( format!( - "no silence under {:.0} dBFS lasting {:.2} s", + "NO SILENCE — under {:.0} dBFS lasting {:.2} s", self.silence.threshold_db, self.silence.min_silence ) .into(), diff --git a/crates/app/src/player/export.rs b/crates/app/src/player/export.rs index b2db572..2d5e891 100644 --- a/crates/app/src/player/export.rs +++ b/crates/app/src/player/export.rs @@ -505,7 +505,7 @@ impl Player { pub(crate) fn apply_encoder(&mut self, seat: EncoderSeat, cx: &mut Context) { if let Some(session) = &mut self.session { session.set_encoder_seat(seat); - self.notify_user(format!("Encoder: {}", encoder_label(seat)).into()); + self.notify_user(format!("ENCODER: {}", encoder_label(seat)).into()); } cx.notify(); } diff --git a/crates/app/src/player/view.rs b/crates/app/src/player/view.rs index 0e5f60e..ea0f3ed 100644 --- a/crates/app/src/player/view.rs +++ b/crates/app/src/player/view.rs @@ -133,7 +133,7 @@ impl Player { return; } let Some(session) = &mut self.session else { - self.notify_user("no timeline to fit — no file open".into()); + self.notify_user("NOTHING TO FIT — no file open".into()); cx.notify(); return; }; @@ -165,7 +165,7 @@ impl Player { other => other.or_else(|| session.video_clip_at(session.now())), }; let Some((lane, idx)) = target else { - self.notify_user("no clip under the playhead to fit".into()); + self.notify_user("NOTHING TO FIT — no clip under the playhead".into()); cx.notify(); return; }; diff --git a/crates/app/src/tests/editing.rs b/crates/app/src/tests/editing.rs index 1be6954..d0cc8f0 100644 --- a/crates/app/src/tests/editing.rs +++ b/crates/app/src/tests/editing.rs @@ -285,7 +285,7 @@ fn a_caption_is_deleted_by_the_same_row_and_stroke_every_box_is() { "the one thing a placed caption could always be asked to do", ); // The clip rows are refusals of *kind* on a caption, so the menu leaves - // them out rather than drawing "click a clip first" over a clicked box. + // them out rather than drawing "nothing selected" over a clicked box. for clip_only in [ActionId::Copy, ActionId::Lift, ActionId::Equalizer] { assert_eq!( enable(clip_only, cap), @@ -564,7 +564,7 @@ fn group_is_live_over_a_multi_selection_and_words_a_repeated_lane() { }; assert_eq!( enable(ActionId::Group, twice), - Enable::No("a group is one clip per lane: keep one pick per track") + Enable::No("a lane is picked twice") ); // One pick and none at all: the partner hunt and its own refusal, which // the player words rather than the oracle. @@ -683,7 +683,7 @@ fn the_clip_menu_dims_what_the_playhead_is_not_on_and_stays_in_the_window() { assert!(!offered(&slow, v1, ActionId::Cut, 35)); assert_eq!( on(&slow, v1, ActionId::Cut, 35).why(), - Some("this speed holds one frame here — step to the next"), + Some("this speed holds one frame here"), ); assert_eq!( on(&slow, v1, ActionId::Cut, 30).why(), @@ -904,7 +904,7 @@ fn the_clip_menu_dims_what_the_playhead_is_not_on_and_stays_in_the_window() { ..live } ), - Enable::No("put a clip on a lane first") + Enable::No("the timeline is empty") ); // The magnet and the monitoring level are the editor's own and answer // with no timeline at all -- the keyboard always fired them there, and diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index f302df7..8b51057 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -3305,12 +3305,13 @@ fn the_cut_readout_counts_from_the_playhead() { /// notices are what the ledger strip paints, and a sentence there is what cut /// mid-word in the user's own screenshot (`OPENED ... 1 subtitle track(s) in `). /// -/// The scan reads every notice-shaped literal -- one whose first word is a -/// state word in capitals, which is how every message this window pushes -/// opens -- and refuses one that is both long (over eight words) and -/// instructional (an imperative tell). A refusal *claim* may still be long: -/// those are the allowlist below, each one naming a genuine absent capability, -/// never a lesson in how to use the room. +/// The scan reads every literal handed to a notice constructor, found by its +/// *call site* and not by its shape: the head of a composed refusal is the +/// verb's own label ("Delete — click a clip first", seen live 2026-09-09), so +/// a caps-headed filter walked past every one of them. Any imperative tell in +/// such a literal is a defect at any length. A refusal *claim* may still be +/// long: those are the allowlist below, each one naming a genuine absent +/// capability, never a lesson in how to use the room. #[test] fn no_notice_teaches_the_room_in_prose() { // Long refusal claims that report a capability genuinely absent from this @@ -3328,28 +3329,17 @@ fn no_notice_teaches_the_room_in_prose() { "to use", "takes it back", "puts it back", - "first", - "instead", + " first", ]; let mut offenders = Vec::new(); for path in source_files() { let text = std::fs::read_to_string(&path).expect("a source file"); - for literal in string_literals(&text) { - // A notice opens with its state in capitals -- placeholders in - // front of it (`{count} SILENCES CUT`) are stepped over. - let head = literal - .split_whitespace() - .find(|word| !word.starts_with('{')) - .unwrap_or(""); - let shouty = head.len() >= 2 - && head - .chars() - .all(|c| c.is_ascii_uppercase() || c == '-' || c == ':'); - if !shouty || ALLOWED.iter().any(|allowed| literal.starts_with(allowed)) { + for literal in notice_literals(&text) { + if ALLOWED.iter().any(|allowed| literal.contains(allowed)) { continue; } - let long = literal.split_whitespace().count() > 8; - if long && TELLS.iter().any(|tell| literal.contains(tell)) { + let lower = literal.to_lowercase(); + if TELLS.iter().any(|tell| lower.contains(tell)) { offenders.push(format!("{}: {literal}", path.display())); } } @@ -3361,6 +3351,56 @@ fn no_notice_teaches_the_room_in_prose() { ); } +/// Every string literal that reaches the user as a notice: the arguments of +/// the doors a message comes through -- the queue's own two, and the oracle's +/// refusal words, which the dispatch pastes behind an action label +/// ([`crate::player::actions`]). Reading the call site rather than the string +/// is the point: a message's case says nothing about whether it teaches. +fn notice_literals(text: &str) -> Vec { + const CALLS: &[&str] = &[ + "notify_user(", + "push_notice(", + "Enable::No(", + "Enable::Hidden(", + ]; + let code: String = text + .lines() + .filter(|line| !line.trim_start().starts_with("//")) + .collect::>() + .join("\n"); + let mut out = Vec::new(); + for call in CALLS { + for (at, _) in code.match_indices(call) { + let open = at + call.len(); + // The call's own argument list, to its matching paren: a literal + // written two lines below the opening one is still this call's. + let mut depth = 1usize; + let mut in_string = false; + let mut escaped = false; + let mut end = open; + for (offset, c) in code[open..].char_indices() { + end = open + offset; + match (in_string, c) { + (true, '\\') => escaped = !escaped, + (true, '"') if !escaped => in_string = false, + (true, _) => escaped = false, + (false, '"') => in_string = true, + (false, '(') => depth += 1, + (false, ')') => { + depth -= 1; + if depth == 0 { + break; + } + } + _ => {} + } + } + out.extend(string_literals(&code[open..end])); + } + } + out +} + /// Every string literal in `text`, comments dropped first so the prose about /// a message is never read as the message. fn string_literals(text: &str) -> Vec {