Skip to content

Fix misplaced quote in the tool-failure log line#821

Merged
ptr727 merged 5 commits into
developfrom
fix/tool-failure-log-formatting
Jul 10, 2026
Merged

Fix misplaced quote in the tool-failure log line#821
ptr727 merged 5 commits into
developfrom
fix/tool-failure-log-formatting

Conversation

@ptr727

@ptr727 ptr727 commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Problem

A tool-failure line rendered with a stray quote right after the exit code:

[ERR] Failed execution of FfMpeg : ExitCode: 0" : [null @ ...] ... dts to muxer ... 4 >= 4 |"

MediaTool.LogFailedResult(BufferedCommandResult) passed the error summary as a {Detail} string that already contained the " : " separator. The app's output templates use {Message} (not :lj) so Serilog quotes string values — which pulled the separator inside the quotes, so the opening quote landed right after ExitCode: 0.

ExitCode: 0 on a failure is expected, not a bug: FfMpegTool treats a non-zero exit or any stderr text as a failure (FfMpegTool.cs:161-165), because ffmpeg can exit 0 yet report a fatal error (here, a non-monotonic dts muxer error) on stderr.

Fix

Log the summary as its own {Error} value with the " : " separator in the template, so only the error text is quoted:

[ERR] Failed execution of FfMpeg : ExitCode: 0 : "[null @ ...] ... dts to muxer ... 4 >= 4 |"

Tests

Added ToolFailureLogFormatTests that render through the same {Message} template the sinks use and assert the exit code is clean and only the error text is quoted (the NotContain("ExitCode: 0\"") assertion guards the regression). Full suite: 193 pass, formatters/linters clean.

LogFailedResult passed the error summary as a {Detail} string that already
included the " : " separator. The app's {Message} output template quotes
string values, so the separator was pulled inside the quotes and rendered
as "ExitCode: 0" : ...", with the quote landing right after the exit code.

Log the summary as its own {Error} value with the " : " separator in the
template, so only the error text is quoted: ExitCode: 0 : "...". The exit
code can be 0 on a failure because ffmpeg can exit 0 yet report a fatal
error on stderr (FfMpegTool treats non-zero exit or any stderr as failure).

Add tests that render through the {Message} template to verify the quote
placement.
Copilot AI review requested due to automatic review settings July 10, 2026 15:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the formatting of tool-failure log lines by separating the error summary into its own structured log value, preventing the " : " separator from being pulled inside Serilog’s string quoting when rendered via the {Message} output template.

Changes:

  • Update MediaTool.LogFailedResult(BufferedCommandResult) to log failures with/without an error summary using distinct templates.
  • Add an xUnit test (ToolFailureLogFormatTests) that renders via {Message} and asserts the exit code is not followed by a stray quote and that only the error text is quoted.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
PlexCleaner/MediaTool.cs Adjusts failure logging templates to keep the " : " separator outside Serilog-quoted string values.
PlexCleanerTests/ToolFailureLogFormatTests.cs Adds regression tests validating the exact rendered {Message} formatting for tool-failure lines.

Comment thread PlexCleaner/MediaTool.cs Outdated
Copilot AI review requested due to automatic review settings July 10, 2026 15:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread PlexCleanerTests/ToolFailureLogFormatTests.cs Outdated
Copilot AI review requested due to automatic review settings July 10, 2026 15:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread PlexCleanerTests/ToolFailureLogFormatTests.cs
Copilot AI review requested due to automatic review settings July 10, 2026 15:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 10, 2026 15:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@ptr727
ptr727 merged commit 5bf1baa into develop Jul 10, 2026
15 checks passed
@ptr727
ptr727 deleted the fix/tool-failure-log-formatting branch July 10, 2026 15:55
ptr727 added a commit that referenced this pull request Jul 11, 2026
Replace the assembly-wide xunit.runner.json parallelizeTestCollections:false (added in #821, which slowed the whole suite) with a 'Sequential' collection using DisableParallelization, applied only to the two tests that swap the global Serilog Log.Logger. The rest of the suite parallelizes again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants