Commit 739961b
committed
fix(parser): multi-line /// doc comments were truncated to their last line
Found live via mcp__ci__understand() on this repo's own
apply_personalization_boost: its real 12-line /// doc comment came
back as just the final line ("configured to 0.0 — the common case
for a session's first calls."), silently dropping the actual
explanation of what the function does. Root cause: walk_symbols took
only node.prev_named_sibling() as the docstring — a single tree-sitter
node — but line-comment doc conventions (Rust ///, Go //, Shell/C #)
parse each line as its own separate node, so anything past the
immediate last line was never collected. Python (separate branch,
expression_statement-based) and block-comment languages (/** */ is
already one node) were unaffected.
Fix: collect_doc_comment_lines walks backward through contiguous
same-kind comment siblings (stopping at a blank-line gap or a
different node kind) and joins them. Adjacency check needed
n.end_position().row == expected_row, not + 1 — confirmed by
dumping the real parse tree: a line_comment node's end_position()
already lands on the following line (the grammar folds the
terminating newline into the token), an off-by-one that showed up
immediately as a regression in the existing single-line test before
landing on the right formula.
2 new regression tests: multi-line capture, and blank-line-gap
isolation (an unrelated comment above must not merge into the
docstring). Verified: cargo build/clippy -D warnings/fmt --check
clean, full workspace test suite green (354 ci-core + 88 ci-server).
mcp__ci__diff_impact(staged=true) flagged parser.rs::find as "high
risk" — confirmed via git diff it was untouched, just line-shifted by
the new tests above it in the same file (known line-overlap heuristic
limitation, not a real signature change).1 parent 7cbfac0 commit 739961b
1 file changed
Lines changed: 87 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
193 | 226 | | |
194 | 227 | | |
195 | 228 | | |
| |||
217 | 250 | | |
218 | 251 | | |
219 | 252 | | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
| 253 | + | |
| 254 | + | |
225 | 255 | | |
226 | 256 | | |
227 | 257 | | |
| |||
1318 | 1348 | | |
1319 | 1349 | | |
1320 | 1350 | | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
1321 | 1403 | | |
1322 | 1404 | | |
1323 | 1405 | | |
| |||
0 commit comments