Skip to content

Add tree-sitter pattern for three-part qualified calls (#1918) - #1920

Open
Aman-goel-04 wants to merge 1 commit into
repowise-dev:mainfrom
Aman-goel-04:fix/three-part-qualified-call-1918
Open

Add tree-sitter pattern for three-part qualified calls (#1918)#1920
Aman-goel-04 wants to merge 1 commit into
repowise-dev:mainfrom
Aman-goel-04:fix/three-part-qualified-call-1918

Conversation

@Aman-goel-04

Copy link
Copy Markdown

Summary

  • cpp.scm's two scoped-call patterns require name: (identifier), but tree-sitter nests a three-part qualifier left-recursively (ns::util::fn()), so the outer node's name field is itself a qualified_identifier. Neither pattern matched, so these calls produced no call site at all — not an unresolved one, just absent, so they never reached the resolver.
  • Adds a third pattern that captures the innermost identifier as @call.target and its adjacent scope as @call.scope, matching how the existing two-part pattern already behaves.
  • Verified against real leveldb source: 19 genuine three-part call sites now captured (including leading-:: global-qualified variants like ::crc32c::Extend(...), which hit the same left-recursion shape), with zero unexpected overlap against the existing two-part pattern.

Related Issues

Fixes #1918

Test Plan

  • Added TestThreePartQualifiedCallProducesACallSite to tests/unit/ingestion/test_cpp_scoped_calls.py, covering:

    • a three-part call (ns::util::toHex()) now resolves to the function
    • the existing two-part control (util::toHex()) is unaffected
    • the unqualified control (free_thing()) is unaffected
  • Verified the new tree-sitter pattern directly (outside pytest) against the exact grammar shape, confirming no collision/dedup dependency with the existing two-part pattern.

  • Ran the new pattern against a real google/leveldb checkout: 19 genuine three-part call sites found and manually spot-checked against source, all correct.

  • Full suite: pytest tests/ — 2654 passed, 5 skipped, 1 pre-existing unrelated failure (test_repo_totals_churn.py::test_a_rebased_branch_in_the_history_falls_back, a local git-rebase fixture issue, not touched by this change).

  • Tests pass (pytest)

  • Lint passes (ruff check .)

  • Web build passes (npm run build) (if frontend changes) — N/A, no frontend changes

Checklist

  • My code follows the project's code style
  • I have added tests for new functionality
  • All existing tests still pass
  • I have updated documentation if needed - Not needed

@repowise-bot

repowise-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown

✅ Health of changed files: 2.6 → 2.9 (+0.3)

📋 At a glance
1 file changed health · 2 hotspots touched · 3 co-change pairs left out · 2 files with recent fix history.

Files & modules (2)
  • packages (1 file)
    • .../ingestion/parser.py
  • tests (1 file)
    • .../ingestion/test_cpp_scoped_calls.py

✅ Health gate: passed

📌 Before you merge

  • Run tests/integration/test_deterministic_generation.py, tests/integration/test_generation_determinism.py, tests/integration/test_generation_pipeline.py: they import the changed files
  • .../ingestion/models.py changed together with .../ingestion/parser.py in 16 past commits and isn't in this PR
  • .../dead_code/analyzer.py changed together with .../ingestion/parser.py in 13 past commits and isn't in this PR
  • .../ingestion/call_resolver.py changed together with .../ingestion/parser.py in 10 past commits and isn't in this PR
🔎 More signals (3)

🗺️ Change map

flowchart LR
  subgraph PR ["Changed in this PR (1 with dependents)"]
    f_packages_core_src_repowise_core_ingestion_parser_py[".../ingestion/parser.py 🔥"]:::changed
  end
  f_packages_core_src_repowise_core_analysis_dead_code_analyzer_py[".../dead_code/analyzer.py"]
  f_packages_core_src_repowise_core_ingestion_parser_py --> f_packages_core_src_repowise_core_analysis_dead_code_analyzer_py
  f_packages_core_src_repowise_core_analysis_dead_code_constants_py[".../dead_code/constants.py"]
  f_packages_core_src_repowise_core_ingestion_parser_py --> f_packages_core_src_repowise_core_analysis_dead_code_constants_py
  f_packages_core_src_repowise_core_analysis_health_complexity_languages_py[".../complexity/languages.py"]
  f_packages_core_src_repowise_core_ingestion_parser_py --> f_packages_core_src_repowise_core_analysis_health_complexity_languages_py
  f_packages_core_src_repowise_core_analysis_health_complexity_walker_py[".../complexity/walker.py"]
  f_packages_core_src_repowise_core_ingestion_parser_py --> f_packages_core_src_repowise_core_analysis_health_complexity_walker_py
  more(["+14 more dependents"])
  PR --> more
  w_packages_core_src_repowise_core_ingestion_models_py(["⚠️ .../ingestion/models.py changed together 16×, not in PR"]):::warn
  f_packages_core_src_repowise_core_ingestion_parser_py -.- w_packages_core_src_repowise_core_ingestion_models_py
  w_packages_core_src_repowise_core_analysis_dead_code_analyzer_py(["⚠️ .../dead_code/analyzer.py changed together 13×, not in PR"]):::warn
  f_packages_core_src_repowise_core_ingestion_parser_py -.- w_packages_core_src_repowise_core_analysis_dead_code_analyzer_py
  t_tests_integration_test_deterministic_generation_py(["✅ tests/integration/test_deterministic_generation.py"]):::guard
  t_tests_integration_test_deterministic_generation_py -.-> f_packages_core_src_repowise_core_ingestion_parser_py
  classDef changed fill:#dbeafe,stroke:#1d4ed8,color:#1e3a5f
  classDef warn fill:#fef3c7,stroke:#b45309,color:#78350f
  classDef guard fill:#dcfce7,stroke:#15803d,color:#14532d
Loading

Solid arrows: code that imports the changed files (18 direct dependents, from the last indexed snapshot). Dashed: history/tests.

🔥 Hotspots touched (2)

  • .../ingestion/test_cpp_scoped_calls.py: 1 commits/90d, 0 dependents · primary owner: Raghav Chamadiya (100%)
  • .../ingestion/parser.py: 33 commits/90d, 125 dependents · primary owner: Raghav Chamadiya (75%)

🔗 Hidden coupling (1 file)

  • .../ingestion/parser.py co-changes with these files (not in this PR):
    • .../ingestion/models.py (16×, 🟡 notable)
    • .../dead_code/analyzer.py (13×, 🟡 notable)
    • .../ingestion/call_resolver.py (10×, 🟡 notable)

👀 Suggested reviewers @RaghavChamadiya


📊 See the full report for this PR
Your repo map with this PR's blast radius lit up, every caller of the contracts it changes, and health before and after. No sign-in. · ⭐ Star Repowise · 📥 Install bot · Silence on a single PR with [skip repowise] in the title · Per-repo toggle on repowise.dev/settings?tab=bot · Updated 2026-08-25 11:39 UTC

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.

[Bug] A three-part C++ qualified call like ns::util::fn() produces no call site at all

1 participant