Skip to content

fix(producer): a frame coverage abort names the clip's source and window - #8828

Merged
miguel-heygen merged 5 commits into
mainfrom
fix/coverage-error-names-source
Nov 26, 2026
Merged

miguel-heygen merged 5 commits into
mainfrom
fix/coverage-error-names-source

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

When the frame coverage gate aborts a render, its message now names what the clip reads, in its first sentence: the source's codec, frame rate, whether that rate is variable, the video stream's length, and the clip's window, media start and playback rate.

Video "rec-end" captured 21 of expected 34 frames (coverage 61.8%, threshold 95.0%; source h264, 60 fps, variable frame rate, video stream 4.000 s; clip 0.000-1.133 s reads from 2.500 s at 1x). check/snapshot may pass ...

Why

The gate's message said only how many frames arrived. An abort seen from a report, without the project's files, gave no way to tell which source shape fell short: a variable frame rate recording, a held last frame, a window past the source's end, or a playback rate. Each needs a different fix. Tools that keep only the start of a long error still get the facts, because they come before the explanation.

Related work

None.

How

computeVideoFrameCoverage already holds each clip's probed metadata. Each report now carries a source (codec, fps, VFR, the playable stream length from resolvePlayableVideoDuration, media start, playback rate as sourceTimeAt(rate, 1)), present only when the clip was extracted. assertVideoFrameCoverage puts it after the threshold. The gate's decision and the report's other fields are unchanged.

Test plan

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug

fails without the fix: packages/producer/src/services/render/videoFrameCoverage.test.ts "names the clip's source in the error's first sentence, so a cut report still says what the video was"

  • That test fails on main: the message has no source facts. With the change, videoFrameCoverage.test.ts passes 3 runs in a row (42 of 42).
  • packages/producer/src/services/render under vitest: every test that runs passes (1051). The 27 files reported as failed are bun:test files that vitest cannot load; none of them imports the coverage gate.

Not exercised

  • A real render that trips the gate: this changes only the error text and the report's fields.
  • Which source shape caused the aborts that prompted this. Five likely shapes render at full coverage on 0.9.92: variable frame rate recordings at 30 and 60 fps nominal, a last frame held 1.5 s (on Linux, and on macOS with VideoToolbox decode), and a clip at 1.618x. This change is what makes the next one readable.

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] The diagnostic reports a speed ramp as a constant rate (packages/producer/src/services/render/videoFrameCoverage.ts:252)

sourceTimeAt(rate, 1) integrates the first clip-local second. For a speed ramp it can be unrelated to how much of the file the reported clip window consumes. The message then says the entire clip reads at that multiplier, which can misdirect an end-of-source investigation. Keep the multiplier for constant rates. For ramps, label the rate as variable and report the source span computed over the actual clip duration.

[P3] Label the playable end separately from the stream duration (packages/producer/src/services/render/videoFrameCoverage.ts:250)

resolvePlayableVideoDuration includes the stream's lead when the stream duration is known. The message calls the result the stream length. A delayed stream therefore appears longer than it is. Label this value as the playable end, or report the stream length and lead separately.

All 42 focused tests passed locally. I verified that the 16 fixture pointer conversions match the base files byte for byte.

— tai (automated review)

@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Both points fixed in 0376ea8.

  • Speed ramp: the error no longer turns a rate into one multiplier. It names the span of source the clip reads, mediaStart to mediaStart + sourceTimeAt(rate, clip length), the same mapping extraction uses, and says "on a speed ramp" when the rate is a lane, or "at Nx" for a constant. A 1x-to-3x ramp over a 1 s clip now reads "reads source 0.000-1.821 s on a speed ramp".
  • Playable end: "video stream" is now "plays to", the value resolvePlayableVideoDuration gives and the gate's expected frames stop at. When the stream starts late it also names the lead: "plays to 4.000 s, video from 0.200 s".

The new test "names a speed ramp's whole source range and a lead before the video's first frame" failed before the change on both points. videoFrameCoverage.test.ts passes 3 runs in a row, 43 of 43.

Description correction (the description can't be edited here): its example line now reads ... plays to 4.000 s; clip 0.000-1.133 s reads source 2.500-3.633 s at 1x).

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 273 (base branch 271), smooth 67 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Newly passing (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Quarantined, measured but not gated (0)

Unstable (1)

  • seqab-none-pct-r0-root-z100: tracking 0.05, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.05, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.05, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true

…d with stubs

Puts back main's own copies of the generated compiled.html fixtures and the
portrait-edge-bleed sample video; these files are identical to main after this commit.
@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Scope fix: commit 89cfe76 had also replaced 16 producer test fixtures (the compiled.html outputs and portrait-edge-bleed/src/sample.mp4) with Git LFS pointer stubs by mistake. f52e616 puts back main's copies after a merge of main, so the PR's diff against main is again only videoFrameCoverage.ts and videoFrameCoverage.test.ts. The only code change since 0376ea8 is a comment wrapped under 120 characters. The merge also picks up main's raised producer size budget, which the Build check failed on.

videoFrameCoverage.test.ts: 43 passed, 3 runs in a row.

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verified that all 16 restored producer fixtures match the merged main revision byte for byte. The remaining diff is the coverage report and its tests. The error now includes the source metadata and requested clip window without changing the coverage threshold or expected-frame calculation.

All 43 coverage tests passed. Both new diagnostic tests failed with main's coverage implementation restored. Local verification was limited to the coverage suite.

— tai (automated review)

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 26, 2026
@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit 971499e Nov 26, 2026
99 checks passed
@miguel-heygen
miguel-heygen deleted the fix/coverage-error-names-source branch November 26, 2026 12:02
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