Repository navigation
fix(javascript): resolve spread and constant kill-signal arguments - #2830
ahmed0magdy wants to merge 5 commits into
Conversation
cb1a936 to
43c67f7
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 43c67f75d2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8e5653839
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Source fixes and publication evidence for the review findings below. Tests and executable checks were skipped at the maintainer's request. Findings that still require a decision or execution evidence remain open. The argument classifier inspected the raw AST node and missed transparent TS/Flow wrappers around |
|
Source fixes and publication evidence for the review findings below. Tests and executable checks were skipped at the maintainer's request. Findings that still require a decision or execution evidence remain open. The kill-signal producer recognized omitted arguments and unshadowed |
8006d9d to
be69cf6
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: be69cf6c06
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
kill() substituted SIGTERM whenever the signal argument was not a string literal, so a parameter or other unresolved value became a definite SIGTERM fact. Only an omitted argument or the unshadowed global undefined selects Node's SIGTERM default; any other unresolved argument now leaves signalName null. Fixes morluto#2572 Co-Authored-By: Claude Opus 5.5 <[email protected]>
be69cf6 to
4c51319
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c513190fd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Track module writes and escapes at their owner, preserve capture and reassignment ordering, and share CommonJS/default namespace identity without erasing parent-slot changes. Carry write sites into ambient alias resolution and use parsed write targets across consumers. Deduplicate returned-reference work with cycle context; retain unchanged temporal selection identity so provenance memoization stays effective. Reviewed fixes include #2041, #2465, #2830, #2881, and #2948. Remove superseded mutation representations and the ineffective per-markValue dedup layer. Validation: 380 focused JavaScript tests passed under a 384 MiB heap cap, including the previously aborting 30-level/128-call alias regression. Six public CLI/MCP builtin tests passed. Exact pdf.js completed-workflow performance remains unmeasured.
…-call-facts # Conflicts: # src/domain/javascript/javascriptSemanticAnalysis.native_bindings.test.ts
…gnals Address review feedback on the kill() signal fact: - Drop the semanticResolutionBlocked import, which isUnshadowedGlobal superseded. - Expand spreads of array literals before selecting the signal, so kill(...[]) reports Node's SIGTERM default and kill(...["SIGINT"]) reports SIGINT. A spread of anything else stays unknown. - Follow const aliases whose only write is one unconditional initializer (the same !mutable + semanticStableInitializer rule other producers use), so `const signal = undefined; kill(signal)` reports SIGTERM. let, var, reassigned, and shadowed bindings stay unknown. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
TL;DR: The one new test in this PR passes on Node 22, 24 and 26. The same test fails on the PR's base and on current main, so it catches the bug and the fix works. Thanks, ahmed0magdy, for the fix. I tested head 05429ce. Its merge base is 7375ab6, and main was at 40f73f6 (#3735). ResultsI ran the PR's own native-bindings test file. It holds 11 tests. One is new, the spread and alias test.
Not run
Commandsgit -C ~/code/rea-mirror/rea.git fetch origin
git -C ~/code/rea-mirror/rea.git archive 05429ce9c5054eae549dbe41058611d17a1907b0 | tar -x -C /tmp/fresh-1015/2830-head
npm ci && npm run build && npm run test:prepare # Node 24.18.0, all exit 0
node scripts/run-development-tests.mjs focused \
src/domain/javascript/javascriptSemanticAnalysis.native_bindings.test.ts
# new test: expands literal spreads and follows only immutable signal aliases
# head: exit 0 on Node 22, 24 and 26
# base source swapped in: exit 1 (1 failed, 10 passed)
# fresh main tree (40f73f62b) plus the PR test file: exit 1 (1 failed, 10 passed)Test setup🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
|
Thanks for separating the follow-up. Main now handles omitted arguments, unshadowed |
|
Thanks for the analysis fixes. Closing as superseded by #10678, which carries the remaining literal-spread and const-alias handling forward against current main. The earlier changes from this branch are already on main. |
Summary
Follow-up to #2571 and #2572. The original fixes from this PR landed on main in 04672f2 ("Reviewed fixes include … #2830 …"), and both issues are closed. After merging main back into the branch, this PR now carries only the fixes for the three review findings raised on it, in commit 05429ce.
Problem and expected behavior
killSignalNamereportednull(unknown) for two argument forms where Node's behavior is fully determined by the source:child.kill(...[]): a spread of an empty array literal passes no runtime argument, so Node applies its SIGTERM default. Before, the first raw Babel argument was aSpreadElement, which producednull.const signal = undefined; child.kill(signal): an immutable alias toundefinedalso gets the SIGTERM default. Before,signalwas neither the globalundefinedspelling nor a literal, which producednull.Change and scope
All changes are in
src/domain/javascript/javascriptSemanticChildProcesses.ts:firstRuntimeArgument: walks the call arguments and expands spreads of array literals, including nested ones, to find the first argument Node actually receives....[]gives SIGTERM,...["SIGINT"]gives SIGINT, and an array hole (...[,]) gives SIGTERM.constarray variable) staysnull.immutableAliasValue: follows an identifier to its initializer only when the binding is notmutable,semanticStableInitializergives a single unconditional initializer, and there is no destructuring projection. It follows alias chains with a cycle guard.javascriptSemanticPromises.ts).mutableis false only forconst.const s = undefinedgives SIGTERM, andconst a = "SIGKILL"; const b = agives SIGKILL.let,var, reassigned bindings, and an alias of a shadowedundefinedall staynull.semanticResolutionBlockedimport is removed. The merge had brought it back on this branch.Contribution scope: an ordinary fix within existing boundaries, so a maintainer scope decision is not applicable.
Contract and boundary impact
src/domain/javascript/javascriptSemanticChildProcesses.ts(domain semantic IR construction)signalNameisstring | null)Expected effects:
Evidence and regression coverage
child-process signalsblock ofsrc/domain/javascript/javascriptSemanticAnalysis.native_bindings.test.ts....[],...["SIGINT"], aconstundefined alias, and aconststring alias chain.null: a spread parameter, a spreadconstarray variable,let, a reassignedlet, and a shadowedundefined.kill(9)) still reportnull. That is intentional: the source doesn't establish the value.Validation performed
Run with Node 24.18.0 after
npm ci:npm run test:local --on all JavaScript domain and application tests: 77 files, 1,851 tests passed.npm run check:fast: passed.docs:check: not run, because no contract or generated metadata changed.Compatibility, safety, and release
AI assistance: written with Claude Code; the commits carry a
Co-authored-bytrailer.