fix: duplicate regex in prune, redundant cloning in undo/redo, typo#723
fix: duplicate regex in prune, redundant cloning in undo/redo, typo#723fix2015 wants to merge 1 commit into
Conversation
- pruneAutoRecordings had an inline regex that duplicated the logic from isAutoRecordingPath — if one gets updated without the other, wrong files get pruned. replaced with a call to isAutoRecordingPath. - undo/redo were cloning snapshots 3 times each when 2 is sufficient. reduced the redundant clone to avoid the extra structuredClone cost on every undo/redo operation. - fixed "seperate" → "separate" in audioFilters comment
📝 WalkthroughWalkthroughThis PR makes three small, unrelated edits: corrects a comment typo in an audio filters constant, replaces a regex-based filename filter with a helper function ChangesMiscellaneous small fixes
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
electron/ipc/recording/prune.ts (1)
128-136: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
isAutoRecordingPathneeds the video-extension check
recording-*.cursor.jsonandrecording-*.{system,mic}.{m4a,wav,webm}also start withrecording-, so this prefix-only filter counts sidecars as recordings. That skews retention and sends non-video entries through the video-specific cleanup path.🤖 Prompt for 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. In `@electron/ipc/recording/prune.ts` around lines 128 - 136, The auto-recording scan is using only the filename prefix, so sidecar files like cursor JSON and audio files are being treated as recordings. Update the filter in the recording pruning flow around the autoRecordingStats Promise.all pipeline to use isAutoRecordingPath with the video-extension check, so only actual video recordings are included and sidecars are excluded from the video cleanup path.
🤖 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.
Outside diff comments:
In `@electron/ipc/recording/prune.ts`:
- Around line 128-136: The auto-recording scan is using only the filename
prefix, so sidecar files like cursor JSON and audio files are being treated as
recordings. Update the filter in the recording pruning flow around the
autoRecordingStats Promise.all pipeline to use isAutoRecordingPath with the
video-extension check, so only actual video recordings are included and sidecars
are excluded from the video cleanup path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 709df9a0-4555-4163-92ef-56077469e2b3
📒 Files selected for processing (3)
electron/ipc/recording/audioFilters.tselectron/ipc/recording/prune.tssrc/components/video-editor/editorHistory.ts
A few things I found:
`pruneAutoRecordings` had an inline regex `/^recording-.*\.(mp4|mov|webm)$/i` that duplicates the logic from `isAutoRecordingPath`. If the pattern is ever updated in one place but not the other, the prune function will miss files or prune the wrong ones. Replaced the inline regex with a call to `isAutoRecordingPath(entry.name)` which is already imported.
undo/redo in `editorHistory.ts` were each cloning snapshots 3 times via `structuredClone` when 2 is sufficient. Since snapshots can contain all zoom/clip/speed/annotation/audio/caption data, that's a meaningful amount of unnecessary copying on every undo/redo action. Reduced to clone once for storage and once for the return value.
fixed "seperate" → "separate" typo in audioFilters.ts comment
Summary by CodeRabbit