Sweep: Refactor toggleRecording into RecordingManager#65
Sweep: Refactor toggleRecording into RecordingManager#65
Conversation
Refactored App.tsx to extract audio engine and transcription logic into a singleton RecordingManager class. This improves code maintainability and reduces the complexity of App.tsx. Changes: - Created `src/lib/recording/RecordingManager.ts` to manage audio engine, worker clients, and VAD pipeline. - Moved `toggleRecording`, `v4Tick`, `cleanupV4Pipeline`, and related state variables from `App.tsx` to `RecordingManager`. - Updated `App.tsx` to use `RecordingManager` singleton. - Exposed `audioEngine` and `melClient` via signals from `RecordingManager` for UI components. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Review Summary (Post r1→master merge)Status: Changes: Large refactor (~400 lines) extracting recording orchestration from App.tsx into a new RecordingManager singleton. Moves oggleRecording, model loading, v2/v3/v4 pipeline setup, and tick loop logic into a dedicated class. Assessment: The intent is good — reducing App.tsx complexity — but this PR has significant issues:
Recommendation: ❌ Close — The v4 pipeline in App.tsx has evolved significantly since this PR. Rebasing would essentially require rewriting the entire PR. If we still want this refactor, it should be done fresh from current staging. |
I have refactored |
Changed RecordingManager from a class singleton to a SolidJS reactive root (store pattern). This addresses feedback about SolidJS reactivity and aligns with appStore architecture. Changes: - Refactored `src/lib/recording/RecordingManager.ts` to use `createRoot` and `createSignal`. - Updated `src/App.tsx` to consume `recordingManager` as a reactive object. - Replaced direct property access with signal calls where appropriate. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Refactored
App.tsxto extract audio engine and transcription logic into a singletonRecordingManagerclass. This improves code maintainability and reduces the complexity ofApp.tsx.What
AudioEngine,TranscriptionWorkerClient,MelWorkerClient,BufferWorkerClient,TenVADWorkerClient, andHybridVADmanagement intosrc/lib/recording/RecordingManager.ts.toggleRecording,v4Tick,cleanupV4Pipeline, and related state variables fromApp.tsxtoRecordingManager.App.tsxto useRecordingManagersingleton for initialization, cleanup, and recording toggling.audioEngineandmelClientvia signals fromRecordingManagerforDebugPanelandSidebar.Why
toggleRecordingfunction inApp.tsxwas overly complex (>100 lines) and handled disparate responsibilities (UI state, audio lifecycle, worker communication).App.tsxcleaner and easier to maintain.RecordingManagermakes it easier to test and reason about the transcription flow independently of the UI.Verification
App.tsxcorrectly imports and usesRecordingManager.audioEngineandmelClientare correctly exported and used byDebugPanelandSidebar.node_modulesand network restrictions in the environment, but the refactoring is structural and preserves existing logic.PR created automatically by Jules for task 399432521048318983 started by @ysdede