Skip to content

fix(text): drop seconds past one hour and stop leaking mkv AC-3 extras - #36

Merged
s0up4200 merged 2 commits into
mainfrom
fix/duration-and-ac3-text-extras
Aug 10, 2026
Merged

fix(text): drop seconds past one hour and stop leaking mkv AC-3 extras#36
s0up4200 merged 2 commits into
mainfrom
fix/duration-and-ac3-text-extras

Conversation

@s0up4200

@s0up4200 s0up4200 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

This continues the Matroska default-text work in #32, #33, and #35. The text output still printed three duration units past one hour. Matroska E-AC-3 tracks also copied raw mixing and dialnorm metadata into the same output. Official MediaInfo prints two duration units and keeps that metadata under JSON extra. #33 removed the ltrt and loro pair, and this removes the rest.

Those PRs measured against samples mkv-01 to mkv-10. That set cannot show either fault, because every sample is shorter than one hour and none is FLAC or DD+ 7.1. Fourteen new mkv samples found both. Against official v23.04 on 32 real files the result is 14 better, 18 same, and 0 worse. JSON and --language=raw output stay byte-identical, including on the BDAV and DVD controls.

Summary by CodeRabbit

  • Improvements
    • Duration displays for media lasting an hour or more now show hours and minutes for clearer formatting.
    • E-AC-3 metadata is presented more consistently, with technical details retained in raw metadata and excluded from friendly text fields.
  • Documentation
    • Added field-test results covering 14 samples, parity measurements across 32 files, and known text-output gaps.

Two default-text gaps found by testing 14 new mkv samples that the
existing parity set cannot reach, because every old sample is shorter
than one hour and none is FLAC, DD+ 7.1, or 2160p Dolby Vision.

formatDuration printed three units once a duration reached an hour.
Official prints only the two most significant units, truncated. This is
confirmed against 190 paired raw-to-text values from official v23.04.

Matroska E-AC-3 tracks also copied raw mixing and dialnorm metadata into
the friendly text output. Official keeps those under JSON extra only.
Commit fba9661 removed the ltrt and loro pair; this removes the rest.

Verified against official v23.04 on 32 real files: 14 better, 18 same, 0
worse. The default-text diff over the mkv, mp4, and TS set fell from 611
lines to 193, and three samples reached 0. JSON and --language=raw
output stay byte-identical to the previous commit on every file,
including the BDAV and DVD controls.
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@s0up4200, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 16 minutes

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

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9d0732e1-272c-4292-863d-88421cd681e1

📥 Commits

Reviewing files that changed from the base of the PR and between a7c0bb4 and 3ae1d16.

📒 Files selected for processing (1)
  • internal/mediainfo/matroska_eac3_probe_test.go
📝 Walkthrough

Walkthrough

The change updates hour-based duration formatting and removes legacy friendly-text projection for Matroska E-AC-3 metadata. Raw JSON retains dialog normalization and mixing metadata. Tests cover duration boundaries and E-AC-3 output separation.

Changes

Media output updates

Layer / File(s) Summary
Duration formatting and validation
internal/mediainfo/format_duration.go, internal/mediainfo/format_duration_test.go
Durations of at least one hour now show hours and minutes only. Tests cover hour boundaries and truncation.
E-AC-3 metadata projection and field-test status
internal/mediainfo/matroska_ac3_canonical.go, internal/mediainfo/matroska_eac3_probe_test.go, AGENTS.md
Legacy E-AC-3 friendly-text fields are removed. Raw JSON retains dialnorm and related mixing metadata. Probe expectations and field-test status are updated.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Poem

A rabbit checks the minutes climb,
While E-AC-3 fields sort in line.
Raw facts stay where JSON grows,
Friendly text sheds unused clothes.
Tests hop briskly, green and bright—
“Good work,” says Bun, “this output’s right!”

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes both main changes: duration formatting and removal of Matroska AC-3 metadata leakage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/duration-and-ac3-text-extras

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

Comment @coderabbitai help to get the list of available commands.

@s0up4200 s0up4200 added bug Something isn't working go Pull requests that update go code labels Aug 10, 2026
@s0up4200

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (2)
internal/mediainfo/matroska_eac3_probe_test.go (2)

259-260: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Assert the complete raw extra payload.

This test checks only a short substring, so it can pass if those fields appear in the wrong order or among extra keys. Replace the strings.Contains(extra, "dialnorm":"-31","compr":"-0.28","acmod":"7","lfeon":"1","dmixmod":"Lo/Ro") assertion with an exact match or unmarshal-and-assert check. Then assert JSONRaw["extra"] separately for the JOC fields before or after the existing ComplexityIndex check.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/mediainfo/matroska_eac3_probe_test.go` around lines 259 - 260,
Update the test assertion around JSONRaw["extra"] to validate the complete raw
extra payload rather than checking a partial substring; use an exact match or
unmarshal-and-assert approach that rejects reordered or unexpected keys.
Separately assert the JOC fields in JSONRaw["extra"] before or after the
existing ComplexityIndex check, preserving the expected E-AC-3 mixing metadata.

Source: Coding guidelines


237-246: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Cover the E-AC-3 default text output.

The current assertion only checks canonical stream.Fields. projectRawTextReport then projects raw text through rawTextLabel("dialnorm") when extra entries are visible, so this test can pass while Dialog Normalization still appears in raw text. Add a minimal raw-text assertion for the EAC3JOC text metadata test.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/mediainfo/matroska_eac3_probe_test.go` around lines 237 - 246, The
E-AC-3 metadata test only validates canonical stream fields, not projected raw
text. In the EAC3JOC text metadata test, add a minimal assertion against the
output of projectRawTextReport to confirm Dialog Normalization and related
dialnorm metadata are omitted from the default text projection while retaining
the existing stream.Fields checks.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@internal/mediainfo/matroska_eac3_probe_test.go`:
- Around line 259-260: Update the test assertion around JSONRaw["extra"] to
validate the complete raw extra payload rather than checking a partial
substring; use an exact match or unmarshal-and-assert approach that rejects
reordered or unexpected keys. Separately assert the JOC fields in
JSONRaw["extra"] before or after the existing ComplexityIndex check, preserving
the expected E-AC-3 mixing metadata.
- Around line 237-246: The E-AC-3 metadata test only validates canonical stream
fields, not projected raw text. In the EAC3JOC text metadata test, add a minimal
assertion against the output of projectRawTextReport to confirm Dialog
Normalization and related dialnorm metadata are omitted from the default text
projection while retaining the existing stream.Fields checks.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f7bb12b0-0c2d-4a2b-a0bf-a871de8c626c

📥 Commits

Reviewing files that changed from the base of the PR and between caa51c2 and a7c0bb4.

📒 Files selected for processing (5)
  • AGENTS.md
  • internal/mediainfo/format_duration.go
  • internal/mediainfo/format_duration_test.go
  • internal/mediainfo/matroska_ac3_canonical.go
  • internal/mediainfo/matroska_eac3_probe_test.go
💤 Files with no reviewable changes (1)
  • internal/mediainfo/matroska_ac3_canonical.go

The text assertions cover the default output, because stream.Fields is
already the projectTextStore result that RenderText uses. Nothing covered
the other half of the split, so add one check that raw text still carries
dialnorm.
@s0up4200
s0up4200 merged commit 90292ea into main Aug 10, 2026
2 checks passed
@s0up4200
s0up4200 deleted the fix/duration-and-ac3-text-extras branch August 10, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant