Skip to content

fix(check): a media source that failed to load is not reported as a timeout - #7954

Merged
jrusso1020 merged 1 commit into
heygen-com:mainfrom
wonjangcloud9:fix/media-fit-load-failure
Nov 16, 2026
Merged

jrusso1020 merged 1 commit into
heygen-com:mainfrom
wonjangcloud9:fix/media-fit-load-failure

Conversation

@wonjangcloud9

Copy link
Copy Markdown
Contributor

What

When an <audio> clip's source fails to load, check / validate no longer tell the person to re-run with a longer --timeout. The slot-fit audit now reports those clips as failed to load.

Why

In a real check run of mine the voice file was missing, and the saved report had both:

http_error       error    404 loading assets/audio/take.wav
clip_media_fit   warning  Could not read the duration of 1 media element(s) within the validate timeout (voice); their slot vs. source fit was not checked. Re-run with a longer --timeout if the source is slow to load.

The second finding points at the wrong fix. auditClipDurations' probe already stops waiting on error, so a missing file is reported right away and a longer timeout changes nothing. The same code is on main.

Related work

None found (searched open and closed PRs and issues for clip_media_fit and the message).

How

  • The page-side rows record failed: Boolean(el.error ?? reads.get(el)?.error), the element's or the probe's MediaError.
  • A clip with no duration goes to unloadable when it failed and to unreadable otherwise. The two warnings are built in a small unmeasuredClipWarnings helper: the unreadable text is unchanged, the new one reads 1 media element(s) failed to load (voice), so their slot vs. source fit was not checked. A longer --timeout will not help: check that the source exists and plays in Chrome.
  • It stays a warning, since a format Chrome can't decode may not raise any other finding.

Test plan

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments"

New case in validate.media-fit.test.ts (happy-dom, like the existing "audio the page never loaded" case): a probe that fires error with a MediaError-like error gets one warning containing "failed to load (voice)" and not "Re-run with a longer --timeout". It fails on main with the old message. validate.media-fit.test.ts and validate.test.ts pass (34 tests); oxfmt, oxlint and the comment ratchet pass. I didn't re-run check in headless Chrome locally after the change (keeping my machine's load down); the real-run output above is from before.

🤖 Generated with Claude Code

…imeout

When an <audio> clip's source failed to load (a 404, a format Chrome
can't play), the slot-fit audit put it with the clips whose metadata
was still loading and told the person to re-run with a longer --timeout,
next to the http_error for the same file. The audit's probe already
stops waiting on the error, so the timeout was never the cause. Record
whether the element or its probe errored, and report those clips as
failed to load, without the timeout advice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks. Pointing someone at --timeout for a 404 sends them the wrong way.

The split is narrow. failed is only consulted when no duration was read, so an element that errored transiently but whose probe still got metadata is measured as before, and the timeout path keeps its exact old text.

I also ran the real path: validate in headless Chrome, on a project whose <audio id="voice"> points at a missing assets/audio/take.wav, now prints ✗ 404 loading assets/audio/take.wav and ⚠ 1 media element(s) failed to load (voice) … A longer --timeout will not help.

Verified: validate.media-fit.test.ts + validate.test.ts pass 34/34. With validate.ts reverted, the new case fails with the old "Could not read the duration" text.

Need ✅ · Size ✅ · Reuse ✅ · Simpler ✅ · Structure ✅
Risk: low. Warning text only; severity and code (clip_media_fit) are unchanged.

— Rames

@jrusso1020
jrusso1020 added this pull request to the merge queue Nov 16, 2026
Merged via the queue into heygen-com:main with commit 5e0c3db Nov 16, 2026
70 checks passed
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