Repository navigation
fix(bash): a $(fn) in an argument or a test is a call (#5561) - #5569
yashsaxena wants to merge 1 commit into
Conversation
…5561) Only a $(fn) in a statement's command-name position stays suppressed (Graphify-Labs#2141); x=$(fn) (Graphify-Labs#2978), echo "$(fn)" and [ "$(fn)" = x ] now emit calls. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
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. |
There was a problem hiding this comment.
Graphify review 
1 possible issue to check · High impact
Bash call extraction now records calls found in command substitutions used in arguments and tests, while continuing to suppress command-name substitutions and process substitutions.
1 possible issue we couldn't confirm
- Calls nested inside a
$(...)that is a command name are dropped, even when they run ·graphify/extractors/bash.py:278
They don't change the score.
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 f38c9bf
|
Shipped in v0.9.123, landed via authorship-preserving cherry-pick so your commits keep your name. Thanks @yashsaxena! |
What does this PR do?
Fixes #5561.
A function run inside
$( )got acallsedge only when the substitution was an assignment's value (x=$(fn), #2978)._bash_call_in_command_allowednow suppresses a$(fn)only where #2141 needed it: as a statement's command name ($(build)alone on a line).Anywhere else,
$(fn)runs fn, soecho "at $(fn)",--arg t "$(fn)"and[ "$(fn)" = x ]get a call edge.Process substitution stays suppressed, unchanged.
Type of change
Verification & Invariants
Invariant (#2141): a
$(fn)whose output bash would run as a command is not a call to fn by the outer statement;test_extract_bash_rejects_command_substitution_as_callandtest_extract_bash_process_substitution_not_recordedstill pass unchanged.Invariant (#2978):
x=$(fn)is a call; its test still passes.$(fn)in an argument or a test gets no call edge (onlyx=$(fn)does, #2978) #5561, on graphifyy 0.9.122 from PyPI).test_extract_bash_command_substitution_in_argument_or_test_emits_callfails without the fix (nocallsedge for any of its four callers).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:
Graphify-specific checklist