fix(timeline): make virtual lookup order-independent - #240
Conversation
|
Warning Review limit reached
Next review available in: 39 minutes 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)
📝 WalkthroughWalkthroughVirtual preview timeline calculations now remain correct when clips are provided in a different order. Tests cover duration, position lookup, and next-segment selection for unordered clips. ChangesVirtual preview ordering
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/lib/ai-edition/timeline/virtual-preview.ts`:
- Around line 113-116: The sort in findNextKeptSegment() needs a deterministic
secondary ordering when candidates share the same rawStart. Update the .sort()
comparator to apply the playback contract’s tie-breaker after comparing
rawStart, and add a regression test using tied candidates with permuted
playbackClips order to verify the selected segment remains consistent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 2b8edd8e-e647-4e3e-8029-b16efecc4601
📒 Files selected for processing (2)
src/lib/ai-edition/timeline/virtual-preview.test.tssrc/lib/ai-edition/timeline/virtual-preview.ts
|
Closing this one, and I want to give you the actual reason rather than leaving it to rot. The premise does not hold. So the sorting is defending against a state the document model cannot produce — and it is not free: What made me close it rather than ask for changes is that the one thing the PR does change behaviourally is not the thing in the title. If you think the precedence should change, that is a real conversation and worth its own PR: state the new rule, update the comment that guards it, and pin it with a test that fails on the old order. As it stands the change is invisible. For context on where the rest landed: #236, #237, #238, #239, #242 and #235 are all merged. #242 in particular found a data-integrity bug I had not seen — deleting the last clip left orphaned modifiers that got resurrected onto new footage on the next open. That one was worth the whole batch. |
Summary
Related issue
No linked issue; found while auditing the virtual-preview ordering contract.
Type of change
Release impact
Desktop impact
Screenshots / video
Not applicable; this is timeline math with no visual changes.
Testing
npm exec -- vitest run src/lib/ai-edition/timeline/virtual-preview.test.tsnpm exec -- biome check src/lib/ai-edition/timeline/virtual-preview.ts src/lib/ai-edition/timeline/virtual-preview.test.tsnpm run build-vitenpm run wb:typecheckSummary by CodeRabbit
Bug Fixes
Tests