2248 feat network sweeper UI #2653
No reviewers
Labels
No labels
1week
2weeks
Failed compliance check
IP cameras
NATS
Possible security concern
Review effort 1/5
Review effort 2/5
Review effort 3/5
Review effort 4/5
Review effort 5/5
UI
aardvark
accessibility
amd64
api
arm64
auth
back-end
bgp
blog
bug
build
checkers
ci-cd
cleanup
cnpg
codex
core
dependencies
device-management
documentation
duplicate
dusk
ebpf
enhancement
eta 1d
eta 1hr
eta 3d
eta 3hr
feature
fieldsurvey
github_actions
go
good first issue
help wanted
invalid
javascript
k8s
log-collector
mapper
mtr
needs-triage
netflow
network-sweep
observability
oracle
otel
plug-in
proton
python
question
reddit
redhat
research
rperf
rperf-checker
rust
sdk
security
serviceradar-agent
serviceradar-agent-gateway
serviceradar-web
serviceradar-web-ng
siem
snmp
sysmon
topology
ubiquiti
wasm
wontfix
zen-engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
carverauto/serviceradar!2653
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2653/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from GitHub pull request.
Original GitHub pull request: #2267
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/2267
Original created: 2026-01-12T05:17:38Z
Original updated: 2026-01-12T05:27:42Z
Original head: carverauto/serviceradar:2248-feat-network-sweeper-ui
Original base: staging
Original merged: 2026-01-12T05:27:40Z by @mfreeman451
User description
IMPORTANT: Please sign the Developer Certificate of Origin
Thank you for your contribution to ServiceRadar. Please note, when contributing, the developer must include
a DCO sign-off statement indicating the DCO acceptance in one commit message. Here
is an example DCO Signed-off-by line in a commit message:
Describe your changes
Issue ticket number and link
Code checklist before requesting a review
PR Type
Enhancement, Tests
Description
Network Sweeper UI Implementation: Comprehensive LiveView module for managing network sweep configuration with advanced criteria builder, real-time progress tracking, and three main tabs (Sweep Groups, Scanner Profiles, Active Scans)
Device Management Enhancements: Added bulk device selection, tag editing modal, and quick filter buttons to device listing; integrated sweep status display in device detail view
Sweep Jobs Domain: New Ash domain with resources for
SweepProfile(admin templates),SweepGroup(user-configured jobs),SweepGroupExecution(tracking), andSweepHostResult(per-host results)Device Targeting DSL: Flexible criteria matching with 14+ operators (eq, neq, in, contains, in_cidr, etc.) for precise device selection in sweep groups
Sweep Results Ingestion: New
SweepResultsIngestormodule processes sweep results, updates device inventory, manages availability status, and broadcasts PubSub events for real-time UI updatesAgent Configuration System: Complete infrastructure for compiling and caching agent configurations with version history, templates, and cluster-wide invalidation via NATS
Sweep Monitoring & Cleanup: Oban workers for detecting missed executions and managing data retention with configurable periods
Result Buffering: Agent gateway now buffers results during core outages with exponential backoff retry strategy
Observability Integration: Default rules seeded for missed sweep detection and repeated missed sweep alerts
Database Migrations: New tables for sweep jobs, agent configurations, device tags, and supporting indexes
Comprehensive Test Coverage: End-to-end tests for sweep results ingestion, integration tests for config distribution, and unit tests for target criteria matching
Diagram Walkthrough
File Walkthrough
32 files
index.ex
Network Sweeper UI LiveView with Criteria Builderweb-ng/lib/serviceradar_web_ng_web/live/settings/networks_live/index.ex
configuration with 2459 lines
Scanner Profiles (admin templates), and Active Scans (real-time
monitoring)
conversion and device count preview
event handling and scanner performance metrics display
index.ex
Bulk Device Selection and Tag Managementweb-ng/lib/serviceradar_web_ng_web/live/device_live/index.ex
functionality
multiple devices at once
matching current filters
Unavailable, Swept) with visual indicators
and error formatting
sweep_results_ingestor.ex
Sweep results ingestion and device inventory updateselixir/serviceradar_core/lib/serviceradar/sweep_jobs/sweep_results_ingestor.ex
and stores SweepHostResult entries
discovery_sources
updates
target_criteria.ex
Device targeting DSL for sweep group configurationelixir/serviceradar_core/lib/serviceradar/sweep_jobs/target_criteria.ex
neq, in, contains, in_cidr, etc.)
criteria
comparisons
sweep_group.ex
Sweep group resource with scheduling and device targetingelixir/serviceradar_core/lib/serviceradar/sweep_jobs/sweep_group.ex
schedules
target_criteriaDSL andstatic_targetsrecording executions
show.ex
Device detail view with network sweep status displayweb-ng/lib/serviceradar_web_ng_web/live/device_live/show.ex
results
history
listings
sweep_compiler.ex
Sweep configuration compiler for agent deploymentelixir/serviceradar_core/lib/serviceradar/agent_config/compilers/sweep_compiler.ex
into agent-consumable config
concurrency
sweep_group_execution.ex
Sweep execution tracking resourceelixir/serviceradar_core/lib/serviceradar/sweep_jobs/sweep_group_execution.ex
lifecycle
sweep.ex
Sweep event processor with inventory update integrationelixir/serviceradar_core/lib/serviceradar/event_writer/processors/sweep.ex
SweepResultsIngestor
sweep results
discovery_sources
sweep_monitor_worker.ex
Sweep group monitoring worker for missed execution detectionelixir/serviceradar_core/lib/serviceradar/sweep_jobs/sweep_monitor_worker.ex
interval plus grace period
logs.internal.sweepfor missed sweepsgrpc_server.rs
gRPC server response structure for sweep execution trackingcmd/consumers/zen/src/grpc_server.rs
execution_idandsweep_group_idfields to gRPC response structureconfig_cache.ex
ETS cache for compiled agent configurationselixir/serviceradar_core/lib/serviceradar/agent_config/config_cache.ex
support
get,get_if_changed,put,invalidate, andclear_alltask
sweep_host_result.ex
Ash resource for sweep host result trackingelixir/serviceradar_core/lib/serviceradar/sweep_jobs/sweep_host_result.ex
executions
ports, and error messages
sorting and pagination
config_server.ex
GenServer for config compilation orchestrationelixir/serviceradar_core/lib/serviceradar/agent_config/config_server.ex
automatic cache invalidation
get_configandget_config_if_changedAPIs for retrievingcompiled configurations
config_instance.ex
Ash resource for compiled config instanceselixir/serviceradar_core/lib/serviceradar/agent_config/config_instance.ex
or partitions
hash-based lookups
capabilities
sweep_data_cleanup_worker.ex
Oban worker for sweep data retention cleanupelixir/serviceradar_core/lib/serviceradar/sweep_jobs/sweep_data_cleanup_worker.ex
prevent table growth
executions (default 30 days)
ones
sweep_profile.ex
Ash resource for network scanner profileselixir/serviceradar_core/lib/serviceradar/sweep_jobs/sweep_profile.ex
configurations
ICMP/TCP settings
administrators
sweep_pubsub.ex
PubSub broadcaster for sweep execution eventselixir/serviceradar_core/lib/serviceradar/sweep_jobs/sweep_pubsub.ex
execution-specific topics
events (started, progress, completed, failed)
rule_seeder.ex
GenServer for seeding default observability ruleselixir/serviceradar_core/lib/serviceradar/observability/rule_seeder.ex
for each tenant
alerts out of the box
initialization
status_processor.ex
Add result buffering and telemetry to status processorelixir/serviceradar_agent_gateway/lib/serviceradar_agent_gateway/status_processor.ex
forwardfunction with buffering support for failed resultdeliveries
StatusBufferintegration to queue results when core isunavailable
status tracking
config_template.ex
Ash resource for configuration templateselixir/serviceradar_core/lib/serviceradar/agent_config/config_template.ex
default values
flags
per tenant/type
status_buffer.ex
In-memory buffer for result payloads during outageselixir/serviceradar_agent_gateway/lib/serviceradar_agent_gateway/status_buffer.ex
payloads during core outages
interval
backoff on failure
growth
config_version.ex
Ash resource for config version history trackingelixir/serviceradar_core/lib/serviceradar/agent_config/config_version.ex
audit and rollback
information per version
versions by number
combination
config_publisher.ex
NATS publisher for config invalidation eventselixir/serviceradar_core/lib/serviceradar/agent_config/config_publisher.ex
invalidation
with resource metadata
information
cache is invalidated
agent_config_generator.ex
Integrate sweep config into agent payload generationelixir/serviceradar_core/lib/serviceradar/edge/agent_config_generator.ex
load_sweep_configfunction to retrieve compiled sweepconfigurations from ConfigServer
sweepkey
loads
build_configto merge sweep config with sync payload andrecompute version hash
compiler.ex
Behaviour definition for config compilerselixir/serviceradar_core/lib/serviceradar/agent_config/compiler.ex
into agent-consumable JSON
config types
content_hashfunction for SHA256-based change detectiontracking
create_version_history.ex
Ash change for automatic config version historyelixir/serviceradar_core/lib/serviceradar/agent_config/changes/create_version_history.ex
config instances are updated
IDs for audit trail
fails
template_seeder.ex
Add sweep monitoring templates and alert ruleselixir/serviceradar_core/lib/serviceradar/observability/template_seeder.ex
passthroughlog template for internal sweep logs with subjectlogs.internal.sweeppromote_missed_sweepslog promotion rule to convert sweep.missedevents to observability events
repeated_missed_sweepsstateful alert rule to trigger alerts onmultiple missed executions
monitoring.pb.ex
Extend sweep completion status with scanner statselixir/serviceradar_core/lib/serviceradar/proto/monitoring.pb.ex
execution_idandsweep_group_idfields toSweepCompletionStatusprotobuf message
SweepScannerStatsprotobuf message with detailedpacket, ring, retry, and port statistics
diagnostics
config_invalidation_notifier.ex
Ash notifier for config cache invalidationelixir/serviceradar_core/lib/serviceradar/agent_config/config_invalidation_notifier.ex
ConfigTemplate resources change
and delete actions
invalidation
sweep_jobs.ex
Ash domain for sweep job managementelixir/serviceradar_core/lib/serviceradar/sweep_jobs.ex
SweepJobsAsh domain for network sweep job managementrelationships
SweepGroupExecution, SweepHostResult
management
sync_ingestor.ex
Add tags field support to sync ingestorelixir/serviceradar_core/lib/serviceradar/inventory/sync_ingestor.ex
tagsfield extraction and initialization in device updateprocessing
tagsin both new device creation and update data structurestagsas empty map in default update structure5 files
sweep_results_flow_e2e_test.exs
Sweep Results Ingestion E2E Testelixir/serviceradar_core/test/serviceradar/sweep_jobs/sweep_results_flow_e2e_test.exs
sweep results
device discovery source tracking
and port information
sweep_compiler_test.exs
Tests for sweep compiler and target criteria validationelixir/serviceradar_core/test/serviceradar/sweep_jobs/sweep_compiler_test.exs
agent-consumable format
target_criteria_test.exs
Unit tests for sweep target criteria matchingelixir/serviceradar_core/test/serviceradar/sweep_jobs/target_criteria_test.exs
TargetCriteriamodule covering tag operators (has_any,has_all)in_range,gt,gte,lt,lte)sweep_config_distribution_integration_test.exs
Integration test for sweep config distributionelixir/serviceradar_core/test/serviceradar/edge/sweep_config_distribution_integration_test.exs
payload
config contains expected targets and settings
compilation to agent payload generation
AgentConfigGenerator
networks_live_test.exs
Tests for network settings LiveViewweb-ng/test/serviceradar_web_ng_web/live/settings/networks_live_test.exs
profiles
4 files
20260111200000_add_sweep_jobs_tables.exs
Database migration for sweep jobs tableselixir/serviceradar_core/priv/repo/tenant_migrations/20260111200000_add_sweep_jobs_tables.exs
sweep_profiles,sweep_groups,sweep_group_executions,sweep_host_resultsand IP
results
20260111194010_add_agent_config_tables.exs
Database migration for agent configuration tableselixir/serviceradar_core/priv/repo/tenant_migrations/20260111194010_add_agent_config_tables.exs
agent_config_versions,agent_config_templates, andagent_config_instancesjdm_definitionfield tozen_rulestable for JDM rule definitionsinstance management
application.ex
Register agent config and sweep job serviceselixir/serviceradar_core/lib/serviceradar/application.ex
ServiceRadar.Observability.RuleSeederto supervision tree forseeding default rules
ServiceRadar.AgentConfig.ConfigCacheandServiceRadar.AgentConfig.ConfigServerto supervision treeServiceRadar.AgentConfigandServiceRadar.SweepJobsdomains toAsh configuration
repo_enabledconfigurationconfig.exs
Configure agent config domains and sweep job workerselixir/serviceradar_core/config/config.exs
ServiceRadar.AgentConfigandServiceRadar.SweepJobsto Ashdomains list
maintenanceandmonitoringqueues to Oban configurationSweepDataCleanupWorkercron job for 3 AM daily cleanupSweepMonitorWorkercron job for 5-minute interval monitoring1 files
srql_components.ex
Refactor SRQL builder to use QueryBuilderComponentsweb-ng/lib/serviceradar_web_ng_web/components/srql_components.ex
QueryBuilderComponentsmodule for reusable query builder UIcomponents
srql_builder_pillcomponent calls toquery_builder_pillthroughout the SRQL builder interface
convention
1 files
show.ex
Format agent show live view codeweb-ng/lib/serviceradar_web_ng_web/live/agent_live/show.ex
line breaks
maintainability
72 files
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2267#issuecomment-3736927598
Original created: 2026-01-12T05:19:01Z
PR Compliance Guide 🔍
Below is a summary of compliance checks for this PR:
Query injection
Description: User-controlled criteria values are interpolated into an SRQL query string (
full_query ="in:devices #{srql_query} ...") and the escaping performed byescape_srql_value/1may beinsufficient for SRQL grammar, potentially enabling SRQL injection or expensive-query/DoS
via crafted values. index.ex [2291-2436]
Referred Code
🎫 #2248
define which protocols/ports are available (e.g., scanner profiles).
jobs, with operational status such as last run.
device selection criteria like IP range/CIDR, tags (discovery_sources), partition, etc.
sweeper scope (CIDRs / /32 for single IP) and ports/protocols, generating a new agent
config.
defaultalwaysavailable; agent selection optional and defaults to any available agent in the selected
partition.
agent-gateway forwards to core (RPC/chunking/streaming); core processes via
identity/reconciliation and enriches devices (e.g., availability), updating device
inventory tables.
Codebase context is not defined
Follow the guide to enable codebase context checks.
Generic: Meaningful Naming and Self-Documenting Code
Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting
Status: Passed
Generic: Secure Error Handling
Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.
Status: Passed
Generic: Comprehensive Audit Trails
Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.
Status: 🏷️
Missing audit logging: Critical state-changing actions (create/update/delete/enable-disable sweep groups and
profiles) do not emit audit log entries with user/tenant context and outcome.
Referred Code
Generic: Robust Error Handling and Edge Case Management
Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation
Status: 🏷️
Errors silently ignored: Multiple data-load failure paths swallow errors (returning
[]/nil) without logging oractionable context, reducing debuggability and resilience.
Referred Code
Generic: Security-First Input Validation and Data Handling
Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities
Status: 🏷️
Insufficient input validation: User-supplied criteria and
static_targetsare incorporated into an SRQL query string andpersisted without validation of allowed characters/formats (e.g., IP/CIDR/range),
increasing injection and malformed-input risk.
Referred Code
Generic: Secure Logging Practices
Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.
Status: 🏷️
Log sensitivity risk: Logging
inspect(reason)on config load failures may include sensitive details depending onupstream errors and should be reviewed/normalized to avoid leaking secrets in logs.
Referred Code
Compliance status legend
🟢 - Fully Compliant🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2267#issuecomment-3736930460
Original created: 2026-01-12T05:20:31Z
PR Code Suggestions ✨
Explore these optional code suggestions:
Fix SQL injection vulnerability
Refactor the function to use Ecto's schema tuple in
from/2to prevent a SQLinjection vulnerability caused by direct string interpolation of the
tenant_schema.elixir/serviceradar_core/lib/serviceradar/sweep_jobs/sweep_results_ingestor.ex [490-511]
Suggestion importance[1-10]: 10
__
Why: The suggestion correctly identifies a critical SQL injection vulnerability by interpolating
tenant_schemadirectly into a raw query and proposes a secure fix using Ecto's built-in features.Re-evaluate the custom agent configuration system
The custom system for agent configuration is overly complex. It should be
re-evaluated in favor of a simpler pattern or an existing tool to reduce
maintenance overhead.
Examples:
elixir/serviceradar_core/lib/serviceradar/agent_config/config_server.ex [1-196]
elixir/serviceradar_core/lib/serviceradar/agent_config/compilers/sweep_compiler.ex [1-294]
Solution Walkthrough:
Before:
After:
Suggestion importance[1-10]: 9
__
Why: The suggestion correctly identifies the introduction of a large, complex custom configuration system and raises a valid architectural concern about its long-term maintenance and complexity, which impacts a significant portion of the PR.
Improve performance by filtering devices in database
Improve performance by converting
target_criteriato an Ash filter usingTargetCriteria.to_ash_filter/1, allowing device filtering to occur at thedatabase level instead of in-memory.
elixir/serviceradar_core/lib/serviceradar/agent_config/compilers/sweep_compiler.ex [239-252]
Suggestion importance[1-10]: 9
__
Why: The suggestion correctly identifies a major performance bottleneck that could lead to application failure and proposes an efficient solution by moving the filtering logic to the database.
Make flush batch size configurable
Make the flush batch size for the status buffer configurable via an environment
variable instead of using a hard-coded value.
elixir/serviceradar_agent_gateway/lib/serviceradar_agent_gateway/status_buffer.ex [39-86]
Suggestion importance[1-10]: 4
__
Why: The suggestion improves configurability by allowing the flush batch size to be set via an environment variable, which enhances operational flexibility.
Prevent excessive memory usage
Add a recursion depth limit to
fetch_all_uids_paginated/5to prevent potentialserver memory exhaustion when fetching a very large number of device UIDs.
web-ng/lib/serviceradar_web_ng_web/live/device_live/index.ex [1202-1235]
[To ensure code accuracy, apply this suggestion manually]Suggestion importance[1-10]: 8
__
Why: The suggestion correctly identifies a potential memory exhaustion issue from unbounded recursion and proposes a robust solution by adding a depth limit, which is a critical safeguard for server stability.
Add support for IPv6 CIDR matching
Add a new function clause to
ip_matches_cidr?/3to implement CIDR matching forIPv6 addresses, as the current implementation only supports IPv4 and silently
fails for IPv6.
elixir/serviceradar_core/lib/serviceradar/sweep_jobs/target_criteria.ex [320-329]
Suggestion importance[1-10]: 8
__
Why: The suggestion correctly identifies that the
ip_matches_cidr?function lacks IPv6 support, which is a significant functional bug, and provides a correct implementation to fix it.Prevent potential infinite loop in cleanup
Prevent a potential infinite loop in the
do_cleanup_batch/8function bymodifying the recursive batch deletion logic.
elixir/serviceradar_core/lib/serviceradar/sweep_jobs/sweep_data_cleanup_worker.ex [116-171]
Suggestion importance[1-10]: 8
__
Why: The suggestion correctly identifies a potential infinite loop in the recursive batch deletion logic and provides a robust fix that handles partial deletions and errors, preventing a critical runtime issue.
Correct ETS match_spec for expiration cleanup
Correct the ETS
match_specfor expired entry cleanup to properly match anddelete records, preventing a memory leak.
elixir/serviceradar_core/lib/serviceradar/agent_config/config_cache.ex [220-234]
Suggestion importance[1-10]: 8
__
Why: The suggestion correctly identifies a bug where the ETS match spec for cleanup is wrong, which would lead to a memory leak. The proposed fix correctly matches the data structure and fixes the bug.
Fully reset bulk selection state
Update the
clear_selectionevent handler to also reset the:select_all_matchingand
:total_matching_countassigns to prevent inconsistent UI state.web-ng/lib/serviceradar_web_ng_web/live/device_live/index.ex [159-161]
[To ensure code accuracy, apply this suggestion manually]Suggestion importance[1-10]: 7
__
Why: The suggestion correctly identifies a bug where clearing the selection leaves the UI in an inconsistent state and provides the correct fix to reset all related state variables.
Always return
:okon forward failureEnsure the
process/1pipeline continues gracefully by always returning:okfromthe
forward/2function, even on failure.elixir/serviceradar_agent_gateway/lib/serviceradar_agent_gateway/status_processor.ex [74-87]
Suggestion importance[1-10]: 6
__
Why: The suggestion correctly points out that returning an error tuple breaks the
withchain inprocess/1, and proposes changing the return value to:okto ensure the pipeline continues, which is a valid improvement for robustness.