Repository navigation
fix(cli): preserve clip lengths when duplicating media - #6280
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
miguel-heygen
left a comment
There was a problem hiding this comment.
Thanks, this is a clean fix in the right place. The CLI already knows each clip's resolved length, and passing it into the one helper that every timeline duplicate goes through fixes both of your cases without a second probe. I checked that the helper's new argument defaults to the old behaviour, that a clip with an authored data-duration still wins, and that the new tests fail when the two production changes are reverted (the three natural-duration cases fail, the explicit one still passes).
One related case you may want to fold in, since it ends the same way. A clip timed with data-end instead of data-duration still overlaps. With a 3 s source, <video id="clip" data-start="1" data-end="2"> and a next clip at 2-3, timeline duplicate '#clip' now correctly moves the next clip to 3-4. But the copy is written as data-start="2" data-end="2", because the clone keeps the original's absolute data-end. Its end equals its start, so it falls back to the full source and plays 2-5, over the next clip. Shifting the clone's data-end by the same amount as its start (or writing data-duration on the copy) would close it. This also happens on main, so a follow-up is fine too.
Small optional point: every e2e row uses the 1 s fixture with 1 s authored durations, so the source length and the authored length give the same numbers. A longer fixture in one row would show which one won.
Verdict: APPROVE
Reasoning: Fixes the reported overlap at its root with tests that fail without it; CI is green and the remaining data-end case is older than this change.
|
Addressed the bounded-clip case in The copy's explicit end now moves with its start. Ripple uses the same operation for following clips with absolute ends, preserving their lengths too. Your three-second-source example now gives copy 2–3s and next 3–4s. A bounded neighbour also stays 3–4s instead of growing to 3–6s and overlapping a third clip. The CLI regression distinguishes a half-second authored trim from its one-second source. All 151 CLI and 148 helper tests pass. Independent GPT-6.1 Sol xhigh review also passed 15 boundary checks, 11 built-CLI plan/apply/reopen scenarios and both package gates. |
miguel-heygen
left a comment
There was a problem hiding this comment.
Thanks for folding this in. Moving the clip's start and its data-end together in one helper, and using it both for the copy and for every clip the duplicate pushes later, is the right fix: a later clip timed with data-end used to shrink, and once its end fell before its start it fell back to its full source length. My earlier example now gives copy 2-3 and next 3-4, and the same holds for plain elements timed only with data-end.
The new tests cover both parts. With the previous version of duplicateElement.ts, the three new helper tests and the two new CLI cases fail, and the older rows still pass. The half-second row also settles which length wins. The tests pass three runs in a row, the CLI typecheck is clean and CI is green.
Verdict: APPROVE
Reasoning: Copies and later clips timed with data-end now keep their length, closing the remaining overlap, with tests that fail without the change; CI is green.
Duplicating a video that uses its source length could put the copy underneath the next shot. The CLI knew the resolved length, but inserted zero seconds of space. A following video without an explicit duration also escaped the ripple.
The copy now gets its full slot, and later clips on the same track move by that length. The review also identified clips bounded by
data-end: the copy kept the original absolute end, so a one-second clip could become three seconds long. The copy and each rippled neighbour now shift their explicit ends by the same amount as their starts. One shared timing update keeps these operations consistent.data-endThe helper uses the timeline's existing resolved duration as a fallback. Authored duration still wins. No extra media probe or persisted duration attribute is added.
Closes #6278. The Studio clipboard work in #5684 does not change this CLI duplication helper.
Validation:
de4c0cd7447e68a6a2137fec613adad9cfb2f498and pass with the correction. The CLI regression uses a half-second authored clip from a one-second source.This follow-up uses existing dependencies and builds. It adds no new browser or MP4-export evidence. Mintlify validation and broken-link checks require the unavailable
mintexecutable. Independent GPT-6.1 Sol xhigh review cleared exact signed commit5726850d0b3cb939ab00d092bb89248fb027b037. It independently passed all 299 focused tests, 15 boundary checks and 11 built-CLI scenarios, and verified source/bundle correspondence and both actual archives without changing the checkout.