Skip to content

fix(vad): guard unknown field limits and normalize context in whisperVadConfig - #1926

Open
hsusul wants to merge 1 commit into
OpenWhispr:mainfrom
hsusul:fix/1925-whisper-vad-config-safety
Open

fix(vad): guard unknown field limits and normalize context in whisperVadConfig#1926
hsusul wants to merge 1 commit into
OpenWhispr:mainfrom
hsusul:fix/1925-whisper-vad-config-safety

Conversation

@hsusul

@hsusul hsusul commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #1925

Problem

In src/helpers/whisperVadConfig.js:

  • clampVadField(key, value) unconditionally indexed LIMITS[key], throwing TypeError: Cannot destructure property 'min' of 'LIMITS[key]' if an unlisted or custom configuration field was passed.
  • resolveContextSileroEnabled(settings, context) compared against literal "dictation", "noteRecording", and "meeting", failing to recognize mixed-case or whitespace-padded context strings.

Solution

  • Checked for existence of LIMITS[key] before destructuring min/max limits.
  • Normalized context string with .trim().toLowerCase().
  • Added unit tests in test/helpers/whisperVadConfig.test.js.

Verification

  • node --test test/helpers/whisperVadConfig.test.js (passes, 5/5 tests)
  • npm run typecheck (passes, 0 errors)
  • npm run lint (passes, 0 errors)
  • npm run i18n:check (passes)
  • npm run build:renderer (passes)
  • git diff --check (clean)

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.

clampVadField throws TypeError on unknown keys and resolveContextSileroEnabled misses mixed-case contexts

1 participant