Skip to content

feat(frontend): improve audio recorder lifecycle and STT integration#231

Open
chriswritescode-dev wants to merge 1 commit into
mainfrom
fix/zod-vite-compatibility
Open

feat(frontend): improve audio recorder lifecycle and STT integration#231
chriswritescode-dev wants to merge 1 commit into
mainfrom
fix/zod-vite-compatibility

Conversation

@chriswritescode-dev
Copy link
Copy Markdown
Owner

@chriswritescode-dev chriswritescode-dev commented May 17, 2026

Enhances the audio recording infrastructure for speech-to-text with improved lifecycle management and comprehensive test coverage.

Changes

Audio Recorder Improvements

  • Added prepare() method to initialize AudioContext in suspended state without acquiring microphone
  • Implemented lifecycle management: prepare → start → stop → releaseStream → dispose
  • AudioContext now suspends on stop instead of closing, enabling efficient restarts
  • MediaStream tracks are properly disabled on stop and released on demand
  • Idempotent prepare() prevents duplicate worklet loading

STT Hook Updates

  • Improved integration with new audio recorder lifecycle
  • Better error handling and state management
  • Added startup timeout handling for recorder initialization

Testing

  • Added comprehensive lifecycle tests for AudioRecorder
  • Mocked AudioContext, AudioWorkletNode, and MediaStream APIs
  • Tests cover: prepare, start, stop, releaseStream, dispose, and recovery scenarios

Build Fixes

  • Updated zod to ^4.4.3 for compatibility with @hookform/resolvers
  • Added vite optimizeDeps configuration for zod and @hookform/resolvers

Testing

  • Verified audio recording flow works correctly
  • All new tests pass
  • Frontend dev server starts without errors

Updates zod to latest version and configures vite optimizeDeps to fix
the missing './v4/core' import error from @hookform/resolvers.
@chriswritescode-dev chriswritescode-dev changed the title fix(frontend): resolve zod v4 import path for vite pre-bundling feat(frontend): improve audio recorder lifecycle and STT integration May 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