Skip to content

fix(scanner): reject probes that only guessed a container the extension rules out - #2882

Merged
Quick104 merged 2 commits into
fix/issue-2861-skip-files-without-videofrom
fix/issue-2862-probe-score-guess
Oct 21, 2026
Merged

Quick104 merged 2 commits into
fix/issue-2861-skip-files-without-videofrom
fix/issue-2862-probe-score-guess

Conversation

@Quick104

@Quick104 Quick104 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #2862
Related issue: N/A
Validation tasks: none

ffprobe exits 0 for some damaged files after it only guessed their format, and Silo stored the guess as fact. An AVI with a damaged header probes as a bare MPEG-4 stream (m4v) at probe_score 5. Silo cataloged it as m4v video with no audio, and the web app showed a "480p · MPEG4" version for it. Pressing Play said This file hasn't finished scanning, a message to wait that never resolves. A file ffprobe refuses outright gets the damaged-file treatment instead: the row is marked probe_failed_at and Play says This file can't be played.

This change applies that treatment to a probe that only guessed a container the file's extension rules out.

Stacked on #2881, which adds the container table this uses.

Approach

The probe now reads format.probe_score. A score at or below FFmpeg's AVPROBE_SCORE_RETRY (25) means the format was guessed. A low score alone is not damage, since a valid stream of a few frames also scores 25 or less. So the probe is rejected only when the guessed container is also not one the file's video extension names, for example m4v for an .avi. A .m4v file may be MP4 or a bare MPEG-4 stream, since FFmpeg writes both under that extension. The rejection goes through IsProbeRejection, so scans mark the row and the playback probe answers with the existing damaged-file terminal. ffprobe exited 0 in this case, so there is no error output to search for read failures, but the file's start-and-end read check still runs: a guess made while storage is failing stays retryable.

Files without a video extension (audiobooks, podcasts, theme songs) are never rejected this way, and neither is a probe without a score.

Validation

  • Live on a dev sandbox: the same damaged AVI, probed fresh on main and on this branch. On main it was cataloged as m4v/mpeg4 with no audio. Here it was marked probe_failed_at with no stream facts, the scanner logged the guess with its score, and Play showed the damaged-file message. A further rescan did not re-probe it.
  • Healthy files measured with ffprobe 8.1.3-Jellyfin all scored 50 or higher (MP3 with and without ID3, ADTS AAC, FLAC, M4B, Opus, raw MPEG-2, short MPEG-TS).
  • New rows in the probe-rejection test, run with fails-on-base against the parent commit: fail there, pass here.
  • go test ./internal/scanner/... against a migrated scratch database: pass.
  • The full Go gate (build, gofmt, vet, make lint-changed, make lint-router-recovery, make test-go) passes on the stacked branch, apart from one invitations DB test. It failed once under full-suite load, in a package this change does not touch, and passes alone on this branch 3 of 3.
  • make lint-changed: 0 issues.

Evidence

The damaged file's detail page before (guessed 480p · MPEG4 version) and after (no stream facts), and Play before (This file hasn't finished scanning) and after (This file can't be played). Desktop web; mobile layout is unaffected.

Evidence: https://evidence.siloserver.org/r/silo-server/issue-2862/

Risks

  • Rows a misdetected file already has keep their guessed facts while the file is unchanged. Rows with a successful probe are not re-probed or re-marked, so this protects new and changed files only.
  • A valid file that is named with the wrong extension and probes only at a low score would now be reported as damaged.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code (in T3 Code)
  • Tool(s): Claude Code /silo skill; T3 Code delegate_task for the cross-provider review
  • Model(s): claude-opus-5-5 (implementation); gpt-6.1-sol (plan review)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: before implementation, gpt-6.1-sol (xhigh) reviewed the plan. It showed that valid MPEG-4 and MP3 streams of a few frames score 25, so a score cutoff alone would reject healthy files. The rule now also requires the guessed container to contradict the extension. The background review (gpt-6.1-sol, reviewed b461346) found that a healthy bare MPEG-4 .m4v was rejected; fixed in 0015077 and covered by a new test row.

Note

Reject scanner probes that guessed a container the file extension rules out

The scanner now keeps ffprobe's format probe score and uses it to reject guessed containers. When ffprobe succeeds but reports a probe score from 1 through 25 and a container the file's extension does not allow, the probe returns the new errProbeGuessedContainer error.

  • extensionAllowsContainer in video_extensions.go checks the probed container against the extension's container group; unknown or non-video extensions impose no restriction.
  • Moves .m4v into its own group that allows both mp4 and m4v containers.
  • IsProbeRejection in probe.go treats a guessed-container error on a readable file as a rejection, and reuses the existing readability check for this path.
  • Behavioral Change: files that previously probed successfully via a low-confidence container guess (score ≤ 25) are now rejected when the extension conflicts.

Macroscope summarized b9488bc.

@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Oct 21, 2026
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 32fe8aac-7a63-4803-9d2a-528a83bf4873

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

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

@silo-triage silo-triage Bot added bug Something isn't working go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish stacked Base is another open PR; merge in stack order named in the body labels Oct 21, 2026

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adversarial review (gpt-6.1-sol, reviewed b461346)

Reviewed the specified diff against 6d282c55b982e64062ecce65eeaaae40f0343758 and traced the probe callers. The scanner package tests pass. One regression was reproduced with FFmpeg 8.1.3-Jellyfin and the actual ProbeFile/IsProbeRejection functions, using a Go build overlay to compare the parent without changing either checkout or branch.

AI disclosure: Model gpt-6.1-sol; harness Codex in T3 Code. Review and prose generated by AI.

Comment thread internal/scanner/video_extensions.go Resolved
@Quick104
Quick104 force-pushed the fix/issue-2862-probe-score-guess branch from b461346 to 0015077 Compare October 21, 2026 17:34
@macroscopeapp

macroscopeapp Bot commented Oct 21, 2026

Copy link
Copy Markdown

The playback behavior change from internal/scanner/probe.go is shown only after the change; please add a before-and-after capture of the same Play flow on the damaged file, showing the previous guessed-version outcome and the new “This file can't be played” state. Suggested fix: no code diff; add the missing before capture to the evidence page.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

@Quick104
Quick104 force-pushed the fix/issue-2862-probe-score-guess branch from 0015077 to 36244a0 Compare October 21, 2026 17:50
Quick104 and others added 2 commits October 21, 2026 18:01
…on rules out

ffprobe exits 0 for some damaged files after detecting a format "only with
low score". An AVI with a damaged header probed as a bare MPEG-4 stream (m4v)
at probe_score 5, and Silo cataloged it as m4v with no audio.

A probe whose probe_score is at or below FFmpeg's AVPROBE_SCORE_RETRY (25)
and whose container the file's video extension does not name now counts as
a rejection, like a non-zero ffprobe exit: the row is marked probe_failed_at
and playback reports a damaged file. A low score for the container the
extension names is left alone, since short valid streams score low too.

Closes #2862

Co-Authored-By: Claude Opus 5.5 <[email protected]>
FFmpeg also writes bare MPEG-4 video streams as .m4v, and a valid one of a
few frames probes as m4v at score 25. The .m4v extension now names both MP4
and that stream, so such a file is not reported as damaged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Quick104
Quick104 force-pushed the fix/issue-2862-probe-score-guess branch from 36244a0 to b9488bc Compare October 21, 2026 18:01
@Quick104
Quick104 merged commit a856fd8 into fix/issue-2861-skip-files-without-video Oct 21, 2026
16 checks passed
@Quick104
Quick104 deleted the fix/issue-2862-probe-score-guess branch October 21, 2026 18:32
Quick104 added a commit that referenced this pull request Nov 5, 2026
…on rules out (#2882)

* fix(scanner): reject probes that only guessed a container the extension rules out

ffprobe exits 0 for some damaged files after detecting a format "only with
low score". An AVI with a damaged header probed as a bare MPEG-4 stream (m4v)
at probe_score 5, and Silo cataloged it as m4v with no audio.

A probe whose probe_score is at or below FFmpeg's AVPROBE_SCORE_RETRY (25)
and whose container the file's video extension does not name now counts as
a rejection, like a non-zero ffprobe exit: the row is marked probe_failed_at
and playback reports a damaged file. A low score for the container the
extension names is left alone, since short valid streams score low too.

Closes #2862

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

* fix(scanner): accept a bare MPEG-4 stream in a .m4v file

FFmpeg also writes bare MPEG-4 video streams as .m4v, and a valid one of a
few frames probes as m4v at score 25. The .m4v extension now names both MP4
and that stream, so such a file is not reported as damaged.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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 priority: P2 Limited scope, workaround exists, or polish size/M 50–199 added + deleted lines (all files); change volume, not priority. stacked Base is another open PR; merge in stack order named in the body

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant