fix(explore): accurately resolve query file paths and find camelCase symbols

Previously, `codegraph_explore` queries explicitly naming files by path (e.g., `src/routes/m/projects/[id]/runs/[runId]/+page.svelte`) were shredded. Bracketed path segments exploded into "named symbol" seeds, and FTS on fragments like `page` or `runs` admitted every sibling file, starving the user's intended target.

This change introduces:
- **Query path pinning:** File paths named in a query are now resolved against the index, "pinned," and stripped from the query. Pinned files are guaranteed inclusion, top ranking, and fair allocation. Unresolvable path-like spans are reported.
- **Segment vocabulary supplement:** Natural language query terms (e.g., "auto-scroll to bottom") can now reach camelCase identifiers (e.g., `pinFeedIfNearBottom`, `feedAtBottom`) by matching against their constituent segments.
- **Variable seeding:** `variable` and `constant` node kinds are now included in identifier seeding, improving recall for `$state`-style variables common in frameworks like Svelte.
This commit is contained in:
Colby McHenry
2026-08-20 09:10:07 -07:00
parent c6aaa20358
commit 238dbc5cec
15 changed files with 905 additions and 31 deletions
+4
View File
@@ -60,6 +60,8 @@ export interface ExploreCandidateMeta {
graphScore: number;
termHits: number;
nodes: number;
/** The query named this file by PATH — pinned rank/allocation treatment. */
pinned?: boolean;
named: boolean;
central: boolean;
entry: boolean;
@@ -579,6 +581,7 @@ export class ExploreDiagnostics {
graphScore: round6(r.graphScore),
termHits: r.termHits,
nodes: r.nodes,
pinned: r.pinned ?? false,
named: r.named,
central: r.central,
entry: r.entry,
@@ -797,6 +800,7 @@ export function renderTable(report: ExploreDiagnosticReport): string {
function flagString(f: ExploreDiagnosticFile): string {
const flags: string[] = [];
if (f.pinned) flags.push('pinned');
if (f.named) flags.push('named');
if (f.entry) flags.push('entry');
if (f.central) flags.push('central');