From 477826132bbcce54dbb22db48852147804140fa2 Mon Sep 17 00:00:00 2001 From: Francesco Renzi Date: Tue, 19 May 2026 02:44:56 -0700 Subject: [PATCH] Address Copilot review feedback - Remove the redundant second `TrimEnd('\n')` from the return path. The earlier trim already removes any trailing newline before the `\n...` doc-end check; the marker-removal substring does not re-introduce one, so the second trim was dead code. - Surface full exception (`ex.ToString()`) in the test round-trip helper so YAML parse failures show stack + inner exception, not just the top-level message. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Runner.Worker/Dap/YamlScalarFormatter.cs | 2 +- src/Test/L0/Worker/YamlScalarFormatterL0.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Runner.Worker/Dap/YamlScalarFormatter.cs b/src/Runner.Worker/Dap/YamlScalarFormatter.cs index 15fa3f380..2191f1c29 100644 --- a/src/Runner.Worker/Dap/YamlScalarFormatter.cs +++ b/src/Runner.Worker/Dap/YamlScalarFormatter.cs @@ -57,7 +57,7 @@ namespace GitHub.Runner.Worker.Dap { raw = raw.Substring(0, raw.Length - DocEndMarker.Length); } - return raw.TrimEnd('\n'); + return raw; } } } diff --git a/src/Test/L0/Worker/YamlScalarFormatterL0.cs b/src/Test/L0/Worker/YamlScalarFormatterL0.cs index e4c441035..4c8ac320c 100644 --- a/src/Test/L0/Worker/YamlScalarFormatterL0.cs +++ b/src/Test/L0/Worker/YamlScalarFormatterL0.cs @@ -27,7 +27,7 @@ namespace GitHub.Runner.Common.Tests.Worker catch (Exception ex) { throw new Xunit.Sdk.XunitException( - $"Formatted scalar did not round-trip as valid YAML.\nInput: '{value}'\nFormatted: '{scalar}'\nFull YAML:\n{yaml}\nError: {ex.Message}"); + $"Formatted scalar did not round-trip as valid YAML.\nInput: '{value}'\nFormatted: '{scalar}'\nFull YAML:\n{yaml}\nError: {ex}"); } Assert.NotNull(doc); Assert.True(doc.ContainsKey("k"), $"missing key in parsed doc. Formatted: '{scalar}'");