Skip to content

fix(javascript): resolve literal spreads and const aliases in kill signals - #10678

Merged
N0zoM1z0 merged 2 commits into
morluto:mainfrom
Davmunrey:claude/kill-signal-spreads
Nov 21, 2026
Merged

N0zoM1z0 merged 2 commits into
morluto:mainfrom
Davmunrey:claude/kill-signal-spreads

Conversation

@Davmunrey

Copy link
Copy Markdown
Contributor

Summary

Supersedes #2830 by @ahmed0magdy. That PR has been inactive since 2026-10-26, is about 4,500 commits behind main and never had its readiness declaration filled. Its fix commit is cherry-picked unchanged with @ahmed0magdy as the author; it applied to current main without conflicts. If @ahmed0magdy reopens or updates #2830, close this one.

The kill() signal fact on child-process interactions read only the first syntactic argument. Two common spellings therefore stayed unknown:

  • child.kill(...[]) and child.kill(...["SIGINT"]): a spread of an array literal, which Node receives as no argument (SIGTERM) or "SIGINT";
  • const signal = undefined; child.kill(signal) and const named = "SIGKILL"; child.kill(named): immutable const aliases.

Change and scope

src/domain/javascript/javascriptSemanticChildProcesses.ts:

  • expands array-literal spreads to find the first runtime argument; an array hole passes undefined;
  • follows a const alias only when its single write is one unconditional initializer (!mutable plus semanticStableInitializer, the rule other producers use);
  • leaves let, var, reassigned, shadowed and non-literal spreads unknown.

Evidence and regression coverage

  • javascriptSemanticAnalysis.native_bindings.test.ts adds one case with 9 calls covering expanded spreads, unexpanded spreads, const aliases, let, reassignment and a shadowed undefined.
    • On main it fails: all 9 signals are null.
    • With the fix it passes: SIGTERM, SIGINT, unknown, unknown, SIGTERM, SIGKILL, unknown, unknown, unknown.

Validation performed

  • npm run test:local over the child-process and javascriptSemanticAnalysis.* tests: 56 files, 1,954 tests passed.
  • npm run check:fast passed.

Author readiness

Human owner: @Davmunrey

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

…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]>
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-14T22:15:39.791221Z
We couldn’t complete this review. Comment @codex review to try again.
212cd68 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the requested test coverage is now present.

Summary

Resolves child-process kill signals through literal array spreads and immutable aliases.

  • Child-process analysis resolves signals passed through literal spreads and immutable aliases.

Reviews (2) · Last reviewed commit: "test(javascript): cover array holes, nes..." · Reviewed by Greptile

…ad before an argument in kill signals

Review follow-up: firstRuntimeArgument has separate paths for an array hole, a nested array spread and an empty spread followed by another argument. child.kill(...[, "SIGINT"]) sends SIGTERM, child.kill(...[...["SIGINT"]]) sends SIGINT and child.kill(...[], "SIGKILL") sends SIGKILL; the case now pins all three.
@Davmunrey

Copy link
Copy Markdown
Contributor Author

Ready to merge: full CI is green on this head, Greptile's latest review is 5/5 with no open threads, and it merges into main 42cab26 without conflicts.

@gensokyo-dev gensokyo-dev 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.

Verified: the new kill-signal cases fail on main and pass here. Spreads of array literals, holes, void and the unshadowed undefined resolve to SIGTERM, and const aliases resolve only through single unconditional initializers; anything else stays unknown. Thanks, and thanks to the original author of #2830.

@N0zoM1z0
N0zoM1z0 merged commit 909d470 into morluto:main Nov 21, 2026
38 checks passed
@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants