- Add comprehensive type definitions for Leaflet plugins (heatmap, marker clustering, overlapping marker spiderfier)
- Create event payload interfaces for all LiveView events
- Add marker extension types for APRS-specific properties
- Define Chart.js dataset and configuration types
- Replace 74 instances of 'any' type across all TypeScript files
- Improve type safety for event handlers and state management
- Add proper typing for external library integrations
This refactoring enhances type safety throughout the codebase, making it easier to catch errors at compile time and improving IDE support for autocompletion and refactoring.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add aggressive autovacuum settings for packet_counters table
- Replace table-based counter with PostgreSQL sequence to eliminate bloat
- Sequences are designed for high-frequency counter operations
- Maintains backward compatibility through get_packet_count() function
The packet_counters table was experiencing severe bloat due to 350K+ updates
on a single row. PostgreSQL sequences avoid this issue entirely.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
The function was sending a message but not returning the socket,
causing an ArgumentError when the result was passed to assign/3.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Replace bracket notation (packet_data[key]) with Map.get/2 to avoid
UndefinedFunctionError when processing ParseError structs that don't
implement the Access behavior.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add missing :historical_packets initialization to prevent KeyError when
HistoricalLoader tries to access it during zoom-based display handling.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Remove duplicate received_at indexes (packets_received_at_asc_idx and packets_recent_hour_idx)
that were consuming 423 MB, keeping only packets_received_at_idx
- Fix KeyError by initializing missing :all_packets and :visible_packets in socket assigns
- All tests now pass successfully
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Restored original PacketConsumer implementation from before optimizations
- Reverted to fixed batch size of 50 packets (original value)
- Removed SystemMonitor and InsertOptimizer from application startup
- Restored original config with buffer size 1000 and batch timeout 1000ms
- Removed all dynamic batch sizing and optimization logic
The recent performance optimizations were causing packet buffer overflows
because the dynamic batch sizing was actually slowing down processing.
Reverting to the simpler, working implementation that processes packets
consistently without buffer overflows.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Increased packet buffer size from 1,000 to 10,000 to handle traffic spikes
- Removed InsertOptimizer dynamic batch sizing that was slowing processing
- Reverted to fixed batch size of 200 for consistent performance
- Simplified insert options to use static configuration
- Added telemetry metrics for buffer overflow and utilization monitoring
- Fixed unused variable warning in packet_consumer.ex
The root cause was the recent performance optimizations that introduced
dynamic batch sizing, which actually degraded performance and caused
the producer buffer to overflow when the consumer couldn't keep up.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fixed InsertOptimizer returning map instead of keyword list for Ecto
- Increased batch size ranges to handle high load (100-800 packets)
- Improved consumer responsiveness:
- Reduced batch timeout from 1000ms to 500ms
- Process batches at 80% capacity for better throughput
- Reduced adjustment interval from 10s to 5s
- Added comprehensive logging for debugging buffer status
- Created integration tests for packet pipeline
- Coordinated batch sizing between SystemMonitor and InsertOptimizer
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Renamed predicate functions to follow Elixir conventions:
- is_finite? → finite?
- is_finite_number? → finite_number?
- is_finite_float? → finite_float?
- Fixed all function returns to ensure proper nil handling
- Applied mix format to all files
- All tests pass with no compilation warnings
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Security improvements:
- Added sanitize_numeric_string to remove dangerous characters
- Limited input string length to prevent DoS attacks (20 chars for numbers)
- Added is_finite? checks to prevent infinity/NaN values
- Validate coordinate ranges (lat: -90 to 90, lng: -180 to 180)
- Added safe_parse_coordinate with proper validation
- Updated to_float in EncodingUtils with security validations
- Protected against integer overflow in coordinate conversions
- Added sanitize_path_string for APRS path validation
All coordinate inputs from users are now:
1. Sanitized to remove injection characters
2. Length-limited to prevent resource exhaustion
3. Validated for finite values (no infinity/NaN)
4. Checked against valid geographic ranges
5. Given safe fallback defaults
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Implemented dual-strategy pruning based on overage size
- Small overages (<10 packets): Only remove exactly what's needed
- Large overages: Batch prune with 20% buffer to reduce frequency
- Used Map.drop for more efficient bulk deletion
- Added Stream for lazy evaluation in small overage case
- Reduces complexity from O(n log n) on every insertion to:
- O(k log k) for small overages where k << n
- Amortized O(n log n) for large overages with buffering
- This significantly improves performance when managing thousands of packets
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fixed PHG parsing test to match actual parser behavior
- Fixed movement test to properly handle batch loading behavior
- Movement test now sets bounds and uses higher zoom level
- Added helper function to flush events during test setup
- All tests now passing with clean compilation
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>