From 7ad5912073c2bebe989c313878e190a85b06d00c Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Sat, 27 Jun 2026 10:09:05 -0700 Subject: [PATCH 1/2] Remove temporary base64 function used for coverage validation The base64_encode function and its tests were added solely to validate that the code coverage instrumentation was working. Now that coverage is confirmed working (97% on PR #1600), remove the temporary code. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- dsc/src/main.rs | 62 ------------------------------------------------- 1 file changed, 62 deletions(-) diff --git a/dsc/src/main.rs b/dsc/src/main.rs index 6e5c8c0fd..9414d677d 100644 --- a/dsc/src/main.rs +++ b/dsc/src/main.rs @@ -55,9 +55,6 @@ fn main() { } fn dsc_main() { - // Temporary: validate code coverage instrumentation - let _encoded = base64_encode("coverage-test"); - #[cfg(debug_assertions)] check_debug(); @@ -225,62 +222,3 @@ fn check_store() { } } -/// Temporary function for validating code coverage instrumentation. -/// Encodes a string as base64 without external crates. -fn base64_encode(input: &str) -> String { - const ALPHABET: &[u8; 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - - let bytes = input.as_bytes(); - let mut output = String::with_capacity(bytes.len().div_ceil(3) * 4); - - for chunk in bytes.chunks(3) { - let b0 = chunk[0] as u32; - let b1 = if chunk.len() > 1 { chunk[1] as u32 } else { 0 }; - let b2 = if chunk.len() > 2 { chunk[2] as u32 } else { 0 }; - - let triple = (b0 << 16) | (b1 << 8) | b2; - - output.push(ALPHABET[((triple >> 18) & 0x3F) as usize] as char); - output.push(ALPHABET[((triple >> 12) & 0x3F) as usize] as char); - - if chunk.len() > 1 { - output.push(ALPHABET[((triple >> 6) & 0x3F) as usize] as char); - } else { - output.push('='); - } - - if chunk.len() > 2 { - output.push(ALPHABET[(triple & 0x3F) as usize] as char); - } else { - output.push('='); - } - } - - output -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_base64_encode_empty() { - assert_eq!(base64_encode(""), ""); - } - - #[test] - fn test_base64_encode_basic() { - assert_eq!(base64_encode("Hello"), "SGVsbG8="); - } - - #[test] - fn test_base64_encode_padding() { - assert_eq!(base64_encode("Hi"), "SGk="); - assert_eq!(base64_encode("Hey"), "SGV5"); - } - - #[test] - fn test_base64_encode_coverage_string() { - assert_eq!(base64_encode("coverage-test"), "Y292ZXJhZ2UtdGVzdA=="); - } -} From 0e51a1e30dbb9e05f6b5a2cfc1a480179a05f4f4 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Sat, 27 Jun 2026 10:41:26 -0700 Subject: [PATCH 2/2] Fix Show-CodeCoverageReport when no executable lines changed Allow empty FileDetails array (e.g. when PR only deletes code) instead of failing with a mandatory parameter binding error. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- helpers.build.psm1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/helpers.build.psm1 b/helpers.build.psm1 index db3431743..15bae8654 100644 --- a/helpers.build.psm1 +++ b/helpers.build.psm1 @@ -1961,11 +1961,15 @@ function Show-CodeCoverageReport { #> [CmdletBinding()] param( - [Parameter(Mandatory)] - [PSCustomObject[]]$FileDetails + [Parameter()] + [AllowEmptyCollection()] + [PSCustomObject[]]$FileDetails = @() ) process { + if ($FileDetails.Count -eq 0) { + return + } foreach ($detail in $FileDetails) { $filePath = $detail.File $lineCoverageMap = $detail.LineCoverageMap