From b78492f9bcc2343229b2a8af7cd8429f41de1931 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 9 Jul 2026 08:52:19 +0000 Subject: [PATCH] Fold long undefined-symbol reports with
/ The --details Markdown report of ipk-verify lists every undefined symbol of a failing native binary as a bullet, which can run to dozens or hundreds of entries and make the report unwieldy in CI/PR comments. Collapse the undefined-symbol list into a
/ block when it has more than 10 entries, and only for Markdown output. Terminal and Plain output keep the plain bullet list, where raw HTML tags would just be noise. Missing-library bullets stay inline. To do this, thread the OutputFormat through print_component_details into print_bin_verify_details. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01PfjeD1nBEtfapZGVJ1U9am --- packages/ipk-verify/src/main.rs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/packages/ipk-verify/src/main.rs b/packages/ipk-verify/src/main.rs index 7d03005..e931c54 100644 --- a/packages/ipk-verify/src/main.rs +++ b/packages/ipk-verify/src/main.rs @@ -130,6 +130,7 @@ fn main() { print_component_details( results.iter().map(|(fw, res)| (*fw, &res.app)).collect(), &mut output, + &format, ) .unwrap(); } @@ -158,6 +159,7 @@ fn main() { .map(|(fw, res)| (*fw, res.services.get(idx).unwrap())) .collect(), &mut output, + &format, ) .unwrap(); } @@ -222,6 +224,7 @@ fn print_component_summary( fn print_component_details( results: Vec<(&Firmware, &ComponentVerifyResult)>, out: &mut Box, + out_fmt: &OutputFormat, ) -> Result { let (_, result) = *results.first().unwrap(); if result.detection.is_some() { @@ -236,7 +239,7 @@ fn print_component_details( for (fw, result) in &results { if let ComponentBinVerifyResult::Failed(result) = &result.exe { out.h5(&format!("On {}", fw.info))?; - print_bin_verify_details(result, out)?; + print_bin_verify_details(result, out, out_fmt)?; out.write_fmt(format_args!("\n"))?; } } @@ -257,7 +260,7 @@ fn print_component_details( for (fw, result) in &results { if let ComponentBinVerifyResult::Failed(result) = &result.libs.get(index).unwrap().1 { out.h5(&format!("On {}", fw.info))?; - print_bin_verify_details(result, out)?; + print_bin_verify_details(result, out, out_fmt)?; out.write_fmt(format_args!("\n"))?; } } @@ -265,16 +268,35 @@ fn print_component_details( return Ok(false); } +/// A long list of undefined symbols is folded into a collapsible `
` +/// block rather than emitted inline. +const SYMBOL_FOLD_THRESHOLD: usize = 10; + fn print_bin_verify_details( result: &BinVerifyResult, out: &mut Box, + out_fmt: &OutputFormat, ) -> Result<(), Error> { for lib in &result.missing_lib { out.write_fmt(format_args!("* Library {lib} is missing\n"))?; } + // Collapse a long symbol list behind a
/ so the report + // stays scannable. GitHub renders raw HTML in Markdown; other formats keep + // the plain bullet list (raw tags would be noise there). + let fold = *out_fmt == OutputFormat::Markdown + && result.undefined_sym.len() > SYMBOL_FOLD_THRESHOLD; + if fold { + out.write_fmt(format_args!( + "
\n{} undefined symbols\n\n", + result.undefined_sym.len() + ))?; + } for sym in &result.undefined_sym { out.write_fmt(format_args!("* Symbol {sym} is undefined\n"))?; } + if fold { + out.write_fmt(format_args!("
\n"))?; + } return Ok(()); }