Repository navigation
fix(check): a media source that failed to load is not reported as a timeout - #7954
Conversation
…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
left a comment
There was a problem hiding this comment.
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
What
When an
<audio>clip's source fails to load,check/validateno 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
checkrun of mine the voice file was missing, and the saved report had both:The second finding points at the wrong fix.
auditClipDurations' probe already stops waiting onerror, 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_fitand the message).How
failed: Boolean(el.error ?? reads.get(el)?.error), the element's or the probe'sMediaError.unloadablewhen it failed and tounreadableotherwise. The two warnings are built in a smallunmeasuredClipWarningshelper: theunreadabletext is unchanged, the new one reads1 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.Test plan
New case in
validate.media-fit.test.ts(happy-dom, like the existing "audio the page never loaded" case): a probe that fireserrorwith aMediaError-likeerrorgets 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.tsandvalidate.test.tspass (34 tests); oxfmt, oxlint and the comment ratchet pass. I didn't re-runcheckin headless Chrome locally after the change (keeping my machine's load down); the real-run output above is from before.🤖 Generated with Claude Code