Skip to content

[RED TEAM] test_returns_correct_counts expects 97 CALLS edges but gets 76 — pre-existing parser under-count #118

Description

@Wolfvin

Temuan

tests/test_compact_format.py::TestGraphSchemaCommand::test_returns_correct_counts mengharapkan tepat 97 CALLS edges pada clean_app fixture, tapi scan saat ini hanya menghasilkan 76 CALLS edges (plus 37 IMPORTS edges = 113 total).

Backend.json juga hanya punya 76 edges — jadi ini bukan masalah graph population, tapi parser memang menghasilkan lebih sedikit edges dari expected.

26 dari 76 edges memiliki to_fn: '' (empty target) — ini adalah method/attribute calls yang parser tangkap tapi tidak resolve nama function-nya.

Cara reproduce

git clone https://github.com/Wolfvin/CodeLens.git
cd CodeLens
pip install -e .[grammars]  # atau pip install tree-sitter-python tree-sitter-javascript
python -m pytest tests/test_compact_format.py::TestGraphSchemaCommand::test_returns_correct_counts -v

Output aktual

FAILED tests/test_compact_format.py::TestGraphSchemaCommand::test_returns_correct_counts
E   assert 76 == 97

Manual verification:

CALLS edges: 76
IMPORTS edges: 37
total edges: 113
empty to_fn edges: 26

Output yang diharapkan

Test passes dengan CALLS edges == 97.

Severity

MEDIUM — test failure yang block CI. Tidak直接影响 end-user functionality, tapi mengindikasikan parser mungkin miss beberapa call edges (regression atau test expectation stale). Perlu investigasi:

  1. Apakah 97 adalah angka yang benar (test expectation valid) atau 76 (parser benar)?
  2. Jika 97 benar, parser kehilangan 21 edges — kemungkinan pada method calls seperti cursor.execute(), conn.commit(), dll.
  3. Mungkin terkait tree-sitter API version (0.26 vs older) yang mengubah AST shape untuk call expressions.

PR terkait

Pre-existing — test ditulis di commit 6214f14 (PR #27, issue #17). Parser file scripts/parsers/python_parser.py tidak berubah sejak itu. Tidak diperkenalkan oleh #106#113. Tapi tetap perlu fix karena block CI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    exec: parallelCan be picked up anytime independentlytype: bug-fixRegression or broken behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions