Pulse/internal
rcourtman 06b5d5153b fix: resolve critical alert system bugs preventing crashes and memory leaks
Fix 5 critical bugs identified through systematic code review:

CRITICAL FIXES (prevent service crashes):
- Add panic recovery to all alert callbacks (onAlert, onResolved, onEscalate)
- Clone alerts before passing to escalation callback to prevent data races
- Make clearAlertNoLock callback async to prevent deadlock

HIGH PRIORITY FIXES (prevent memory leaks):
- Add cleanup for stale pendingAlerts entries (deleted resources)
- Add cleanup for dockerRestartTracking (ephemeral containers in CI/CD)

MEDIUM PRIORITY FIXES (prevent stuck alerts):
- Validate hysteresis thresholds (ensure clear < trigger)
- Auto-fix invalid configurations with warning logs

Impact:
- Service stability: Malformed webhook URLs or email configs can no longer crash Pulse
- Memory management: Prevents unbounded growth in dynamic environments
- Alert reliability: Prevents alerts that never clear due to invalid thresholds
- Concurrency safety: Eliminates data races in escalation path

Technical details:
- Created safeCallResolvedCallback() and safeCallEscalateCallback() wrappers
- Added ensureValidHysteresis() validation helper
- Extended Cleanup() with pendingAlerts and dockerRestartTracking pruning
- All callbacks now have defer/recover panic handlers with detailed logging

Testing: Verified compilation with 'go build -o /dev/null ./...'
2025-10-21 10:55:57 +00:00
..
adapters Fix settings security tab navigation 2025-10-11 23:29:47 +00:00
alerts fix: resolve critical alert system bugs preventing crashes and memory leaks 2025-10-21 10:55:57 +00:00
api docs: add Mermaid diagrams to improve visual documentation 2025-10-21 10:40:33 +00:00
auth Fix settings security tab navigation 2025-10-11 23:29:47 +00:00
config feat: improve discovery with progress tracking, validation, and structured errors 2025-10-20 22:29:30 +00:00
crypto Fix settings security tab navigation 2025-10-11 23:29:47 +00:00
discovery feat: improve discovery with progress tracking, validation, and structured errors 2025-10-20 22:29:30 +00:00
dockeragent Docker agent: add arch-aware self-update download 2025-10-16 08:43:59 +00:00
errors Fix settings security tab navigation 2025-10-11 23:29:47 +00:00
interfaces Fix settings security tab navigation 2025-10-11 23:29:47 +00:00
logging feat: add professional logging with runtime configuration and performance optimization 2025-10-20 15:13:38 +00:00
mock Adjust backup and snapshot alert handling 2025-10-18 20:11:01 +00:00
models Adjust backup and snapshot alert handling 2025-10-18 20:11:01 +00:00
monitoring feat: enhance runtime configuration and system settings management 2025-10-20 17:41:19 +00:00
notifications security: complete Phase 1 sensor proxy hardening 2025-10-20 15:13:37 +00:00
ssh/knownhosts security: complete Phase 1 sensor proxy hardening 2025-10-20 15:13:37 +00:00
tempproxy security: add resilience and error handling to tempproxy client 2025-10-19 16:37:11 +00:00
types Fix settings security tab navigation 2025-10-11 23:29:47 +00:00
updates fix: skip update check for source builds and show appropriate UI message 2025-10-21 10:08:00 +00:00
utils Fix settings security tab navigation 2025-10-11 23:29:47 +00:00
websocket refactor: use strconv.Itoa instead of string(rune()) in test 2025-10-20 15:12:14 +00:00