test(tty): wire-witness the channel_close cancel path + the no-exit-chunk close shape, record the write_all no-deadline limit (w4-tty-coverage)

- wire row: a client close on a served pipe row fires the per-channel
  cancel (kill-on-drop witnessed before teardown, no exit report
  fabricated, ended lifecycle event) and releases the cap (over-cap
  open refused at 1, re-open admits + routes after the close)
- wire row: the Closed no-exit-chunk close shape, constructed through
  the real path (an oversized shim chunk dies at alktty's own
  ChunkWriter validation -> bridge EOF, scripted exit never forwarded,
  plain close, nothing fabricated); Break's frame classification
  pinned by a unit row (wire-unreachable through the validated writer
  at this pin - recorded)
- module docs: the stdout write_all no-deadline known limit recorded
  (the gate's disposition: bounded backpressure, inactivity-timeout
  liveness; a deadline would be a behavior change)

Verification: cargo test (default/session/session+git/git/tunnel/sftp/
--all-features, tty rows 5x repeat), clippy x2 -D warnings, fmt, doc,
taskgraph validate
This commit is contained in:
glm-5.3-flash committed 2026-10-29 07:46:16 +00:00
1 parent 3d3bb5e9bf
commit 0506f233fc
3 files changed
+292 -10

No files matched your search

+35
View File
@@ -102,6 +102,15 @@
//! nothing (the chunk is the sole fidelity input; its absence is
//! neither 0 nor 255 — no fabricated report): plain close, and
//! the lifecycle's ended event.
//! - **Known limit (recorded disposition, wave-3 gate booked item 3):
//! the stdout [`tokio::io::AsyncWriteExt::write_all`] carries no
//! deadline.** Backpressure is bounded (the bounded bridging duplex,
//! russh's per-channel window and the client's own flow control bound
//! what can pile up) and liveness is covered by the inactivity
//! timeout ([`crate::Limits::inactivity_timeout`], always set) — a
//! deadline here would be a behavior change (a slow client may stall
//! its stream, vanilla sshd's posture included), not a coverage
//! minor. So the limit is recorded, not "fixed".
//!
//! ## The control rows
//!
@@ -893,4 +902,30 @@ mod tests {
assert_eq!(sig_control_name(&Sig::USR1), "USR1");
assert_eq!(sig_control_name(&Sig::Custom("ABRT".to_owned())), "ABRT");
}
/// - *Contract stamp:* the no-exit-chunk close family's frame
/// classification (`w4-tty-coverage` — the wire row in
/// `tests/tty_mapping.rs` lands the family's serving outcome): a
/// clean read-end classifies `Closed`, an oversized claimed
/// length classifies `Break` — bounds-checked both directions,
/// never an oversized read. `Break`'s serving arm is one body
/// with `Closed`'s; through alktty's own validated `ChunkWriter`
/// a `Break` frame is unreachable on the duplex (the drainer
/// rejects the oversized chunk locally and the read sees EOF —
/// the wire row's construction), so the classification rows pin
/// the defensive arm at the frame layer.
#[tokio::test]
async fn clean_ends_classify_closed_and_oversized_lengths_classify_break() {
let mut clean: &[u8] = &[];
assert!(matches!(
super::read_bridge_frame(&mut clean).await,
super::BridgeFrame::Closed
));
let mut oversized: &[u8] = &[0x01, 0x01, 0x00, 0x00, 0x01];
assert!(matches!(
super::read_bridge_frame(&mut oversized).await,
super::BridgeFrame::Break
));
}
}