Skip to content

mcp: codedb_callers counts full-line comment mentions as call sites #562

@justrach

Description

@justrach

Problem

handleCallers filters by langHasCallSites, definition-line exclusion, and hasWholeWordMatch, but never checks whether the matching line is a comment. Full-line comments are reported (and counted) as call sites.

Live repro on this repo: codedb_callers name=insertRestoredFile returns 3 'call sites' — snapshot.zig:822 (// is false: insertRestoredFile errors above…), test_snapshot.zig:1080 (another comment), and only one real call. For searchContent, several of the 30 results are doc-comment lines. Found in the 2026-06-10 dogfooding audit.

Failing Test

test "issue-562: codedb_callers excludes full-line comment mentions" in src/test_search.zig (branch fix/issue-562-callers-comments): a real call in src/caller.zig:2, a full-line // mention in src/noisy.zig — output must keep the former, exclude the latter, and report 1 call sites. Verified failing on release/0.2.5825: 67/68 (noisy.zig leaks in).

Expected

Full-line comment mentions are documentation, not call sites: excluded from both the rendered list and the header count. (Trailing comments on code lines stay — position-aware comment parsing is out of scope.)

Fix

In both handleCallers loops: skip when explore_mod.isCommentOrBlank(r.line_text, lang) — the same helper compact-mode search already uses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:p2Medium priority

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions