fix(main): async project listing, ffmpeg timeouts + concurrency cap, structured IPC errors, recorder cleanup#52
Merged
Conversation
…structured errors, recorder cleanup
Main process:
- listProjects is now async (fs/promises + Promise.all): it parses every
project's edl.json + meta.json, and doing that serially with sync fs on
the UI thread janked the window once a user had many projects.
- Shared runFfmpeg(args, timeoutMs) with a hard SIGKILL timeout replaces
the four ad-hoc ffmpeg spawns (thumbnail/probe/proxy/voice-sample) — a
malformed file could otherwise hang a spawn forever. Proxy encodes are
bounded to 2 concurrent (importing N videos previously fired N at once).
- Import/watch/thumbnail handlers validate the slug via a shared
assertSlug and return {ok:false,error} instead of throwing across IPC
(they called safeProjectPath, which throws, outside any try/catch).
- meta:save / style:patch re-validate the merged result through
parseMeta / parseStyleProfile before writing, so an arbitrary renderer
patch can't persist unknown keys or a url() palette.
Renderer:
- RecordButton (LeftRail) and VoicesTab (Settings) stop the MediaRecorder
and release the mic on unmount — Cmd+\ unmounts the rail mid-recording,
which left the mic hot and the recorder leaked.
- Home project/album delete failures now surface an error toast instead of
silently doing nothing.
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Audit roadmap Phase 5 (main-process robustness + two renderer leak/error fixes).
Main process
listProjectsis now async (fs/promises+Promise.all). It parses every project'sedl.json+meta.json; doing that serially with sync fs on the main (UI) thread janked the window once a user had many projects.runFfmpeg(args, timeoutMs)with a hardSIGKILLtimeout replaces the four ad-hoc ffmpeg spawns (thumbnail / duration probe / proxy / voice-sample). A malformed or hostile media file could otherwise hang a spawn forever with no reaping. Proxy encodes are bounded to 2 concurrent — importing N videos previously fired Nffmpegprocesses at once, saturating CPU/memory.asset:import,asset:importBuffer,references/benchmark:import,project:watch, andproject:thumbnailvalidate the slug via a sharedassertSlugand return{ ok:false, error }instead of throwing across IPC (they calledsafeProjectPath, which throws, outside any try/catch — violating the repo's own IPC convention).asset:importBufferalso rejects a non-basename filename.meta:save/style:patchre-validate the merged result throughparseMeta/parseStyleProfilebefore writing, so an arbitrary renderer patch can't persist unknown keys or an unsafe (url()) palette into the sidecar files.Renderer
RecordButton(LeftRail) andVoicesTab(Settings) now stop theMediaRecorderand release the mic tracks on unmount.Cmd+\unmounts the rail mid-recording, which left the mic hot and the recorder leaked.Main-process + preload-adjacent change — restart
npm run dev.Test plan
Made with Cursor