towerops/test/towerops_web/live
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
..
account_live test: expand coverage for devices, workers, and LiveView modules 2026-02-12 09:06:41 -06:00
admin feat: add Dell PowerVault storage array text-based sensor parsing 2026-02-12 08:38:30 -06:00
agent_live Fix tests, credo issues, and Gaiia sync bugs 2026-02-15 11:55:49 -06:00
device_live Fix pre-existing test failures from role enum and MikroTik changes 2026-02-16 16:11:32 -06:00
device_live_nested feat: add Force10 FTOS and optical transceiver monitoring (ProCurve, Comware) 2026-02-12 08:19:12 -06:00
graph_live feat: add Dell PowerVault storage array text-based sensor parsing 2026-02-12 08:38:30 -06:00
help_live feat: add critical network switch sensor support (HP Comware, Dell PowerConnect, Dell SONiC) 2026-02-11 17:36:45 -06:00
helpers fix: convert alert_type from enum to string and fix SQL array syntax 2026-03-05 09:12:39 -06:00
org Fix pre-existing test failures from role enum and MikroTik changes 2026-02-16 16:11:32 -06:00
org_live fix test warnings and failures 2026-02-05 15:24:41 -06:00
user_settings_live feat: add 12/24-hour time format setting with consistent timezone display 2026-02-13 15:16:29 -06:00
agent_live_test.exs fix: convert alert_type from enum to string and fix SQL array syntax 2026-03-05 09:12:39 -06:00
alert_live_test.exs fix: convert alert_type from enum to string and fix SQL array syntax 2026-03-05 09:12:39 -06:00
dashboard_live_test.exs fix: convert alert_type from enum to string and fix SQL array syntax 2026-03-05 09:12:39 -06:00
mobile_qr_live_test.exs fix: convert alert_type from enum to string and fix SQL array syntax 2026-03-05 09:12:39 -06:00
my_data_live_test.exs fix: convert alert_type from enum to string and fix SQL array syntax 2026-03-05 09:12:39 -06:00
network_map_live_test.exs feat: add automatic network topology inference 2026-02-12 13:28:01 -06:00
org_live_test.exs fix test warnings and failures 2026-02-05 15:24:41 -06:00
site_live_test.exs fix: convert alert_type from enum to string and fix SQL array syntax 2026-03-05 09:12:39 -06:00
user_registration_live_test.exs Use detected timezone from session in user registration 2026-02-01 12:18:33 -06:00
user_reset_password_live_test.exs add HIBP password check 2026-02-01 08:57:01 -06:00
user_settings_live_test.exs feat: add Dell PowerVault storage array text-based sensor parsing 2026-02-12 08:38:30 -06:00