forge
Explore
Log in

Don't you dare go Hollow

A notice reports state in capitals — the guard reads the call site

Browse files at this commit

b8a94e6a62ce6d372c52a34cf23ab7d8c663c51cAhmet Kaan GümüşParent: 585827b
  • fix
    • a notice reports state in capitals — the guard reads the call site
Show full message
🐛 fix(app): a notice reports state in capitals — the guard reads the call site

`x` with nothing marked put "Delete — click a clip first" on the ledger: prose
the room is forbidden (DESIGN §8), and instructional at that. The guard that
was meant to catch it scanned only literals whose first word was already in
capitals, so a refusal whose head is the *verb's label* — every refusal the
oracle words — walked past it, along with the eleven card/view notices that
open in lower case.

The scan now finds its subjects by call site (`notify_user`, `push_notice`,
`Enable::No`, `Enable::Hidden`), reads their arguments to the matching paren
and refuses an imperative tell at any length, not only past eight words. The
dispatch shouts the label so a composed refusal opens the way every other
message does: DELETE — nothing selected.
crates/app/src/oracle.rsmodified+4 -4
@@ -253,7 +253,7 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {
253 .split_at(clip.len(), ctx.playhead - clip.start)253 .split_at(clip.len(), ctx.playhead - clip.start)
254 .is_none() =>254 .is_none() =>
255 {255 {
256- Enable::No("this speed holds one frame here — step to the next")256+ Enable::No("this speed holds one frame here")
257 }257 }
258 _ => Enable::Yes,258 _ => Enable::Yes,
259 },259 },
@@ -282,14 +282,14 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {
282 // words itself.282 // words itself.
283 ActionId::Group => match ctx.picks {283 ActionId::Group => match ctx.picks {
284 2.. if ctx.pick_lanes == ctx.picks => Enable::Yes,284 2.. if ctx.pick_lanes == ctx.picks => Enable::Yes,
285- 2.. => Enable::No("a group is one clip per lane: keep one pick per track"),285+ 2.. => Enable::No("a lane is picked twice"),
286 _ => Enable::Yes,286 _ => Enable::Yes,
287 },287 },
288 // The three that act on the marked clip and on nothing else: with none288 // The three that act on the marked clip and on nothing else: with none
289 // marked they would silently do nothing, which is what the Delete289 // marked they would silently do nothing, which is what the Delete
290 // button's own dimming has always said.290 // button's own dimming has always said.
291 ActionId::Copy | ActionId::Delete | ActionId::Lift if ctx.clip.is_none() => {291 ActionId::Copy | ActionId::Delete | ActionId::Lift if ctx.clip.is_none() => {
292- Enable::No("click a clip first")292+ Enable::No("nothing selected")
293 }293 }
294 // The cut machinery (DESIGN.md §6): the odometer, the trim pair and294 // The cut machinery (DESIGN.md §6): the odometer, the trim pair and
295 // the loop-trim all act on the subject cut, and with none marked295 // 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 {
335 // nothing: the transport says so by being dim, which is what its own335 // nothing: the transport says so by being dim, which is what its own
336 // ad-hoc boolean used to say before the oracle knew the question.336 // ad-hoc boolean used to say before the oracle knew the question.
337 ActionId::Play | ActionId::Loop if !ctx.playable => {337 ActionId::Play | ActionId::Loop if !ctx.playable => {
338- Enable::No("put a clip on a lane first")338+ Enable::No("the timeline is empty")
339 }339 }
340 // A rate applies to a clip of either kind and to its whole group, so340 // A rate applies to a clip of either kind and to its whole group, so
341 // there is no lane it means nothing on, and the engine words the one341 // there is no lane it means nothing on, and the engine words the one
crates/app/src/player/actions.rsmodified+2 -2
@@ -20,7 +20,7 @@ impl Player {
20 // A state refusal is spoken: the thing exists and cannot happen20 // A state refusal is spoken: the thing exists and cannot happen
21 // *now*, which is exactly what a silent key press fails to say.21 // *now*, which is exactly what a silent key press fails to say.
22 Enable::No(why) => {22 Enable::No(why) => {
23- self.notify_user(format!("{} — {why}", action.label()).into());23+ self.notify_user(format!("{} — {why}", action.label().to_uppercase()).into());
24 cx.notify();24 cx.notify();
25 return;25 return;
26 }26 }
@@ -216,7 +216,7 @@ impl Player {
216 match enable_lane(action, lane, self.ctx(None)) {216 match enable_lane(action, lane, self.ctx(None)) {
217 Enable::Yes => {}217 Enable::Yes => {}
218 Enable::No(why) => {218 Enable::No(why) => {
219- self.notify_user(format!("{} — {why}", action.label()).into());219+ self.notify_user(format!("{} — {why}", action.label().to_uppercase()).into());
220 cx.notify();220 cx.notify();
221 return;221 return;
222 }222 }
crates/app/src/player/cards.rsmodified+9 -9
@@ -244,7 +244,7 @@ impl Player {
244 return;244 return;
245 }245 }
246 let Some(session) = &self.session else {246 let Some(session) = &self.session else {
247- self.notify_user("no timeline to grade — no file open".into());247+ self.notify_user("NOTHING TO GRADE — no file open".into());
248 cx.notify();248 cx.notify();
249 return;249 return;
250 };250 };
@@ -289,7 +289,7 @@ impl Player {
289 self.pending_color = None;289 self.pending_color = None;
290 self.context_menu = None;290 self.context_menu = None;
291 }291 }
292- None => self.notify_user("no clip under the playhead to grade".into()),292+ None => self.notify_user("NOTHING TO GRADE — no clip under the playhead".into()),
293 }293 }
294 cx.notify();294 cx.notify();
295 }295 }
@@ -399,7 +399,7 @@ impl Player {
399 return;399 return;
400 }400 }
401 let Some(session) = &self.session else {401 let Some(session) = &self.session else {
402- self.notify_user("no timeline to place — no file open".into());402+ self.notify_user("NOTHING TO PLACE — no file open".into());
403 cx.notify();403 cx.notify();
404 return;404 return;
405 };405 };
@@ -430,7 +430,7 @@ impl Player {
430 self.pending_transform = None;430 self.pending_transform = None;
431 self.context_menu = None;431 self.context_menu = None;
432 }432 }
433- None => self.notify_user("no clip under the playhead to place".into()),433+ None => self.notify_user("NOTHING TO PLACE — no clip under the playhead".into()),
434 }434 }
435 cx.notify();435 cx.notify();
436 }436 }
@@ -531,7 +531,7 @@ impl Player {
531 return;531 return;
532 }532 }
533 let Some(session) = &self.session else {533 let Some(session) = &self.session else {
534- self.notify_user("no timeline to re-time — no file open".into());534+ self.notify_user("NOTHING TO RE-TIME — no file open".into());
535 cx.notify();535 cx.notify();
536 return;536 return;
537 };537 };
@@ -569,7 +569,7 @@ impl Player {
569 self.pending_speed = None;569 self.pending_speed = None;
570 self.context_menu = None;570 self.context_menu = None;
571 }571 }
572- None => self.notify_user("no clip under the playhead to re-time".into()),572+ None => self.notify_user("NOTHING TO RE-TIME — no clip under the playhead".into()),
573 }573 }
574 cx.notify();574 cx.notify();
575 }575 }
@@ -693,7 +693,7 @@ impl Player {
693 return;693 return;
694 }694 }
695 let Some(session) = &self.session else {695 let Some(session) = &self.session else {
696- self.notify_user("no timeline to scan — no file open".into());696+ self.notify_user("NOTHING TO SCAN — no file open".into());
697 cx.notify();697 cx.notify();
698 return;698 return;
699 };699 };
@@ -774,7 +774,7 @@ impl Player {
774 ScanPlan::Wait => {}774 ScanPlan::Wait => {}
775 }775 }
776 }776 }
777- None => self.notify_user("no clip under the playhead to scan".into()),777+ None => self.notify_user("NOTHING TO SCAN — no clip under the playhead".into()),
778 }778 }
779 cx.notify();779 cx.notify();
780 }780 }
@@ -1196,7 +1196,7 @@ impl Player {
1196 if self.silence_marks.is_empty() {1196 if self.silence_marks.is_empty() {
1197 self.notify_user(1197 self.notify_user(
1198 format!(1198 format!(
1199- "no silence under {:.0} dBFS lasting {:.2} s",1199+ "NO SILENCE — under {:.0} dBFS lasting {:.2} s",
1200 self.silence.threshold_db, self.silence.min_silence1200 self.silence.threshold_db, self.silence.min_silence
1201 )1201 )
1202 .into(),1202 .into(),
crates/app/src/player/export.rsmodified+1 -1
@@ -505,7 +505,7 @@ impl Player {
505 pub(crate) fn apply_encoder(&mut self, seat: EncoderSeat, cx: &mut Context<Self>) {505 pub(crate) fn apply_encoder(&mut self, seat: EncoderSeat, cx: &mut Context<Self>) {
506 if let Some(session) = &mut self.session {506 if let Some(session) = &mut self.session {
507 session.set_encoder_seat(seat);507 session.set_encoder_seat(seat);
508- self.notify_user(format!("Encoder: {}", encoder_label(seat)).into());508+ self.notify_user(format!("ENCODER: {}", encoder_label(seat)).into());
509 }509 }
510 cx.notify();510 cx.notify();
511 }511 }
crates/app/src/player/view.rsmodified+2 -2
@@ -133,7 +133,7 @@ impl Player {
133 return;133 return;
134 }134 }
135 let Some(session) = &mut self.session else {135 let Some(session) = &mut self.session else {
136- self.notify_user("no timeline to fit — no file open".into());136+ self.notify_user("NOTHING TO FIT — no file open".into());
137 cx.notify();137 cx.notify();
138 return;138 return;
139 };139 };
@@ -165,7 +165,7 @@ impl Player {
165 other => other.or_else(|| session.video_clip_at(session.now())),165 other => other.or_else(|| session.video_clip_at(session.now())),
166 };166 };
167 let Some((lane, idx)) = target else {167 let Some((lane, idx)) = target else {
168- self.notify_user("no clip under the playhead to fit".into());168+ self.notify_user("NOTHING TO FIT — no clip under the playhead".into());
169 cx.notify();169 cx.notify();
170 return;170 return;
171 };171 };
crates/app/src/tests/editing.rsmodified+4 -4
@@ -285,7 +285,7 @@ fn a_caption_is_deleted_by_the_same_row_and_stroke_every_box_is() {
285 "the one thing a placed caption could always be asked to do",285 "the one thing a placed caption could always be asked to do",
286 );286 );
287 // The clip rows are refusals of *kind* on a caption, so the menu leaves287 // The clip rows are refusals of *kind* on a caption, so the menu leaves
288- // them out rather than drawing "click a clip first" over a clicked box.288+ // them out rather than drawing "nothing selected" over a clicked box.
289 for clip_only in [ActionId::Copy, ActionId::Lift, ActionId::Equalizer] {289 for clip_only in [ActionId::Copy, ActionId::Lift, ActionId::Equalizer] {
290 assert_eq!(290 assert_eq!(
291 enable(clip_only, cap),291 enable(clip_only, cap),
@@ -564,7 +564,7 @@ fn group_is_live_over_a_multi_selection_and_words_a_repeated_lane() {
564 };564 };
565 assert_eq!(565 assert_eq!(
566 enable(ActionId::Group, twice),566 enable(ActionId::Group, twice),
567- Enable::No("a group is one clip per lane: keep one pick per track")567+ Enable::No("a lane is picked twice")
568 );568 );
569 // One pick and none at all: the partner hunt and its own refusal, which569 // One pick and none at all: the partner hunt and its own refusal, which
570 // the player words rather than the oracle.570 // 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() {
683 assert!(!offered(&slow, v1, ActionId::Cut, 35));683 assert!(!offered(&slow, v1, ActionId::Cut, 35));
684 assert_eq!(684 assert_eq!(
685 on(&slow, v1, ActionId::Cut, 35).why(),685 on(&slow, v1, ActionId::Cut, 35).why(),
686- Some("this speed holds one frame here — step to the next"),686+ Some("this speed holds one frame here"),
687 );687 );
688 assert_eq!(688 assert_eq!(
689 on(&slow, v1, ActionId::Cut, 30).why(),689 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() {
904 ..live904 ..live
905 }905 }
906 ),906 ),
907- Enable::No("put a clip on a lane first")907+ Enable::No("the timeline is empty")
908 );908 );
909 // The magnet and the monitoring level are the editor's own and answer909 // The magnet and the monitoring level are the editor's own and answer
910 // with no timeline at all -- the keyboard always fired them there, and910 // with no timeline at all -- the keyboard always fired them there, and
crates/app/src/tests/layout.rsmodified+62 -22
@@ -3305,12 +3305,13 @@ fn the_cut_readout_counts_from_the_playhead() {
3305 /// notices are what the ledger strip paints, and a sentence there is what cut3305 /// notices are what the ledger strip paints, and a sentence there is what cut
3306 /// mid-word in the user's own screenshot (`OPENED ... 1 subtitle track(s) in `).3306 /// mid-word in the user's own screenshot (`OPENED ... 1 subtitle track(s) in `).
3307 ///3307 ///
3308-/// The scan reads every notice-shaped literal -- one whose first word is a3308+/// The scan reads every literal handed to a notice constructor, found by its
3309-/// state word in capitals, which is how every message this window pushes3309+/// *call site* and not by its shape: the head of a composed refusal is the
3310-/// opens -- and refuses one that is both long (over eight words) and3310+/// verb's own label ("Delete — click a clip first", seen live 2026-09-09), so
3311-/// instructional (an imperative tell). A refusal *claim* may still be long:3311+/// a caps-headed filter walked past every one of them. Any imperative tell in
3312-/// those are the allowlist below, each one naming a genuine absent capability,3312+/// such a literal is a defect at any length. A refusal *claim* may still be
3313-/// never a lesson in how to use the room.3313+/// long: those are the allowlist below, each one naming a genuine absent
3314+/// capability, never a lesson in how to use the room.
3314 #[test]3315 #[test]
3315 fn no_notice_teaches_the_room_in_prose() {3316 fn no_notice_teaches_the_room_in_prose() {
3316 // Long refusal claims that report a capability genuinely absent from this3317 // Long refusal claims that report a capability genuinely absent from this
@@ -3328,28 +3329,17 @@ fn no_notice_teaches_the_room_in_prose() {
3328 "to use",3329 "to use",
3329 "takes it back",3330 "takes it back",
3330 "puts it back",3331 "puts it back",
3331- "first",3332+ " first",
3332- "instead",
3333 ];3333 ];
3334 let mut offenders = Vec::new();3334 let mut offenders = Vec::new();
3335 for path in source_files() {3335 for path in source_files() {
3336 let text = std::fs::read_to_string(&path).expect("a source file");3336 let text = std::fs::read_to_string(&path).expect("a source file");
3337- for literal in string_literals(&text) {3337+ for literal in notice_literals(&text) {
3338- // A notice opens with its state in capitals -- placeholders in3338+ if ALLOWED.iter().any(|allowed| literal.contains(allowed)) {
3339- // front of it (`{count} SILENCES CUT`) are stepped over.
3340- let head = literal
3341- .split_whitespace()
3342- .find(|word| !word.starts_with('{'))
3343- .unwrap_or("");
3344- let shouty = head.len() >= 2
3345- && head
3346- .chars()
3347- .all(|c| c.is_ascii_uppercase() || c == '-' || c == ':');
3348- if !shouty || ALLOWED.iter().any(|allowed| literal.starts_with(allowed)) {
3349 continue;3339 continue;
3350 }3340 }
3351- let long = literal.split_whitespace().count() > 8;3341+ let lower = literal.to_lowercase();
3352- if long && TELLS.iter().any(|tell| literal.contains(tell)) {3342+ if TELLS.iter().any(|tell| lower.contains(tell)) {
3353 offenders.push(format!("{}: {literal}", path.display()));3343 offenders.push(format!("{}: {literal}", path.display()));
3354 }3344 }
3355 }3345 }
@@ -3361,6 +3351,56 @@ fn no_notice_teaches_the_room_in_prose() {
3361 );3351 );
3362 }3352 }
3363 3353
3354+/// Every string literal that reaches the user as a notice: the arguments of
3355+/// the doors a message comes through -- the queue's own two, and the oracle's
3356+/// refusal words, which the dispatch pastes behind an action label
3357+/// ([`crate::player::actions`]). Reading the call site rather than the string
3358+/// is the point: a message's case says nothing about whether it teaches.
3359+fn notice_literals(text: &str) -> Vec<String> {
3360+ const CALLS: &[&str] = &[
3361+ "notify_user(",
3362+ "push_notice(",
3363+ "Enable::No(",
3364+ "Enable::Hidden(",
3365+ ];
3366+ let code: String = text
3367+ .lines()
3368+ .filter(|line| !line.trim_start().starts_with("//"))
3369+ .collect::<Vec<_>>()
3370+ .join("\n");
3371+ let mut out = Vec::new();
3372+ for call in CALLS {
3373+ for (at, _) in code.match_indices(call) {
3374+ let open = at + call.len();
3375+ // The call's own argument list, to its matching paren: a literal
3376+ // written two lines below the opening one is still this call's.
3377+ let mut depth = 1usize;
3378+ let mut in_string = false;
3379+ let mut escaped = false;
3380+ let mut end = open;
3381+ for (offset, c) in code[open..].char_indices() {
3382+ end = open + offset;
3383+ match (in_string, c) {
3384+ (true, '\\') => escaped = !escaped,
3385+ (true, '"') if !escaped => in_string = false,
3386+ (true, _) => escaped = false,
3387+ (false, '"') => in_string = true,
3388+ (false, '(') => depth += 1,
3389+ (false, ')') => {
3390+ depth -= 1;
3391+ if depth == 0 {
3392+ break;
3393+ }
3394+ }
3395+ _ => {}
3396+ }
3397+ }
3398+ out.extend(string_literals(&code[open..end]));
3399+ }
3400+ }
3401+ out
3402+}
3403+
3364 /// Every string literal in `text`, comments dropped first so the prose about3404 /// Every string literal in `text`, comments dropped first so the prose about
3365 /// a message is never read as the message.3405 /// a message is never read as the message.
3366 fn string_literals(text: &str) -> Vec<String> {3406 fn string_literals(text: &str) -> Vec<String> {