towerops/test/towerops_web/live
Graham McIntire 872f717dba Fix critical bugs, memory leaks, and N+1 queries (#132)
CRITICAL FIXES:
- Fix unsafe pattern matching in SNMP discovery that would crash on timeout
  - Changed {:ok, _} = ... to proper case statements with error handling
  - Extracted safe_discover/3 helper to reduce cyclomatic complexity
  - Added fallback to empty lists and warning logging for timeouts
  - Affects: discover_vlans, discover_ip_addresses, discover_processors, discover_storage

MEMORY LEAK FIXES (JS Hooks):
- GlobalSearchTrigger: Added destroyed() cleanup for click listener
- SidebarCollapse: Added destroyed() cleanup for click listener
- ThemeSelector: Added destroyed() cleanup for phx:set-theme window listener
- NetworkMap: Added destroyed() cleanup for 3 button listeners (zoom in/out/fit)
- All hooks now properly store handler references and remove listeners on unmount

LIVEVIEW FIXES:
- Added phx-update="ignore" to 5 SensorChart hooks to prevent chart re-initialization
- Added catch-all handle_info(_msg, socket) to 5 LiveViews to prevent crashes on unexpected messages
  - device_live/show.ex, device_live/index.ex, alert_live/index.ex, activity_feed_live.ex, agent_live/index.ex

N+1 QUERY FIXES:
- Created Gaiia.get_site_subscriber_summaries/1 batch function
- Refactored alert_live and device_live to use batch query instead of looping
- Reduces queries from N to 1 when loading site subscriber data

Impact:
- Prevents discovery worker crashes during SNMP timeouts
- Eliminates memory accumulation from leaked event handlers
- Prevents chart state loss on LiveView updates
- Prevents LiveView crashes from unexpected PubSub messages
- Improves database performance by eliminating N+1 queries in alert/device views
- Passes credo --strict with 0 issues

Reviewed-on: graham/towerops-web#132
2026-03-23 17:03:41 -05:00
..
account_live test: expand coverage for devices, workers, and LiveView modules 2026-02-12 09:06:41 -06:00
admin rename "Admin Dashboard" to "Dashboard" 2026-03-10 13:36:03 -05:00
agent_live Fix critical bugs, memory leaks, and N+1 queries (#132) 2026-03-23 17:03:41 -05:00
components fix: remove unused import in global search component test 2026-03-07 14:44:28 -06:00
device_live fix/traffic-graph-rendering-and-polarity (#130) 2026-03-23 15:24:44 -05:00
device_live_nested chore: remove backup files from sed operations 2026-03-06 07:57:30 -06:00
graph_live fix/traffic-graph-rendering-and-polarity (#130) 2026-03-23 15:24:44 -05: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 test: fix all compile warnings in subscriber matching tests 2026-03-10 13:02:32 -05:00
maintenance_live perf: disable Req retry for faster error tests 2026-03-10 16:19:31 -05:00
org improve agent status display and fix two pre-existing test failures (#83) 2026-03-19 11:43:42 -05:00
org_live fix test warnings and failures 2026-02-05 15:24:41 -06:00
user_settings_live gdpr (#86) 2026-03-19 14:28:31 -05: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: remove stale tests for deleted capacity route and removed subtitle 2026-03-12 14:18:45 -05:00
dashboard_live_test.exs fix: resolve test fixture issues and skip flaky/environmental tests 2026-03-15 17:48:36 -05:00
escalation_policy_live_test.exs feat: add on-call schedules and escalation policies 2026-03-11 12:32:54 -05:00
mobile_qr_live_test.exs fix: resolve test fixture issues and skip flaky/environmental tests 2026-03-15 17:48:36 -05:00
my_data_live_test.exs gdpr (#86) 2026-03-19 14:28:31 -05:00
network_map_live_test.exs fix: resolve test fixture issues and skip flaky/environmental tests 2026-03-15 17:48:36 -05:00
onboarding_live_test.exs fix-sticky-header-overlap (#60) 2026-03-17 13:21:58 -05:00
org_live_test.exs fix: improve insight auto-resolution and query performance 2026-03-05 10:11:52 -06:00
schedule_live_test.exs fix: display on-call user names instead of emails on schedule index 2026-03-11 13:35:43 -05:00
site_live_test.exs logging fix and some other codex fixes 2026-03-10 15:04:28 -05: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