From f6a85ba5ca87ade4efa5f5a11a2cc86fd28a38b9 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sun, 16 Aug 2026 03:09:20 +0800 Subject: [PATCH] test(kitty): refuse every indirect medium on a remote pane, not just shm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `query_reply_refuses_shm_file_on_remote_pane` probed `t=d` and `t=s` and stopped, while its local counterpart probes all three of `t=s`, `t=f` and `t=t`. The refusing side is the one where a gap would matter: `t=f` and `t=t` name a path on *this* machine, and on a remote pane the sender is at the other end of an ssh link. The behaviour was already right — `honored` is `medium == Direct || honors_indirect_media()`, one classification for every indirect medium, so file and tempfile were refused by the same branch shm was. This is coverage catching up with the name, not a fix. Confirmed it earns its place: honoring `Medium::File` on a remote pane now fails the test naming the probe, where before it passed untouched. The message spells the probe out the way the shm-name test does, so a failure reads as a probe rather than 36 bytes. --- crates/tty7-core/src/core/kitty_graphics.rs | 30 ++++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/crates/tty7-core/src/core/kitty_graphics.rs b/crates/tty7-core/src/core/kitty_graphics.rs index f665435e..3a42ac21 100644 --- a/crates/tty7-core/src/core/kitty_graphics.rs +++ b/crates/tty7-core/src/core/kitty_graphics.rs @@ -1570,14 +1570,30 @@ mod tests { } _ => panic!("expected query"), } - // The shm/file medium probes must be refused so the sender falls back. - let ev = p.feed(b"Gi=299,a=q,t=s,f=32,s=1,v=1;L3B4LXE").unwrap(); - match ev { - Event::Query { reply, honored } => { - assert!(!honored); - assert_eq!(reply, b"\x1b_Gi=299;ENOTSUPPORTED\x1b\\".to_vec()); + // Every indirect medium, not just shm: `t=f` and `t=t` name a path on + // *this* machine, and the sender is on the other end of an ssh link. + // The local counterpart probes all three, and the refusing side is the + // one where a gap would matter. + for (id, probe) in [ + (299, &b"Gi=299,a=q,t=s,f=32,s=1,v=1;L3B4LXE"[..]), + (300, &b"Gi=300,a=q,t=f,f=32,s=1,v=1;L3RtcC94"[..]), + (301, &b"Gi=301,a=q,t=t,f=32,s=1,v=1;L3RtcC94"[..]), + ] { + let ev = p.feed(probe).unwrap(); + match ev { + Event::Query { reply, honored } => { + assert!( + !honored, + "remote pane honored {}", + String::from_utf8_lossy(probe) + ); + assert_eq!( + reply, + format!("\x1b_Gi={id};ENOTSUPPORTED\x1b\\").into_bytes() + ); + } + _ => panic!("expected query"), } - _ => panic!("expected query"), } }