Repository navigation
fix(scanner): reject probes that only guessed a container the extension rules out - #2882
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
Quick104
left a comment
There was a problem hiding this comment.
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.
b461346 to
0015077
Compare
|
The playback behavior change from Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
0015077 to
36244a0
Compare
…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]>
36244a0 to
b9488bc
Compare
a856fd8
into
fix/issue-2861-skip-files-without-video
…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]>
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) atprobe_score5. Silo cataloged it asm4vvideo with no audio, and the web app showed a "480p · MPEG4" version for it. Pressing Play saidThis 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 markedprobe_failed_atand Play saysThis 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'sAVPROBE_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 examplem4vfor an.avi. A.m4vfile may be MP4 or a bare MPEG-4 stream, since FFmpeg writes both under that extension. The rejection goes throughIsProbeRejection, 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
m4v/mpeg4with no audio. Here it was markedprobe_failed_atwith 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.fails-on-baseagainst the parent commit: fail there, pass here.go test ./internal/scanner/...against a migrated scratch database: pass.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 · MPEG4version) 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
Checklist
AI Disclosure
/siloskill; T3 Codedelegate_taskfor the cross-provider review.m4vwas 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
errProbeGuessedContainererror.extensionAllowsContainerin video_extensions.go checks the probed container against the extension's container group; unknown or non-video extensions impose no restriction..m4vinto its own group that allows bothmp4andm4vcontainers.IsProbeRejectionin probe.go treats a guessed-container error on a readable file as a rejection, and reuses the existing readability check for this path.Macroscope summarized b9488bc.