Skip to content

fix(bash): a nested function's defines edge comes from its file (#5573) - #5577

Closed
yashsaxena wants to merge 1 commit into
Graphify-Labs:v8from
yashsaxena:bash-nested-defines
Closed

yashsaxena wants to merge 1 commit into
Graphify-Labs:v8from
yashsaxena:bash-nested-defines

Conversation

@yashsaxena

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #5573.
A function defined in another function's body got its defines edge from the outer function.
The outer function's calls edge to it shares that pair of nodes, and the graph keeps one edge per pair, so the call was lost.
The defines edge now comes from the file node, as for a top-level function: in bash the nested function belongs to the file once the outer one runs.

Type of change

  • Bug fix

Verification & Invariants

Invariant: every bash function's defines edge comes from its file node; call edges are unchanged.
The nested body is still walked with the outer function as its parent, so the calls made inside it are attributed as before (test_extract_bash_nested_function_calls_recorded still passes).

How was this tested?

I could not run the suite on my machine, so this repo's own CI workflow ran on the branch in my fork:

CI workflow (workflow_dispatch) on yashsaxena/graphify@bash-nested-defines: all jobs pass
(skillgen-check, test 3.11/3.12/3.13/3.14, pi-guard, security-scan)
test (3.12): 12062 passed, 119 skipped, 2 xfailed   (serial pass: 285 passed, 3 skipped)

Graphify-specific checklist

  • I updated generated skill artifacts: not needed, no fragments changed.
  • Extraction stays deterministic (no ENV reads).
  • Reviewed for security: no new filesystem probe.
  • No API keys or local graph data.
  • AI authorship disclosed in the commit message (Co-Authored-By: Claude).

…hify-Labs#5573)

The outer function's defines took the pair the outer's calls edge needs, and the
graph keeps one edge per pair, so the call was lost. In bash a nested function
is the file's once the outer runs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

Thanks for the pull request, @yashsaxena. A maintainer will review it soon.

Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions.

A couple of things that speed up review: make sure the test suite passes on Python 3.11 and 3.13, and that the change keeps extraction deterministic.

@graphify-labs graphify-labs Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graphify review View in Graphify

Looks safe to merge · Merge confidence 5/5

No issues reported · High impact

Nested Bash functions now get defines edges from their script file, leaving calls from their enclosing function as distinct edges.

Code graph · 621 functions depend on this change
  • 1 function became more coupled. extract_bash() (53 callers).
  • 2 of 652 test files are affected by this change.
  • Gate, test list and every flagged function: in the Graphify check.

Reviewed 3520e0a

@safishamsi

Copy link
Copy Markdown
Member

Shipped in v0.9.123, landed via authorship-preserving cherry-pick so your commits keep your name. Thanks @yashsaxena!

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.

Bash extractor: a nested function's defines edge comes from the outer function, so the outer's call to it is lost

2 participants