Skip to content

Comments

refactor: graph pkg - Service reshape + ListNodes#491

Merged
mfiedorowicz merged 5 commits intodevelopfrom
chore-refactor-graph-pkg-pt2
Feb 13, 2026
Merged

refactor: graph pkg - Service reshape + ListNodes#491
mfiedorowicz merged 5 commits intodevelopfrom
chore-refactor-graph-pkg-pt2

Conversation

@mfiedorowicz
Copy link
Member

Summary

  • Reshapes graph package: Builder+ReaderService with split files (edge.go, lookup.go, matching.go, metadata.go, propagate.go), removes schema versioning
  • Implements full ListNodes stack: SQL query with optional node type array and JSONB metadata filters, SQLC codegen, postgres adapter with DRY toNodeWithLatestSnapshot helper, domain interface, and Service.ListEntities wiring
  • Adds EntityStore interface for consumers to mock the service in tests
  • Adds default (100) and max (1000) limit guardrails on ListEntities

Test plan

  • go build ./... passes
  • go test ./graph/... ./reconciler/... ./entitymatcher/... passes
  • go vet ./... passes
  • Mocks regenerated with mockery

…hema versioning

Remove dead schema versioning code (matching_schema_version column,
CurrentSchemaVersion constant, MigrateNodesToCurrentSchema, FindNodesNeedingSchemaUpdate)
and merge Builder+Reader into a single Service type with clean public API
(UpsertEntity, ListEntities, GetCompleteNodeData, GetSnapshots).

Rename files (builder.go → service.go, builder_*.go → topic-based names),
update receiver from gb to s, rename BuilderOption → Option and
NewBuilder → NewService, and update all callers in reconciler and cmd packages.
Add full stack for listing graph nodes with optional filtering by node
type and metadata: SQL query with JSONB containment and array filters,
SQLC codegen, adapter with DRY toNodeWithLatestSnapshot helper, domain
interface, and Service.ListEntities wiring.
@mfiedorowicz mfiedorowicz changed the title refactor: graph package pt2 — Service reshape + ListNodes refactor: graph pkg— Service reshape + ListNodes Feb 12, 2026
@mfiedorowicz mfiedorowicz changed the title refactor: graph pkg— Service reshape + ListNodes refactor: graph pkg - Service reshape + ListNodes Feb 12, 2026
@github-actions
Copy link

Go test coverage

STATUS ELAPSED PACKAGE COVER PASS FAIL SKIP
🟢 PASS 1.23s github.com/netboxlabs/diode/diode-server/auth 44.7% 42 0 0
🟢 PASS 1.32s github.com/netboxlabs/diode/diode-server/auth/cli 0.0% 0 0 0
🟢 PASS 1.02s github.com/netboxlabs/diode/diode-server/authutil 82.8% 5 0 0
🟢 PASS 0.14s github.com/netboxlabs/diode/diode-server/dbstore/postgres 0.0% 0 0 0
🟢 PASS 1.09s github.com/netboxlabs/diode/diode-server/entityhash 86.7% 16 0 0
🟢 PASS 1.16s github.com/netboxlabs/diode/diode-server/entitymatcher 83.0% 91 0 0
🟢 PASS 0.17s github.com/netboxlabs/diode/diode-server/errors 0.0% 0 0 0
🟢 PASS 1.16s github.com/netboxlabs/diode/diode-server/graph 45.0% 58 0 0
🟢 PASS 1.30s github.com/netboxlabs/diode/diode-server/ingester 82.7% 25 0 0
🟢 PASS 1.12s github.com/netboxlabs/diode/diode-server/matching 94.1% 66 0 0
🟢 PASS 1.07s github.com/netboxlabs/diode/diode-server/migrator 70.4% 4 0 0
🟢 PASS 4.20s github.com/netboxlabs/diode/diode-server/netboxdiodeplugin 83.6% 40 0 0
🟢 PASS 0.17s github.com/netboxlabs/diode/diode-server/pprof 0.0% 0 0 0
🟢 PASS 2.64s github.com/netboxlabs/diode/diode-server/reconciler 81.7% 86 0 0
🟢 PASS 1.04s github.com/netboxlabs/diode/diode-server/reconciler/applier 85.7% 1 0 0
🟢 PASS 0.14s github.com/netboxlabs/diode/diode-server/reconciler/changeset 0.0% 0 0 0
🟢 PASS 1.07s github.com/netboxlabs/diode/diode-server/reconciler/differ 63.8% 6 0 0
🟢 PASS 1.02s github.com/netboxlabs/diode/diode-server/server 85.7% 14 0 0
🟢 PASS 1.01s github.com/netboxlabs/diode/diode-server/strcase 100.0% 24 0 0
🟢 PASS 1.04s github.com/netboxlabs/diode/diode-server/telemetry 28.0% 26 0 0
🟢 PASS 1.04s github.com/netboxlabs/diode/diode-server/telemetry/otel 91.7% 25 0 0
🟢 PASS 0.16s github.com/netboxlabs/diode/diode-server/tls 0.0% 0 0 0
🟢 PASS 1.01s github.com/netboxlabs/diode/diode-server/version 100.0% 2 0 0

Total coverage: 57.0%

Copy link
Contributor

@paulstuart paulstuart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mfiedorowicz mfiedorowicz merged commit 4b2bac5 into develop Feb 13, 2026
8 checks passed
@mfiedorowicz mfiedorowicz deleted the chore-refactor-graph-pkg-pt2 branch February 13, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants