Skip to content

fix(cli): resolve relative data-start references in composition duration [P2]#2077

Open
miguel-heygen wants to merge 1 commit into
mainfrom
fix/subcomp-relative-datastart-duration
Open

fix(cli): resolve relative data-start references in composition duration [P2]#2077
miguel-heygen wants to merge 1 commit into
mainfrom
fix/subcomp-relative-datastart-duration

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Bug

compositions --json (and inspect/snapshot) computed a truncated duration when a clip's data-start was a relative reference to another clip/sub-comp id. parseCompositions/parseSubComposition read parseFloat(data-start ?? "0") — a ref like data-start="s1" is non-numeric → NaN → that clip's contribution to the max-end was silently dropped. A host with two 3s clips (2nd data-start="s1") reported duration 3 instead of 6. Reported on 0.7.42.

Fix

Resolve relative references the same way the frame extractor does (parseStartExpression from @hyperframes/core + a findReferenceTargetEl/resolveReferencedStart port, since the engine's resolver isn't a public export across the package boundary). Applied in both duration-computing spots.

Verified

Host duration now 6 (was 3); 3 tests pass; oxfmt/oxlint clean; fallow exit 0 (deliberate mirror-not-import duplication at warn-level).

`compositions --json` computed each timed child's start with a bare
parseFloat(data-start ?? "0") in parseCompositions (host duration) and
parseSubComposition (sub-comp duration). A relative reference like
data-start="s1" ("start when clip s1 ends") is not numeric, so parseFloat
returned NaN and that clip's contribution to the max-end was silently
dropped — a host with two 3s clips (2nd data-start="s1") reported duration 3
instead of 6, breaking compositions/inspect/snapshot for composition-clip
relative timing.

Resolve relative references the same way the extractor does (parseStartExpression
from @hyperframes/core + a findReferenceTargetEl/resolveReferencedStart port,
since the engine's referenceResolver isn't a public export across the package
boundary). Verified: host duration now 6; 3 tests pass.
(Implemented via Codex; verified independently.)
@miguel-heygen miguel-heygen marked this pull request as ready for review July 8, 2026 21:40
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