Skip to content

Commit 2281ea3

Browse files
Merge pull request #19 from jonathanpopham/fix/lowercase-rel-types-v2
fix: match lowercase relationship types returned by API
2 parents 6e920e2 + 14dca92 commit 2281ea3

7 files changed

Lines changed: 10 additions & 10 deletions

File tree

internal/blastradius/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func findBlastRadius(g *api.Graph, repoDir, target string, maxDepth int) ([]Resu
6262
// Build reverse adjacency: nodeID → set of node IDs that import it.
6363
importedBy := make(map[string][]string)
6464
for _, rel := range g.Rels() {
65-
if rel.Type == "IMPORTS" || rel.Type == "WILDCARD_IMPORTS" {
65+
if rel.Type == "imports" || rel.Type == "wildcard_imports" {
6666
importedBy[rel.EndNode] = append(importedBy[rel.EndNode], rel.StartNode)
6767
}
6868
}

internal/blastradius/handler_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ func TestFindBlastRadius(t *testing.T) {
3737
fileNode("c", "internal/c/c.go"),
3838
},
3939
Relationships: []api.Relationship{
40-
{ID: "r1", Type: "IMPORTS", StartNode: "a", EndNode: "b"},
41-
{ID: "r2", Type: "IMPORTS", StartNode: "c", EndNode: "a"},
40+
{ID: "r1", Type: "imports", StartNode: "a", EndNode: "b"},
41+
{ID: "r2", Type: "imports", StartNode: "c", EndNode: "a"},
4242
},
4343
}
4444

internal/deadcode/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func findDeadCode(g *api.Graph, includeExports bool) []Result {
4545
// Build set of function node IDs that receive at least one CALLS edge.
4646
called := make(map[string]bool)
4747
for _, rel := range g.Rels() {
48-
if rel.Type == "CALLS" || rel.Type == "CONTAINS_CALL" {
48+
if rel.Type == "calls" || rel.Type == "contains_call" {
4949
called[rel.EndNode] = true
5050
}
5151
}

internal/deadcode/handler_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestFindDeadCode(t *testing.T) {
4646
node("f4", "Function", "Handler", "server.go"), // exported → excluded by default
4747
},
4848
Relationships: []api.Relationship{
49-
{ID: "r1", Type: "CALLS", StartNode: "f2", EndNode: "f1"}, // main → process
49+
{ID: "r1", Type: "calls", StartNode: "f2", EndNode: "f1"}, // main → process
5050
},
5151
}
5252

internal/focus/handler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ func reachableImports(g *api.Graph, seedID string, nodeByID map[string]*api.Node
206206
func functionNodesForFile(g *api.Graph, fileID string, rels []api.Relationship) []string {
207207
var ids []string
208208
for _, rel := range rels {
209-
if (rel.Type == "DEFINES_FUNCTION" || rel.Type == "DEFINES") && rel.StartNode == fileID {
209+
if (rel.Type == "defines_function" || rel.Type == "defines") && rel.StartNode == fileID {
210210
ids = append(ids, rel.EndNode)
211211
}
212212
}
@@ -225,7 +225,7 @@ func functionNodesForFile(g *api.Graph, fileID string, rels []api.Relationship)
225225
func buildCalleesOf(rels []api.Relationship) map[string][]string {
226226
m := make(map[string][]string)
227227
for _, rel := range rels {
228-
if rel.Type == "CALLS" || rel.Type == "CONTAINS_CALL" {
228+
if rel.Type == "calls" || rel.Type == "contains_call" {
229229
m[rel.StartNode] = append(m[rel.StartNode], rel.EndNode)
230230
}
231231
}

internal/mcp/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ type deadFn struct{ name, file string }
339339
func findDeadFunctions(g *api.Graph, includeExports bool) []deadFn {
340340
called := make(map[string]bool)
341341
for _, rel := range g.Rels() {
342-
if rel.Type == "CALLS" || rel.Type == "CONTAINS_CALL" {
342+
if rel.Type == "calls" || rel.Type == "contains_call" {
343343
called[rel.EndNode] = true
344344
}
345345
}
@@ -366,7 +366,7 @@ type affected struct {
366366
func findAffected(g *api.Graph, target string) []affected {
367367
importedBy := make(map[string][]string)
368368
for _, rel := range g.Rels() {
369-
if rel.Type == "IMPORTS" || rel.Type == "WILDCARD_IMPORTS" {
369+
if rel.Type == "imports" || rel.Type == "wildcard_imports" {
370370
importedBy[rel.EndNode] = append(importedBy[rel.EndNode], rel.StartNode)
371371
}
372372
}

scripts/check-architecture/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func main() {
114114

115115
var violations []string
116116
for _, rel := range graph.rels() {
117-
if rel.Type != "IMPORTS" && rel.Type != "WILDCARD_IMPORTS" {
117+
if rel.Type != "imports" && rel.Type != "wildcard_imports" {
118118
continue
119119
}
120120
src := nodePackage[rel.StartNode]

0 commit comments

Comments
 (0)