-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Labels
bugSomething isn't workingSomething isn't workingdogfoodFound during dogfoodingFound during dogfooding
Description
Found during dogfooding v2.4.0
Severity: Medium
Command: codegraph embed -m minilm --strategy structured
Reproduction
- Build a graph:
codegraph build . - Switch to a branch where some files were renamed/deleted (stale node data)
- Run:
codegraph embed -m minilm --strategy structured
Expected behavior
Should gracefully skip symbols with invalid line numbers.
Actual behavior
TypeError: Cannot read properties of undefined (reading 'trim')
at extractLeadingComment (embedder.js:138:30)
at buildStructuredText (embedder.js:200:19)
Root cause
extractLeadingComment(lines, fnLineIndex) doesn't bounds-check lines[i]. When fnLineIndex > lines.length (stale graph data), lines[i] is undefined.
Suggested fix
Add bounds check at the top of the loop in extractLeadingComment:
if (i >= lines.length) continue;Or clamp fnLineIndex to lines.length before starting the loop.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdogfoodFound during dogfoodingFound during dogfooding