Skip to content

fix: make Iterator polyfill cover jsdom vm contexts and spawned child processes - #7445

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
scanner/fix-iterator-polyfill-followups
Oct 18, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
scanner/fix-iterator-polyfill-followups

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Closes #7444

#7443's Node 20 Iterator polyfill left two failure modes that the prow presubmit (which never ran on #7443's scripts-only diff) exposed on #7440 (prow run 2111718441651015680: 30 failed tests, 3 jsdom test files unable to start):

  1. jsdom window contexts — jsdom 30 creates each window as a fresh vm context and installs every host JS global into it via vm.runInContext(name, window) (lib/jsdom/browser/Window.js). A fresh context on Node 20 has no Iterator, so window creation throws ReferenceError: Iterator is not defined. The polyfill now wraps vm.createContext to mirror the polyfilled Iterator into each new context.

  2. Relative --require in NODE_OPTIONS — ./scripts/node-iterator-polyfill.cjs resolves against each process's own cwd, so child node processes spawned by script tests from tmpdir cwds (check-leaderboard-regression, release-version, ci-observability reporter) died at startup with MODULE_NOT_FOUND / exit 1. The polyfill now rewrites NODE_OPTIONS to its own absolute path so inherited environments work from any cwd.

On Node >= 22 both branches are no-ops (native Iterator is kept, vm.createContext is untouched).

— hive: agent=scanner backend=copilot model=claude-fable-5 copilot=1.0.88

… processes

The polyfill from #7443 fixed the worker-global Iterator but left two
failure modes that the prow presubmit (which never ran on #7443's
scripts-only diff) exposed on the next PR (#7440):

1. jsdom >= 30 creates each window as a fresh vm context and reads every
   JS global out of it with vm.runInContext(name, window). The fresh
   context on Node 20 has no Iterator, so window creation throws
   "ReferenceError: Iterator is not defined" and every jsdom-environment
   test file fails to start. The polyfill now wraps vm.createContext to
   mirror the polyfilled Iterator into each new context.

2. NODE_OPTIONS carried a cwd-relative --require path, which each child
   node process resolves against ITS cwd. Script tests that spawn node
   with a tmpdir cwd (check-leaderboard-regression, release-version,
   ci-observability reporter — 30 failing tests) died at startup with
   MODULE_NOT_FOUND / exit 1. The polyfill now rewrites NODE_OPTIONS to
   its own absolute path so inherited environments work from any cwd.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <scanner@hive.kubestellar.io>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 18, 2026
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify

netlify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for kubestellar-docs ready!

Name Link
🔨 Latest commit c3536af
🔍 Latest deploy log https://app.netlify.com/projects/kubestellar-docs/deploys/6ad4828bd867988952605ffe
😎 Deploy Preview https://deploy-preview-7445--kubestellar-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 18, 2026
@kubestellar-prow kubestellar-prow Bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 18, 2026
@kubestellar-prow

Copy link
Copy Markdown

Hi @hivecommons-hive[bot]. Thanks for your PR.

I'm waiting for a kubestellar member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

hive/awaiting-ci: CI pending — sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-kubestellar-console-4vkt | SHA: 7305443

— hive: agent=scanner backend=copilot model=claude-fable-5 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed dco-signoff: yes Indicates the PR's author has signed the DCO. labels Oct 18, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit 380faaf into main Oct 18, 2026
13 of 15 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#7445c3536af` sha256:d2f12294e250992f443110ddbafdf9fcc33f4c0458076369fe7dad61cb8a3dd8 — download from the dashboard or `hivectl review evidence #7445`.

@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-iterator-polyfill-followups branch October 18, 2026 08:29
@hivecommons-hive hivecommons-hive Bot removed the role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) label Oct 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

Check out what's new:

Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey

@hivecommons-hive hivecommons-hive Bot removed the stage/050-review-pending Review swarm requested; awaiting a verdict for the current head label Oct 18, 2026
hivecommons-hive Bot added a commit that referenced this pull request Oct 18, 2026
#7447)

jsdom 30's Document-impl.js close() calls the ES2024 Promise.withResolvers
(native only in Node >= 22). On the Node 20 prow presubmit image every
jsdom worker teardown crashed with 'TypeError: Promise.withResolvers is
not a function' — 74 unhandled errors, exit 1 — once the Iterator
polyfill (#7445) stopped masking it. Install the polyfill on the host
realm and mirror it into jsdom's per-window vm contexts.

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off documentation Improvements or additions to documentation needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[scanner] pull-kubestellar-docs-test broken on main by #7443 Iterator polyfill (jsdom vm contexts + relative --require)

0 participants