Skip to content

feat(graph): code change impact graph with blast-radius queries (#30)#65

Merged
Siddhant-K-code merged 1 commit into
mainfrom
feat/30-impact-graph
May 2, 2026
Merged

feat(graph): code change impact graph with blast-radius queries (#30)#65
Siddhant-K-code merged 1 commit into
mainfrom
feat/30-impact-graph

Conversation

@Siddhant-K-code
Copy link
Copy Markdown
Owner

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 traversal
  • BlastRadius — BFS over reverse edges from the changed set; returns affected nodes ranked by impact score with configurable maxDepth
  • BuildFromGoFiles — walks a directory tree and extracts Go import edges using line-by-line parsing (no go/packages, no cgo)
  • Stats — node/edge counts, max in/out degree, top-5 hub nodes by in-degree

Impact 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.goGraph, Node, Edge, BlastRadius, Stats
  • pkg/graph/builder.goBuildFromGoFiles, parseGoImports
  • pkg/graph/graph_test.go — 13 tests

@Siddhant-K-code Siddhant-K-code added enhancement New feature or request priority: high labels May 2, 2026
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>
@Siddhant-K-code Siddhant-K-code force-pushed the feat/30-impact-graph branch from bccb449 to 68b2c1a Compare May 2, 2026 14:31
@Siddhant-K-code Siddhant-K-code merged commit 85cf702 into main May 2, 2026
@Siddhant-K-code Siddhant-K-code deleted the feat/30-impact-graph branch May 2, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Product] Code Change Impact Graph - blast radius analysis from codebase structure

1 participant