towerops/test/towerops_web/controllers
Graham McIntire 0ac99f679c
fix: convert alert_type from enum to string and fix SQL array syntax
Two critical production bugs fixed:

1. **Alert type enum → string conversion**
   - Changed Alert.alert_type from Ecto.Enum to :string for flexibility
   - Updated all queries to use "device_down"/"device_up" strings instead of atoms
   - Fixed pattern matching in alerts.ex and device_monitor_worker.ex
   - Updated 44+ test files to use string literals

2. **SQL array indexing syntax error in activity feed**
   - Fixed PostgreSQL syntax: `array_agg(...)[1]` → `(array_agg(...))[1]`
   - Prevents "syntax error at or near [" in activity feed queries

3. **Added comprehensive timer cleanup tests**
   - Tests for mobile_qr_live.ex timer cleanup on terminate
   - Tests for agent_live index timer cleanup
   - Verifies memory leak fixes from previous commits

Files changed:
- lib/towerops/alerts.ex
- lib/towerops/alerts/alert.ex
- lib/towerops/activity_feed.ex
- lib/towerops/workers/device_monitor_worker.ex
- test/**/*_test.exs (44+ files with alert_type references)
- test/towerops_web/live/mobile_qr_live_test.exs
- test/towerops_web/live/agent_live_test.exs
- test/towerops/workers/device_poller_worker_test.exs

All tests passing except 1 unrelated brute force protection test.
2026-03-05 09:12:39 -06:00
..
api fix: convert alert_type from enum to string and fix SQL array syntax 2026-03-05 09:12:39 -06:00
admin_controller_test.exs feat: add critical network switch sensor support (HP Comware, Dell PowerConnect, Dell SONiC) 2026-02-11 17:36:45 -06:00
api_docs_controller_test.exs feat: add Force10 FTOS and optical transceiver monitoring (ProCurve, Comware) 2026-02-12 08:19:12 -06:00
debug_controller_test.exs feat: add critical network switch sensor support (HP Comware, Dell PowerConnect, Dell SONiC) 2026-02-11 17:36:45 -06:00
error_html_test.exs Fix tests, credo issues, and Gaiia sync bugs 2026-02-15 11:55:49 -06:00
error_json_test.exs init 2025-12-21 11:10:43 -06:00
health_controller_test.exs fix user session controller test 2026-02-03 13:42:24 -06:00
page_controller_test.exs Fix mobile Gaiia entity mapping + redirect / to /dashboard 2026-02-15 15:05:20 -06:00
page_html_test.exs fix: resolve compilation errors, test failures, and credo issues 2026-02-14 12:23:10 -06:00
user_reset_password_controller_test.exs test: expand coverage for devices, workers, and LiveView modules 2026-02-12 09:06:41 -06:00
user_session_controller_test.exs fix user session controller test 2026-02-03 13:42:24 -06:00
user_session_html_test.exs purge more passkey and gettext updates 2026-02-02 10:20:59 -06:00
user_settings_controller_test.exs Convert User Settings from controller to LiveView 2026-01-15 16:29:50 -06:00
user_settings_html_test.exs remove passkeys for now 2026-01-31 09:50:35 -06:00
user_sudo_controller_test.exs fix: address UserSudoController critical issues 2026-02-01 14:45:05 -06:00