towerops/lib/towerops
Graham McIntire edb82bcc40 feat(coverage): public REST API + KMZ export + email-on-complete
cnHeat-2.0-style automation hooks. Coverage prediction is now a
first-class API resource that Terraform / Ansible / cron can drive.

REST API (under /api/v1, Bearer-token auth scoped to one org)
- GET    /coverages              list
- POST   /coverages               create + auto-queue compute
- GET    /coverages/:id           read (includes status / progress_pct
                                  for polling-based providers)
- PATCH  /coverages/:id           update editable fields
- DELETE /coverages/:id           delete + cleanup
- POST   /coverages/:id/recompute requeue, returns 202
- GET    /coverages/:id/kmz       Google Earth bundle (KML + PNG)

Each response includes the full resource — Terraform read-after-write
reconciles cleanly; status polling hits a stable JSON shape.

Email-on-complete (Towerops.Coverages.Notifier)
- Worker fires deliver_compute_complete on both :ready and :failed
  paths. Sends a short text email to every member of the owning
  organisation with a link to the show page (or the failure
  reason). Mirrors cnHeat 2.0's per-project email alerts.
- Failures are non-fatal: a stuck SMTP relay never blocks the
  underlying coverage record from transitioning state.

KMZ export
- Builds a flat KMZ in-memory via :zip.create — doc.kml +
  overlay.png, with the LatLonBox set from the coverage's bbox.
  XML special chars are escaped. 409 if not yet ready.

Tests (11 new, all green)
- Bearer-token auth happy path + 401 missing
- index / show / create / update / delete + 404 cross-org
- create returns status:'queued' confirming the auto-enqueue
- recompute returns 202 with status:'queued'

