node icon indicating copy to clipboard operation
node copied to clipboard

stream: handle undefined chunks correctly in decode stream

Open Nahee-Park opened this issue 1 year ago β€’ 4 comments

Align TextDecoderStream behavior with WPT requirements by treating undefined chunks as errors. This change ensures that TextDecoderStream properly handles unexpected chunk types and throws an error when receiving undefined input.

This update addresses the failing WPT for decode stream error handling.

Nahee-Park avatar Sep 28 '24 16:09 Nahee-Park

Review requested:

  • [ ] @nodejs/web-standards

nodejs-github-bot avatar Sep 28 '24 16:09 nodejs-github-bot

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 88.24%. Comparing base (e32521a) to head (cc89cf2). Report is 343 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #55153      +/-   ##
==========================================
- Coverage   88.24%   88.24%   -0.01%     
==========================================
  Files         651      651              
  Lines      183930   183865      -65     
  Branches    35850    35823      -27     
==========================================
- Hits       162311   162244      -67     
- Misses      14918    14929      +11     
+ Partials     6701     6692       -9     
Files with missing lines Coverage Ξ”
lib/internal/webstreams/encoding.js 100.00% <100.00%> (ΓΈ)

... and 43 files with indirect coverage changes

codecov[bot] avatar Sep 28 '24 17:09 codecov[bot]

Looks good other than throwing ERR_INVALID_THIS. ERR_INVALID_ARG_TYPE is likely a better error to be thrown here.

Thank you for the suggestion! I’ve updated the code to throw ERR_INVALID_ARG_TYPE instead of ERR_INVALID_THIS as per your recommendation. I appreciate the feedback : )

Nahee-Park avatar Sep 29 '24 10:09 Nahee-Park

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

nodejs-github-bot avatar Sep 29 '24 15:09 nodejs-github-bot

Commit Queue failed
- Loading data for nodejs/node/pull/55153
βœ”  Done loading data for nodejs/node/pull/55153
----------------------------------- PR info ------------------------------------
Title      stream: handle undefined chunks correctly in decode stream (#55153)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     Nahee-Park:fix-text-decoder-stream -> nodejs:main
Labels     author ready, needs-ci, web streams
Commits    2
 - stream: handle undefined chunks correctly in decode stream
 - stream: throw ERR_INVALID_ARG_TYPE instead of ERR_INVALID_THIS
Committers 1
 - Nahee-Park <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/55153
Reviewed-By: Mattias Buelens <[email protected]>
Reviewed-By: Matthew Aitken <[email protected]>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/55153
Reviewed-By: Mattias Buelens <[email protected]>
Reviewed-By: Matthew Aitken <[email protected]>
--------------------------------------------------------------------------------
   β„Ή  This PR was created on Sat, 28 Sep 2024 16:09:29 GMT
   βœ”  Approvals: 2
   βœ”  - Mattias Buelens (@MattiasBuelens): https://github.com/nodejs/node/pull/55153#pullrequestreview-2335819701
   βœ”  - Matthew Aitken (@KhafraDev): https://github.com/nodejs/node/pull/55153#pullrequestreview-2335879581
   βœ”  Last GitHub CI successful
   β„Ή  Last Full PR CI on 2024-09-29T15:29:57Z: https://ci.nodejs.org/job/node-test-pull-request/62843/
- Querying data for job/node-test-pull-request/62843/
   βœ”  Last Jenkins CI successful
--------------------------------------------------------------------------------
   βœ”  No git cherry-pick in progress
   βœ”  No git am in progress
   βœ”  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
βœ”  origin/main is now up-to-date
- Downloading patch for 55153
From https://github.com/nodejs/node
 * branch                  refs/pull/55153/merge -> FETCH_HEAD
βœ”  Fetched commits as bbf08c6a1bef..cc89cf23dee8
--------------------------------------------------------------------------------
[main 16d27d5e63] stream: handle undefined chunks correctly in decode stream
 Author: Nahee-Park <[email protected]>
 Date: Sat Sep 28 23:40:33 2024 +0900
 2 files changed, 3 insertions(+), 7 deletions(-)
[main ba985b3895] stream: throw ERR_INVALID_ARG_TYPE instead of ERR_INVALID_THIS
 Author: Nahee-Park <[email protected]>
 Date: Sun Sep 29 19:07:21 2024 +0900
 1 file changed, 2 insertions(+), 1 deletion(-)
   βœ”  Patches applied
There are 2 commits in the PR. Attempting autorebase.
Rebasing (2/4)

Executing: git node land --amend --yes --------------------------------- New Message ---------------------------------- stream: handle undefined chunks correctly in decode stream

Align TextDecoderStream behavior with WPT requirements by treating undefined chunks as errors. This change ensures that TextDecoderStream properly handles unexpected chunk types and throws an error when receiving undefined input.

This update addresses the failing WPT for decode stream error handling.

PR-URL: https://github.com/nodejs/node/pull/55153 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Matthew Aitken <[email protected]>

[detached HEAD dcd4d048ce] stream: handle undefined chunks correctly in decode stream Author: Nahee-Park <[email protected]> Date: Sat Sep 28 23:40:33 2024 +0900 2 files changed, 3 insertions(+), 7 deletions(-) Rebasing (3/4) Rebasing (4/4)

Executing: git node land --amend --yes --------------------------------- New Message ---------------------------------- stream: throw ERR_INVALID_ARG_TYPE instead of ERR_INVALID_THIS

PR-URL: https://github.com/nodejs/node/pull/55153 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Matthew Aitken <[email protected]>

[detached HEAD 0413c2cc24] stream: throw ERR_INVALID_ARG_TYPE instead of ERR_INVALID_THIS Author: Nahee-Park <[email protected]> Date: Sun Sep 29 19:07:21 2024 +0900 1 file changed, 2 insertions(+), 1 deletion(-)

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.

https://github.com/nodejs/node/actions/runs/11110112478

nodejs-github-bot avatar Sep 30 '24 16:09 nodejs-github-bot

Landed in 3111ed7011e03eef7ccf7a27d0d7657e6a4e1cc4

nodejs-github-bot avatar Sep 30 '24 17:09 nodejs-github-bot