Skip to content

Conversation

@ardatan
Copy link
Owner

@ardatan ardatan commented Mar 1, 2025

Fixes ardatan/graphql-tools#6983

Summary by CodeRabbit

  • Chores

    • Updated overall compatibility requirements to support Node.js version 16 and newer, broadening the runtime support.
  • Tests

    • Expanded the automated test configuration to run on Node.js 16 alongside the previously supported versions.
    • Adjusted the 'Native' test suite criteria to ensure it only runs in compatible environments.
    • Enhanced control flow in the Node Specific Cases test suite to conditionally execute tests based on the availability of ReadableStream.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 1, 2025

Warning

Rate limit exceeded

@ardatan has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 5 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 4832c79 and a8c1aff.

📒 Files selected for processing (2)
  • .changeset/metal-feet-attack.md (1 hunks)
  • packages/promise-helpers/package.json (1 hunks)

Walkthrough

A new changeset entry has been added to document a patch for the @whatwg-node/promise-helpers package, indicating that Node.js version 16 or higher is now required. The GitHub Actions workflow configuration was updated to include Node.js version 16 in its testing matrix. Additionally, the package’s package.json was modified to change the supported Node.js engine from >=18.0.0 to >=16.0.0. The test conditions for the 'Native' test suite were refined to ensure compatibility with the fetch API in Deno.

Changes

File(s) Change Summary
.changeset/shaggy-moles-invent.md, packages/promise-helpers/package.json Added an entry for @whatwg-node/promise-helpers and updated the Node.js engine requirement from >=18.0.0 to >=16.0.0.
.github/workflows/tests.yml Modified the Node version matrix in the unit job to include Node.js version 16, updating the list to [16, 18, 20, 22, 23].
packages/server/test/test-fetch.ts, packages/server/test/test-server.ts Updated test conditions for the 'Native' test suite and introduced a conditional implementation for the Fastify test server based on Node.js version.
packages/server/src/utils.ts Modified the endResponse function to check if serverResponse.finished is true before calling serverResponse.end().
packages/server/test/node.spec.ts Altered a test case to conditionally execute based on the availability of ReadableStream, using a helper function testIf.

Possibly related PRs

  • Upcoming Release Changes #2104: Involves updates to the @whatwg-node/promise-helpers package, including dependency additions across multiple packages.
  • Upcoming Release Changes #2108: Addresses Node.js version compatibility and specific issues in the iterateAsync function within @whatwg-node/promise-helpers.
  • Upcoming Release Changes #2106: Related to the same package, focusing on different aspects of functionality while also addressing Node.js compatibility.

Poem

I'm a rabbit hopping along the code lane,
Seeing changes that ease our Node.js strain.
From version updates to workflows in stride,
I jump with joy and share this ride.
With whiskers twitching in ASCII delight, 🎉🐇
Code's now light, agile, and just right!
Hop on, for a smooth debugging night!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2025

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@whatwg-node/promise-helpers 1.2.2-alpha-20250303010559-a8c1affa732f19dd296462b66215c01fd144d661 npm ↗︎ unpkg ↗︎
@whatwg-node/server 0.9.71-alpha-20250303010559-a8c1affa732f19dd296462b66215c01fd144d661 npm ↗︎ unpkg ↗︎

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2025

@benchmarks/node-fetch results (noConsumeBody)

   ✓ active_handles.................: avg=139.830995 min=12     med=139     max=190     p(90)=159     p(95)=165    
     data_received..................: 21 MB  697 kB/s
     data_sent......................: 14 MB  451 kB/s
     http_req_blocked...............: avg=3.96µs     min=631ns  med=1.31µs  max=9.45ms  p(90)=2.03µs  p(95)=2.29µs 
     http_req_connecting............: avg=2.21µs     min=0s     med=0s      max=9.41ms  p(90)=0s      p(95)=0s     
     http_req_duration..............: avg=21.88ms    min=3.11ms med=21.23ms max=1.26s   p(90)=27.56ms p(95)=29.04ms
       { expected_response:true }...: avg=21.88ms    min=3.11ms med=21.23ms max=1.26s   p(90)=27.56ms p(95)=29.04ms
     http_req_failed................: 0.00%  ✓ 0           ✗ 136611
     http_req_receiving.............: avg=32.02µs    min=9.15µs med=22.66µs max=20.72ms p(90)=37.29µs p(95)=44.63µs
     http_req_sending...............: avg=11.93µs    min=3.31µs med=6.12µs  max=12.63ms p(90)=9.71µs  p(95)=13.76µs
     http_req_tls_handshaking.......: avg=0s         min=0s     med=0s      max=0s      p(90)=0s      p(95)=0s     
     http_req_waiting...............: avg=21.84ms    min=3.08ms med=21.2ms  max=1.26s   p(90)=27.52ms p(95)=28.97ms
     http_reqs......................: 136611 4553.183463/s
     iteration_duration.............: avg=43.88ms    min=9.92ms med=42.24ms max=1.28s   p(90)=47.3ms  p(95)=54.28ms
     iterations.....................: 68288  2276.008464/s
     vus............................: 86     min=86        max=100 
     vus_max........................: 100    min=100       max=100 

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2025

@benchmarks/server results (undici)

     ✓ no-errors
     ✓ expected-result

   ✓ checks.........................: 100.00% ✓ 222362      ✗ 0     
     data_received..................: 22 MB   745 kB/s
     data_sent......................: 8.9 MB  297 kB/s
     http_req_blocked...............: avg=1.33µs   min=841ns    med=1.14µs   max=180.87µs p(90)=1.83µs   p(95)=2µs     
     http_req_connecting............: avg=1ns      min=0s       med=0s       max=125.55µs p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=208.02µs min=146.58µs med=196.19µs max=43.69ms  p(90)=224.08µs p(95)=233.77µs
       { expected_response:true }...: avg=208.02µs min=146.58µs med=196.19µs max=43.69ms  p(90)=224.08µs p(95)=233.77µs
     http_req_failed................: 0.00%   ✓ 0           ✗ 111181
     http_req_receiving.............: avg=24.81µs  min=12.73µs  med=23.06µs  max=3.12ms   p(90)=30.39µs  p(95)=33.2µs  
     http_req_sending...............: avg=6.17µs   min=3.84µs   med=5.3µs    max=2.54ms   p(90)=8.04µs   p(95)=8.6µs   
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=177.03µs min=127.16µs med=164.94µs max=43.62ms  p(90)=189.46µs p(95)=198.08µs
     http_reqs......................: 111181  3705.908895/s
     iteration_duration.............: avg=265.39µs min=187.17µs med=253.35µs max=43.82ms  p(90)=284.64µs p(95)=296.17µs
     iterations.....................: 111181  3705.908895/s
     vus............................: 1       min=1         max=1   
     vus_max........................: 1       min=1         max=1   

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2025

@benchmarks/server results (ponyfill)

     ✓ no-errors
     ✓ expected-result

   ✓ checks.........................: 100.00% ✓ 297832     ✗ 0     
     data_received..................: 29 MB   978 kB/s
     data_sent......................: 12 MB   397 kB/s
     http_req_blocked...............: avg=1.42µs   min=891ns    med=1.21µs   max=308.8µs  p(90)=1.89µs   p(95)=2.07µs  
     http_req_connecting............: avg=0ns      min=0s       med=0s       max=116µs    p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=138.87µs min=93.74µs  med=134µs    max=6.07ms   p(90)=156.27µs p(95)=163.45µs
       { expected_response:true }...: avg=138.87µs min=93.74µs  med=134µs    max=6.07ms   p(90)=156.27µs p(95)=163.45µs
     http_req_failed................: 0.00%   ✓ 0          ✗ 148916
     http_req_receiving.............: avg=24.33µs  min=12.36µs  med=22.75µs  max=2.25ms   p(90)=30.12µs  p(95)=32.75µs 
     http_req_sending...............: avg=6.37µs   min=4.08µs   med=5.51µs   max=271.02µs p(90)=8.17µs   p(95)=8.94µs  
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=108.16µs min=67.28µs  med=102.96µs max=5.99ms   p(90)=121.97µs p(95)=127.88µs
     http_reqs......................: 148916  4963.63223/s
     iteration_duration.............: avg=197.03µs min=141.58µs med=191.57µs max=6.23ms   p(90)=216.95µs p(95)=226.21µs
     iterations.....................: 148916  4963.63223/s
     vus............................: 1       min=1        max=1   
     vus_max........................: 1       min=1        max=1   

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2025

