GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [v18.x-backport] Backport feature flags and nogc types 2 by gabrielschulhof · Pull Request #51804 · nodejs/node

Conversation

@gabrielschulhof

@gabrielschulhof gabrielschulhof commented Feb 19, 2024

Copy link
Copy Markdown
Contributor

This backports the following PRs:

#50060
#50991
#50664

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodejs-github-bot

nodejs-github-bot commented Feb 19, 2024 •
edited by gabrielschulhof
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/node-api
  • @nodejs/tsc
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. v18.x labels Feb 19, 2024
@gabrielschulhof
gabrielschulhof force-pushed the backport-feature-flags-and-nogc-types-2 branch from 263deaa to 65a8966 Compare February 19, 2024 07:39
@gabrielschulhof gabrielschulhof added the node-api Issues and PRs related to Node-API. label Feb 19, 2024
@gabrielschulhof
gabrielschulhof requested review from legendecas, mhdawson and vmoroz February 19, 2024 07:39
@gabrielschulhof gabrielschulhof mentioned this pull request Feb 19, 2024
Release plan - v18.x Maintenance LTS nodejs/Release#737
Closed
@nodejs-github-bot

nodejs-github-bot commented Feb 19, 2024

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/57179/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gabrielschulhof
gabrielschulhof force-pushed the backport-feature-flags-and-nogc-types-2 branch from 65a8966 to 5bf1523 Compare February 19, 2024 18:17
gabrielschulhof
gabrielschulhof commented Feb 19, 2024
View reviewed changes
Comment thread doc/contributing/releases-node-api.md Outdated

@gabrielschulhof gabrielschulhof Feb 19, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This was the only conflict. On main we had moved to ```bash, so the context of the hunk was different.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodejs-github-bot

nodejs-github-bot commented Feb 21, 2024

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/57244/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mhdawson
mhdawson approved these changes Feb 29, 2024
View reviewed changes

@mhdawson mhdawson left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gabrielschulhof added 3 commits February 29, 2024 21:49
@gabrielschulhof
node-api: introduce experimental feature flags
86e3bb0
Add a flag for each experimental feature to indicate its presence.
That way, if we compile with `NAPI_EXPERIMENTAL` turned on, we'll be
able to distinguish between what `NAPI_EXPERIMENTAL` used to mean on an
old version of the headers when compiling against such an old version,
and what it means on a new version of Node.js.

PR-URL: nodejs#50991
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Vladimir Morozov <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Backport-PR-URL: nodejs#51804
(cherry picked from commit 727dd28)
@gabrielschulhof
node-api: factor out common code into macros
ebbfcfa
    * Create macro for checking new string arguments.
    * Create macro for combining env check and inside-gc check.

PR-URL: nodejs#50664
Reviewed-By: Vladimir Morozov <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Backport-PR-URL: nodejs#51804
(cherry picked from commit 5e250bd)
@gabrielschulhof
node-api: segregate nogc APIs from rest via type system
344099d
We define a new type called `node_api_nogc_env` as the `const` version
of `napi_env` and `node_api_nogc_finalize` as a variant of
`napi_finalize` that accepts a `node_api_nogc_env` as its first
argument.

We then modify those APIs which do not affect GC state as accepting a
`node_api_nogc_env`. APIs accepting finalizer callbacks are modified to
accept `node_api_nogc_finalize` callbacks. Thus, the only way to attach
a `napi_finalize` callback, wherein Node-APIs affecting GC state may be
called is to call `node_api_post_finalizer` from a
`node_api_nogc_finalize` callback.

In keeping with the process of introducing new Node-APIs, this feature
is guarded by `NAPI_EXPERIMENTAL`. Since this feature modifies APIs
already marked as stable, it is additionally guared by
`NODE_API_EXPERIMENTAL_NOGC_ENV`, so as to provide a further buffer to
adoption. Nevertheless, both guards must be removed upon releasing a
new version of Node-API.

PR-URL: nodejs#50060
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: Vladimir Morozov <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Backport-PR-URL: nodejs#51804
(cherry picked from commit 7a216d5)
@gabrielschulhof
gabrielschulhof force-pushed the backport-feature-flags-and-nogc-types-2 branch from 5bf1523 to 344099d Compare March 1, 2024 05:50
@richardlau richardlau 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 Mar 1, 2024
@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 Mar 1, 2024
@nodejs-github-bot

nodejs-github-bot commented Mar 1, 2024

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/57529/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Mar 7, 2024

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/57618/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gabrielschulhof gabrielschulhof added commit-queue PRs queued for automated landing through the Commit Queue. and removed needs-ci PRs that need a full CI run. labels Mar 8, 2024
@gabrielschulhof

gabrielschulhof commented Mar 8, 2024

Copy link
Copy Markdown
Contributor Author

@mhdawson can you please give the PR another look?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mhdawson
mhdawson approved these changes Mar 8, 2024
View reviewed changes

@mhdawson mhdawson left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Still LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gabrielschulhof

gabrielschulhof commented Mar 9, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Hmmm ... it looks like the commit queue doesn't work with this branch, and

remote: error: GH006: Protected branch update failed for refs/heads/v18.x-staging.
remote: error: You're not authorized to push to this branch. Visit https://docs.github.com/articles/about-protected-branches/ for more information.

if I try to use git node land.

@mhdawson, can you land this PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95 aduh95 added author ready PRs with CI started, the required approvals, and no outstanding review comments. needs-ci PRs that need a full CI run. and removed commit-queue PRs queued for automated landing through the Commit Queue. labels Mar 9, 2024
@aduh95

aduh95 commented Mar 9, 2024

Copy link
Copy Markdown
Contributor

node/doc/contributing/collaborator-guide.md

Lines 801 to 802 in b1468d2

Only members of @nodejs/backporters should land commits onto LTS staging
branches.

gabrielschulhof reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@KevinEady

KevinEady commented Mar 11, 2024

Copy link
Copy Markdown
Contributor

Hi @gabrielschulhof ,

Should #51801 also be included in this backport? It looks like napi_create_threadsafe_function still uses node_api_nogc_finalize nogc_thread_finalize_cb instead of napi_finalize.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gabrielschulhof

gabrielschulhof commented Mar 11, 2024

Copy link
Copy Markdown
Contributor Author

@KevinEady yes, please also include #51801!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@richardlau

richardlau commented Mar 15, 2024

Copy link
Copy Markdown
Member

Should #51801 also be included in this backport? It looks like napi_create_threadsafe_function still uses node_api_nogc_finalize nogc_thread_finalize_cb instead of napi_finalize.

@KevinEady yes, please also include #51801!

Is this waiting on #51801 to be including in this backport PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhdawson

mhdawson commented Mar 18, 2024

Copy link
Copy Markdown
Member

@gabrielschulhof can you answer @richardlau 's question?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@richardlau

richardlau commented Mar 20, 2024

Copy link
Copy Markdown
Member

#51801 hasn't gone out in a current release yet, so is technically not eligible to land on LTS.

Does it make more sense to delay this PR so that it can land together with #51801, or should we land this PR first on v18.x without #51801?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gabrielschulhof

gabrielschulhof commented Mar 22, 2024

Copy link
Copy Markdown
Contributor Author

@richardlau this PR can land on v18.x on its own. The subsequent PR can land after that. It is an improvement over this PR, but PR does provide value on its own.

richardlau reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

richardlau pushed a commit that referenced this pull request Mar 22, 2024
@gabrielschulhof @richardlau
node-api: introduce experimental feature flags
3d0b233
Add a flag for each experimental feature to indicate its presence.
That way, if we compile with `NAPI_EXPERIMENTAL` turned on, we'll be
able to distinguish between what `NAPI_EXPERIMENTAL` used to mean on an
old version of the headers when compiling against such an old version,
and what it means on a new version of Node.js.

PR-URL: #50991
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Vladimir Morozov <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Backport-PR-URL: #51804
(cherry picked from commit 727dd28)
richardlau pushed a commit that referenced this pull request Mar 22, 2024
@gabrielschulhof @richardlau
node-api: factor out common code into macros
1aa71c2
    * Create macro for checking new string arguments.
    * Create macro for combining env check and inside-gc check.

PR-URL: #50664
Reviewed-By: Vladimir Morozov <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Backport-PR-URL: #51804
(cherry picked from commit 5e250bd)
richardlau pushed a commit that referenced this pull request Mar 22, 2024
@gabrielschulhof @richardlau
node-api: segregate nogc APIs from rest via type system
32906dd
We define a new type called `node_api_nogc_env` as the `const` version
of `napi_env` and `node_api_nogc_finalize` as a variant of
`napi_finalize` that accepts a `node_api_nogc_env` as its first
argument.

We then modify those APIs which do not affect GC state as accepting a
`node_api_nogc_env`. APIs accepting finalizer callbacks are modified to
accept `node_api_nogc_finalize` callbacks. Thus, the only way to attach
a `napi_finalize` callback, wherein Node-APIs affecting GC state may be
called is to call `node_api_post_finalizer` from a
`node_api_nogc_finalize` callback.

In keeping with the process of introducing new Node-APIs, this feature
is guarded by `NAPI_EXPERIMENTAL`. Since this feature modifies APIs
already marked as stable, it is additionally guared by
`NODE_API_EXPERIMENTAL_NOGC_ENV`, so as to provide a further buffer to
adoption. Nevertheless, both guards must be removed upon releasing a
new version of Node-API.

PR-URL: #50060
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: Vladimir Morozov <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Backport-PR-URL: #51804
(cherry picked from commit 7a216d5)
@richardlau

richardlau commented Mar 22, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Landed in 931d02f...32906dd.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@richardlau richardlau closed this Mar 22, 2024
@richardlau richardlau mentioned this pull request Apr 2, 2024
node-addon-api addons broken by default on Node.js 20.12+ #52229
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vmoroz vmoroz Awaiting requested review from vmoroz
@legendecas legendecas Awaiting requested review from legendecas
1 more reviewer
@mhdawson mhdawson mhdawson approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. node-api Issues and PRs related to Node-API.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@gabrielschulhof @nodejs-github-bot @aduh95 @KevinEady @richardlau @mhdawson
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.