Skip to content

Conversation

addaleax
Copy link
Member

@addaleax addaleax commented Sep 5, 2025

A number of recent changes to the REPL tab completion logic have introduced the ability for completion to cause side effects, specifically, calling arbitrary functions or variable assignments/updates.

This was first introduced in 0722023 and the problem exacerbated in 8ba66c5. Our team noticed this because our tests started failing when attempting to update to Node.js 20.19.5.

Some recent commits, such as 1093f38 or 6945337, have messages or PR descriptions that imply the intention to avoid side effects, which I can can generally be agreed upon is in line with the expectations that a user has of autocomplete functionality.
However, some of the tests introduced in those commts specifically verify that side effects can happen under specific circunmstances. I am assuming here that this is unintentional, and the corresponding tests have been removed/replaced in this commit.

Fixes: #58903
Fixes: #59731
Refs: #58709
Refs: #58775
Refs: #57909
Refs: #58891

@addaleax addaleax added the repl Issues and PRs related to the REPL subsystem. label Sep 5, 2025
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Sep 5, 2025
@addaleax addaleax force-pushed the repl-fix-side-effects-in-completion branch 2 times, most recently from a916498 to e518d76 Compare September 5, 2025 17:52
Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for looking into it!

This should also supersede and close #58943, if I am not mistaken.

@addaleax addaleax force-pushed the repl-fix-side-effects-in-completion branch from e518d76 to 5eae957 Compare September 5, 2025 18:12
@addaleax
Copy link
Member Author

addaleax commented Sep 5, 2025

This should also supersede and close #58943, if I am not mistaken.

@BridgeAR I'm honestly not sure, #58943 is quite a large PR and it's honestly not immediately obvious to me what its full set of consequences are. I've added a Fixes: tag for #58903 though, it definitely should address that one.

Copy link

codecov bot commented Sep 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.92%. Comparing base (57bc177) to head (7e9f266).
⚠️ Report is 28 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #59774      +/-   ##
==========================================
- Coverage   89.94%   89.92%   -0.03%     
==========================================
  Files         667      669       +2     
  Lines      197207   197547     +340     
  Branches    38521    38594      +73     
==========================================
+ Hits       177378   177636     +258     
- Misses      12253    12302      +49     
- Partials     7576     7609      +33     
Files with missing lines Coverage Δ
lib/repl.js 94.27% <100.00%> (-0.02%) ⬇️

... and 51 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@addaleax addaleax added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Sep 7, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 7, 2025
@nodejs-github-bot
Copy link
Collaborator

@jasnell
Copy link
Member

jasnell commented Sep 7, 2025

#59731 and #59798 are fixed by this also.

Copy link
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

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

Looks good to me 😄

(besides the test file header that I think should be removed 🙂)

A number of recent changes to the REPL tab completion logic have
introduced the ability for completion to cause side effects,
specifically, calling arbitrary functions or variable
assignments/updates.

This was first introduced in 0722023 and the problem exacerbated in
8ba66c5. Our team noticed this because our tests started failing
when attempting to update to Node.js 20.19.5.

Some recent commits, such as 1093f38 or 6945337, have
messages or PR descriptions that imply the intention to avoid side
effects, which I can can generally be agreed upon is in line with the
expectations that a user has of autocomplete functionality.
However, some of the tests introduced in those commts specifically
verify that side effects *can* happen under specific circunmstances.
I am assuming here that this is unintentional, and the corresponding
tests have been removed/replaced in this commit.

Fixes: nodejs#59731
Fixes: nodejs#58903
Refs: nodejs#58709
Refs: nodejs#58775
Refs: nodejs#57909
Refs: nodejs#58891
@addaleax addaleax force-pushed the repl-fix-side-effects-in-completion branch from 5eae957 to 7e9f266 Compare September 7, 2025 23:41
@addaleax
Copy link
Member Author

addaleax commented Sep 7, 2025

#59731 and #59798 are fixed by this also.

Looks like #59798 has been resolved independently on main before (and it doesn't seem to be about tab completion), so I've only added a Fixes: tag for #59731

@addaleax addaleax requested a review from jasnell September 7, 2025 23:42
@targos targos added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 8, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 8, 2025
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@addaleax addaleax added the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 8, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 8, 2025
@nodejs-github-bot nodejs-github-bot merged commit 6cf64af into nodejs:main Sep 8, 2025
60 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 6cf64af

targos pushed a commit that referenced this pull request Sep 9, 2025
A number of recent changes to the REPL tab completion logic have
introduced the ability for completion to cause side effects,
specifically, calling arbitrary functions or variable
assignments/updates.

This was first introduced in 0722023 and the problem exacerbated in
8ba66c5. Our team noticed this because our tests started failing
when attempting to update to Node.js 20.19.5.

Some recent commits, such as 1093f38 or 6945337, have
messages or PR descriptions that imply the intention to avoid side
effects, which I can can generally be agreed upon is in line with the
expectations that a user has of autocomplete functionality.
However, some of the tests introduced in those commts specifically
verify that side effects *can* happen under specific circunmstances.
I am assuming here that this is unintentional, and the corresponding
tests have been removed/replaced in this commit.

Fixes: #59731
Fixes: #58903
Refs: #58709
Refs: #58775
Refs: #57909
Refs: #58891
PR-URL: #59774
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Dario Piotrowicz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fetch('/') in the Repl causing infinite errors Promise.reject() hint cause endless loop
6 participants