@benchmarks/node-fetch results (consumeBody)

   ✓ active_handles.................: avg=139.727478 min=12      med=140     max=197     p(90)=162     p(95)=166    
     data_received..................: 20 MB  681 kB/s
     data_sent......................: 13 MB  437 kB/s
     http_req_blocked...............: avg=2.15µs     min=651ns   med=1.27µs  max=10.95ms p(90)=2.02µs  p(95)=2.26µs 
     http_req_connecting............: avg=302ns      min=0s      med=0s      max=3.08ms  p(90)=0s      p(95)=0s     
     http_req_duration..............: avg=22.37ms    min=1.71ms  med=21.86ms max=1.17s   p(90)=28.06ms p(95)=29.63ms
       { expected_response:true }...: avg=22.37ms    min=1.71ms  med=21.86ms max=1.17s   p(90)=28.06ms p(95)=29.63ms
     http_req_failed................: 0.00%  ✓ 0           ✗ 133639
     http_req_receiving.............: avg=32.02µs    min=9µs     med=23.07µs max=10.43ms p(90)=36.77µs p(95)=42.99µs
     http_req_sending...............: avg=10.03µs    min=3.23µs  med=5.76µs  max=7.32ms  p(90)=9.47µs  p(95)=12.88µs
     http_req_tls_handshaking.......: avg=0s         min=0s      med=0s      max=0s      p(90)=0s      p(95)=0s     
     http_req_waiting...............: avg=22.33ms    min=1.67ms  med=21.82ms max=1.17s   p(90)=28.02ms p(95)=29.58ms
     http_reqs......................: 133639 4453.673381/s
     iteration_duration.............: avg=44.85ms    min=10.62ms med=43.23ms max=1.2s    p(90)=48.56ms p(95)=54.44ms
     iterations.....................: 66791  2225.886895/s
     vus............................: 100    min=100       max=100 
     vus_max........................: 100    min=100       max=100 

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2025

@benchmarks/server results (native)

     ✓ no-errors
     ✓ expected-result

   ✓ checks.........................: 100.00% ✓ 227004      ✗ 0     
     data_received..................: 23 MB   760 kB/s
     data_sent......................: 9.1 MB  303 kB/s
     http_req_blocked...............: avg=1.48µs   min=922ns    med=1.25µs   max=295.65µs p(90)=1.95µs   p(95)=2.16µs  
     http_req_connecting............: avg=1ns      min=0s       med=0s       max=127.45µs p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=200.51µs min=146.05µs med=189.37µs max=8.75ms   p(90)=215.71µs p(95)=226.75µs
       { expected_response:true }...: avg=200.51µs min=146.05µs med=189.37µs max=8.75ms   p(90)=215.71µs p(95)=226.75µs
     http_req_failed................: 0.00%   ✓ 0           ✗ 113502
     http_req_receiving.............: avg=26.03µs  min=13.57µs  med=24.28µs  max=2.53ms   p(90)=31.75µs  p(95)=34.52µs 
     http_req_sending...............: avg=6.6µs    min=4.19µs   med=5.83µs   max=261.04µs p(90)=8.33µs   p(95)=9.25µs  
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=167.88µs min=120.23µs med=156.85µs max=8.65ms   p(90)=179.97µs p(95)=189.93µs
     http_reqs......................: 113502  3783.265825/s
     iteration_duration.............: avg=259.71µs min=188.74µs med=247.59µs max=9.02ms   p(90)=277.48µs p(95)=291.3µs 
     iterations.....................: 113502  3783.265825/s
     vus............................: 1       min=1         max=1   
     vus_max........................: 1       min=1         max=1   

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/server/test/test-server.ts (1)

170-170: Consider replacing empty object type.

The empty object type {} should be replaced with a more explicit type definition.

-        ServerAdapterBaseObject<{}>
+        ServerAdapterBaseObject<Record<string, unknown>>
🧰 Tools
🪛 Biome (1.9.4)

[error] 170-170: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6fca1e1 and 3edbe3a.

⛔ Files ignored due to path filters (1)
  • packages/fetch/dist/create-node-ponyfill.js is excluded by !**/dist/**
📒 Files selected for processing (2)
  • packages/server/test/test-fetch.ts (1 hunks)
  • packages/server/test/test-server.ts (2 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
packages/server/test/test-server.ts

[error] 170-170: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: unit / node 23
  • GitHub Check: unit / node 22
  • GitHub Check: unit / node 20
  • GitHub Check: unit / node 18
  • GitHub Check: e2e / cloudflare-workers
  • GitHub Check: unit / node 16
  • GitHub Check: e2e / azure-function
  • GitHub Check: e2e / aws-lambda
🔇 Additional comments (5)
packages/server/test/test-fetch.ts (1)

82-82: Improved conditional test execution for Deno environment.

The updated condition ensures that the 'Native' test suite will only run in Deno environments where the fetch API is actually available, preventing potential test failures in environments where fetch might not be accessible.

packages/server/test/test-server.ts (4)

5-5: LGTM: Improved import statement.

Changed from importing Fastify to only importing Fastify types, which is more efficient and aligns with the dynamic import pattern implemented below.


12-13: Good approach for version detection.

Extracting the Node.js major version into a variable makes the conditional logic more readable and maintainable.


162-246: Effective Node.js version compatibility implementation.

Conditionally including the Fastify implementation only for Node.js 16+ is a good approach to maintaining backward compatibility while preventing breaking changes.

🧰 Tools
🪛 Biome (1.9.4)

[error] 170-170: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


172-172: Well-implemented dynamic import pattern.

Using dynamic import with fallback to handle both default and named exports accommodates different module formats across Node.js versions.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/server/test/test-server.ts (1)

162-486: Well-structured conditional framework support based on Node version.

Wrapping the Fastify, Express, Koa, and Hapi server implementations in a Node version check ensures the tests only run on compatible environments. The dynamic import of Fastify using await import('fastify').then(m => m.default || m) properly handles both ESM and CommonJS module formats.

There are three instances of using {} as a type which static analysis flagged. While not directly related to Node 16 compatibility, consider using more specific types:

- ServerAdapterBaseObject<{}>
+ ServerAdapterBaseObject<Record<string, unknown>>
🧰 Tools
🪛 Biome (1.9.4)

[error] 170-170: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


[error] 301-301: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


[error] 394-394: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3edbe3a and 4832c79.

📒 Files selected for processing (3)
  • packages/server/src/utils.ts (1 hunks)
  • packages/server/test/node.spec.ts (1 hunks)
  • packages/server/test/test-server.ts (2 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
packages/server/test/test-server.ts

[error] 170-170: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


[error] 301-301: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


[error] 394-394: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: unit / node 23
  • GitHub Check: unit / node 22
  • GitHub Check: unit / deno
  • GitHub Check: unit / node 20
  • GitHub Check: unit / node 18
  • GitHub Check: unit / bun
  • GitHub Check: server (undici)
  • GitHub Check: unit / node 16
  • GitHub Check: e2e / cloudflare-modules
  • GitHub Check: node-fetch (consumeBody)
  • GitHub Check: type check
  • GitHub Check: alpha / snapshot
  • GitHub Check: server (ponyfill)
  • GitHub Check: prettier
  • GitHub Check: e2e / cloudflare-workers
  • GitHub Check: lint
  • GitHub Check: e2e / azure-function
  • GitHub Check: node-fetch (noConsumeBody)
  • GitHub Check: e2e / aws-lambda
  • GitHub Check: server (native)
🔇 Additional comments (4)
packages/server/src/utils.ts (1)

259-265: Great addition of server response finished check.

This adds a necessary check to prevent calling end() on a server response that is already finished, which is essential for compatibility with Node 16 and prevents potential errors.

packages/server/test/node.spec.ts (1)

533-534: Well implemented conditional test execution pattern.

This is a good approach to conditionally run tests based on feature availability. The testIf helper ensures the React streaming response test is skipped in environments like Node 16 where ReadableStream might not be globally available by default.

packages/server/test/test-server.ts (2)

12-13: Appropriate Node.js version detection.

Extracting the major version number is a clean approach to conditionally execute code based on Node version compatibility.


5-5: Good change to import only types from Fastify.

Changing from importing the entire module to only importing types is a better practice for type checking without loading the module unnecessarily.

@ardatan ardatan merged commit 2ca563a into master Mar 3, 2025
24 checks passed
@ardatan ardatan deleted the add-16 branch May 12, 2025 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dependency mismatch

2 participants