Skip to content

feat(scip): resolve parent_symbol_id from SCIP descriptor chain#249

Merged
jafreck merged 1 commit intomainfrom
feat/scip-parent-symbol-v2
Mar 24, 2026
Merged

feat(scip): resolve parent_symbol_id from SCIP descriptor chain#249
jafreck merged 1 commit intomainfrom
feat/scip-parent-symbol-v2

Conversation

@jafreck
Copy link
Copy Markdown
Owner

@jafreck jafreck commented Mar 24, 2026

Summary

The SCIP indexer now sets parent_symbol_id for every symbol that has an enclosing parent in the SCIP descriptor hierarchy.

Previously parent_symbol_id was only populated by the tree-sitter extraction path, leaving it NULL for all SCIP-indexed symbols. This meant the parent_name fields in lore_graph, lore_dependents, and lore_lookup returned no data for SCIP-covered languages (Java, Go, Python, Rust, C#, etc.).

Approach

SCIP symbol strings encode a descriptor chain that naturally represents the containment hierarchy. The parent of any symbol is obtained by stripping the last descriptor.

Symbols are sorted by descriptor depth (shallowest first) before insertion, so parents are always in scipToLoreId before their children. The parent lookup walks up the chain past skipped intermediates (modules, type literals) until it finds a symbol that was actually inserted, then includes the resolved parent_symbol_id in the original INSERT — no separate UPDATE pass needed.

Changes

  • extractParentScipSymbol() — strips the last SCIP descriptor to produce the parent symbol string
  • descriptorDepth() — counts descriptors for depth-first insertion ordering
  • findDescriptorNameStart() — backward-walks descriptor boundaries
  • Symbol insertion loop sorts by depth and resolves parent_symbol_id inline
  • INSERT INTO symbols now includes parent_symbol_id directly
  • 10 unit tests for extractParentScipSymbol

Impact

Indexing lore-self: 2036 / 7604 symbols gain parent_symbol_id — methods (98%), enum members (100%), constructors (100%), and interface/class properties correctly link to their enclosing container.

Testing

  • 238 SCIP tests pass
  • End-to-end verified on lore-self

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 24, 2026

Codecov Report

❌ Patch coverage is 97.01493% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.03%. Comparing base (d5eb579) to head (2bef21b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/indexer/stages/scip-indexer.ts 97.01% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #249      +/-   ##
==========================================
+ Coverage   87.97%   88.03%   +0.05%     
==========================================
  Files          85       85              
  Lines        9580     9643      +63     
  Branches     2971     2991      +20     
==========================================
+ Hits         8428     8489      +61     
- Misses       1152     1154       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jafreck jafreck merged commit e7b585c into main Mar 24, 2026
3 checks passed
@jafreck jafreck deleted the feat/scip-parent-symbol-v2 branch March 27, 2026 20:55
@jafreck jafreck mentioned this pull request Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant