feat(graph): code change impact graph with blast-radius queries (#30)#65
Merged
Conversation
Implements issue #30. Builds an in-memory directed dependency graph and answers blast-radius queries: given a set of changed files, which other files are transitively affected? - Graph: nodes (files/packages) + directed edges with weights - BlastRadius: BFS over reverse edges, returns affected nodes ranked by impact score (1.0 at depth 1, halved per level) - BuildFromGoFiles: walks a directory tree and extracts Go import edges using line-by-line parsing (no cgo/go/packages dependency) - Stats: node/edge counts, max in/out degree, top-5 hub nodes Co-authored-by: Ona <no-reply@ona.com>
bccb449 to
68b2c1a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #30
Summary
Adds
pkg/graph— an in-memory directed dependency graph that answers blast-radius queries: given a set of changed files, which other files are transitively affected?Features
Graph— nodes (files/packages/modules) + directed weighted edges, O(1) node lookup, O(degree) neighbour traversalBlastRadius— BFS over reverse edges from the changed set; returns affected nodes ranked by impact score with configurablemaxDepthBuildFromGoFiles— walks a directory tree and extracts Go import edges using line-by-line parsing (nogo/packages, no cgo)Stats— node/edge counts, max in/out degree, top-5 hub nodes by in-degreeImpact scoring
Nodes at depth 1 (direct dependents) score 1.0; each additional level halves the score. Results are sorted by score descending.
Files
pkg/graph/graph.go—Graph,Node,Edge,BlastRadius,Statspkg/graph/builder.go—BuildFromGoFiles,parseGoImportspkg/graph/graph_test.go— 13 tests