Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: use better return types in KVStore #54539

Closed
wants to merge 2 commits into from
Closed

Conversation

targos
Copy link
Member

@targos targos commented Aug 24, 2024

  • Use v8::Maybe<void> instead of v8::Maybe<bool> and handle error
    from AssignFromObject.
  • An empty v8::Maybe is supposed to be returned when an exception is
    pending. Use std::optional instead to indicate a missing value in
    Get(key).

- Use `v8::Maybe<void>` instead of `v8::Maybe<bool>` and handle error
  from `AssignFromObject`.
- An empty `v8::Maybe` is supposed to be returned when an exception is
  pending. Use `std::optional` instead to indicate a missing value in
  `Get(key)`.
@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 related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Aug 24, 2024
@targos
Copy link
Member Author

targos commented Aug 24, 2024

Note that I didn't change MaybeLocal<String> Get(Isolate* isolate, Local<String> key) and v8::Maybe<bool> AssignToObject because they are less straightforward (when they return an empty Maybe(Local), it could be either because an exception is pending, or for another reason.

@targos
Copy link
Member Author

targos commented Aug 24, 2024

/cc @nodejs/cpp-reviewers

@targos targos marked this pull request as draft August 24, 2024 13:55
@targos

This comment was marked as resolved.

@targos targos marked this pull request as ready for review August 24, 2024 14:10
@targos
Copy link
Member Author

targos commented Aug 24, 2024

The mistake was obvious.

@targos targos added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 24, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 24, 2024
@nodejs-github-bot

This comment was marked as outdated.

Copy link

codecov bot commented Aug 24, 2024

Codecov Report

Attention: Patch coverage is 84.37500% with 5 lines in your changes missing coverage. Please review.

Project coverage is 87.33%. Comparing base (9edf4a0) to head (6fcc1a6).
Report is 337 commits behind head on main.

Files with missing lines Patch % Lines
src/node_env_var.cc 81.25% 2 Missing and 1 partial ⚠️
src/node_worker.cc 80.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #54539   +/-   ##
=======================================
  Coverage   87.32%   87.33%           
=======================================
  Files         649      649           
  Lines      182603   182607    +4     
  Branches    35042    35042           
=======================================
+ Hits       159464   159471    +7     
+ Misses      16400    16397    -3     
  Partials     6739     6739           
Files with missing lines Coverage Δ
src/inspector_profiler.cc 77.56% <100.00%> (+0.27%) ⬆️
src/node_credentials.cc 69.14% <100.00%> (+0.76%) ⬆️
src/node_dotenv.cc 81.70% <100.00%> (ø)
src/util.h 89.91% <ø> (ø)
src/node_worker.cc 83.44% <80.00%> (-0.60%) ⬇️
src/node_env_var.cc 84.81% <81.25%> (+0.31%) ⬆️

... and 21 files with indirect coverage changes

@nodejs-github-bot
Copy link
Collaborator

@targos targos added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Aug 25, 2024
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Aug 26, 2024
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/54539
✔  Done loading data for nodejs/node/pull/54539
----------------------------------- PR info ------------------------------------
Title      src: use better return types in KVStore (#54539)
Author     Michaël Zasso <[email protected]> (@targos)
Branch     targos:kv-optional -> nodejs:main
Labels     c++, lib / src, needs-ci, commit-queue-squash
Commits    2
 - src: use better return types in KVStore
 - fixup
Committers 1
 - Michaël Zasso <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/54539
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/54539
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Sat, 24 Aug 2024 13:14:22 GMT
   ✔  Approvals: 5
   ✔  - Tobias Nießen (@tniessen) (TSC): https://github.com/nodejs/node/pull/54539#pullrequestreview-2258733830
   ✔  - Anna Henningsen (@addaleax): https://github.com/nodejs/node/pull/54539#pullrequestreview-2258750609
   ✔  - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/54539#pullrequestreview-2258973417
   ✔  - Rafael Gonzaga (@RafaelGSS) (TSC): https://github.com/nodejs/node/pull/54539#pullrequestreview-2258999489
   ✔  - Mohammed Keyvanzadeh (@VoltrexKeyva): https://github.com/nodejs/node/pull/54539#pullrequestreview-2259303546
   ✘  Last GitHub CI failed
   ℹ  Last Full PR CI on 2024-08-24T21:03:59Z: https://ci.nodejs.org/job/node-test-pull-request/61426/
- Querying data for job/node-test-pull-request/61426/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/10560540424

targos added a commit that referenced this pull request Aug 26, 2024
- Use `v8::Maybe<void>` instead of `v8::Maybe<bool>` and handle error
  from `AssignFromObject`.
- An empty `v8::Maybe` is supposed to be returned when an exception is
  pending. Use `std::optional` instead to indicate a missing value in
  `Get(key)`.

PR-URL: #54539
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
@targos
Copy link
Member Author

targos commented Aug 26, 2024

Landed in 8f1fa03

@targos targos closed this Aug 26, 2024
@targos targos deleted the kv-optional branch August 26, 2024 13:33
RafaelGSS pushed a commit that referenced this pull request Aug 30, 2024
- Use `v8::Maybe<void>` instead of `v8::Maybe<bool>` and handle error
  from `AssignFromObject`.
- An empty `v8::Maybe` is supposed to be returned when an exception is
  pending. Use `std::optional` instead to indicate a missing value in
  `Get(key)`.

PR-URL: #54539
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
RafaelGSS pushed a commit that referenced this pull request Aug 30, 2024
- Use `v8::Maybe<void>` instead of `v8::Maybe<bool>` and handle error
  from `AssignFromObject`.
- An empty `v8::Maybe` is supposed to be returned when an exception is
  pending. Use `std::optional` instead to indicate a missing value in
  `Get(key)`.

PR-URL: #54539
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
@RafaelGSS RafaelGSS mentioned this pull request Aug 30, 2024
@targos targos added the dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. label Sep 22, 2024
louwers pushed a commit to louwers/node that referenced this pull request Nov 2, 2024
- Use `v8::Maybe<void>` instead of `v8::Maybe<bool>` and handle error
  from `AssignFromObject`.
- An empty `v8::Maybe` is supposed to be returned when an exception is
  pending. Use `std::optional` instead to indicate a missing value in
  `Get(key)`.

PR-URL: nodejs#54539
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
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++. commit-queue-failed An error occurred while landing this pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants