Skip to content

Add Sidecar Failure, Tool Change Logging, and Summarize Tests - #1190

Merged
ptr727 merged 1 commit into
developfrom
feature/coverage-sidecar-tests
Nov 3, 2026
Merged

ptr727 merged 1 commit into
developfrom
feature/coverage-sidecar-tests

Conversation

@ptr727

@ptr727 ptr727 commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Adds tests for sidecar failure paths, the per-tool version-mismatch warning, and tool output summarizing.

  • SidecarFileFailureTests:
    • A sidecar that cannot be parsed fails Read and logs the JSON read error.
    • A sidecar missing each tool's data (MediaInfoData, MkvMergeInfoData, FfProbeInfoData) fails Read.
    • A sidecar update whose write fails, because the sidecar path is a directory, fails Open and logs the write error.
  • ToolChangeSenseTests gains a theory: with SidecarUpdateOnToolChange on, a version change in each of FfProbe, MkvMerge, and MediaInfo makes the sidecar not current, and warns for that tool alone.
  • MediaToolSummarizeTests: long tool output keeps its first 2 and last 8 lines (StartLines and StopLines), and short output stays whole.

This is phase 6 of the coverage plan on the coverage track (#1171), group E. It covers 41 of the 82 lines Codecov reported missed in SidecarFile.cs at the phase 5 measurement, and 3 in MediaTool.cs. The rest of SidecarFile.cs is mostly ComputeHash's short-read error blocks, which need a file truncated mid-read, and cancel paths, which no unit test can trigger without cancelling the program's one-shot token.

Verification: the .NET Format chain is clean, and the unit suite passes (559 tests). The local strict review raised no findings.

🤖 Generated with Claude Code

Cover a sidecar that cannot be parsed, one missing each tool's data, a
sidecar update whose write fails, the version-mismatch warning for each
of the three tools, and summarizing long tool output to its first and
last lines.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings November 3, 2026 03:15
@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 3f993975-ff83-4907-b1e7-f659e487c34a
Commits

Reviewing files that changed from the base of the PR and between fc70c62 and 2ec06fc.

Files selected for processing: 3
  • PlexCleanerTests/MediaToolSummarizeTests.cs
  • PlexCleanerTests/SidecarFileFailureTests.cs
  • PlexCleanerTests/ToolChangeSenseTests.cs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@ptr727

ptr727 commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 2ec06fca8c0febe9c9a2d3b10c4e28774c1f9161, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Expand sidecar failure, tool-change warning, and output summary tests

🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Cover malformed, incomplete, and unwritable sidecars to verify failures and error logs.
• Verify each tool version mismatch invalidates the sidecar and emits its specific warning.
• Check long output retains its first two and last eight lines; short output stays intact.
Diagram

graph TD
  Fixture["FakeTools fixture"] --> Failure["Failure tests"] --> Sidecar["SidecarFile"] --> Capture["LogCapture"]
  Fixture --> Change["Tool change tests"] --> Sidecar
  Summary["Summarize tests"] --> Tool["MediaTool"]
Loading
High-Level Assessment

Focused unit tests using the existing sample fixture and log-capture helper are appropriate for these branches. Broader integration tests would add setup without improving assertions about the specific failures, warnings, or summary boundaries.

Files changed (3) +188 / -0

Tests (3) +188 / -0
MediaToolSummarizeTests.csTest long and short tool-output summaries +51/-0

Test long and short tool-output summaries

• Adds assertions that a 20-line output retains its first two and last eight lines, while a five-line output remains complete.

PlexCleanerTests/MediaToolSummarizeTests.cs

SidecarFileFailureTests.csTest sidecar read and write failure paths +99/-0

Test sidecar read and write failure paths

• Tests invalid JSON, missing data for each of the three media tools, and a sidecar path that cannot be written. Asserts failure results and relevant error logs.

PlexCleanerTests/SidecarFileFailureTests.cs

ToolChangeSenseTests.csTest per-tool version mismatch warnings +38/-0

Test per-tool version mismatch warnings

• Adds a theory for FfProbe, MkvMerge, and MediaInfo version changes. Each case asserts that the sidecar is not current and that one warning identifies the changed tool.

PlexCleanerTests/ToolChangeSenseTests.cs

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.

🟢 Approval recommended

No active issues were identified in the reviewed test-only changes, which cover sidecar failures, tool version mismatches, and media-output summarization.

No open issues 🎉

What changed in this PR

This pull request expands unit-test coverage for sidecar read/write failures, per-tool version-mismatch logging, and media-tool output summarization without changing production code.

Changes:

  • Adds sidecar parsing, missing-data, and write-failure tests with log assertions.
  • Adds version-mismatch coverage for FFprobe, MkvMerge, and MediaInfo.
  • Verifies long-output summarization and preservation of short output.
File Description
PlexCleanerTests/​ToolChangeSenseTests.cs Tests tool-specific version mismatch detection and warning logging.
PlexCleanerTests/​SidecarFileFailureTests.cs Tests invalid, incomplete, and unwritable sidecar failure paths.
PlexCleanerTests/​MediaToolSummarizeTests.cs Tests long-output summarization and short-output preservation.

Review effort: Lite

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Tool-change logging test fails on timestamps 🐞 Bug ≡ Correctness
Description
IsMediaAndToolsCurrent(true) logs a media timestamp warning before it logs the requested
tool-version mismatch. Because the copied sample sidecar stores a fixed 2025 timestamp while the
copied media file has a different timestamp, the captured warnings contain at least two entries and
ContainSingle fails for every theory case.
Code

PlexCleanerTests/ToolChangeSenseTests.cs[R96-99]

+        _ = LogCapture
+            .Messages(events, LogEventLevel.Warning)
+            .Should()
+            .ContainSingle(message => message.Contains("tool version mismatch"))
Evidence
The test captures warnings only around the explicit IsMediaAndToolsCurrent(true) call and requires
exactly one warning. That call checks media currency first, and the fixture copies a media file
while retaining a sidecar with a fixed 2025 timestamp, so IsMediaCurrent(true) emits a timestamp
warning before IsToolsCurrent(true) emits the tool mismatch warning.

PlexCleanerTests/ToolChangeSenseTests.cs[91-101]
PlexCleanerTests/FakeTools.cs[22-47]
Samples/PlexCleaner/Sidecar.v5.PlexCleaner[5-8]
PlexCleaner/SidecarFile.cs[268-271]
PlexCleaner/SidecarFile.cs[343-360]
PlexCleaner/SidecarFile.cs[399-418]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The tool-change logging theory captures `IsMediaAndToolsCurrent(true)` after copying a sample media file whose sidecar contains a fixed, stale `MediaLastWriteTimeUtc`. The method therefore logs both a media timestamp warning and the intended tool-version warning, so the `ContainSingle` assertion fails.
## Fix Focus Areas
- PlexCleanerTests/ToolChangeSenseTests.cs[91-101]
- PlexCleanerTests/FakeTools.cs[22-47]
## Recommended Fix
Make the media sidecar current before invoking the captured call, or change the assertion to select and validate the expected tool-version warning without requiring it to be the only warning. Preserve the existing assertion that the changed tool name appears in the matching warning.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can tweak Display settings with a live preview to see your comment before it ships

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@ptr727

ptr727 commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Qodo: Tool-change logging test fails on timestamps

Declined, because the test passes and the assertion tolerates the timestamp warning:

  • This PR's "Unit test job (Python 3.13)" runs the .NET suite. Its log reads Test run summary: Passed! total: 561, failed: 0, and that includes all three IsMediaAndToolsCurrent_ToolChange_LogsTheChangedTool rows. The suite passed locally too.
  • The assertion is ContainSingle(message => message.Contains("tool version mismatch")). AwesomeAssertions' predicate form requires exactly one matching message, and allows any number of others. So the "LastWriteTimeUtc out of sync" warning that IsMediaCurrent(true) may log is not counted. The chained .Which then checks that the one mismatch names the changed tool.
  • IsMediaCurrent returns true for this sample, which is why the tool comparison runs at all. If the timestamp made it false, the && would short-circuit, no mismatch would be logged, and the test would fail. It doesn't.

@ptr727
ptr727 merged commit 98158e5 into develop Nov 3, 2026
25 checks passed
@ptr727
ptr727 deleted the feature/coverage-sidecar-tests branch November 3, 2026 03:22
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