Skip to content

fix(analyzer): collect only binding positions from parameter patterns - #1076

Merged
rng1995 merged 2 commits into
NVIDIA:mainfrom
Varshith-Kali:fix-1074-shell-execution-default-values
Nov 9, 2026
Merged

rng1995 merged 2 commits into
NVIDIA:mainfrom
Varshith-Kali:fix-1074-shell-execution-default-values

Conversation

@Varshith-Kali

Copy link
Copy Markdown
Contributor

Fixes #1074.

_has_shell_execution_call treated every identifier inside formal_parameters as an uncertain binding, including identifiers that appear only in a parameter default-value expression. A later ordinary call to the same name, such as Number(value), was then treated as a call through an unknown callable, keeping template files partially inspected with a false AE1 HIGH.

Parameter and destructuring patterns now contribute only their binding positions (left of assignment patterns, identifiers in object and array patterns, rest targets). Default-value expressions, computed keys, and property names are references and are no longer descended into. The same walk also covered destructuring defaults in variable declarations, assignment targets, and arrow parameters, so those get the same fix. Member and subscript assignment targets keep the previous conservative walk.

Still fail-closed: calling a genuinely uncertain parameter (including cb = getHandler() and destructured {handler = ...}) with a template stays partial, and a shell call sitting in a default value still marks the file.

Tests: 16 new tests in tests/nodes/analyzers/test_javascript_template_ownership.py, including both issue reproducers, the plain-parameter controls, destructuring and arrow defaults, a class-method default, and the fail-closed forms. Targeted file 428 passed; analyzer suite 11984 passed, 4 skipped, 5 deselected, 4 xfailed. Ruff check and format clean; mypy shows only the 69 pre-existing errors in the touched file.

…NVIDIA#1074)

Fixes NVIDIA#1074: _has_shell_execution_call treated every identifier inside formal_parameters as an uncertain binding, including identifiers that appear only in a parameter default-value expression. A later ordinary call to the same name, such as Number(value), was then treated as a call through an unknown callable, keeping template files partially inspected with a false AE1 HIGH.

Parameter and destructuring patterns now contribute only their binding positions (left of assignment patterns, identifiers in object and array patterns, rest targets). Default-value expressions, computed keys, and property names are references and are no longer descended into. The same walk also covered destructuring defaults in variable declarations, assignment targets, and arrow parameters, so those get the same fix. Member and subscript assignment targets keep the previous conservative walk.

Signed-off-by: Varshith Puli <[email protected]>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[SkillSpector Review]
Approve at 09602d8fc61b43515c7739c9c1504f4d788280d2.

Value and readiness: This fixes #1074 by collecting actual binding positions rather than references inside parameter/default expressions. The walk follows assignment left sides, pair values, rest targets and nested object/array patterns. The independent program-node scan still inspects default expressions, and actual parameter bindings remain uncertain. Added tests cover the two issue reproducers, destructuring, arrow/class methods, rest parameters, and genuine uncertain callbacks/shell surfaces; the ledger control verifies completed inspection. Ready from this review.

Material findings: None.

PIC tradeoffs: None.

Verification and gaps: Reviewed the complete two-file diff, surrounding exact-head ownership/alias/callable logic and parser contract, added tests, #1074 and its discussion, and cutoff PR review/comment/thread history (empty). Hosted CI run 42603232297 is attributed to this exact head; test-unit reports 20,997 passed, 24 skipped, 258 deselected and 4 xfailed, including the JavaScript ownership module. The six reported CI checks succeeded. This was a static review; no contributor code, tests, imports, builds or setup were executed locally. Author-reported local results were not independently reproduced.

@rng1995
rng1995 merged commit 346af34 into NVIDIA:main Nov 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants