Skip to content

Compare Output Tracks and Normalized Process Logs Between Regression Runs - #1233

Merged
ptr727 merged 7 commits into
developfrom
feature/regression-log-checks
Nov 9, 2026
Merged

ptr727 merged 7 commits into
developfrom
feature/regression-log-checks

Conversation

@ptr727

@ptr727 ptr727 commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

check_results.py --baseline compared only Results_process.json outcomes. The track and codec check and the normalized log comparison lived as shell recipes in the host configuration repository. Both depend only on PlexCleaner's log format, so this moves them beside the outcome check, where unit tests hold them to that format.

  • Output tracks. Each file's output tracks come from the last Debug MkvMerge track dump its log holds, keyed by file name as outcomes are, in logged order. A type, format, or codec difference, or a reorder within a track type, fails the comparison with exit 1. So does a run with no log or no Debug dump, since its track check is unverified. Two paths sharing a file name refuse rather than mix their dumps.
  • Normalized log lines. The two process logs compare as multisets of lines after the run-varying fields are normalized, and each difference prints as a warning. The normalization follows the recipe's list. It adds the Before line's progress percentage, which follows completion order. It drops the temp-file suffix rule, since each operation's temp name is fixed and carries signal. Its address rule is anchored so a WxH resolution survives.
  • The bitrate gap the recipe judged by eye. A bitrate summary is attributed to the file its thread last began processing. A shifted summary or bitrate warning is only noted when that file was re-encoded, deinterlaced, or repaired and its outcome matches in both runs.
  • Documented in RegressionTests/README.md "Comparing two runs" and OPERATIONS.md "Ship a change" step 3.

Closes #1219. Reducing the host recipes to pointers is a follow-up in the host configuration repository, once this merges.

Declined in review

  • Sharing corpus_common's one-line 0x address regex: it sits inside that module's error-payload normalizer, and one regex does not justify coupling the two files.
  • Merging the track-dump pattern with corpus_common.TRACK_RE: that pattern reads every parser's Format and Interlaced for the catalog at any level, so changing it changes catalog parsing.
  • Normalizing temp-file suffixes: each operation's temp name is a fixed constant in Convert.cs and ProcessFile.cs, so a suffix never varies between two runs of one build.
  • Runs with UseSidecarFiles off: it defaults on (ProcessOptions.cs), the harness keeps it on, and the result off would be a loud false difference rather than a silent pass.
  • Reading rolled process logs: the file sink rolls at 1 GiB (LoggerFactory.cs), far above a full-corpus Debug run's log.

Test plan

  • python3 -m unittest discover -s tests in RegressionTests/: 93 tests pass, on constructed log lines only.
  • uvx [email protected] check ., uvx [email protected] format --check ., and uvx mypy@latest: clean.
  • prose_lint.py --diff origin/develop, markdownlint, and cspell: clean.

🤖 Generated with Claude Code

ptr727 and others added 4 commits November 9, 2026 09:46
…Runs

check_results.py --baseline compared only Results_process.json outcomes, while the
track and codec check and the normalized log comparison lived as shell recipes in
the host configuration repository. Both depend only on PlexCleaner's log format, so
they now sit beside the outcome check, held to that format by unit tests.

A track difference fails the comparison, and a side with no Debug track dump is
reported unverified rather than passed. Log differences are warnings to judge. A
bitrate summary shift is noted as noise only for a re-encoded or deinterlaced file
whose outcome matches in both runs, which settles the gap the recipe judged by eye.

Closes #1219

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The local review found that the Before line's progress percentage varies with
completion order, that temp-file suffixes are fixed per operation and so carry
signal, that tracks keyed by full path fail every file across media roots, and
that thread attribution duplicated corpus_common's LINE_RE and Before anchor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The second local review found that a re-encoding repair and the bitrate warning
lines shift like a re-encode's summary, that the address rule rewrote the tail
of every WxH resolution, and that two paths sharing a file name mixed their
track dumps. The trailing file name now reuses corpus_common's LINE_FILE_RE.

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

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

@ptr727

ptr727 commented Nov 9, 2026

Copy link
Copy Markdown
Owner Author

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

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

Copy link
Copy Markdown

PR Summary by Qodo

Compare output tracks and normalized logs between regression runs

✨ Enhancement 🧪 Tests 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Compare final output tracks alongside outcomes, failing on track differences and warning when
 dumps are unavailable.
• Compare normalized process logs as multisets, distinguishing eligible bitrate shifts from other
 log warnings.
• Add constructed-log tests and document how to judge the expanded regression comparison.
Diagram

graph TD
  B["Baseline run"] --> I["Input checks"] --> O["Outcome checks"] --> R["Comparison report"]
  C["Candidate run"] --> I
  I --> T["Track comparison"] --> R
  I --> L["Normalized logs"] --> R
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Separate Python log-comparison command
  • ➕ Keeps log parsing isolated from outcome comparison.
  • ➕ Allows independent invocation.
  • ➖ Requires orchestration to combine findings and exit status.
  • ➖ Duplicates run loading or introduces a shared run-data interface.

Recommendation: Keeping the checks in the existing baseline command gives reviewers one comparison and one exit status; the separate-command option adds coordination without a clear benefit here. Before relying on the track check, consider preserving track order: sorting currently makes audio-track reorderings compare equal. The tests also do not exercise bitrate warnings that use NewFileName.

Files changed (4) +408 / -8

Enhancement (1) +178 / -5
check_results.pyAdd process-log checks to baseline comparison +178/-5

Add process-log checks to baseline comparison

• Reads each run's log once, compares final MkvMerge track dumps by file name, and warns when a log or Debug dump is unavailable. Normalizes run-varying log fields for multiset comparison and attributes eligible bitrate shifts to files with matching outcomes. Track differences now contribute to exit status 1; log-line differences remain warnings.

RegressionTests/check_results.py

Tests (1) +219 / -1
test_check_results.pyTest track extraction and normalized-log findings +219/-1

Test track extraction and normalized-log findings

• Adds constructed-log tests for final dumps, codec and missing-track differences, normalization, bitrate classification, missing logs, and duplicate file names. Existing baseline fixtures gain a Debug track dump so the new check is exercised.

RegressionTests/tests/test_check_results.py

Documentation (2) +11 / -2
OPERATIONS.mdExpand release regression-review instructions +1/-1

Expand release regression-review instructions

• Step 3 now calls for reviewing output-track and normalized-log differences alongside outcome differences before promotion.

OPERATIONS.md

README.mdDocument track and log comparison behavior +10/-1

Document track and log comparison behavior

• Describes final Debug track dumps, normalized multiset comparison, bitrate-shift notes, and which findings affect the exit status.

RegressionTests/README.md

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

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. Track check passes exit 0 when a side lacks a dump ✓ Resolved
Description
When either run's log holds no Debug MkvMerge track dump, compare_logs prints a warning and
leaves found empty, so the track check exits 0 with no track comparison. The compliance rule
requires the check to fail when either side lacks a Debug track dump, and the test
test_side_without_dump_is_unverified asserts exit 0 for that case. A CI job that reads only the
exit code will treat a run with no track evidence as a clean match.


Remediation recommended

2. Log comparison skips temp-file suffix normalization 📎 Requirement gap ≡ Correctness
Description
The NORMALIZE table in check_results.py has no rule for temporary-file suffixes, so each log
line keeps its temp-file name exactly as written. The compliance rule lists temp-file suffixes among
the run-to-run variations to normalize before comparing logs. If those suffixes do vary between
runs, every operation that writes a temp file produces a warning on each comparison, and the
warnings are noise a reviewer must dismiss by hand.
Code

RegressionTests/check_results.py[R45-48]

+NORMALIZE = tuple(
+    (re.compile(pattern), repl)
+    for pattern, repl in (
+        (r"^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ [+-]\d{2}:\d{2} ", ""),
Evidence
The rule's success criteria require normalizing temporary-file suffixes, and its failure criteria
flag any listed run-to-run variation left unnormalized. The PR description says the temp-file suffix
rule was dropped on purpose because each operation's temp name is fixed. That premise is the
author's claim, and this review did not check it against the code that generates the temp names.

Compare normalized process logs
RegressionTests/check_results.py[45-48]

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 `NORMALIZE` table in `RegressionTests/check_results.py` does not normalize temporary-file suffixes. The compliance rule for normalized process logs requires that normalization, and its failure criteria flag any listed variation left unnormalized.
## Fix Focus Areas
- RegressionTests/check_results.py[45-68]
- RegressionTests/README.md[70-72]
## Recommended Fix
Confirm from the PlexCleaner source whether temp-file names vary between runs. If they do, add a `NORMALIZE` entry that replaces the varying suffix, with a constructed-log-line test beside `test_run_noise_normalized`. If they do not, state in the README that the suffix is fixed by design, so the deviation from the rule is documented.

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


3. Audio track reordering goes undetected ✓ Resolved
Description
output_tracks() sorts the extracted tracks before comparing them, discarding their order in the
MkvMerge dump. If two runs contain the same audio tracks in a different order, their track lists
compare equal even though the output order changed.

4. Track changes can disappear without a warning ✓ Resolved
Description
output_tracks() discards every dump whose parsed track list is empty, while compare_logs() warns
only if an entire run has no retained dumps. When a file's tool read produces a dump-start line but
no tracks and other files have valid dumps, that file is absent from the comparison without a
per-file unverified warning.

View medium (2)
5. Sidecar-free runs compare stale tracks ✓ Resolved
Description
output_tracks() resets a file's tracks only on a Reading media info from tools line, but
sidecar-free Refresh() emits MkvMerge tracks without that marker. If processing refreshes the same
file more than once with sidecars disabled, the extractor combines successive dumps instead of
comparing the final one.

6. Rolled process logs are compared in part 🐞 Bug ≡ Correctness
Description
read_log() reads only PlexCleaner_process.log, although the application's file logger rolls a
log into numbered files at its size limit. When a Debug regression run crosses that limit, the track
and normalized-line checks operate on only one fragment and can miss differences in the others.
Code

RegressionTests/check_results.py[R110-111]

+    log = run_dir / PROCESS_LOG
+    return log.read_text(encoding="utf-8") if log.is_file() else None
Evidence
The logger enables size-based rollover, while the new reader opens just the base filename and
supplies that text to both new comparisons. The harness runs processing at Debug level.

PlexCleaner/LoggerFactory.cs[12-20]
PlexCleaner/LoggerFactory.cs[88-101]
RegressionTests/regression-test.sh[369-375]
RegressionTests/check_results.py[108-111]
RegressionTests/check_results.py[254-265]

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 comparison reads one process-log file even though the logger can split a run across numbered files.
## Fix Focus Areas
- RegressionTests/check_results.py[108-111]
- PlexCleaner/LoggerFactory.cs[88-101]
## Recommended Fix
Read all retained fragments of each run in chronological order before extracting tracks and lines. If a complete log cannot be established, mark the affected checks unverified rather than comparing a fragment as the whole run.

ⓘ 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 see how risky a PR is at a glance with blast radius labels

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

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.

🟡 Changes recommended

The change still has an order-sensitive comparison bug that can miss track reordering, and its tests do not cover differing renamed-output bitrate names.

2 open issues
What changed in this PR

This PR extends regression-run comparison beyond Results_process.json outcomes by validating output tracks and normalized process logs, with corresponding tests and documentation.

Changes:

  • Adds per-file output-track extraction and comparison.
  • Adds normalized multiset log comparison with bitrate-noise handling.
  • Expands unit tests and updates regression-testing documentation.

This pull request requires changes.

File Summary
RegressionTests/​tests/​test_check_results.py Adds coverage for track, log, and bitrate comparison behavior. [P2] Add coverage for renamed-output bitrate noise (1 vote).
RegressionTests/​README.md Documents the expanded comparison workflow. [P2] Remove the incidental check count (1 vote).
RegressionTests/​check_results.py Implements track extraction, normalized log comparison, and bitrate-noise handling. [P1] Preserve track order during comparison (4 votes). [P2] Cover the renamed-output bitrate case (3 votes).
OPERATIONS.md Updates release regression-testing guidance to include the new comparisons.

Review effort: Lite

Comment thread RegressionTests/check_results.py Resolved
Comment thread RegressionTests/check_results.py Resolved
@ptr727

ptr727 commented Nov 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 9, 2026

Copy link
Copy Markdown

Rate Limit Exceeded

@ptr727 have exceeded the limit for the number of chat messages per hour. Please wait 9 minutes and 34 seconds before sending another message.

ptr727 and others added 3 commits November 9, 2026 10:23
Review on the pull request found that a run with no track evidence exited 0, that
sorting a dump hid a reordered track, and that a last read logging no tracks
dropped its file from the comparison. A renamed file's bitrate warning gains a test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ptr727

ptr727 commented Nov 9, 2026

Copy link
Copy Markdown
Owner Author

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

@ptr727

ptr727 commented Nov 9, 2026

Copy link
Copy Markdown
Owner Author

@qodo-free-for-open-source-projects please dismiss findings 2 and 6, both disproved.

  • 2, temp-file suffix normalization: each operation's temp name is a fixed constant, set through Path.ChangeExtension with .tmp1 to .tmp4 in Convert.cs and .tmp6 to .tmp14 in ProcessFile.cs. No suffix varies between two runs of one build, so normalizing it would only hide which conversion path ran.
  • 6, rolled process logs: the file sink rolls only at FileSizeLimitBytes, 1 GiB in LoggerFactory.cs, and the harness passes --logclear so each run starts a fresh log. A full-corpus Debug run's log stays orders of magnitude below that limit, so it never rolls.

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

Copy link
Copy Markdown

free-for-open-source-projects please dismiss findings 2 and 6, both disproved.

  • 2, temp-file suffix normalization: each operation's temp name is a fixed constant, set through Path.ChangeExtension with .tmp1 to .tmp4 in Convert.cs and .tmp6 to .tmp14 in ProcessFile.cs. No suffix varies between two runs of one build, so normalizing it would only hide which conversion path ran.
  • 6, rolled process logs: the file sink rolls only at FileSizeLimitBytes, 1 GiB in LoggerFactory.cs, and the harness passes --logclear so each run starts a fresh log. A full-corpus Debug run's log stays orders of magnitude below that limit, so it never rolls.

I can't dismiss findings 2 and 6 from this conversation. The findings catalog for this PR is empty, so I don't have the stable IDs the dismiss tool needs.

In the published report, they are:

  • Finding 2: Log comparison skips temp-file suffix normalization (requirement gap, open)
  • Finding 6: Rolled process logs are compared in part (bug, open)

Dismissal also requires the PR author to make the request. If the findings are available on a later attempt, I can dismiss them then.

@ptr727
ptr727 merged commit 03b1439 into develop Nov 9, 2026
15 checks passed
@ptr727
ptr727 deleted the feature/regression-log-checks branch November 9, 2026 18:56
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