Skip to content

C extraction: a macro-argument identifier becomes a USAGE edge to a same-named struct field #2666

Closed

Description

@DeusData

C extraction turns a macro-argument identifier into an edge to an unrelated struct field of the same name.

tests/test_main.c runs every suite through a macro, e.g. RUN_SELECTED_SUITE(mcp);. The argument mcp is a suite name, but the graph records a USAGE edge from main to whichever Field is named mcp: in one index openhands_fixture_t.mcp (char mcp[640] in tests/test_cli.c), in another cbm_daemon_application_session.mcp (src/daemon/application.c).

A data member that is only named as a macro argument is not used there, so the edge is wrong for every consumer (trace_path, impact, detect_changes, test-impact selection).

Repro: index this repository, then

query_graph: MATCH (m)-[r]->(f) WHERE m.name = 'main' AND m.file_path = 'tests/test_main.c' AND f.name = 'mcp' RETURN type(r), labels(f), f.qualified_name

returns USAGE, ["Field"], a struct member.

Expected: an identifier that appears only as a macro argument resolves to nothing, or at least never to a Field of an unrelated struct.

Found while making PR test selection narrow: the test-impact engine reached the runner's main through this edge and ran every test. The Smart CI PR guards the engine against it (an edge from the runner's main into a Field named like one of its suites no longer counts); this issue is the extractor fix itself.

Activity

  1. added
    bugSomething isn't working
    priority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.
    on Oct 19, 2026
  2. added a commit that references this issue on Oct 29, 2026
    c933d0b
  3. DeusData commented on Oct 29, 2026

    @DeusData
    OwnerAuthor

    Fixed on main by #2754 (merge commit 442989e), thanks to @gaurav0107: a bare C identifier that names no visible declaration no longer falls back to a same-named struct Field, so the macro-argument USAGE edge described here and the matching stray WRITES edges are gone. C++ and headers keep their member resolution unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingparsing/qualityGraph extraction bugs, false positives, missing edgespriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions