Skip to content

fix(javascript): retain iterator prototype effects through array spreads - #12563

Merged
morluto merged 4 commits into
mainfrom
audit/ambient-array-spread-origins
Nov 19, 2026
Merged

morluto merged 4 commits into
mainfrom
audit/ambient-array-spread-origins

Conversation

@morluto

@morluto morluto commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Problem

Follow-up to #12558 and #7716. A reflected prototype stored through an array spread could hide writes from the ambient effect pass and leave an incorrect exact dependency. Value evaluation, property references, getter receivers, and read presence also calculated spread positions separately.

Change

Retain possible native prototype effects before iteration is proved, including inherited iterator-close effects. Preserve ordinary ambient identity resolution for CommonJS aliases. Use one bounded layout for dense inline spreads, including receiver selection at copy time. Keep uncertainty for borrowed iterators whose behavior cannot be proved, and report budget exhaustion through the existing recovery contract.

The dense-spread refactor was reviewed separately in #12564 and squash-merged into this branch.

Validation

  • All 7,035 JavaScript source tests, the compiled CLI destructuring regression, and check:fast passed on d86f8bbad7.
  • Ten ambient-effect regressions failed on main. Additional review controls covered inherited iterator-close effects, opaque global calls, getter writes, budget reporting, and an ordinary object reached through a spread.
  • Validation used static source analysis of authored inputs.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T23:21:38.044340Z d86f8bb New commits
ℹ️ 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.

@greptile-apps

greptile-apps Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The reviewed changes appear safe to merge.

Summary

The PR retains possible iterator prototype effects through array spreads and shares one bounded layout across array consumers.

  • Array spreads keep iterator changes visible to dependency analysis.
  • Dense inline spreads keep the same slot positions across analysis.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Array spread] --> B[Shared bounded layout]
  B --> C[Known inline slots]
  B --> D[Unknown spread]
  C --> E[Values and property references]
  C --> F[Getter receivers and read presence]
  D --> G[Retain possible prototype effects]
  G --> H[Keep affected iteration uncertain]
Loading

Reviews (6) · Last reviewed commit: "fix(javascript): preserve spread slot pr..." · Reviewed by Greptile

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5d42ac1780

ℹ️ 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".

* fix(javascript): share dense inline array spread layout

* fix(javascript): report exhausted dense spread layout allowance

* fix(javascript): preserve getter receivers through array spread

* fix(javascript): guard native array iteration from opaque global code

* test(javascript): group spread receiver controls

* test(javascript): preserve getter fixture tuple types
@morluto
morluto enabled auto-merge (squash) November 19, 2026 23:23
@morluto
morluto merged commit 7cb3f10 into main Nov 19, 2026
40 of 41 checks passed
@morluto
morluto deleted the audit/ambient-array-spread-origins branch November 19, 2026 23:27
@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.

1 participant