towerops/test/towerops_web/live/device_live
Graham McIntire 4804dfea5b feat(insights): UpstreamDegradation multi-AP correlation rule
When 50%+ of the access points at one site simultaneously have
Preseem QoE score <60, root cause is almost always a shared upstream
problem (backhaul, transit, DNS, DHCP) — not per-AP RF. This rule
emits one site-level insight that points the operator at the right
investigation layer instead of letting them chase per-AP RF
symptoms across many APs at the same site.

- Towerops.Recommendations.Rules.UpstreamDegradation — single query
  pulls all matched Preseem APs grouped by site_id. Critical when
  100% of APs at the site are degraded; warning otherwise. Lists
  every degraded AP with its QoE score in metadata.
- Insight.@valid_types extended with upstream_degradation.
- LLM prompt hint tells the model to instruct the operator to
  investigate upstream FIRST and to NOT chase per-AP RF symptoms.
- UI: indigo card with degraded/total AP counts, an "Investigate
  upstream first" badge, and a clickable list of affected APs.
- Wired into RecommendationsRunWorker FIRST in the @rules list so
  the upstream signal surfaces before per-AP RF rules.

Also fixes two flakes:
- device_live/show_test.exs is now async: false. It inserts to
  InterfaceStat which is a TimescaleDB hypertable; concurrent inserts
  deadlock on chunk-table locks under parallel SQL-sandbox tests
  (ERROR 40P01 deadlock_detected in setup).
- Cleared an unused-variable warning in device_overheating_test.exs.

8 new tests for UpstreamDegradation.
2026-05-09 17:51:41 -05:00
..
helpers test: DataLoaders DB-backed paths for agent_info, snmp_data, neighbor lookups 2026-05-09 12:49:53 -05:00
form_events_test.exs test: lift coverage 79.78% → 80.92%+ with broad new tests 2026-05-08 09:11:06 -05:00
form_helpers_test.exs tests: raise coverage to 70% via helper promotion + new unit/property tests 2026-04-24 09:49:06 -05:00
form_test.exs test: refactor LiveView tests to use HTML-aware element/form helpers 2026-04-29 11:14:20 -05:00
index_helpers_test.exs tests: raise coverage to 70% via helper promotion + new unit/property tests 2026-04-24 09:49:06 -05:00
index_test.exs test: stabilize DeviceLive.Index health-color tests; drop deadlock-prone latency cases 2026-05-09 13:09:00 -05:00
show_events_test.exs test: DeviceLive.Show trigger_manual_backup success and disabled-mikrotik branches 2026-05-09 12:26:23 -05:00
show_helpers_test.exs test: GraphLive live mode + Show snmp_sensor format + Alert/Activity events 2026-05-08 18:12:32 -05:00
show_smoke_test.exs tests: raise coverage to 70% via helper promotion + new unit/property tests 2026-04-24 09:49:06 -05:00
show_test.exs feat(insights): UpstreamDegradation multi-AP correlation rule 2026-05-09 17:51:41 -05:00
tabs_smoke_test.exs tests: raise coverage to 70% via helper promotion + new unit/property tests 2026-04-24 09:49:06 -05:00