Repository navigation
Fix Python @property read edges and call resolution - #1065
7 commits merged into
Conversation
|
Thank you for this PR. I tested small examples on this branch and on Before I can merge it, please fix these:
Please add tests for both cases. After you push the fix, I will test it again. |
code-review-graph reviewOverall risk: 0.65 (MEDIUM) — 43 changed function(s)/class(es), 52 affected flow(s), 30 test gap(s) (25 with no tested caller found, 5 reached only through a caller) Risk-scored changes
Affected execution flows
Test gaps
Reached only through a callerNo test names these directly, but a tested caller reaches them along the call path shown. That is a path in the call graph, not a record of execution -- the caller's tests may never take this branch. Treat it as where to look, not as coverage: these count as gaps and are scored as untested.
Powered by code-review-graph — local-first analysis; no code leaves the CI runner. |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved binding, reachability, and scope-resolution defects produce false or missing property-getter call edges, making caller and dead-code analysis unreliable.
6 open issues
Treat property targets in with statements and comprehensions as stores · New Preserve captured instance receivers in nested functions · New Filter unreachable property reads from getter call edges · New Track function-local import origins by lexical binding · New Prevent unknown parameters from inheriting instance-field evidence · New Preserve defining-module class identity for property return types · New
What changed in this PR
This PR addresses #1060 by adding Python property-read edges to the knowledge graph, improving caller discovery and dead-code analysis for explicitly declared getters.
Changes:
- Emit
CALLSedges for property reads with known receiver types. - Use getter return annotations to resolve calls on assigned property values.
- Add regression coverage for cross-file resolution, unknown receivers, class receivers, and store targets.
| File | Description |
|---|---|
tests/test_python_property_reads.py |
Adds property-read and return-type resolution regression tests. |
code_review_graph/parser.py |
Collects property metadata, infers receiver types, and emits getter-call edges. |
Review effort: Balanced
0160eb0
…8205#1065) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Take the head's class identity through receiver_class_file, candidate-set import conflicts, ast scope map and store-target checks: they cover more than our fix. Keep our depth guard on the imported-module walk and our tests that the head lacks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # code_review_graph/graph.py

Linked issue
Closes #1060
What & why
CALLSedge for reads of explicitly declared@propertygetters when the owner class is known from local or imported bindings.How it was tested
The full test suite ran on Python 3.12.13 with watchdog's polling observer because the native macOS FSEvents observer crashed during full-suite runs on this host.
Checklist
uv run pytest tests/ --tb=short -quv run ruff check code_review_graph/uv run mypy code_review_graph/ --ignore-missing-imports --no-strict-optionaldocs/, docstrings)