Skip to content

fix(lint): read a media window's start through the parser - #8133

Merged
jrusso1020 merged 1 commit into
heygen-com:mainfrom
zhengqiuyang:probe/media-window
Nov 19, 2026
Merged

jrusso1020 merged 1 commit into
heygen-com:mainfrom
zhengqiuyang:probe/media-window

Conversation

@zhengqiuyang

Copy link
Copy Markdown
Contributor

What

mediaTimeWindow now reads data-start through readClipTiming, the same timing contract the renderer uses, instead of a raw Number().

Why

With a raw parse, a negative data-start produced a window entirely before zero. mediaWindowsOverlap then reported no overlap and video_audio_double_source missed a real duplicate-audio error.

<div data-composition-id="c" data-duration="10">
  <video data-start="-5" data-duration="3" src="clip.mp4"></video>
  <audio data-start="0" data-duration="2" src="clip.mp4"></audio>
</div>

The renderer clamps the video start to 0, so both play clip.mp4 over 0..2.

Related work

Fixes #8132.

How

  • mediaTimeWindow reads the window through readClipTiming; a negative start is clamped to zero and an unknown start/duration still returns null.
  • Added video_audio_double_source still fires when the video starts negative; it fails on main and passes with the change.

Test plan

  • Unit tests added/updated — packages/lint/src/rules/media.test.ts is 149 passed.
  • Typecheck: @hyperframes/lint typecheck passes.
  • comment-ratchet and oxfmt --check pass on the changed files.
  • Manual testing performed — not needed for a pure lint rule.
  • Documentation updated — not applicable.
  • Comments follow CONTRIBUTING.md.

Commands run:

vitest media.test.ts -t "starts negative" -> fails on main, passes with the fix
vitest media.test.ts                     -> 149 passed
bun run --filter @hyperframes/lint typecheck -> 0
node scripts/comment-ratchet.mjs         -> 0
oxfmt --check on the changed files       -> pass

@zhengqiuyang

Copy link
Copy Markdown
Contributor Author

Test (cli 2/2) was cancelled by the runner mid-shard (the log ends with "The operation was canceled" and has no failing assertion); the aggregate Test job then reported a failed shard. The lint change is covered locally by media.test.ts (149 passed), so this looks like a runner cancellation rather than a test failure.

Could you re-run that workflow? Thanks.

`mediaTimeWindow` parsed `data-start` with a raw `Number()`. A negative start,
which `readClipTiming` clamps to zero, produced a window entirely before zero,
so `mediaWindowsOverlap` reported no overlap and `video_audio_double_source`
missed a real duplicate-audio error.

Read the window through `readClipTiming`, the same contract parser the renderer
uses, and keep returning null when the start or duration is unknown.

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

Reviewed at 383a58ddf752103d07fa2d9d5c7c6383ef5163f1.

mediaTimeWindow now uses the canonical timing reader (packages/lint/src/utils.ts:242), including negative-start clamping. Unknown timing stays conservative, and the regression reproduces the duplicate-source overlap from #8132.

Need: yes · Size: ok · Reuse: readClipTiming and the existing overlap predicate · Simpler: already minimal · Structure: fine (checked existing callers and helpers; no split)
Risk: low — lint timing only.

Validation: bun run --cwd packages/lint test src/rules/media.test.ts --maxWorkers=2: 149 passed. Restoring the old utility makes the new negative-start regression fail (1 failed). Full workspace build passed at this head. Independent source cross-check found no blocker.

Verdict: APPROVE
Reasoning: The focused change addresses the reported behavior without introducing a blocking regression.

— Rames

@jrusso1020
jrusso1020 added this pull request to the merge queue Nov 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 18, 2026
@zhengqiuyang

Copy link
Copy Markdown
Contributor Author

All checks on 383a58dd are green now (81 check runs, none failed or cancelled), and the PR is CLEAN, but the merge-queue bot removed it earlier due to a transient failed status. Could you re-add it to the queue when you get a chance?

@jrusso1020
jrusso1020 added this pull request to the merge queue Nov 19, 2026
Merged via the queue into heygen-com:main with commit a7d7a60 Nov 19, 2026
81 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.

[Bug]: check: a negative data-start hides a video_audio_double_source error

2 participants