Skip to content

fix(#562): codedb_callers excludes full-line comment mentions from call sites#563

Merged
justrach merged 3 commits into
release/0.2.5825from
fix/issue-562-callers-comments
Jun 10, 2026
Merged

fix(#562): codedb_callers excludes full-line comment mentions from call sites#563
justrach merged 3 commits into
release/0.2.5825from
fix/issue-562-callers-comments

Conversation

@justrach

Copy link
Copy Markdown
Owner

Fixes #562.

Problem

handleCallers filtered by language, definition-line, and whole-word match — but never by comment-ness. Full-line // mentions were counted and rendered as call sites (live: insertRestoredFile reported 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), with detectLanguage hoisted. 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 says 1 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

justrach and others added 2 commits June 10, 2026 10:55
…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>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/mcp.zig
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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread src/mcp.zig
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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@github-actions

Copy link
Copy Markdown

Benchmark Regression Report

Thresholds: 10.00% and 50,000 ns absolute delta

NOISE means the percentage threshold was exceeded, but the absolute delta was too small to fail CI.

Tool Base (ns) Head (ns) Delta Abs Delta (ns) Status
codedb_bundle 107488 103077 -4.10% -4411 OK
codedb_changes 11298 10554 -6.59% -744 OK
codedb_context 1165543 1167995 +0.21% +2452 OK
codedb_deps 362 346 -4.42% -16 OK
codedb_edit 49193 84406 +71.58% +35213 NOISE
codedb_find 11598 9172 -20.92% -2426 OK
codedb_hot 25700 27603 +7.40% +1903 OK
codedb_outline 33389 36534 +9.42% +3145 OK
codedb_read 16463 16528 +0.39% +65 OK
codedb_search 25097 25996 +3.58% +899 OK
codedb_snapshot 64707 68333 +5.60% +3626 OK
codedb_status 10159 9445 -7.03% -714 OK
codedb_symbol 48018 50273 +4.70% +2255 OK
codedb_tree 47072 50655 +7.61% +3583 OK
codedb_word 11877 12077 +1.68% +200 OK

…(546 + 560 + 562)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@justrach justrach merged commit 6f922c3 into release/0.2.5825 Jun 10, 2026
1 check passed
@justrach justrach deleted the fix/issue-562-callers-comments branch June 10, 2026 03:24
@github-actions

Copy link
Copy Markdown

Benchmark Regression Report

Thresholds: 10.00% and 50,000 ns absolute delta

NOISE means the percentage threshold was exceeded, but the absolute delta was too small to fail CI.

Tool Base (ns) Head (ns) Delta Abs Delta (ns) Status
codedb_bundle 102182 99782 -2.35% -2400 OK
codedb_changes 12216 15050 +23.20% +2834 NOISE
codedb_context 1104533 1110161 +0.51% +5628 OK
codedb_deps 316 508 +60.76% +192 NOISE
codedb_edit 42152 51047 +21.10% +8895 NOISE
codedb_find 9154 9368 +2.34% +214 OK
codedb_hot 25147 24411 -2.93% -736 OK
codedb_outline 33358 34542 +3.55% +1184 OK
codedb_read 15699 16175 +3.03% +476 OK
codedb_search 25291 26242 +3.76% +951 OK
codedb_snapshot 63982 65333 +2.11% +1351 OK
codedb_status 8480 9708 +14.48% +1228 NOISE
codedb_symbol 50179 49661 -1.03% -518 OK
codedb_tree 22576 22308 -1.19% -268 OK
codedb_word 12149 11919 -1.89% -230 OK

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