Skip to content

fix: stash overload siblings instead of discarding them on QN collision - #1

Open
pranitpanda-affirm wants to merge 1 commit into
mainfrom
fix/method-overload-collision-sibling-stash
Open

fix: stash overload siblings instead of discarding them on QN collision#1
pranitpanda-affirm wants to merge 1 commit into
mainfrom
fix/method-overload-collision-sibling-stash

Conversation

@pranitpanda-affirm

@pranitpanda-affirm pranitpanda-affirm commented Aug 26, 2026

Copy link
Copy Markdown

What does this PR do?

Interface/class methods that share a qualified_name (JDBI @SqlQuery overloads, C++ overloads, Python @overload, etc.) previously had every arrival but one silently destroyed by cbm_gbuf_upsert_node's same-QN tie-break — search_graph/definition lookups would report zero results for a real, present method.

This is Option 1 of two considered fixes. The canonical survivor is picked using the exact same tie-break as before, so CALLS-edge resolution (which is name-only in registry.c and has no way to disambiguate overloads) sees no behavior change — no regression to callers-of enumeration. Instead of discarding the loser, its name, signature, line range, and annotations are folded into a sibling_overloads array on the surviving node's properties_json, so overload existence is discoverable instead of silently vanishing.

Option 2 (symmetric arg-count-aware call resolution, so overload fan-in actually resolves per-overload rather than just being visible) is a larger, separate follow-up — deliberately out of scope here.

Testing

Two new regression tests in tests/test_graph_buffer.c:

  • gbuf_upsert_overload_collision_stashes_loser — 2-way and 3-way overload collisions, verifying flattening (not nesting) of stashed siblings.
  • gbuf_upsert_same_location_refresh_no_sibling_stash — a same-file/same-line incremental re-emit is not mistaken for an overload collision.

All 52 tests in the graph_buffer suite pass under ASan/UBSan. Applied to the locally-installed binary and smoke-tested against all 30 existing project indexes (no data loss).

Checklist

  • Every commit is signed off (git commit -s) — not yet done, flagging for follow-up
  • Tests pass locally (make -f Makefile.cbm test) — relevant suites (graph_buffer, store_*, mcp, pipeline) are clean; the full run has ~327 pre-existing failures in tree-sitter grammar/extraction probes, unrelated to this change and present on main before it
  • Lint passes (make -f Makefile.cbm lint-ci) — not run locally (cppcheck/clang-format unavailable in this environment); deferring to CI
  • New behavior is covered by a test (reproduce-first for bug fixes)

Interface/class methods that share a qualified_name (JDBI @sqlquery
overloads, C++ overloads, Python @overload, ...) previously had every
arrival but one silently destroyed by cbm_gbuf_upsert_node's same-QN
tie-break. The canonical survivor is picked exactly as before (no
change to CALLS-edge resolution behavior), but the loser's name,
signature, and annotations are now folded into a sibling_overloads
array on the surviving node's properties_json instead of vanishing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@pranitpanda-affirm
pranitpanda-affirm marked this pull request as ready for review August 26, 2026 22:39
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.

2 participants