Skip to content

ffi: use type errors for invalid signatures - #66222

Merged
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
HoonDongKang:ffi-change-type-errors
Sep 25, 2026
Merged

nodejs-github-bot merged 2 commits into
nodejs:mainfrom
HoonDongKang:ffi-change-type-errors

Conversation

@HoonDongKang

Copy link
Copy Markdown
Contributor

Summary

ParseFunctionSignature() reports ERR_INVALID_ARG_VALUE when signature properties have incorrect JS types.

- THROW_ERR_INVALID_ARG_VALUE()
+ THROW_ERR_INVALID_ARG_TYPE()

Use ERR_INVALID_ARG_TYPE when:

  • return is not a string.
  • arguments is not an array.
  • An element of the arguments array is not a string.

Testing

make -j4
./node --test test/ffi/test-ffi-dynamic-library.js

ℹ tests 18
ℹ suites 0
ℹ pass 18
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 140.289875

Signed-off-by: HoonDongKang <d159123@naver.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/ffi

@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. labels Sep 23, 2026
@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.28%. Comparing base (3d85c94) to head (f981fef).
⚠️ Report is 87 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66222      +/-   ##
==========================================
- Coverage   90.29%   90.28%   -0.01%     
==========================================
  Files         790      789       -1     
  Lines      272880   272880              
  Branches    52103    52107       +4     
==========================================
- Hits       246385   246382       -3     
- Misses      16936    16956      +20     
+ Partials     9559     9542      -17     
Files with missing lines Coverage Δ
src/ffi/types.cc 56.07% <100.00%> (+2.35%) ⬆️

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

@daeyeon daeyeon added the ffi Issues and PRs related to experimental Foreign Function Interface support. label Sep 23, 2026
Comment thread test/ffi/test-ffi-dynamic-library.js Outdated
@daeyeon daeyeon added request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. author ready PRs with CI started, the required approvals, and no outstanding review comments. and removed request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Sep 24, 2026
Signed-off-by: HoonDongKang <d159123@naver.com>
@daeyeon daeyeon added request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. and removed request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Sep 24, 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 Sep 24, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@panva panva added the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Sep 25, 2026
@github-actions github-actions Bot removed the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Sep 25, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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

lgtm

@panva panva added the commit-queue PRs queued for automated landing through the Commit Queue. label Sep 25, 2026
@nodejs-github-bot nodejs-github-bot added commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. and removed commit-queue PRs queued for automated landing through the Commit Queue. labels Sep 25, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Commit Queue failed

This pull request has multiple commits, but no landing policy was selected.

Add commit-queue-squash PRs the Commit Queue should land as one squashed commit. to land it as one commit, or commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. to land the commits separately.

The pull request was removed from the Commit Queue and labeled commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. . After resolving the failure, remove that label and add commit-queue PRs queued for automated landing through the Commit Queue. to retry.

Full Commit Queue output
�[36m⠋�[39m Loading data for nodejs/node/pull/66222
�[36m⠋�[39m Loading data for nodejs/node/pull/66222
�[36m⠋�[39m Getting collaborator contacts from README of nodejs/node
�[36m⠋�[39m Getting PR from nodejs/node/pull/66222
�[36m⠋�[39m Getting reviews from nodejs/node/pull/66222
�[36m⠋�[39m Getting comments from nodejs/node/pull/66222
�[36m⠋�[39m Getting commits from nodejs/node/pull/66222
✔  Done loading data for nodejs/node/pull/66222
----------------------------------- PR info ------------------------------------
Title      ffi: use type errors for invalid signatures (#66222)
Author     Donghoon Kang <d159123@naver.com> (@HoonDongKang)
Branch     HoonDongKang:ffi-change-type-errors -> nodejs:main
Labels     c++, author ready, needs-ci, commit-queue, ffi
Commits    2
 - ffi: use type errors for invalid signatures
 - ffi: check only error codes in assertions
Committers 1
 - HoonDongKang <d159123@naver.com>
PR-URL: https://github.com/nodejs/node/pull/66222
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/66222
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Wed, 23 Sep 2026 03:11:58 GMT
   ✔  Approvals: 2
   ✔  - Daeyeon Jeong (@daeyeon): https://github.com/nodejs/node/pull/66222#pullrequestreview-5305118389
   ✔  - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/66222#pullrequestreview-5316849406
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2026-09-25T09:56:58Z: https://ci.nodejs.org/job/node-test-pull-request/77886/
�[36m⠙�[39m Querying data for job/node-test-pull-request/77886/
�[36m⠙�[39m Querying data for job/node-test-pull-request/77886/
�[36m⠙�[39m Querying API for job/node-test-pull-request/77886/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
�[36m⠹�[39m Bringing origin/main up to date...
�[36m⠹�[39m Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
✔  origin/main is now up-to-date
�[36m⠸�[39m Downloading patch for 66222
�[36m⠸�[39m Downloading patch for 66222
From https://github.com/nodejs/node
 * branch                  refs/pull/66222/merge -> FETCH_HEAD
✔  Fetched commits as 53aafbb4c287..f981fef5fc64
--------------------------------------------------------------------------------
[main 86413e41fa] ffi: use type errors for invalid signatures
 Author: HoonDongKang <d159123@naver.com>
 Date: Wed Sep 23 11:59:31 2026 +0900
 2 files changed, 24 insertions(+), 3 deletions(-)
[main 149deef04c] ffi: check only error codes in assertions
 Author: HoonDongKang <d159123@naver.com>
 Date: Thu Sep 24 22:24:18 2026 +0900
 1 file changed, 3 deletions(-)
   ✔  Patches applied
There are 2 commits in the PR. Attempting autorebase.
(node:497) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.
(Use `node --trace-deprecation ...` to show where the warning was created)
Rebasing (2/4)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
ffi: use type errors for invalid signatures

Signed-off-by: HoonDongKang <d159123@naver.com>
PR-URL: https://github.com/nodejs/node/pull/66222
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
--------------------------------------------------------------------------------
[detached HEAD c982077f97] ffi: use type errors for invalid signatures
 Author: HoonDongKang <d159123@naver.com>
 Date: Wed Sep 23 11:59:31 2026 +0900
 2 files changed, 24 insertions(+), 3 deletions(-)
Rebasing (3/4)
Rebasing (4/4)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
ffi: check only error codes in assertions

Signed-off-by: HoonDongKang <d159123@naver.com>
PR-URL: https://github.com/nodejs/node/pull/66222
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
--------------------------------------------------------------------------------
[detached HEAD 91c40fca8c] ffi: check only error codes in assertions
 Author: HoonDongKang <d159123@naver.com>
 Date: Thu Sep 24 22:24:18 2026 +0900
 1 file changed, 3 deletions(-)
Successfully rebased and updated refs/heads/main.
--------------------------------------------------------------------------------
   ℹ  Add `commit-queue-squash` label to land the PR as one commit, or `commit-queue-rebase` to land as separate commits.

View workflow run

@panva panva added commit-queue-squash PRs the Commit Queue should land as one squashed commit. commit-queue PRs queued for automated landing through the Commit Queue. commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. and removed commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. labels Sep 25, 2026
@panva panva removed the commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. label Sep 25, 2026
@nodejs-github-bot
nodejs-github-bot merged commit ad63e9e into nodejs:main Sep 25, 2026
92 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in ad63e9e

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Sep 25, 2026
aduh95 pushed a commit that referenced this pull request Sep 27, 2026
Signed-off-by: HoonDongKang <d159123@naver.com>
PR-URL: #66222
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
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. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-squash PRs the Commit Queue should land as one squashed commit. ffi Issues and PRs related to experimental Foreign Function Interface support. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants