Skip to content

Comments

Sweep: Refactor toggleRecording into RecordingManager#65

Open
ysdede wants to merge 2 commits intostagingfrom
refactor/recording-manager-399432521048318983
Open

Sweep: Refactor toggleRecording into RecordingManager#65
ysdede wants to merge 2 commits intostagingfrom
refactor/recording-manager-399432521048318983

Conversation

@ysdede
Copy link
Owner

@ysdede ysdede commented Feb 7, 2026

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.

What

  • Extracted AudioEngine, TranscriptionWorkerClient, MelWorkerClient, BufferWorkerClient, TenVADWorkerClient, and HybridVAD management into src/lib/recording/RecordingManager.ts.
  • Moved toggleRecording, v4Tick, cleanupV4Pipeline, and related state variables from App.tsx to RecordingManager.
  • Updated App.tsx to use RecordingManager singleton for initialization, cleanup, and recording toggling.
  • Exposed audioEngine and melClient via signals from RecordingManager for DebugPanel and Sidebar.

Why

  • The toggleRecording function in App.tsx was overly complex (>100 lines) and handled disparate responsibilities (UI state, audio lifecycle, worker communication).
  • Moving this logic to a dedicated manager improves separation of concerns and makes App.tsx cleaner and easier to maintain.
  • Encapsulating the "V4 Pipeline" logic in RecordingManager makes it easier to test and reason about the transcription flow independently of the UI.

Verification

  • Manually verified code structure and logic flow.
  • Verified that App.tsx correctly imports and uses RecordingManager.
  • Confirmed that signals for audioEngine and melClient are correctly exported and used by DebugPanel and Sidebar.
  • Note: Build and tests could not be run due to missing node_modules and 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

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>
@ysdede ysdede changed the base branch from release/r1 to staging February 10, 2026 20:59
@ysdede
Copy link
Owner Author

ysdede commented Feb 10, 2026

Review Summary (Post r1→master merge)

Status: ⚠️ CONFLICTING — Has merge conflicts with staging

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:

  1. Merge conflicts with current staging (App.tsx has diverged significantly)
  2. Duplicates v4 pipeline logic that was iterated on after this PR was created
  3. The singleton pattern may not be ideal for SolidJS reactivity
  4. Missing the latest v4 pipeline refinements (BufferWorker config, TEN-VAD improvements, etc.)

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.

@google-labs-jules
Copy link
Contributor

Review Summary (Post r1→master merge)

Status: ⚠️ CONFLICTING — Has merge conflicts with staging

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:

  1. Merge conflicts with current staging (App.tsx has diverged significantly)
  2. Duplicates v4 pipeline logic that was iterated on after this PR was created
  3. The singleton pattern may not be ideal for SolidJS reactivity
  4. Missing the latest v4 pipeline refinements (BufferWorker config, TEN-VAD improvements, etc.)

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 RecordingManager to use the SolidJS createRoot pattern (as a reactive store) instead of a class singleton, addressing the concern about reactivity. This approach is consistent with appStore. I extracted the v4 pipeline logic from the current state of App.tsx available in the branch; if there are newer refinements in staging, I can incorporate them if they are merged or if specific diffs are provided. The refactoring aims to reduce App.tsx complexity while maintaining the existing behavior.

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>
Repository owner deleted a comment from google-labs-jules bot Feb 17, 2026
Repository owner deleted a comment from coderabbitai bot Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant