Uh oh!
There was an error while loading. Please reload this page.
fix(export): keep speed segments non-overlapping - #237
Conversation
Warning Review limit reached
Next review available in:5 seconds You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesSpeed region handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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. Comment |
89e07a8 to
545043dComparefab6cf3 to
f29927bComparef29927b to
ebb1cd0Compare
EtienneLescot
left a comment
There was a problem hiding this comment.
The clamp is right, and the two tests pin exactly the cases that were broken. if (srEnd <= cursor) continue plus effectiveStart = Math.max(srStart, cursor) is the same shape the native side already uses in speed_segments_for_window (crates/compositor/src/regions.rs), so this brings the TS path into agreement with Rust rather than inventing a third rule, and it honours the existing docstring's "the earliest-starting one wins" instead of quietly changing the contract.
One thing to be straight about: splitBySpeed is dormant right now. Its only consumers are StreamingVideoDecoder.decodeAll and getExportMetrics in src/lib/exporter/streamingDecoder.ts, and nothing in the repo calls either — every export goes through buildSceneDescription + exportMultiNative/exportGifNative from ExportDialog.tsx. So no user is hitting the duplicated output today. That doesn't argue against merging: it removes a divergence from the compositor and leaves the web decoder correct for whenever it's wired back up.
Also worth knowing, since it landed after your merge base: overlapping speed regions are now trivial to create. addSpeed in useTimeline.ts does no overlap check on create, and new pills are sized by zoom — roughly 3m45s per click at full zoom-out on a 30-minute recording. Two clicks reproduce your first test case exactly.
Merging.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
The docstring still described regions as assumed non-overlapping, with the earliest-starting one winning when they do overlap. After this PR the first clause is no longer an assumption the code leans on and the second is enforced rather than incidental, so say what the function actually guarantees — disjoint, ascending output — and name the native counterpart it agrees with (speed_segments_for_window in crates/compositor/src/regions.rs). Also record what main produced for the fully-covered case, so the second overlap test does not read as a redundant variant of the first and get dropped: the emitted list stopped being ascending and re-emitted 5-8, and decodeAll walks these with a forward-only frame cursor, so that was a backwards seek rather than just a duplicated stretch.
EtienneLescot
left a comment
There was a problem hiding this comment.
Docstring and test note landed in 5a38403, CI green, threads resolved. Approving.
For the record on priority: splitBySpeed has no live caller today — every export goes through the native compositor — so nothing user-facing was broken. What this buys is that the TS helper and speed_segments_for_window now implement the same rule, which matters because the toolbar makes overlapping speed regions easy to create and the next person to wire up the web decoder should not rediscover this.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Related issue
No linked issue; found with overlapping speed-region property cases.
Type of change
Release impact
Desktop impact
Screenshots / video
Not applicable; export timeline segmentation logic.
Testing
Summary by CodeRabbit
Bug Fixes
Tests