git-ents.gitmain
⌘K
foforge
commit a226659
fix: show a friendly message for a check recording with no output

The blank "fmt on 8585358b" box wasn’t a rendering bug: acdc’s replay capture succeeded but a cleanly-passing check (e.g. cargo fmt --check) prints nothing, so there are zero frames to replay. acdc’s own fallback renders an unexplained empty box; the log now confirms this via "terminal replay produced no visible frames".

fix: detect a header-only asciicast and skip acdc entirely for it fix: render "This check produced no terminal output." instead Assisted-by: Claude:claude-sonnet-5

Joseph D. Carpinelli · 1 month ago

Reviews

No reviews of this commit yet — record a verdict below.

Start a review

verdict

crates/git-ents-server/src/asciidoc.rs @@ -74,6 +74,14 @@ .terminal-view__row{white-space:pre;min-height:1.2em} "; +/// Whether an asciicast v2/v3 `recording` has no output events beyond its +/// header line — e.g. a check that passed without printing anything. acdc's +/// replay player renders this as a bare empty box with no explanation, so +/// callers should check this first and show their own message instead. +pub(crate) fn recording_has_no_output(recording: &str) -> bool { + recording.lines().skip(1).all(|line| line.trim().is_empty()) +} + /// Render an asciicast v2/v3 `recording` as a replayable terminal session via /// acdc's `[terminal%replay]` block, or `None` if it cannot be parsed or /// converted. Wraps `recording` in a listing block, so a recording containing
crates/git-ents-server/src/web/pages.rs @@ -995,19 +995,29 @@ let Some(recording) = recording else { return not_found().into_response(); }; - let Some(player) = crate::asciidoc::render_recording(&recording) else { - return not_found().into_response(); + let short_commit = commit.get(..8).unwrap_or(commit); + let body = if crate::asciidoc::recording_has_no_output(&recording) { + html! { + p.muted { "This check produced no terminal output." } + } + } else { + let Some(player) = crate::asciidoc::render_recording(&recording) else { + return not_found().into_response(); + }; + html! { + style { (PreEscaped(crate::asciidoc::TERMINAL_VIEW_CSS)) } + (PreEscaped(player)) + } }; repo_shell( meta, Tab::Checks, - &format!("{name} @ {}", commit.get(..8).unwrap_or(commit)), + &format!("{name} @ {short_commit}"), html! { - style { (PreEscaped(crate::asciidoc::TERMINAL_VIEW_CSS)) } div.page-header { - h1.page-title { (name) " on " code { (commit.get(..8).unwrap_or(commit)) } } + h1.page-title { (name) " on " code { (short_commit) } } } - (PreEscaped(player)) + (body) }, ) .into_response()