fix: include constant nodes in edge building (#487)#495
Conversation
…in backlog These two items deliver the highest immediate impact on agent experience and graph accuracy without requiring Rust porting or TypeScript migration. They should be implemented before any Phase 4+ roadmap work. - #83: hook-optimized `codegraph brief` enriches passively-injected context - #71: basic type inference closes the biggest resolution gap for TS/Java
Impact: 14 functions changed, 0 affected
…487) The edge-building stage excluded 'constant'-kind nodes from the node lookup maps, so no import/dependency edges were ever created for exported constants. This made them invisible to where, fn-impact, query, roles, and all other graph queries. Also adds missing 'record' kind to build-edges.js to match CORE_SYMBOL_KINDS. Impact: 6 functions changed, 33 affected
|
Claude finished @carlos-alm's task —— View job Reviewing PR #495: Include constant nodes in edge buildingReview Progress:
Root Cause AnalysisProblem Being Solved: Exported constants were invisible to graph queries because the edge-building stage excluded Why This Approach: The fix correctly addresses the root cause by adding Risk Assessment: Very low risk. This is purely additive (more edges, more visibility) with no breaking changes to existing behavior. Configuration Change Detection✅ No configuration changes detected. No linting rules, test timeouts, build config, or TypeScript flags were modified. Test Integrity Check✅ No test integrity concerns. According to the PR description, all integration tests (504/504) and graph tests (139/139) pass. No test files were modified. The change is purely in the core graph building logic. Code Quality AssessmentStrengths:
Minor observations:
Architecture alignment: The fix addresses the discrepancy between No security, performance, or maintainability concerns identified. Backlog Compliance
Critical ConcernsNone identified. This is a straightforward, well-implemented bug fix. Final Recommendation
Suggested follow-up (not blocking): Consider refactoring the hardcoded SQL kind lists to use |
Greptile SummaryThis PR fixes issue #487 by including Two issues were found during review:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant CLI as CLI / MCP
participant SL as symbol-lookup.js
participant GEN as generators.js (iterWhere)
participant BE as build-edges.js
participant DB as SQLite nodes table
Note over CLI,DB: codegraph where SOME_CONSTANT (non-streaming)
CLI->>SL: whereData(target)
SL->>DB: SELECT * FROM nodes WHERE kind IN<br/>(...CORE_SYMBOL_KINDS, 'parameter', 'property', 'constant')
DB-->>SL: rows including constant nodes ✅
SL-->>CLI: results with constants
Note over CLI,DB: codegraph where SOME_CONSTANT (streaming / iterWhere)
CLI->>GEN: iterWhere(target)
GEN->>DB: SELECT * FROM nodes WHERE kind IN<br/>(CORE_SYMBOL_KINDS — no constant ❌)
DB-->>GEN: rows WITHOUT constant nodes
GEN-->>CLI: results missing constants
Note over CLI,DB: Graph build — buildEdges (after this PR)
CLI->>BE: buildEdges(ctx)
BE->>DB: SELECT id,name,kind,file,line FROM nodes<br/>WHERE kind IN (...CORE_SYMBOL_KINDS, 'record', 'constant') ✅
DB-->>BE: allNodes including constants
BE->>BE: populate nodesByName / nodesByNameAndFile
BE->>DB: INSERT edges (calls, imports, receiver…)
|
…es (#487) whereSymbolImpl used ALL_SYMBOL_KINDS (core 10, no constant) so codegraph where could not find constants. findMatchingNodes defaulted to FUNCTION_KINDS which also excluded constant. Switch whereSymbolImpl to EVERY_SYMBOL_KIND and add constant to FUNCTION_KINDS default. Impact: 1 functions changed, 6 affected
|
Fixed in 8266b33 — addressed the Greptile feedback about
All 1862 tests pass, lint clean. |
Summary
'constant'to theWHERE kind IN (...)SQL clause inbuild-edges.jsso exported constants participate in edge resolution and become visible to all graph queries (where,fn-impact,query,roles, etc.)'record'kind tobuild-edges.jsto matchCORE_SYMBOL_KINDScontext.js,watcher.js,export.js,graph-enrichment.js) to include'constant'in their kind filtersCloses #487
Test plan
codegraph where BUILTIN_RECEIVERS -Treturns resultscodegraph fn-impact BUILTIN_RECEIVERS -Treports correct dependentscodegraph roles --role dead -Tno longer misclassifies active constants