[PR #2] [CLOSED] Make recording debounce atomic, harden WAV/file I/O, secure config saving, and validate whisper model #3

Closed
opened 2026-08-08 18:06:17 +00:00 by jahruz67 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jahruz67/wisp-open/pull/2
Author: @jahruz67
Created: 5/15/2026
Status: Closed

Base: mainHead: codex/review-code-for-bugs-and-improvements-upuyf8


📝 Commits (2)

  • 54ec0fb Fix silent I/O failures and harden whisper model handling
  • 1639459 Fix debounce race and recorder callback write handling

📊 Changes

4 files changed (+73 additions, -25 deletions)

View changed files

📝 app.go (+10 -4)
📝 internal/audio/recorder/recorder.go (+47 -14)
📝 internal/config/config.go (+2 -2)
📝 internal/services/whisper/whisper.go (+14 -5)

📄 Description

Motivation

  • Prevent timing/race issues and silent I/O failures by making toggle debouncing atomic and checking write errors.
  • Improve security of persisted configuration by tightening directory and file permissions.
  • Harden whisper management and download logic to avoid panics or invalid model lookups.

Description

  • Replaced lastToggle time.Time with lastToggleUnixNano int64 and used atomic.LoadInt64/atomic.StoreInt64 with a nanosecond-based debounce check in ToggleRecording to avoid races and Wayland/double-bind glitches.
  • Added error checks and propagation to writeWAVHeader so each Write/binary.Write call returns an error instead of being ignored.
  • Secured config persistence by creating config directories with 0700 and writing config files with 0600 in Save.
  • Validated model lookup in the whisper Manager by checking Models[info.Model] existence before using the filename and returning an error on invalid installed model, and improved downloadFile to handle and return errors from out.Write.

Testing

  • Built the project with go build ./... and the build completed successfully.
  • Ran unit tests with go test ./... and all tests passed.

Codex Task


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/jahruz67/wisp-open/pull/2 **Author:** [@jahruz67](https://github.com/jahruz67) **Created:** 5/15/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex/review-code-for-bugs-and-improvements-upuyf8` --- ### 📝 Commits (2) - [`54ec0fb`](https://github.com/jahruz67/wisp-open/commit/54ec0fb1974fd144a4e076f5188fe5ce450384d3) Fix silent I/O failures and harden whisper model handling - [`1639459`](https://github.com/jahruz67/wisp-open/commit/1639459293d538b70aa81221956c9080cd68e8f3) Fix debounce race and recorder callback write handling ### 📊 Changes **4 files changed** (+73 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `app.go` (+10 -4) 📝 `internal/audio/recorder/recorder.go` (+47 -14) 📝 `internal/config/config.go` (+2 -2) 📝 `internal/services/whisper/whisper.go` (+14 -5) </details> ### 📄 Description ### Motivation - Prevent timing/race issues and silent I/O failures by making toggle debouncing atomic and checking write errors. - Improve security of persisted configuration by tightening directory and file permissions. - Harden whisper management and download logic to avoid panics or invalid model lookups. ### Description - Replaced `lastToggle time.Time` with `lastToggleUnixNano int64` and used `atomic.LoadInt64`/`atomic.StoreInt64` with a nanosecond-based debounce check in `ToggleRecording` to avoid races and Wayland/double-bind glitches. - Added error checks and propagation to `writeWAVHeader` so each `Write`/`binary.Write` call returns an error instead of being ignored. - Secured config persistence by creating config directories with `0700` and writing config files with `0600` in `Save`. - Validated model lookup in the whisper `Manager` by checking `Models[info.Model]` existence before using the filename and returning an error on invalid installed model, and improved `downloadFile` to handle and return errors from `out.Write`. ### Testing - Built the project with `go build ./...` and the build completed successfully. - Ran unit tests with `go test ./...` and all tests passed. ------ [Codex Task](https://chatgpt.com/codex/cloud/tasks/task_e_6a0685a3cc44832eb15a7b50f815a92f) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
jahruz67 added the pull-request label 2026-08-08 18:06:17 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jahruz67/wisp-open#3