Skip to content

feat(cli): check_report counts the browser-playable copies a check waited for - #7316

Merged
miguel-heygen merged 4 commits into
mainfrom
drenderq/check-copies-fields
Nov 6, 2026
Merged

miguel-heygen merged 4 commits into
mainfrom
drenderq/check-copies-fields

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

check_report gains copies_total, copies_waited_ms and copies_unfinished, sent only when the project had videos Chrome cannot decode: how many there were, how long the check waited for their browser-playable copies, and how many were still not done when the wait budget stopped it (copies ffmpeg failed on in a normal run are not counted). Counts and milliseconds only, no names or paths. preResolveHostileMediaProxies reports the numbers through a callback just before it may throw CheckCopiesUnfinishedError, runBrowserCheck keeps them as a partial result, so a check that stopped on the copy wait still sends them.

Why

A check that stops with media_copies_unfinished cannot be counted today: the event has no copies facts, and stop_code (#7305) says only that it stopped. Whether the wait is stuck or just slow on many large videos is not answerable from the data.

What I measured

  • fails without the fix: packages/cli/src/commands/check.test.ts "a check stopped by the copy wait still sends the copy facts and stays browserSkipped" (copy facts then CheckCopiesUnfinishedError; with the earlier head's pipeline it read browserSkipped false), and packages/cli/src/telemetry/events.test.ts "sends what making browser-playable copies cost as counts and milliseconds, and omits it without videos" (with events.ts at main it fails; 1 failed, 82 passed). With the change that file and commands/check.test.ts pass (246).

What I did NOT exercise

  • No end-to-end check run that waits for copies and reads the sent event; the plumbing from the copy step to the event is typed but not run.
  • tsc on the box printed errors for @hyperframes/inspector/live (not built in that tree), none in the lines this changes.

Size

About 30 changed lines in 5 files: a lone telemetry addition; nothing open on this event to carry it.

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

Verdict: REQUEST CHANGES · 2 blocker · 1 important · 0 nits · head 5cbc9a13

  • blocker: required Comments check fails at this head: checkTypes.ts comment share rises 8.2% (38/465 → 39/473); the PR body doesn't mention it. ↓ inline
  • blocker: the new partial flips browserSkipped to false on the exact stop this PR targets. ↓ inline
  • important: copies_unfinished also counts copies that failed. ↓ inline
Scope

Read all 5 files at head, plus checkDeadline.ts (keepPartial/partialResult), checkPipeline.ts catch path (L1748–1751) and commands/check.ts browserSkipped consumers. The PR names a test that fails without the fix (events.test.ts), which covers the event mapping only. Nothing exercises the stop path end to end.

const html = await loadCheckHtmlWithDeferredMedia(project.dir);
deadline?.enter("copies");
let mediaCopies: MediaCopyFacts | undefined;
deadline?.keepPartial(() => (mediaCopies ? { mediaCopies } : {}));

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.

blocker: when the copy wait throws CheckCopiesUnfinishedError, checkPipeline.ts:1750 builds skipped: Object.keys(found).length === 0 from the partial. found is now { mediaCopies }, so browserSkipped becomes false even though Chrome never launched. The human report then drops the "Browser session never ran — … empty placeholders, not a clean pass" warning (commands/check.ts:688), and the JSON report and artifact metadata show browserSkipped: false over empty layout/motion/contrast sections.

Fix: carry mediaCopies outside keepPartial, or have line 1750 ignore mediaCopies when deciding skipped. Then add a check.test.ts case where runBrowserCheck reports copy facts and then throws CheckCopiesUnfinishedError, asserting browserSkipped === true and that copies_* are sent.

Comment thread packages/cli/src/utils/checkBrowser.ts Outdated
const unfinished = sources.flatMap(({ file }, index) =>
results[index]!.status === "rejected" ? [`${file} ${heartbeat.percent(index)}`] : [],
);
record?.({ total, waitedMs: Date.now() - startedAt, unfinished: unfinished.length });

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.

important: unfinished counts every rejected result, including copies that ffmpeg failed on (lines 341–344 handle those as warnings when the budget isn't hit). So a check that finishes normally with 2 failed copies sends copies_unfinished: 2. That mixes slow or stuck copies with broken ones, which is the distinction this field exists for. Count only the rejections caused by the abort, or send failures as their own field.

Comment thread packages/cli/src/utils/checkTypes.ts Outdated
overlapMs: number;
}

/** What a check's browser-playable copies cost: videos, ms waited, videos not done. */

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.

blocker (CI): this line makes the required Comments check fail (RAISED comment share: checkTypes.ts 8.2% (39/473), base 8.2% (38/465)). The field names already say what the doc comment says. Drop the comment, or cut one elsewhere in the file.

@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Head a523981: the doc comment on checkTypes.ts is dropped (Comments check); the catch path ignores mediaCopies when deciding browserSkipped, with a check.test.ts case for the copy-wait stop (copy facts sent, browserSkipped true); copies_unfinished is 0 unless the budget stopped the wait, so ffmpeg-failed copies are not counted. The red/green run for the new test is running on a loaded box; I will post it.

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

Verdict: APPROVE — 3 resolved, 0 open, 0 new · 5cbc9a13 → a523981f

Comments now passes. With mediaCopies left out of the skipped count, the copy-wait stop reads browserSkipped: true, and the new check.test.ts case fails without that change. unfinished is zeroed unless the budget fired. The rest of CI was still running when I approved, so required checks still gate the merge.

@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Run on a Linux box (bun install, build, vitest): the new check.test.ts case "a check stopped by the copy wait still sends the copy facts and stays browserSkipped" fails with the previous head's checkPipeline.ts (1 failed), and events.test.ts plus check.test.ts pass with this head (247).

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 267 (base branch 267), smooth 106 of those

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

Quarantined, measured but not gated (8)

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

Verdict: APPROVE — 0 resolved, 0 open, 0 new · a523981f → 6acbc419

Only formatting changed, in the two test files. CI, preview-regression, Comments and CodeQL pass on this head. The earlier preview-regression red came from the format preflight, not from main. Windows render verification was still running; it also fails on main at 410a516c (engine-cli-1).

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit de2d21a Nov 6, 2026
84 checks passed
@miguel-heygen
miguel-heygen deleted the drenderq/check-copies-fields branch November 6, 2026 14:03
SanHsien added a commit to SanHsien/hyperframes that referenced this pull request Nov 6, 2026
…view to heygen-com#7250

Adopts heygen-com#7310 (MPEG-4 Part 2 / MJPEG get browser-playable copies), heygen-com#7316
(check_report counts the copies a check waited for) and heygen-com#7317 (render reads
a composition src like the preview and refuses paths outside the project).
Defers heygen-com#7309 (needs heygen-com#6912); heygen-com#7314 does not apply. PR axis advances to heygen-com#7250
(heygen-com#7243 closed unmerged, heygen-com#7249 open and pinned as monitored; monitored 96->97).

Co-authored-by: Miguel Ángel <miguel.sierra@heygen.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant