Commit 0c729ea
authored
fix(graph): correct symbol resolution, centrality, and edge recall (v2.6.0) (#163)
* fix(core): stop indexing prose as code
Found by running the CLI over honojs/hono.
Markdown was in the code-graph extension list "for knowledge graphs
(Lattice)", so a `# fetch benchmark` heading in a README became a graph node
named `fetch` — and then competed with the real `fetch` definitions when
resolving TypeScript call sites. Markdown is still parseable, just no longer
part of the default code index.
Shell comments became functions. `parse_shell_line` looks for `()` anywhere
on the line, so `# Compare app.fetch() between the working tree and a git
ref` produced a function named "# Compare app.fetch". The comment guard ran
*after* parsing and only skipped a line when nothing had matched, so any
comment that happened to parse was kept. Comments are now skipped before
parsing, and shell function names must be bare identifiers.
Together these were 59 phantom nodes on hono — every one of them a false
candidate during symbol resolution.
* fix(graph): stop warning about routine resolution outcomes
`arbor setup` on hono printed dozens of WARN lines before its success
message — every ambiguous method name and every unimported cross-module
reference. Names like `.get`, `.encode`, and `.match` are shared by many
types in any real codebase, and most references are stdlib or third-party
with no definition to find. None of it is a user problem.
These are diagnostics for someone debugging resolution, so they move to
`debug!`. A first run should end with a clean success line, not a wall of
warnings about normal behaviour.
* fix: pick the right definition when a symbol name is ambiguous
`arbor inspect getPath` on hono reported "Role: unreachable, Callers: 0" and
suggested the symbol might be dead code. `getPath` is one of hono's hottest
utilities, called from ten places including the line directly below it.
The graph was right; the lookup was not. `getPath` names five nodes — a
function in `utils/url.ts` and methods on four AWS Lambda event processors —
and every caller resolved it with `find_by_name(..).first()`, i.e. whichever
file happened to be parsed first. The CLI and the MCP bridge each had their
own copy of that mistake, eleven call sites in total.
`ArborGraph::resolve_symbol_ranked` becomes the single resolution policy:
rank by graph degree, then centrality, then file path, so the pick is both
meaningful and independent of parse order. The CLI additionally prints which
definition it chose and what else matched, because answering an ambiguous
question silently is how this turned into a confidently wrong answer.
Also strips Windows' `\?\` verbatim prefix from resolved paths, which was
leaking into every line of user-facing output, and makes file lookup
separator-insensitive — callers join a project root with a forward-slash
relative path, producing `C:\root\src/lib.rs` where the parser recorded
`C:\root\src\lib.rs`, so `file-graph` reported "No symbols found" for files
full of symbols.1 parent 4579985 commit 0c729ea
5 files changed
Lines changed: 349 additions & 99 deletions
File tree
- crates
- arbor-cli/src
- arbor-core/src
- arbor-graph/src
- arbor-mcp/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
41 | 61 | | |
42 | | - | |
| 62 | + | |
| 63 | + | |
43 | 64 | | |
44 | 65 | | |
45 | 66 | | |
| |||
1997 | 2018 | | |
1998 | 2019 | | |
1999 | 2020 | | |
2000 | | - | |
2001 | | - | |
2002 | | - | |
2003 | | - | |
2004 | | - | |
2005 | | - | |
2006 | | - | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
2007 | 2033 | | |
2008 | 2034 | | |
2009 | 2035 | | |
| |||
3236 | 3262 | | |
3237 | 3263 | | |
3238 | 3264 | | |
| 3265 | + | |
| 3266 | + | |
| 3267 | + | |
| 3268 | + | |
| 3269 | + | |
| 3270 | + | |
| 3271 | + | |
| 3272 | + | |
| 3273 | + | |
| 3274 | + | |
| 3275 | + | |
| 3276 | + | |
| 3277 | + | |
| 3278 | + | |
| 3279 | + | |
| 3280 | + | |
| 3281 | + | |
| 3282 | + | |
| 3283 | + | |
| 3284 | + | |
| 3285 | + | |
| 3286 | + | |
| 3287 | + | |
| 3288 | + | |
3239 | 3289 | | |
3240 | | - | |
3241 | | - | |
3242 | | - | |
3243 | | - | |
3244 | | - | |
3245 | | - | |
3246 | | - | |
3247 | | - | |
3248 | | - | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + | |
| 3297 | + | |
| 3298 | + | |
| 3299 | + | |
| 3300 | + | |
| 3301 | + | |
| 3302 | + | |
| 3303 | + | |
| 3304 | + | |
| 3305 | + | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
| 3324 | + | |
| 3325 | + | |
| 3326 | + | |
| 3327 | + | |
| 3328 | + | |
| 3329 | + | |
| 3330 | + | |
3249 | 3331 | | |
3250 | 3332 | | |
3251 | 3333 | | |
3252 | 3334 | | |
3253 | 3335 | | |
3254 | 3336 | | |
3255 | | - | |
| 3337 | + | |
| 3338 | + | |
| 3339 | + | |
| 3340 | + | |
3256 | 3341 | | |
3257 | 3342 | | |
3258 | 3343 | | |
| |||
3296 | 3381 | | |
3297 | 3382 | | |
3298 | 3383 | | |
3299 | | - | |
| 3384 | + | |
| 3385 | + | |
| 3386 | + | |
| 3387 | + | |
3300 | 3388 | | |
3301 | 3389 | | |
3302 | 3390 | | |
| |||
3468 | 3556 | | |
3469 | 3557 | | |
3470 | 3558 | | |
3471 | | - | |
| 3559 | + | |
| 3560 | + | |
| 3561 | + | |
| 3562 | + | |
3472 | 3563 | | |
3473 | 3564 | | |
3474 | 3565 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
11 | 17 | | |
12 | 18 | | |
13 | 19 | | |
14 | 20 | | |
15 | 21 | | |
16 | | - | |
17 | 22 | | |
18 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
19 | 30 | | |
20 | 31 | | |
21 | 32 | | |
22 | 33 | | |
23 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
24 | 41 | | |
25 | 42 | | |
| 43 | + | |
26 | 44 | | |
27 | 45 | | |
28 | 46 | | |
29 | 47 | | |
30 | 48 | | |
31 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
32 | 61 | | |
33 | 62 | | |
34 | 63 | | |
| |||
39 | 68 | | |
40 | 69 | | |
41 | 70 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | 71 | | |
49 | 72 | | |
50 | 73 | | |
| |||
158 | 181 | | |
159 | 182 | | |
160 | 183 | | |
161 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
162 | 188 | | |
163 | 189 | | |
164 | 190 | | |
165 | 191 | | |
166 | 192 | | |
167 | 193 | | |
168 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
169 | 205 | | |
170 | 206 | | |
171 | 207 | | |
| |||
215 | 251 | | |
216 | 252 | | |
217 | 253 | | |
218 | | - | |
| 254 | + | |
219 | 255 | | |
220 | 256 | | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
221 | 261 | | |
222 | 262 | | |
223 | 263 | | |
| |||
383 | 423 | | |
384 | 424 | | |
385 | 425 | | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
172 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
173 | 175 | | |
174 | 176 | | |
175 | 177 | | |
| |||
196 | 198 | | |
197 | 199 | | |
198 | 200 | | |
199 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
200 | 204 | | |
201 | 205 | | |
202 | 206 | | |
| |||
289 | 293 | | |
290 | 294 | | |
291 | 295 | | |
292 | | - | |
| 296 | + | |
293 | 297 | | |
294 | 298 | | |
295 | 299 | | |
| |||
0 commit comments