Commit graph

115 commits

Author SHA1 Message Date
a0ba9285dd
bring in snmpkit 2026-01-23 12:52:17 -06:00
00f704cd83
updated agent code 2026-01-19 14:10:54 -06:00
ceded37d9c
improve agent 2026-01-19 13:38:43 -06:00
5339f51dd8
Convert Task.* calls to Exq background workers
Created three new Exq workers to handle background jobs:
- PollWorker: SNMP polling operations (queue: polling)
- MonitorWorker: Device monitoring checks (queue: monitoring)
- DiscoveryWorker: SNMP discovery (already existed)

Updated files to use Exq.enqueue instead of Task.start:
- lib/towerops/snmp/poller_worker.ex
- lib/towerops/monitoring/device_monitor.ex
- lib/towerops_web/channels/agent_channel.ex

Each module includes enqueue_* helper functions that:
- Use Task.start in test environment for synchronous execution
- Use Exq.enqueue in dev/prod for proper background job processing

Added "monitoring" queue to Exq configuration in application.ex

All tests passing (824 tests, 0 failures)
2026-01-17 16:46:36 -06:00
541ab7e7d6
more renames 2026-01-17 15:13:56 -06:00
b6f4946385
moduledocs 2026-01-17 15:08:49 -06:00
22f81acfa6
credo cleanup 2026-01-17 15:00:52 -06:00
a810e75fc4
rename equipment to device 2026-01-17 14:48:46 -06:00
b53a53b199
Add comprehensive Dialyzer type specifications
- Add @type definitions to all schema modules:
  - User, UserCredential, Membership, Invitation
  - Organization, Site, AgentAssignment
  - InterfaceStat, SensorReading, Alert
- Fix all compilation warnings with stronger Elixir types:
  - Remove unused require Logger in log_filter.ex
  - Remove unused parse_float(nil) clause
  - Add pin operators (^) for variables in binary pattern matches
- Fix Dialyzer errors (25 → 0):
  - Remove unreachable pattern match clauses
  - Fix unmatched return values with _ = prefix
  - Update @spec for deliver_alert_notification/1
- Properly handle all Phoenix.PubSub.subscribe and Task.start return values
- Explicitly ignore if statement return values where needed

All files now pass mix compile --warnings-as-errors and mix dialyzer.
2026-01-17 10:52:02 -06:00
02c163986e
Fix 21 Dialyzer errors by adding schema types and fixing unmatched returns
Schema types added:
- AgentToken.t/0
- Equipment.t/0
- Device.t/0
- Interface.t/0
- Sensor.t/0

Fixed unmatched returns in AgentChannel:
- Agents.update_agent_token_heartbeat/3 (2 instances)
- process_snmp_result/2

Reduced Dialyzer errors from 48 to 27.
2026-01-17 10:40:47 -06:00
e1b9976219
Add Dialyzer typespecs to WebSocket agent code and Agents context
- Add @spec to AgentSocket callbacks (connect/3, id/1)
- Add @spec to AgentChannel callbacks (join/3, handle_info/2, handle_in/3)
- Add @spec to AgentChannel private function build_jobs_for_agent/1
- Add @spec to Agents.verify_agent_token/1
- Add @spec to Agents.update_agent_token_heartbeat/3
- Add @spec to Agents.list_agent_polling_targets/1

These specs provide strict type checking for the critical WebSocket
agent communication code implemented in this session.
2026-01-17 10:37:27 -06:00
305b22dc65
Fix organization_id access: use equipment.site.organization_id 2026-01-16 19:21:58 -06:00
6b7a3ba36e
Fix binary protobuf encoding for JSON serializer
- Use base64-encoded binary in JSON payload instead of {:binary, data} tuples
- V1.JSONSerializer cannot encode tuples, needs plain JSON objects
- Agent already sends/expects base64-encoded binary in 'binary' key
2026-01-16 18:36:24 -06:00
9b88a32f33
Move token authentication from URL to Phoenix channel join payload 2026-01-16 18:22:57 -06:00
eb91798729
agent improvements and agent config 2026-01-16 17:26:51 -06:00