Skip to content

Conversation

@servak
Copy link
Owner

@servak servak commented Sep 30, 2025

Summary

  • Implement beep sound notification system for probe failures
  • Add 'b' key binding to toggle beep on/off
  • Display beep state in UI header panel

Changes

Core Implementation

  • New package internal/beep: Thread-safe beep sound player with 500ms debounce
  • Stats integration: Automatically play beep on probe failures (non-blocking)
  • UI integration: Complete UI support with state display and controls

Key Features

  • ✅ Thread-safe with mutex protection
  • ✅ Non-blocking asynchronous execution
  • ✅ 500ms debounce to prevent continuous beeping
  • ✅ Toggle functionality (default: ON)
  • ✅ Comprehensive test coverage

UI Updates

  • b key: Toggle beep on/off
  • Header: Display "Beep: ON/OFF" state
  • Footer: Show "b:beep" operation guide
  • Help modal: Add beep toggle documentation

Test Results

✅ go fmt: No issues
✅ go test: All packages pass
✅ go build: Build successful

Related

Implements beep sound notification requirements as specified in BEEP.md

Implement a beep sound notification system for probe failures:
- Thread-safe Beeper with mutex protection
- 500ms debounce interval to prevent continuous beeping
- Non-blocking asynchronous execution using goroutines
- ON/OFF toggle functionality
- Comprehensive test coverage including concurrent access tests
Integrate beep functionality across the application:
- Stats manager plays beep on probe failures
- Add ToggleBeep() and IsBeepEnabled() to MetricsSystemManager interface
- UI key binding 'b' to toggle beep on/off
- Header panel displays beep state (ON/OFF)
- Footer panel shows 'b:beep' operation guide
- Help modal includes beep toggle documentation
- BeepStateProvider interface for UI state access

All changes are non-blocking and maintain thread safety.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a beep sound notification system that plays an audible alert when probe failures occur. The feature includes both backend functionality and complete UI integration with user controls.

  • Adds new internal/beep package with thread-safe beep sound player featuring 500ms debounce
  • Integrates beep functionality into stats manager to automatically play sounds on probe failures
  • Updates UI with beep state display in header, toggle controls, and help documentation

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/beep/beep.go Core beep sound implementation with debouncing and thread safety
internal/beep/beep_test.go Comprehensive test suite for beep functionality
internal/stats/manager.go Integration of beep system with probe failure events
internal/stats/interface.go Interface extensions for beep control methods
internal/ui/tui/app.go Key binding for 'b' toggle and help text updates
internal/ui/tui/layout.go Wiring of beep state provider to header panel
internal/ui/tui/panels/header_footer.go UI display of beep state and footer controls

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

- Add GetLastBeepTime() method with mutex protection for thread-safe access
- Use time.Time.Equal() for time comparison as recommended by staticcheck
- Fix race condition detected in TestDebounce
- All tests now pass with -race flag
@servak servak merged commit 753733d into main Sep 30, 2025
4 checks passed
@servak servak deleted the feat/beap branch September 30, 2025 05:54
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