Repository navigation
fix(elixir): capture calls made from single-line def …, do: bodies - #2970
rajatnagda45 wants to merge 1 commit into
Conversation
…calls are captured The extractor only registered a function body for call-walking when the `def` had a `do_block` child. The one-line keyword form -- `def f(x), do: g(x)`, which is idiomatic and pervasive in Elixir -- stores its body as a `do:` pair inside the call's `arguments` (`keywords` -> `pair` -> `keyword` "do:" + value), so every call made from a one-line function was silently dropped from the graph. Register the `do:` keyword value for the call pass when no `do_block` is present. The multi-line `do..end` form is unchanged. Adds a regression test asserting the one-line caller emits its `calls` edge while the do..end form keeps working.
There was a problem hiding this comment.
Graphify reviewed this change.
Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.
Formal verification. No changes could be formally verified in this run.
Graphify review — findings
Adds _keyword_do_body to the Elixir extractor so single-line def f(x), do: expr functions have their body walked for call edges, not just do_block forms. Covers it with test_elixir_single_line_do_body_emits_calls, asserting the one-liner and do..end forms both emit calls.
Worth a look
- Keyword do bodies are not handled for single-line defmodule forms —
graphify/extractors/elixir.py· Escalate · medium- agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 523 functions depend on the 523 functions this change touches.
Health — this change adds coupling hotspots:
- new:
extract_elixir()— 11 callers, 5 callees - new:
walk()— 1 callers, 6 callees
Verification — 523 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 523 function(s) in the blast radius were not formally verified this run
Formal verification
Could not verify: Could not verify extract\_elixir.
The verifier did not have enough to check extract\_elixir, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `path` is annotated `Path` — outside the synthesizable primitive/collection set
· 1 grounded finding(s) anchored inline below; 1 more finding(s) on lines outside this diff (see the check run).
| return value | ||
| return None | ||
|
|
||
| def walk(node, parent_module_nid: str | None = None) -> None: |
There was a problem hiding this comment.
walk()
fans out to 6 callees (efferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
What
Calls made from Elixir's single-line keyword function form are silently dropped from the graph.
def f(x), do: g(x)— the idiomatic one-liner — stores its body as ado:pair inside the call'sarguments(keywords → pair → keyword "do:" + value), not as ado_block. The extractor only registered a body for the call pass when it found ado_blockchild, so every call issued from a one-line function was never walked.This form is pervasive in real Elixir (short delegating functions,
defphelpers, guards), so a large slice of the intra-module call graph goes missing.Reproduce
Before this change only
block_caller → addwas emitted;line_caller → addwas missing.Fix
When a
def/defphas nodo_block, look for thedo:keyword pair in itsargumentsand register that value node for the existing call-walking pass. The multi-linedo..endpath is untouched.Tests
Adds
test_elixir_single_line_do_body_emits_calls, asserting the one-line caller now emits itscallsedge while thedo..endform keeps working. Full suite green locally (4822 passed, 0 failed).