Skip to content

Commit 999ac58

Browse files
greynewellclaude
andcommitted
fix(shards): extend mergeGraph UUID remap to cover Type and Class nodes
Type/Class nodes from changed files were not remapped in the oldToNew table, leaving relationships from unchanged files pointing at stale UUIDs (dangling edges). Added incTypeByKey map built from the incremental response and wired it into the remap loop alongside File and Function nodes. Fixes #107 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0529851 commit 999ac58

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

internal/shards/daemon.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ func (d *Daemon) mergeGraph(incremental *api.ShardIR, changedFiles []string) { /
451451

452452
incFileByPath := make(map[string]string)
453453
incFnByKey := make(map[string]string)
454+
incTypeByKey := make(map[string]string) // Type and Class nodes keyed by filePath:name
454455
for _, n := range incremental.Graph.Nodes {
455456
fp := n.Prop("filePath")
456457
if n.HasLabel("File") && fp != "" {
@@ -460,6 +461,11 @@ func (d *Daemon) mergeGraph(incremental *api.ShardIR, changedFiles []string) { /
460461
if name != "" {
461462
incFnByKey[fp+":"+name] = n.ID
462463
}
464+
} else if (n.HasLabel("Type") || n.HasLabel("Class")) && fp != "" {
465+
name := n.Prop("name")
466+
if name != "" {
467+
incTypeByKey[fp+":"+name] = n.ID
468+
}
463469
}
464470
}
465471

@@ -479,6 +485,12 @@ func (d *Daemon) mergeGraph(incremental *api.ShardIR, changedFiles []string) { /
479485
if newID, ok := incFnByKey[key]; ok && newID != n.ID {
480486
oldToNew[n.ID] = newID
481487
}
488+
} else if n.HasLabel("Type") || n.HasLabel("Class") {
489+
name := n.Prop("name")
490+
key := fp + ":" + name
491+
if newID, ok := incTypeByKey[key]; ok && newID != n.ID {
492+
oldToNew[n.ID] = newID
493+
}
482494
}
483495
}
484496

0 commit comments

Comments
 (0)