fix(#562): codedb_callers excludes full-line comment mentions from call sites#563
Conversation
…s as call sites Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Both handleCallers loops now skip lines isCommentOrBlank reports as comments (same helper compact-mode search uses), so documentation mentions no longer appear as call sites or inflate the header count. Trailing comments on code lines are unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7428f28a98
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const lang = explore_mod.detectLanguage(r.path); | ||
| if (!langHasCallSites(lang)) continue; | ||
| // #562: a full-line comment mention is documentation, not a call site. | ||
| if (explore_mod.isCommentOrBlank(r.line_text, lang)) continue; |
There was a problem hiding this comment.
Avoid capping callers before filtering comments
When an identifier has many full-line comment mentions, searchContentWithScope(name, ..., max_results) has already limited results before this new filter removes comments. In that case the default 30 raw hits can all be comments, so codedb_callers reports fewer or even zero call sites even though real calls exist just beyond the search cap; the cap should apply after comment/definition/whole-word filtering, or the search should over-fetch.
Useful? React with 👍 / 👎.
| const lang = explore_mod.detectLanguage(r.path); | ||
| if (!langHasCallSites(lang)) continue; | ||
| // #562: a full-line comment mention is documentation, not a call site. | ||
| if (explore_mod.isCommentOrBlank(r.line_text, lang)) continue; |
There was a problem hiding this comment.
Preserve valid call sites on leading-star code lines
For C/C++/JS/TS and similar languages, isCommentOrBlank treats any trimmed line starting with * as a comment continuation, so using it here drops valid code such as *out = compute(); or generator methods like *run() { target(); } from codedb_callers. This filter needs to distinguish actual comment continuations from executable lines, otherwise callers on those lines are silently undercounted and omitted.
Useful? React with 👍 / 👎.
Benchmark Regression ReportThresholds: 10.00% and 50,000 ns absolute delta
|
…(546 + 560 + 562) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Benchmark Regression ReportThresholds: 10.00% and 50,000 ns absolute delta
|
Fixes #562.
Problem
handleCallersfiltered by language, definition-line, and whole-word match — but never by comment-ness. Full-line//mentions were counted and rendered as call sites (live:insertRestoredFilereported snapshot.zig:822, a comment, as a call site; 2 of its 3 'call sites' were comments).Fix
Both loops skip
explore_mod.isCommentOrBlank(r.line_text, lang)lines (the helper compact-mode search already uses), withdetectLanguagehoisted. Trailing comments on code lines are untouched — position-aware parsing is out of scope per the issue.Failing Test
test "issue-562: codedb_callers excludes full-line comment mentions"(src/test_search.zig), committed red: real call kept, comment mention excluded, header says1 call sites. Pre-fix 67/68.Validation
zig build test: all green (730 tests), including issue-391/425/426 callers tests.Note: trivial EOF conflict with #557/#561 in src/test_search.zig (each appends a test at file end).
🤖 Generated with Claude Code