Skip to content

util: fix util.getCallSites plurality#55626

Merged
nodejs-github-bot merged 3 commits into
nodejs:mainfrom
legendecas:util/call-sites
Nov 2, 2024
Merged

util: fix util.getCallSites plurality#55626
nodejs-github-bot merged 3 commits into
nodejs:mainfrom
legendecas:util/call-sites

Conversation

@legendecas

@legendecas legendecas commented Oct 31, 2024

Copy link
Copy Markdown
Member

util.getCallSite returns an array of call site objects. Rename the
function to reflect that it returns a given count of frames captured
as an array of call site object.

Renames the first parameter frames to be frameCount to indicate
that it specifies the count of returned call sites.

Given that this function is marked as "active development", I believe it is better to rename it early.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/performance

@legendecas legendecas requested a review from RafaelGSS October 31, 2024 14:23
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module. labels Oct 31, 2024

@RafaelGSS RafaelGSS 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.

What about using a safe approach and keep a getCallSite function emitting a warning to inform users to use getCallSites instead? We can land it as semver-minor and then in the next release we remove the getCallSite completely

`util.getCallSite` returns an array of call site objects. Rename the
function to reflect that it returns a given count of frames captured
as an array of call site object.

Renames the first parameter `frames` to be `frameCount` to indicate
that it specifies the count of returned call sites.
@codecov

codecov Bot commented Oct 31, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.43%. Comparing base (4379dfb) to head (b36edf2).
Report is 61 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #55626      +/-   ##
==========================================
- Coverage   88.43%   88.43%   -0.01%     
==========================================
  Files         654      654              
  Lines      187718   187725       +7     
  Branches    36129    36140      +11     
==========================================
+ Hits       166010   166012       +2     
+ Misses      14948    14942       -6     
- Partials     6760     6771      +11     
Files with missing lines Coverage Δ
lib/util.js 97.32% <100.00%> (+0.03%) ⬆️
src/node_util.cc 85.76% <100.00%> (ø)

... and 28 files with indirect coverage changes

@RafaelGSS RafaelGSS added the deprecations Issues and PRs related to deprecations. label Oct 31, 2024
Comment thread doc/api/deprecations.md
Comment on lines +3764 to +3775
### DEP0186: `util.getCallSite`

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/55626
description: Runtime deprecation.
-->

Type: Runtime

The `util.getCallSite` API has been removed. Please use [`util.getCallSites()`][] instead.

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.

Doesn't this have to be doc deprecated first?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is an API in active development status, not stable yet. I don't think it is necessary to document deprecated.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should not deprecate experimental APIs, deprecation is for stable features we want to phase out.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There were deprecation for experimental APIs like https://github.com/nodejs/node/blob/main/doc/api/deprecations.md#dep0173-the-assertcalltracker-class.

I was hesistant about adding a deprecation code for this. But all our toolings like expectWarning expects a deprecation code.

@avivkeller avivkeller added semver-minor PRs that contain new features and should be released in the next minor version. notable-change PRs with changes that should be highlighted in changelogs. labels Oct 31, 2024
@github-actions

Copy link
Copy Markdown
Contributor

The notable-change PRs with changes that should be highlighted in changelogs. label has been added by @redyetidev.

Please suggest a text for the release notes if you'd like to include a more detailed summary, then proceed to update the PR description with the text or a link to the notable change suggested text comment. Otherwise, the commit will be placed in the Other Notable Changes section.

Comment thread lib/util.js Outdated
Co-authored-by: Aviv Keller <redyetidev@gmail.com>
@legendecas legendecas added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 1, 2024
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 1, 2024
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@marco-ippolito marco-ippolito added the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 2, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 2, 2024
@nodejs-github-bot nodejs-github-bot merged commit 68dc15e into nodejs:main Nov 2, 2024
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 68dc15e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. experimental Issues and PRs related to experimental features. needs-ci PRs that need a full CI run. semver-minor PRs that contain new features and should be released in the next minor version. util Issues and PRs related to the built-in util module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants