Skip to content

feat(timeline): support video source ranges - #22

Merged
moonrailgun merged 1 commit into
mainfrom
moonrailgun/element-split
Aug 28, 2026
Merged

feat(timeline): support video source ranges#22
moonrailgun merged 1 commit into
mainfrom
moonrailgun/element-split

Conversation

@moonrailgun

@moonrailgun moonrailgun commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Background

Agent timeline tools could add whole videos, but not a selected source range. This made it hard for agents to place only part of a video on the timeline.

Changes

  • Add trimStart and sourceOutPoint inputs for video timeline insertion.
  • Validate source ranges so they stay inside the video duration.
  • Convert source ranges into timeline duration and trimEnd values.
  • Report sourceOutPoint in timeline state for video elements.
  • Allow buildVideoElement to receive trimStart and trimEnd.

Testing

Added Bun tests for adding a source subclip, deriving trimEnd from duration, and rejecting an out-of-range source range.

Summary by CodeRabbit

  • New Features

    • Added support for adding video clips to the timeline with specified source ranges and trim points.
    • Timeline state now reports each video’s source endpoint.
    • Clip duration and trim values are calculated automatically when omitted.
  • Bug Fixes

    • Invalid source ranges and non-video sources are now rejected.
    • Video elements correctly preserve their trim settings.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 71fb83cd-a9f3-428d-a87c-b460f5075c9b

📥 Commits

Reviewing files that changed from the base of the PR and between cf88eae and aea9464.

📒 Files selected for processing (3)
  • apps/web/src/lib/ai/agent/tools/timeline-tools.test.ts
  • apps/web/src/lib/ai/agent/tools/timeline-tools.ts
  • apps/web/src/lib/timeline/element-utils.ts

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The timeline tools now support validated video source ranges. Video elements preserve trim values, timeline state reports computed source endpoints, and tests cover explicit, derived, and invalid ranges.

Changes

Video trim support

Layer / File(s) Summary
Trimmed video insertion
apps/web/src/lib/timeline/element-utils.ts, apps/web/src/lib/ai/agent/tools/timeline-tools.ts
buildVideoElement accepts trim values. addVideoToTimelineTool validates source ranges, derives timing values, and passes them to the element builder.
Timeline state reporting and validation
apps/web/src/lib/ai/agent/tools/timeline-tools.ts, apps/web/src/lib/ai/agent/tools/timeline-tools.test.ts
getTimelineStateTool reports sourceOutPoint. Tests cover explicit trims, duration-based defaults, and out-of-range rejection.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to aea94

The PR adds validated video source-range support without introducing an actionable merge-blocking risk; it is merge-ready after normal checks and review.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the background, implementation changes, and tests, but it describes a feature PR. The repository template states that feature PRs are not accepted and requires opening an issu… Open an issue to discuss the feature before submitting the PR. If this is intended as a critical bug fix, identify the issue and maintainer approval, and update the description to include both checklist items from the template.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: support for video source ranges in the timeline.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the background, implementation changes, and tests, but it describes a feature PR. The repository template states that feature PRs are not accepted and requires opening an issue for discussion first.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch moonrailgun/element-split

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@moonrailgun
moonrailgun merged commit 1ea40e3 into main Aug 28, 2026
4 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.

1 participant