Plus docs/terraform-coverages.md showing how to drive the new API
from a third-party restapi provider until the first-party
terraform-provider-towerops gets a coverage resource.
2026-05-06 17:15:57 -05:00
..
accounts refactor: split accounts.ex into cohesive submodules 2026-04-30 14:26:30 -05:00
admin fix: comprehensive security audit fixes (#108) 2026-03-22 10:10:27 -05:00
agents refactor: extract per-schema Query modules for organization_id filters 2026-04-30 14:26:30 -05:00
alerts refactor: address audit recommendations from results.md 2026-04-30 12:33:41 -05:00
api_tokens dialyzer: fix unknown_type warnings (60 → 0) 2026-04-21 09:43:37 -05:00
billing refactor: adopt Towerops.Result helpers in 8 call sites 2026-04-30 14:43:24 -05:00
capacity refactor: convert 6 Gleam modules to idiomatic Elixir with TDD (#196) 2026-03-28 09:52:07 -05:00
cn_maestro tests: disable Req retries in test env to eliminate ~7s-per-test delays 2026-04-24 10:04:52 -05:00
config_changes tests: raise coverage to 70% via helper promotion + new unit/property tests 2026-04-24 09:49:06 -05:00
contexts help update 2026-02-04 17:56:48 -06:00
coverages feat(coverage): public REST API + KMZ export + email-on-complete 2026-05-06 17:15:57 -05:00
devices refactor: address audit recommendations from results.md 2026-04-30 12:33:41 -05:00
ecto_types dialyzer: fix remaining 88 warnings — clean dialyzer run 2026-04-21 10:32:42 -05:00
gaiia refactor: extract per-schema Query modules for organization_id filters 2026-04-30 14:26:30 -05:00
geoip remove Mix.env and support ip database import 2026-01-28 13:08:06 -06:00
integrations paperclip/TOW-21-uisp-integration-phase1 (#31) 2026-03-15 17:57:36 -05:00
job_monitoring more tests and fixes 2026-02-07 11:50:18 -06:00
lidar feat(lidar): nationwide USGS NED fallback (the actual code) 2026-05-06 16:21:50 -05:00
maintenance refactor: extract per-schema Query modules for organization_id filters 2026-04-30 14:26:30 -05:00
mobile_sessions refactor/dry-improvements (#202) 2026-03-28 10:56:34 -05:00
monitoring chore: track SiteQuery and CheckQuery modules 2026-04-30 14:39:58 -05:00
netbox tests: raise coverage to 70% via helper promotion + new unit/property tests 2026-04-24 09:49:06 -05:00
on_call refactor: extract per-schema Query modules for organization_id filters 2026-04-30 14:26:30 -05:00
organizations refactor: extract per-schema Query modules for organization_id filters 2026-04-30 14:26:30 -05:00
pagerduty tests: remove remaining 1s sleeps in slow tests 2026-04-24 10:13:17 -05:00
preseem tests: disable Req retries in test env to eliminate ~7s-per-test delays 2026-04-24 10:04:52 -05:00
profiles fix: use runtime env config in YamlProfiles init (broken in releases) 2026-05-01 16:40:10 -05:00
proto refactor: adopt Towerops.Result helpers in 8 call sites 2026-04-30 14:43:24 -05:00
rate_limit chore: rate_limit rewrite + on-call redesign plan + handoff_notifications_mode 2026-04-28 12:17:29 -05:00
reports fix: make sidebar sticky with header and resolve all credo issues (#32) 2026-03-15 18:19:09 -05:00
security refactor: adopt Towerops.Result helpers in 8 call sites 2026-04-30 14:43:24 -05:00
settings fix/findings-medium-priority (#188) 2026-03-27 12:31:53 -05:00
sites chore: track SiteQuery and CheckQuery modules 2026-04-30 14:39:58 -05:00
snmp refactor: adopt Towerops.Result helpers in 8 call sites 2026-04-30 14:43:24 -05:00
sonar tests: disable Req retries in test env to eliminate ~7s-per-test delays 2026-04-24 10:04:52 -05:00
splynx tests: disable Req retries in test env to eliminate ~7s-per-test delays 2026-04-24 10:04:52 -05:00
status_pages fix: make sidebar sticky with header and resolve all credo issues (#32) 2026-03-15 18:19:09 -05:00
topology refactor: address audit recommendations from results.md 2026-04-30 12:33:41 -05:00
uisp tests: raise coverage to 70% via helper promotion + new unit/property tests 2026-04-24 09:49:06 -05:00
visp fix: humanize raw error strings in integration sync modules 2026-03-12 13:53:28 -05:00
weather tests: raise coverage to 70% via helper promotion + new unit/property tests 2026-04-24 09:49:06 -05:00
workers feat(coverage): public REST API + KMZ export + email-on-complete 2026-05-06 17:15:57 -05:00
accounts.ex refactor: split accounts.ex into cohesive submodules 2026-04-30 14:26:30 -05:00
activity_feed.ex reliability-audit-fixes (#181) 2026-03-26 14:10:36 -05:00
admin.ex fix: replace Repo.rollback with proper error handling for Oban compatibility (#201) 2026-03-28 09:11:21 -05:00
agents.ex refactor: extract per-schema Query modules for organization_id filters 2026-04-30 14:26:30 -05:00
alerts.ex refactor: extract per-schema Query modules for organization_id filters 2026-04-30 14:26:30 -05:00
api_tokens.ex dialyzer: fix remaining 88 warnings — clean dialyzer run 2026-04-21 10:32:42 -05:00
application.ex feat: add /coverage RF prediction feature scaffold 2026-05-06 13:44:14 -05:00
billing.ex fix: infer device role during discovery and handle string price values 2026-03-10 13:25:51 -05:00
capacity.ex done i think (#177) 2026-03-26 10:23:26 -05:00
config_changes.ex tests: raise coverage to 70% via helper promotion + new unit/property tests 2026-04-24 09:49:06 -05:00
coverages.ex feat(coverage): cnHeat-style unified multi-tower map at /coverage 2026-05-06 16:00:43 -05:00
dashboard.ex fix/findings-medium-priority (#188) 2026-03-27 12:31:53 -05:00
devices.ex refactor: extract per-schema Query modules for organization_id filters 2026-04-30 14:26:30 -05:00
error_tracker_ignorer.ex fix: apply Oban Pro 1.7 follow-up cleanup + filter transient DB noise 2026-05-01 16:04:05 -05:00
gaiia.ex refactor: extract per-schema Query modules for organization_id filters 2026-04-30 14:26:30 -05:00
geocoding.ex tests: raise coverage to 70% via helper promotion + new unit/property tests 2026-04-24 09:49:06 -05:00
geoip.ex db-performance-migrations (#234) 2026-04-04 14:22:25 -05:00
honeybadger_filter.ex fix: suppress benign shutdown errors during K8s pod rollouts 2026-02-12 12:16:40 -06:00
http.ex tests: disable Req retries in test env to eliminate ~7s-per-test delays 2026-04-24 10:04:52 -05:00
integrations.ex refactor/dry-improvements (#202) 2026-03-28 10:56:34 -05:00
job_monitoring.ex more tests and fixes 2026-02-07 11:50:18 -06:00
lidar.ex feat(lidar): nationwide USGS NED fallback (the actual code) 2026-05-06 16:21:50 -05:00
log_filter.ex Add comprehensive Dialyzer type specifications 2026-01-17 10:52:02 -06:00
logger_filters.ex fix: suppress benign shutdown errors during K8s pod rollouts 2026-02-12 12:16:40 -06:00
mailer.ex moduledocs 2026-01-17 15:08:49 -06:00
maintenance.ex refactor(maintenance): use MaintenanceWindowQuery in active_windows_base 2026-04-30 14:26:30 -05:00
mobile_sessions.ex fix: replace Repo.rollback with proper error handling for Oban compatibility (#201) 2026-03-28 09:11:21 -05:00
monitoring.ex refactor: route Sites and Monitoring queries through Query modules 2026-04-30 14:32:00 -05:00
numeric.ex refactor: convert 6 Gleam modules to idiomatic Elixir with TDD (#196) 2026-03-28 09:52:07 -05:00
on_call.ex refactor: extract per-schema Query modules for organization_id filters 2026-04-30 14:26:30 -05:00
organizations.ex refactor: adopt Towerops.Result helpers in 8 call sites 2026-04-30 14:43:24 -05:00
postgrex_types.ex feat: add Texas LIDAR DEM catalog with on-demand elevation reads 2026-05-04 13:03:28 -05:00
preseem.ex fix/findings-medium-priority (#188) 2026-03-27 12:31:53 -05:00
profiles.ex fix/findings-medium-priority (#188) 2026-03-27 12:31:53 -05:00
query_helpers.ex refactor: convert 6 Gleam modules to idiomatic Elixir with TDD (#196) 2026-03-28 09:52:07 -05:00
rate_limit.ex feat(on_call): PagerDuty-style escalation policy redesign + dialyzer fix 2026-04-28 12:36:41 -05:00
redis_health_check.ex fix: remove to_charlist conversion for Redix host option 2026-01-24 17:49:57 -06:00
release.ex fix dialyzer things 2026-01-03 12:56:40 -06:00
repo.ex moduledocs 2026-01-17 15:08:49 -06:00
reports.ex tests: raise coverage to 70% via helper promotion + new unit/property tests 2026-04-24 09:49:06 -05:00
result.ex refactor: convert 6 Gleam modules to idiomatic Elixir with TDD (#196) 2026-03-28 09:52:07 -05:00
rf_links.ex fix: make sidebar sticky with header and resolve all credo issues (#32) 2026-03-15 18:19:09 -05:00
search.ex refactor: extract per-schema Query modules for organization_id filters 2026-04-30 14:26:30 -05:00
settings.ex fix/test-failures (#112) 2026-03-22 13:02:06 -05:00
sites.ex refactor: route Sites and Monitoring queries through Query modules 2026-04-30 14:32:00 -05:00
snmp.ex refactor(snmp): replace extracted sections with delegates 2026-04-30 14:26:31 -05:00
status_pages.ex refactor/dry-improvements (#202) 2026-03-28 10:56:34 -05:00
time.ex refactor/dry-improvements (#202) 2026-03-28 10:56:34 -05:00
topology.ex refactor: adopt Towerops.Result helpers in 8 call sites 2026-04-30 14:43:24 -05:00
trace.ex tests: raise coverage to 70% via helper promotion + new unit/property tests 2026-04-24 09:49:06 -05:00
url_validator.ex refactor: convert 6 Gleam modules to idiomatic Elixir with TDD (#196) 2026-03-28 09:52:07 -05:00
vault.ex add mikrotik device handling 2026-02-01 16:42:39 -06:00
weather.ex tests: raise coverage to 70% via helper promotion + new unit/property tests 2026-04-24 09:49:06 -05:00