Repository navigation
Fix Elixir guarded and multi-clause function - #980
6 commits merged into
Conversation
code-review-graph reviewOverall risk: 0.40 (MEDIUM) — 17 changed function(s)/class(es), 0 affected flow(s), 4 test gap(s) (3 with no tested caller found, 1 reached only through a caller) Risk-scored changes
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.
Token savings: this graph-backed report used ~300,803 fewer tokens (~99%) than reading every changed file in full (estimated, chars/4 approximation). Powered by code-review-graph — local-first analysis; no code leaves the CI runner. |
|
This fails the checks once merged into Merged into origin/staging (clean, ort strategy). pytest (py3.13): "FAILED tests/test_multilang.py::TestElixirParsing::test_multi_clause_functions_keep_the_full_graph_range / 1 failed, 3224 passed, 9 skipped, 2 xpassed, 1 warning in 112.79s". Failure: "assert (5, 5) == (4, 5)" at tests/test_multilang.py:2769. ruff: "All checks passed!". mypy: "Success: no issues found in 72 source files". To fix:
Merge PRs now target |
|
Ok @tirth8205 I will look into it in a while |
|
You pushed Gates on Item by item:
One nit, not blocking. The two writers now disagree for non-Function kinds. 2,6 is arguably the better answer for a partial class, but it is a side effect of dropping the guard rather than a decision anyone made, and it is untested. Pick one, apply it to both writers, and pin it with a test. That can be a follow-up. Queued for merge. Removing |
|
Yeah thanks for the review @tirth8205 Just a follow up from my side Would love to connect with you if you do allow as per your time on linkedin |
|
The MIN/MAX line-range merge on the
That reaches the read path. The queued follow-up does not fix this. Second problem, in the parser. def guarded(x) when is_binary(x), do: helper(x)staging misses the Third, guard calls such as The Elixir fix itself is right. On To merge: move the clause merge into the Elixir path in the parser, where sibling clauses are known to be siblings, and leave both |
|
Thank you for this PR. I merged it with the latest staging and ran the tests. Before I can merge it, please fix these:
After you push the fix, I will test it again. |
|
Hi @tirth8205, thanks again for the detailed review. I've addressed both requested issues and added regression coverage:
The focused graph and multilingual suites pass with 559 tests. I also adjusted the impact-radius test to avoid relying on a global top-10 ranking that changes when the test corpus grows, without changing production ranking behaviour. The full suite now reports 5,051 passed, 884 skipped, 3 xfailed, 2 xpassed, and one remaining failure. The remaining failure is a Windows asyncio-policy test running under Linux/Python 3.14; it also reproduces on the PR base and staging. Native Windows behaviour has not been verified in this environment. Ruff, mypy, and The requested fixes remain intact, and I haven't changed the watcher implementation or weakened the Windows test. The patch is ready for review, subject to the normal supported-version CI validation. Thanks for your time and feedback. |
There was a problem hiding this comment.
🟡 Changes recommended
Both file-storage paths still overwrite earlier Elixir clause ranges, leaving incomplete spans for clauses with the same qualified name.
1 open issue
What changed in this PR
This PR addresses Elixir function graphing from #979 by recognizing guarded definitions and extracting calls from short-form bodies. It also adds multi-clause storage tests, though range preservation remains unimplemented.
Changes:
- Recursively unwraps
whenguards to identify function heads. - Extracts calls from short-form
do:bodies and adds Elixir regression coverage. - Adds graph range tests and adjusts the search-ranking test to query functions.
| File | Description |
|---|---|
| tests/test_multilang.py | Adds guarded-function, short-form call, and multi-clause storage tests. |
| tests/test_graph.py | Tests duplicate-range overwrites and separate nested-function ranges. |
| tests/test_e2e_real_repo.py | Filters search results to functions before checking the top ten. |
| code_review_graph/parser.py | Handles guarded heads and traverses short-form function bodies. |
| code_review_graph/graph.py | Reformats upsert assignments without changing range behavior. |
Review effort: Balanced
| line_start=excluded.line_start, | ||
| line_end=excluded.line_end, |
0160eb0
…review of tirth8205#980) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ew of tirth8205#715) The staging test pinned tirth8205#980's last-writer-wins collapse of same-name clauses. With tirth8205#585 fixed both rows stay and the first keeps the bare name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Pull Request
Linked issue
Closes #979
What & why
Fixes two Elixir function graphing issues:
deffunctions usingwhenwere silently dropped because theirfunction heads are wrapped in a
binary_operatornode. The parser nowrecursively unwraps
whenexpressions to find the actual function head.clause to overwrite the earlier clause's line range. Function/Test nodes now
preserve the minimum
line_startand maximumline_endacross clauses.Added regression coverage for guarded function calls, zero-arity functions,
and multi-clause function ranges.
How it was tested