feat: add normalizeSymbol utility for stable JSON schema#259
feat: add normalizeSymbol utility for stable JSON schema#259carlos-alm wants to merge 2 commits intomainfrom
Conversation
Greptile SummaryThis PR introduces Key changes:
Additional commits in branch:
The PR is well-tested, thoroughly documented, and implements a clean abstraction that closes field gaps across the codebase. Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Query/Search Function] --> B{Has DB rows?}
B -->|Yes| C[Create hashCache Map]
C --> D[For each row]
D --> E[Call normalizeSymbol row, db, hashCache]
E --> F{fileHash in cache?}
F -->|Yes| G[Use cached hash]
F -->|No| H[getFileHash from DB]
H --> I[Cache hash for file]
I --> J[Return 7-field object]
G --> J
J --> K{More rows?}
K -->|Yes| D
K -->|No| L[Return normalized results]
B -->|No| M[Return empty results]
style E fill:#e1f5ff
style J fill:#d4edda
style H fill:#fff3cd
Last reviewed commit: df57e02 |
|
Claude finished @carlos-alm's task —— View job PR Review CompleteFollowing strict review guidelines for codegraph PR #259: Review Checklist:
Root Cause AnalysisProblem Being Solved: This PR addresses the lack of consistency in symbol metadata across different query and search commands. Previously, some functions returned symbols missing Why This Approach: The
Risk Assessment: ✅ LOW RISK - This is a pure additive change that improves API consistency without breaking existing functionality. Configuration & Test Analysis✅ Configuration Changes (Clean)
✅ Test Integrity (Strong)
Code Quality Assessment✅ Implementation Quality
SQL Updates:
Performance Considerations:
✅ Security & Stability
✅ Documentation
Minor Observations
Final RecommendationThis PR demonstrates excellent engineering practices with proper abstraction, comprehensive testing, and thorough documentation. The |
9a6401e to
1f1cff0
Compare
1f1cff0 to
628d4cd
Compare
Add normalizeSymbol(row, db, hashCache) that returns a consistent 7-field symbol shape (name, kind, file, line, endLine, role, fileHash) across all query and search commands. Update queryNameData, fnDepsData, fnImpactData, explainFunctionImpl, listFunctionsData, rolesData, whereSymbolImpl in queries.js and searchData, multiSearchData, ftsSearchData, hybridSearchData in embedder.js to use normalizeSymbol. Update SQL in listFunctionsData, rolesData, iterListFunctions, iterRoles, _prepareSearch, and ftsSearchData to include end_line and role columns. Export normalizeSymbol from index.js. Add docs/json-schema.md documenting the stable schema. Add 8 unit tests and 7 integration schema conformance tests. Impact: 13 functions changed, 33 affected
|
Superseded by #267 (rebased, clean commit history, all CI passing). |
Summary
normalizeSymbol(row, db, hashCache)utility that returns a consistent 7-field symbol shape (name,kind,file,line,endLine,role,fileHash) across all query and search commandsqueries.jsand 4 search functions inembedder.jsto usenormalizeSymbol, closing field gaps whereendLine/role/fileHashwere missinglistFunctionsData,rolesData, iterators,_prepareSearch, andftsSearchDatato includeend_lineandrolecolumnsnormalizeSymbolfromindex.jsfor programmatic consumersdocs/json-schema.mddocumenting the stable base shape, valid kinds/roles, and command envelope shapesnormalizeSymboland 7 integration schema conformance testsTest plan