Commit graph

1548 commits

Author SHA1 Message Date
1ef9e00a05
update robots.txt 2026-06-04 16:33:12 -05:00
f2c8f7020c
update robots.txt 2026-06-04 16:29:53 -05:00
2e0529ee75
update robots.txt 2026-06-04 16:26:13 -05:00
5569d8e2a0
Add user-agent to request logging metadata 2026-06-04 16:19:47 -05:00
6d190bc98e
cleanup todo 2026-06-04 16:14:40 -05:00
c3921e9277
Add Plausible analytics snippet to root layout 2026-06-04 16:05:24 -05:00
1eceb3664d
fix: install libsctp1 to silence Erlang 29 SCTP warning 2026-06-04 15:39:40 -05:00
a4b140beaf
chore: update elixir/erlang versions, remove renovate forgejo task, update deps 2026-06-04 15:33:50 -05:00
e8d48f8058
speed up slow tests: remove Process.sleep, add batch fixture helper
- Replace Process.sleep(N) with explicit synchronization:
  render(view) to force LV mailbox drain, PubSub assert_receive for
  leader election, and render_hook sync guarantees
- Add batch_packet_fixtures/2 using Repo.insert_all for bulk test
  fixtures (200 inserts -> 1 round trip)
- Remove sleeps from historical_loading_test — tests query DB
  directly, don't need LV async processing
2026-06-02 15:02:07 -05:00
73c6703102
perf: debounce BadPacketsLive refresh, remove stale test cases
Coalesce rapid PubSub notifications into single 2-second delayed DB query. Remove tests for removed :update_time_display handler.

Ultraworked with Sisyphus

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-06-01 16:50:28 -05:00
3169abf0f0
perf: convert packets_live table to streams for efficient diffs
Replace full-list assign with stream_insert + phx-update=stream. Add DOM IDs to all packet rows. Skip deprecated phx-update=prepend.

Ultraworked with Sisyphus

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-06-01 16:50:09 -05:00
ff3a478bbd
perf: add LIMIT to unbounded DISTINCT ON, guard device table scan, add DB indexes
Bound batch DISTINCT ON queries by input count. Guard Repo.all(Devices) with exists? check. Add trigram GIN index on base_callsign and (has_weather, received_at DESC) partial index.

Ultraworked with Sisyphus

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-06-01 16:49:48 -05:00
7f814462ed
perf: reduce traversals, optimize packet field lookups, use has_weather boolean
Remove redundant in-memory sort (DB already orders), shortcut get_packet_field when field found at top level, use pre-computed has_weather boolean instead of field-by-field scan

Ultraworked with Sisyphus

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-06-01 16:49:28 -05:00
e02fafc8da
perf: optimize map LiveView hot paths
Remove unused 30s timer, skip heatmap recluster on every single packet, trail dedup O(n^2)->O(n)

Ultraworked with Sisyphus

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-06-01 16:49:08 -05:00
ae1194ebb0
perf: fix PacketBatcher O(n) length/1 to O(1) counter
Ultraworked with Sisyphus

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-06-01 16:48:48 -05:00
21ab9fb20c
perf: add persistent ETS weather cache for N+1 prevention
Ultraworked with Sisyphus

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-06-01 16:48:28 -05:00
3948ae5894
Remove dead packets.html.heex template and create findings.md
The unstyled <h1>Packets</h1> template was dead code - no route in the
router renders it (/packets uses PacketsLive.Index LiveView instead).
Removed the template and its test. Added findings.md with all audit
results from comprehensive security and code quality review.
2026-05-29 15:50:23 -05:00
d0b9513b41
fix elixir type warnings 2026-05-29 14:00:29 -05:00
24796f98d4
Optimize prod: scale deployment, drop expensive metric queries, fix slow callsign and nearby-stations queries
- k8s: 2 replicas, POOL_SIZE 25, cpu 2000m, mem 1Gi (was 1 replica, 5, 500m, 512Mi)
- telemetry poller 10s -> 60s; drop pg_database_size, pg_stat_statements,
  pg_table_size and pg_indexes_size (these were ~7100s of cumulative DB time
  on their own)
- get_latest_packet_for_callsign: bound by :packet_retention_days so partition
  pruning kicks in
- get_nearby_stations_knn: ST_DWithin spatial pre-filter (default 500km) so
  the GiST geography index cuts candidates before DISTINCT ON sort
  (EXPLAIN: 5793ms -> 400ms)
- New migration: partial functional indexes on upper(object_name) and
  upper(item_name), built per-partition CONCURRENTLY then attached to parent.
  Lets get_latest_packet_for_callsign use BitmapOr across all 3 upper()
  indexes instead of falling back to a scan
2026-05-12 17:48:58 -05:00
249e3fa675
Update dependencies
Upgrades: circular_buffer 1.0.1, db_connection 2.10.1, decimal 2.4.1,
mint 1.8.0, phoenix 1.8.7, swoosh 1.25.2, telemetry 1.4.2
2026-05-11 09:58:18 -05:00
6f1d4eee4e
Fix Analyzer.debug_info_line to return nil on with-fallthrough
When :beam_lib.chunks fails (e.g. a project module hasn't been loaded
into :code.which yet), the existing with returned the raw error tuple
as the 'line' value, which then crashed format/1 via String.Chars.

Add an explicit else clause so the function always returns nil or an
integer.
2026-05-09 11:26:41 -05:00
5184d2ee5e
Cache MixUnused analyzer state to skip repeated BEAM scans in tests
- Split Analyzer.analyze/1 into compute_state/1 (slow, scans all BEAMs)
  and a fast filter step. analyze/1 now accepts :precomputed_state opt.
- Mix.Tasks.Compile.Unused.run/1 picks up precomputed state from process
  dict :mix_unused_extra_analyze_opts when present (test escape hatch).
- AnalyzerTest setup_all computes state once; exclude tests pass it
  through analyze/1, dropping per-test cost from ~700ms to <1ms.
- UnusedTest setup_all does the same — the consolidated severity-args
  test drops from 3.4s to ~5ms.
- Trim further sleeps in HistoricalLoadingTest (100->30ms) and
  MovementTest (50->20ms, receive timeouts 100->30ms).

Total suite: 40.6s -> 37.7s; 2488 tests, 0 failures.
2026-05-09 11:17:08 -05:00
4c5c730ee7
Speed up the slowest tests
- packet_replay: stop_replay test reduces fake-task receive timeout from 5s to 200ms
- broadcast_task_supervisor: scheduler_usage takes configurable sample seconds;
  test uses sample-pair API (instant) instead of blocking 1-second sample
- health_check: ask_if_alive timeout is now configurable; unresponsive-pid test
  uses 50ms timeout instead of waiting full 5-second default
- mix_unused/analyzer_test: cache analyze() result in setup_all so 4 tests share
  one analyze pass instead of running 4 separate scans
- mix/tasks/compile/unused_test: consolidate three slow severity tests into one
- log_sanitizer + packet_field_whitelist: cap property-test runs at 25 (was 100)
- historical_loading: trim 200ms post-event sleeps to 50ms
- movement: refute_push_event timeout from 200ms to 50ms

Total suite time: ~45s -> 40.6s; 2488 tests, 0 failures.
2026-05-09 10:56:03 -05:00
1ddc817f50
Remove :slow test tag; make slow tests run fast via configurable timeouts
- Make LeaderElection check_interval, max_cluster_wait, and cluster_check_interval
  configurable via Application env so tests can override with short values
- Slow LeaderElection tests now use 50-150ms timeouts instead of 3-6s
- Remove :slow tag from unused_test (compile cache makes reruns cheap)
- Drop :slow from test_helper exclude list

All 2490 tests now run in ~45s (up from 2485 with 5 excluded).
2026-05-09 09:05:16 -05:00
001af22286
Remove dead code: round_coordinate non-float heads, unreachable get_nearby_stations branch, redundant pattern-match guards 2026-05-08 17:49:23 -05:00
0caf7e4fda
Remove flaky LeaderElection dead-pid cleanup test 2026-05-08 17:27:48 -05:00
e95e2bfe32
Add LogSanitizer tests for sanitize_error_context non-list/non-map branches 2026-05-08 17:22:07 -05:00
2b1a06a6cd
Add MixUnused.Analyzer test for app: nil branch 2026-05-08 17:18:28 -05:00
4560dc0c6f
Add LeaderElection tests for dead-pid cleanup and registered leader pid status 2026-05-08 17:15:26 -05:00
eeec857d01
Add tests for batch_dispatch out-of-bounds removal and load_historical_batch matching generation 2026-05-08 17:13:32 -05:00
e2c0b00238
Add Aprsme.Is tests for send_message live branch, init disable_connection branch, and start_link 2026-05-08 17:09:06 -05:00
02d435557a
Add tests for set_location to_float branches and back-to-back bounds_changed 2026-05-08 17:01:30 -05:00
5685b6931a
Add coverage tests for RF path station packets, process_bounds_update remove_markers, and initialize_replay reschedule 2026-05-08 16:57:09 -05:00
b911bbd626
Add coverage tests for DeviceCache live process branch, PacketConsumer start_link with name, and integer/Decimal coordinate paths 2026-05-08 16:54:26 -05:00
5ba458d505
Add coverage tests for clear_and_reload_markers, cleanup_old_packets, packet_batch low-zoom paths, and historical_loading_timeout 2026-05-08 16:50:44 -05:00
446497d60b
Push coverage past 90% with MapLive postgres_packet/packet_batch and preferred_tracked_packet tests 2026-05-08 14:24:47 -05:00
3f7170cfa2
Add coverage tests for LeaderElection, MapLive integration, ApiDocsLive, BroadcastTaskSupervisor, StatusLive, and Packets 2026-05-08 14:15:35 -05:00
3c1ea54184
Add coverage tests for HistoricalLoader low-zoom non-final and pending-bounds paths 2026-05-08 13:33:13 -05:00
7271cc05cb
Add coverage tests for LeaderElection foreign-pid registration path 2026-05-08 13:29:24 -05:00
d34eab6447
Add coverage tests for HistoricalLoader cursor advance and zoom edge cases 2026-05-08 13:27:01 -05:00
7de1aef648
Add coverage tests for HistoricalLoader real-Packets path and Packets edge cases 2026-05-08 13:21:53 -05:00
5bf66f81b7
Add coverage tests for StreamingPacketsPubSub, Mix.Tasks.Compile.Unused, and HealthCheck 2026-05-08 13:15:59 -05:00
b2a1d8e7e9
Add coverage tests for MixUnused.Analyzer and HistoricalLoader edge cases 2026-05-08 13:09:24 -05:00
aa809976ab
Add coverage tests for DevicesSeeder, StatusLive helpers, DataBuilder, and HistoricalLoader 2026-05-08 13:04:37 -05:00
1e8e97d5f4
Add coverage tests for Telemetry, ApiCSRF, Packets, and PacketsLive.Index 2026-05-08 12:55:20 -05:00
5fb653bf05
Implement mix_unused-style unused public function detector
Adds a self-contained 'unused' Mix compiler task that finds public
functions in this project no caller in the project ever invokes:

- MixUnused.Analyzer: enumerates public functions across the project's
  compiled BEAM files (filtered by app), walks the abstract code in
  each BEAM via :beam_lib to collect every remote {Module, fun, arity}
  call observed at compile time, and subtracts the call set from the
  def set. Exposes :exclude (modules or MFA triples), :compile_path,
  and :app options. Behaviour callbacks (@impl true and any listed
  in behaviour_info(:callbacks)) and well-known entry points
  (start_link, child_spec, mount, render, GenServer callbacks,
  __info__, module_info, etc.) are excluded automatically.

- Mix.Tasks.Compile.Unused: a Mix.Task.Compiler that compiles the
  project then asks the analyzer for unused defs. Severity is
  configurable via the :unused project key; per-file exclusion of
  test/ paths is on by default.

Inspired by https://github.com/hauleth/mix_unused — uses BEAM
introspection rather than a compilation tracer to avoid the
chicken-and-egg problem of recompiling the tracer module itself
during analysis.
2026-05-08 12:30:04 -05:00
039ee83ecb
Add HistoricalLoader real-Packets module path tests and LeaderElection delay branch test 2026-05-08 12:20:53 -05:00
fe25bdda7d
Add Packets tests for round_coordinate types and MicE direction conversion 2026-05-08 12:18:28 -05:00
5066cf7c3b
Add coverage tests for AprsSymbol render helpers and DbOptimizer atom/identifier paths 2026-05-08 12:15:46 -05:00
4bf1a6b3b3
Add coverage tests for CoreComponents (input form/field, safe_row_id) and DataBuilder edge cases 2026-05-08 12:11:14 -05:00