Skip to content

fix(lint): read a sub-composition mount's timing through the parser - #8037

Merged
jrusso1020 merged 1 commit into
heygen-com:mainfrom
zhengqiuyang:fix/lint-subcomp-reference-start
Nov 17, 2026
Merged

jrusso1020 merged 1 commit into
heygen-com:mainfrom
zhengqiuyang:fix/lint-subcomp-reference-start

Conversation

@zhengqiuyang

Copy link
Copy Markdown
Contributor

What

subcomposition_blanks_before_host now reads a mount's timing through readClipTiming, the same contract parser the renderer uses, instead of re-parsing data-start/data-duration with Number().

Why

With a raw parse, a mount whose start resolves at runtime (data-start="intro + 0.5") looked like it started at 0. The rule then reported a blank tail that may not exist and suggested a wrong data-duration. A negative start was measured from the raw value, so both the reported gap and the fix hint were wrong (the hint could exceed the host duration).

Related work

Fixes #8036.

The rule itself came from #1542 (issue #1540). This keeps its intent — a mount that starts at the host start and is shorter than the host blanks the tail — and only fixes how the mount's timing is read.

How

  • The timed-mount map calls readClipTiming with the tag's attribute reader.
  • A runtime-resolved start (timing.start === null) is skipped: its end cannot be known statically, so the rule stays silent instead of guessing.
  • A negative start is measured from zero, matching the renderer.
  • Unknown duration still becomes Infinity, preserving the existing "covers the tail" behavior.
  • Two regression tests: reference start stays silent; negative start reports a 3s end / ~7s gap / 10s hint for a 10s host.

Test plan

  • Unit tests added/updated — both fail on main, pass with the change.
  • 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 composition.test.ts -t "stays silent when the mount resolves|measures a negative start" -> pass (both fail on main)
bun run --filter @hyperframes/lint typecheck -> 0
node scripts/comment-ratchet.mjs -> 0
oxfmt --check on the changed files -> pass

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

Approving. Reading the mount's timing through readClipTiming fixes both cases in #8036: an unresolved expression start is now skipped instead of being treated as 0, and a negative start is clamped to 0, the way the renderer measures it. Clips with an unknown duration still cover the tail, as they did before.

fails without the fix: subcomposition_blanks_before_host > stays silent when the mount resolves its start at runtime and > measures a negative start from zero, as the renderer does. With composition.ts reset to main and the new tests kept, 2 tests fail and 321 pass. At this head, all 323 tests in composition.test.ts pass.

Optional nits:

  • composition.ts:1464 builds the attribute reader inline. readTagTiming(tag.raw) (L88) already does this.
  • A row whose start is a reference (for example data-start="intro") is dropped, so it can't count as covering the tail. A mount that starts at an earlier clip's id is still flagged as blank, which is a false positive. Main behaves the same way, so this isn't a regression.
  • #8032 touches the same two files in different hunks. Whichever PR lands second may need a trivial rebase.

Review by Rames

`subcomposition_blanks_before_host` read `data-start` and `data-duration` with a
raw `Number()`, so a mount with a reference start (`intro + 0.5`) looked like it
started at 0 and was reported as leaving a blank tail that may not exist. A
negative start was measured from the raw value, so the reported gap and the
`data-duration` fix hint were wrong in the other direction.

Read the mount through `readClipTiming`, the same contract parser the renderer
uses: a runtime-resolved start is skipped (its end cannot be known statically),
and a negative start is measured from zero.
@zhengqiuyang
zhengqiuyang force-pushed the fix/lint-subcomp-reference-start branch from 3637380 to 4b3b059 Compare November 17, 2026 16:10
@zhengqiuyang

Copy link
Copy Markdown
Contributor Author

Thanks — applied the nit in 4b3b059: the sub-composition rule now uses readTagTiming(tag.raw) instead of building the reader inline.

On the reference-start row: keeping it skipped is deliberate, because its start (and therefore end) is only known at runtime; counting it as covering the tail would silently suppress a real blank-tail warning, so the rule stays silent for that row.

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

Re-approving at 4b3b059. I compared the patch against the one I approved at 3637380. The only change is the reader: readTagTiming(tag.raw) replaces the inline readClipTiming closure, which was my nit, and the commit is now rebased on current main. composition.test.ts passes 323/323 at this head.

Review by Rames

@jrusso1020
jrusso1020 added this pull request to the merge queue Nov 17, 2026
Merged via the queue into heygen-com:main with commit c84c30f Nov 17, 2026
134 of 135 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: subcomposition_blanks_before_host invents a blank tail for a runtime start and mis-measures a negative start

2 participants