feat(code-graph): extract C++20 concept declarations as definitions

What does this MR do and why?

Extracts C++20 concept declarations as definitions.

This MR adds support for extracting concept_definition nodes from C++ source files, addressing a gap where top-level concepts were ignored. This change ensures that C++ type constraints (concepts) are mapped correctly as Definition nodes (with DefKind::Interface), enabling users to natively query codebase constraints and allowing future blast-radius analysis to trace template constraints correctly.

Closes #687 (closed)

Testing

Added the cpp_concepts integration test suite to verify extraction correctness. Verified locally via mise exec -- cargo nextest run -p integration-tests-codegraph --test suites cpp_concepts.

(Both Numeric and Printable test concepts were correctly matched and returned as top-level definitions in the local run.)

Performance Analysis

This merge request does not introduce any performance regression. The addition of the concept_definition scope rule operates locally within the C++ DSL parsing pipeline and adds no noticeable overhead to the tree-sitter AST extraction.

  • This merge request does not introduce any performance regression. If a performance regression is expected, explain why.

Agent context — long-form analysis, file-by-file walkthroughs, profiler output, alternatives considered

  • crates/code-graph/src/v2/langs/generic/cpp.rs: Added a new concept_definition scope rule to the C++ DSL configuration. We mapped the concept node to DefKind::Interface (as concepts act strictly as type interfaces/constraints) and explicitly set .no_scope() since concepts do not create a distinct nested FQN namespace like classes or standard namespaces do.
  • crates/integration-tests-codegraph/fixtures/cpp/concepts.yaml: Added the required fixture mapping a concepts.cpp file containing Numeric and Printable concepts.
  • crates/integration-tests-codegraph/tests/suites.rs: Registered the new test fixture.

Merge request reports

Loading