fix(engine): treat 0-1 detected keyframes as maximally problematic - #3881
Open
miga-heygen wants to merge 1 commit into
Open
fix(engine): treat 0-1 detected keyframes as maximally problematic#3881miga-heygen wants to merge 1 commit into
miga-heygen wants to merge 1 commit into
Conversation
analyzeKeyframeIntervals short-circuited any video with fewer than 2 detected keyframes to isProblematic:false, maxIntervalSeconds:0 -- the sparsest possible GOP (a single I-frame, or none, covering the entire video) read as healthier than a video with a merely-long-but-finite gap, so the compiler's sparse-keyframe warning silently never fired for the worst case it exists to catch (yt-dlp --download-sections output and screen recordings are common sources of exactly this). 0 or 1 keyframes now reports isProblematic:true with avg/max interval set to +Infinity, consistent with "no keyframe to seek back to at all" being strictly worse than any finite gap. 2+ keyframes are unaffected. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PRINFRA-307:
analyzeKeyframeIntervals(root-caused by cli-repro via direct instrumentation) short-circuited any video with fewer than 2 detected keyframes toisProblematic: false, maxIntervalSeconds: 0— but 0 or 1 keyframes is the sparsest possible GOP (a single I-frame, or none, covering the entire video), strictly worse than any finite gap. This meant the compiler's sparse-keyframe warning ([Compiler] WARNING: ... has sparse keyframes ... causes seek failures and frame freezing, which already correctly fires for the >2s finite-gap case) silently never fired for the worst-case input it exists to catch — common withyt-dlp --download-sectionsoutput and screen recordings.isProblematic: truewithavgIntervalSeconds/maxIntervalSecondsset to+Infinity(no keyframe to seek back to at all — strictly worse than any finite interval, so reporting it as "no interval data" would read as healthier than it is).Test plan
ffprobe.test.ts(analyzeKeyframeIntervals sparse-keyframe blind spot): 0 keyframes → problematic, 1 keyframe → problematic, 3 keyframes with a 1s gap → still correctly not problematic (unaffected by the fix). Confirmed RED on the two new blind-spot cases without the fix (isolated via taggedgit stash) / GREEN with it.bunx vitest run packages/engine/src/utils/ffprobe.test.ts— 114/118 passed, 3/3 new tests pass. The 4 failing tests are pre-existing and unrelated: they depend on a git-lfs-tracked PNG fixture (hdr-photo-pq.png) that resolves to an LFS pointer file (nogit-lfsin this sandbox) — confirmed failing identically on a cleanorigin/maincheckout before any of my changes.bunx tsc --noEmit -p packages/engineand-p packages/producer(the one consumer ofmaxIntervalSeconds) — both clean.bunx oxlint/bunx oxfmt --write— clean, no unwanted reformatting.bunx fallow audit --base origin/main --fail-on-issues— clean (0 issues in 2 changed files).🤖 Generated with Claude Code