Skip to content

bench: fix find_symbol exact-match against nested properties.name#674

Open
DvirDukhan wants to merge 1 commit into
dvirdukhan/benchmark-planfrom
dvirdukhan/fix-find-symbol-nested-name
Open

bench: fix find_symbol exact-match against nested properties.name#674
DvirDukhan wants to merge 1 commit into
dvirdukhan/benchmark-planfrom
dvirdukhan/fix-find-symbol-nested-name

Conversation

@DvirDukhan
Copy link
Copy Markdown

Problem

bench/agents/code_graph_adapter.py::find_symbol always returned [] for exact-name lookups against the live /api/auto_complete endpoint, because it filtered on a top-level name field that doesn't exist in the real response payload.

The real /api/auto_complete payload returns FalkorDB node shape:

{ "id": ..., "labels": [...], "properties": { "name": "...", "path": "...", "doc": "...", ... } }

The adapter was filtering item.get("name") == name, which never matched.

Fix

Filter checks item["properties"]["name"] first, then falls back to top-level name (for backward compat with older unit-test fixtures).

Verification

  • Regression test added: test_find_symbol_reads_nested_properties_name
  • All 56 bench tests pass
  • Live API test: cg find-symbol --name getmodpath now returns the function record with path + line range, where before it returned an empty list

Notes

  • Fix is in the bench adapter only — the upstream /api/auto_complete endpoint is unaffected
  • Base branch is dvirdukhan/benchmark-plan because the affected file only exists there (benchmark suite not yet merged to staging)

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Smoke #3 revealed cg find-symbol --name <exact> returned [] for symbols
the graph clearly contained (cg auto-complete --prefix found the same
symbol with full file:line+docstring). Root cause: the filter compared
item['name'] to the requested name, but the /api/auto_complete payload
nests the symbol name under item['properties']['name'] (FalkorDB node
properties), so the top-level lookup always returned None and nothing
matched.

Fix: prefer item['properties']['name'], fall back to item['name'] for
flatter shapes the unit tests pass in. Added a regression test that
uses the real payload structure.

Verified end-to-end against the live FastAPI service:

  cg find-symbol --repo pytest-dev__pytest-6202__code_graph \
                 --name getmodpath
  # -> [{id:2714, labels:[Function], properties:{name,path,doc,...}}]

This was the bug that made the smoke #3 code_graph agent burn 3 of 5
cg calls retrying exact-name lookups before falling back to
auto-complete. With this fix, an agent doing the natural workflow
(find-symbol -> get-neighbors -> note-edit) should land far fewer
wasted calls.

Also: norecursedirs in [tool.pytest.ini_options] to keep pytest from
walking into per-instance bench worktrees that ship their own pytest
sources (was breaking host pytest's AST rewriter on import).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9659cba6-9aac-4cc7-99f4-1847c764c32a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dvirdukhan/fix-find-symbol-nested-name

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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