Skip to content

util: use Map.prototype.getOrInsert() in circular reference formatting - #67451

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
LiviaMedeiros:util-inspect-mapupsert
Nov 15, 2026
Merged

nodejs-github-bot merged 1 commit into
nodejs:mainfrom
LiviaMedeiros:util-inspect-mapupsert

Conversation

@LiviaMedeiros

Copy link
Copy Markdown
Member

Minor refactoring. Native upsert is available starting from v26.x.

Signed-off-by: LiviaMedeiros <livia@cirno.name>
@LiviaMedeiros LiviaMedeiros added dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. dont-land-on-v24.x PRs that should not land on the v24.x-staging branch and should not be released in v24.x. labels Nov 13, 2026
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module. labels Nov 13, 2026
@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff            @@
##             main   #67451    +/-   ##
========================================
  Coverage   90.71%   90.72%            
========================================
  Files         801      802     +1     
  Lines      281889   282100   +211     
  Branches    54315    54352    +37     
========================================
+ Hits       255709   255925   +216     
- Misses      16307    16312     +5     
+ Partials     9873     9863    -10     
Files with missing lines Coverage Δ
lib/internal/util/inspect.js 97.03% <100.00%> (-0.01%) ⬇️

... and 43 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.

@LiviaMedeiros LiviaMedeiros added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 13, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 13, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@LiviaMedeiros LiviaMedeiros added author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue PRs queued for automated landing through the Commit Queue. labels Nov 14, 2026

@Renegade334 Renegade334 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm fairly sure this won't work on v26.x. Even if enabled, flagged features are not present during the bootstrapping phase when primordials.js is executed, so these methods never get copied onto SafeMap.prototype.

> process.version
'v26.13.1'

> Map.prototype.getOrInsert
[Function: getOrInsert]

> const { SafeMap } = require('internal/test/binding').primordials

> SafeMap.prototype.getOrInsert
undefined

> new SafeMap().getOrInsert('key', 'value')
Uncaught TypeError: (intermediate value).getOrInsert is not a function

@Renegade334 Renegade334 removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 14, 2026
@Renegade334

Copy link
Copy Markdown
Member

(upsert was unflagged in v8/v8@d9740b5, so this should be OK to land on v27.x. I've removed from commit-queue in the meantime to allow for the comment to be seen!)

@LiviaMedeiros LiviaMedeiros added the dont-land-on-v26.x PRs that should not land on the v26.x-staging branch and should not be released in v26.x. label Nov 14, 2026
@LiviaMedeiros

Copy link
Copy Markdown
Member Author

@Renegade334 thanks for the catch! Added dont-land-on-v26.x, should be okay to not backport this.

@LiviaMedeiros LiviaMedeiros added the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 14, 2026
@nodejs-github-bot nodejs-github-bot added the lacks-second-approval Commit Queue PRs awaiting a second collaborator approval or completion of the required wait. label Nov 15, 2026
@nodejs-github-bot
nodejs-github-bot merged commit b0aa887 into nodejs:main Nov 15, 2026
99 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in b0aa887

@nodejs-github-bot nodejs-github-bot removed commit-queue PRs queued for automated landing through the Commit Queue. lacks-second-approval Commit Queue PRs awaiting a second collaborator approval or completion of the required wait. labels Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. dont-land-on-v24.x PRs that should not land on the v24.x-staging branch and should not be released in v24.x. dont-land-on-v26.x PRs that should not land on the v26.x-staging branch and should not be released in v26.x. needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants