2038 feat apache age integration #2492
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!2492
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2492/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: #2039
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/2039
Original created: 2025-12-01T02:52:40Z
Original updated: 2025-12-02T20:10:12Z
Original head: carverauto/serviceradar:2038-feat-apache-age-integration
Original base: main
Original merged: 2025-12-02T20:09:50Z 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
Description
Integrate Apache AGE graph database for device/service/collector relationships
Add AGE graph writer to ingest device updates into relationship graph
Bootstrap AGE graph schema with nodes and edges in CNPG migrations
Enable feature flag control for AGE graph writes via environment variable
Diagram Walkthrough
File Walkthrough
2 files
Add AGE runtime defaults to CNPG configurationBootstrap AGE extension and graph schema in CNPG3 files
Wire AGE graph writer and feature flag to registryImplement AGE graph writer for device relationship ingestionAdd graph writer option and invoke on batch updates1 files
Add unit tests for AGE graph parameter building4 files
Define AGE relationship graph feature proposal and scopeDetail AGE graph design decisions and migration planDefine AGE graph requirements and test scenariosOutline implementation tasks for AGE integrationImported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2039#issuecomment-3594310807
Original created: 2025-12-01T02:53:14Z
PR Compliance Guide 🔍
Below is a summary of compliance checks for this PR:
No security concerns identified
No security vulnerabilities detected by AI analysis. Human verification advised for critical code.🎫 #2038
usable idempotently.
CheckerDefinition and relationships like HOSTS_SERVICE, RUNS_CHECKER, TARGETS,
HAS_INTERFACE, CONNECTS_TO, PROVIDES_CAPABILITY, REPORTED_BY.
Cypher MERGE into AGE.
Collector nodes without creating phantom Device nodes for collector hosts.
AGE availability at runtime.
real deployments.
correctly gated by the feature flag in production-like setups.
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: Secure Logging Practices
Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.
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 logs: The new graph write path performs merges into AGE without emitting structured audit logs
capturing actor/context, making it unclear who/what triggered critical graph mutations.
Referred Code
Generic: Robust Error Handling and Edge Case Management
Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation
Status:
Limited error context: Errors from AGE writes are only warned without retry/backoff/metrics and lack operation
context (e.g., counts), which may lead to silent drift if AGE is unavailable.
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:
Input validation gaps: The graph ingestion builds Cypher parameters from updates without explicit validation for
allowed characters in IDs/types, relying on parameterization but lacking
canonicalization/constraints that could prevent malformed graph data.
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/2039#issuecomment-3594312876
Original created: 2025-12-01T02:54:33Z
PR Code Suggestions ✨
Explore these optional code suggestions:
Consider a more robust data consistency strategy
The current approach of writing to the primary database and then separately to
the AGE graph can cause data inconsistency if the graph write fails. Implement a
more robust mechanism, like the transactional outbox pattern, to ensure updates
are reliably propagated.
Examples:
pkg/registry/registry.go [348-356]
pkg/registry/age_graph_writer.go [84-86]
Solution Walkthrough:
Before:
After:
Suggestion importance[1-10]: 9
__
Why: The suggestion correctly identifies a critical data consistency issue between the primary database and the new AGE graph, as the current implementation lacks transactional guarantees for dual writes, which is a significant architectural risk.
Process graph writes asynchronously for resilience
Refactor
WriteGraphto process updates asynchronously in a goroutine, preventingthe main registry flow from being blocked and improving resilience to transient
database errors.
pkg/registry/age_graph_writer.go [67-87]
Suggestion importance[1-10]: 7
__
Why: The suggestion correctly identifies that synchronous graph writes could block critical path processing and proposes a reasonable asynchronous pattern to improve resilience and performance.
Make new feature opt-in by default
Modify the
ageGraphEnabledfunction to default tofalsewhen theENABLE_AGE_GRAPH_WRITESenvironment variable is unset, making the new graphwriter feature opt-in.
pkg/core/server.go [77-87]
Suggestion importance[1-10]: 6
__
Why: The suggestion correctly identifies that the feature is opt-out by default and proposes making it opt-in, which is a safer approach for introducing new functionality and aligns with best practices for feature flagging.