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

Hive Gateway Driver for NestJS #667

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Hive Gateway Driver for NestJS #667

wants to merge 9 commits into from

Conversation

ardatan
Copy link
Member

@ardatan ardatan commented Feb 14, 2025

Docs are missing...

Completes GW-133

Copy link

coderabbitai bot commented Feb 14, 2025

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Enhanced NestJS integration with improved GraphQL gateway capabilities, including better context management, subscription support, and error logging.
    • Introduced a dedicated package for seamless GraphQL connectivity along with added documentation for guidance.
  • Tests

    • Implemented new end-to-end tests to ensure accurate handling of GraphQL queries.
  • Chores

    • Updated package versions and configuration settings to support modern Node environments and improve overall compatibility.

Walkthrough

This PR introduces several enhancements and new features. A changeset entry has been added to update the patch version for @graphql-hive/nestjs along with its design description. New end-to-end tests for NestJS are added using Vitest, accompanied by a new e2e package. The package for @graphql-hive/nestjs now includes a HiveGatewayDriver, a NestJSLoggerAdapter, and a merged configuration type. Additionally, TypeScript path mappings in tsconfig.json have been updated and the Tenv service/container methods now support custom environment variables.

Changes

File(s) Change Summary
.changeset/sixty-camels-design.md Added a new entry for a patch update of @graphql-hive/nestjs with a brief description ("Hive Gateway Driver for NestJS") and documentation link.
e2e/nestjs/nestjs.e2e.ts Introduced an end-to-end test using Vitest for a NestJS application, setting up the test environment and executing a GraphQL query; added functions such as createExampleSetup, createTenv, and getLocalhost.
e2e/nestjs/package.json Created a new package declaration for @e2e/nestjs with version 0.0.1 including necessary dependencies like NestJS modules, GraphQL, and others.
packages/nestjs/package.json
packages/nestjs/src/index.ts
Added a new package for @graphql-hive/nestjs including metadata, build scripts, dependencies, and devDependencies; introduced the HiveGatewayDriver class with start and stop methods, a NestJSLoggerAdapter class for logging, and a new type HiveGatewayDriverConfig for configuration options.
tsconfig.json Updated the paths section by adding a new mapping for @graphql-hive/nestjs and reformatted the mapping for @graphql-hive/logger-winston from single-line to multi-line format.
internal/e2e/src/tenv.ts Modified the method signatures for service and container to accept an env parameter, allowing for custom environment variable configurations in both service and container processes.
e2e/nestjs/services/nestjs.ts Added a new NestJS application module (AppModule) and an asynchronous main function that uses the Hive Gateway Driver to integrate GraphQL functionality, process command-line arguments for dynamic port allocation, and handle error logging during startup.

Sequence Diagram(s)

sequenceDiagram
    participant Dev
    participant AppModule
    participant HiveGatewayDriver
    participant LoggerAdapter
    participant Server

    Dev->>AppModule: Initiate main()
    AppModule->>HiveGatewayDriver: Start gateway runtime
    HiveGatewayDriver->>LoggerAdapter: Forward logging messages
    HiveGatewayDriver->>Server: Register HTTP adapters & subscriptions
    Server-->>AppModule: Server is ready
Loading
sequenceDiagram
    participant TestRunner
    participant Tenv
    participant Localhost
    participant NestServer

    TestRunner->>Tenv: createTenv() to initialize environment
    Tenv->>Localhost: Allocate dynamic port / get host info
    TestRunner->>NestServer: Send POST GraphQL query with headers
    NestServer-->>TestRunner: Return JSON response matching expected result
Loading

Possibly related PRs

  • Winston Logger Adapter #622: Implements a WinstonLoggerAdapter for the Hive Gateway, closely related to the introduction of the HiveGatewayDriver and NestJSLoggerAdapter in this PR.

Suggested reviewers

  • dotansimha

Poem

I'm a rabbit coding all day,
Hopping through patches in a playful way.
GraphQL carrots and NestJS dreams,
With drivers and logs in seamless streams.
I celebrate these changes with a joyful leap—
In playful code burrows, my heart does keep!
🐇💻


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 83cf7eb and b49673d.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (8)
  • .changeset/sixty-camels-design.md (1 hunks)
  • e2e/nestjs/nestjs.e2e.ts (1 hunks)
  • e2e/nestjs/package.json (1 hunks)
  • e2e/nestjs/services/nestjs.ts (1 hunks)
  • internal/e2e/src/tenv.ts (2 hunks)
  • packages/nestjs/package.json (1 hunks)
  • packages/nestjs/src/index.ts (1 hunks)
  • tsconfig.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
`e2e/**`: This directory includes end-to-end tests for the g...

e2e/**: This directory includes end-to-end tests for the gateway.
The examples directory is generated based on the code in this directory.

  • e2e/nestjs/package.json
  • e2e/nestjs/services/nestjs.ts
  • e2e/nestjs/nestjs.e2e.ts
`**`: For all PRs, we would like to verify that a Linear iss...

**: For all PRs, we would like to verify that a Linear issue is linked. Check if there's a mention for "GW-*" in the PR description, and the us know when it's missing.

In most cases, when a PR adds a new functionality, we would like to make sure it has documentation in the corresponding console project.
Use the global knowledge feature to search for PRs in graphql-hive/console repository that adds documentation. Suggest to create a follow up issue to add the missing documentation.

  • e2e/nestjs/package.json
  • e2e/nestjs/services/nestjs.ts
  • e2e/nestjs/nestjs.e2e.ts
  • tsconfig.json
  • packages/nestjs/package.json
  • packages/nestjs/src/index.ts
  • internal/e2e/src/tenv.ts
`packages/**`: In this directory we keep all packages releva...

packages/**: In this directory we keep all packages relevant to the gateway.

In most cases, when changes are made to the source code / dependencies in these directories, we also require to have a corresponding changeset file, created using yarn changeset with a full description on the changes with an example.
Also, when new features are added the packages, the changeset file should mention minor semver change. When a bug is fixed, patch needs to be used. The major bump is used for a PR that has breaking changes.

  • packages/nestjs/package.json
  • packages/nestjs/src/index.ts
🧠 Learnings (1)
e2e/nestjs/package.json (1)
Learnt from: ardatan
PR: graphql-hive/gateway#667
File: e2e/nestjs/package.json:13-21
Timestamp: 2025-02-14T13:52:33.387Z
Learning: In example and e2e test projects within the repository, using caret ranges (^) for dependencies is preferred to demonstrate compatibility across different versions.
⏰ Context from checks skipped due to timeout of 90000ms (34)
  • GitHub Check: Binary built on ubuntu-24.04-arm
  • GitHub Check: Binary built on windows-latest
  • GitHub Check: Binary built on macos-14
  • GitHub Check: Binary built on macos-13
  • GitHub Check: Bun Docker image
  • GitHub Check: Binary built on ubuntu-latest
  • GitHub Check: Node Docker image
  • GitHub Check: E2E / Bun Docker on Ubuntu
  • GitHub Check: E2E / Bun on Ubuntu
  • GitHub Check: E2E / Node Binary on Windows
  • GitHub Check: E2E / Node Binary on Ubuntu
  • GitHub Check: Unit / Bun
  • GitHub Check: E2E / Node Docker on Ubuntu
  • GitHub Check: E2E / Node 23 on Ubuntu
  • GitHub Check: Unit / Node v23
  • GitHub Check: E2E / Node 22 on Ubuntu
  • GitHub Check: Leaks / Node v23
  • GitHub Check: E2E / Node 20 on Ubuntu
  • GitHub Check: Unit / Node v22
  • GitHub Check: Leaks / Node v22
  • GitHub Check: Types
  • GitHub Check: Benchmark / bun / 1000 items
  • GitHub Check: Unit / Node v20
  • GitHub Check: Benchmark / bun / 100 items
  • GitHub Check: Leaks / Node v20
  • GitHub Check: Benchmark / bun / 10 items
  • GitHub Check: Benchmark / node / 1000 items
  • GitHub Check: Leaks / Node v18
  • GitHub Check: Bundle
  • GitHub Check: Benchmark / node / 100 items
  • GitHub Check: E2E / Node 18 on Ubuntu
  • GitHub Check: Build
  • GitHub Check: Benchmark / node / 10 items
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (10)
packages/nestjs/src/index.ts (2)

28-40: Use a more restrictive context type instead of Record<string, any>.

The current type declaration may allow unintended usage of any. This was previously mentioned in older review comments, so tagging as ``. Consider updating to Record<string, unknown> or a more specific shape to gain stronger type safety.


108-108: Consider using a NestJS-specific exception.

Throwing a raw Error here is acceptable, but you might prefer throwing a HttpException or a more specialized NestJS exception to align with NestJS conventions. This was noted by a previous reviewer, hence ``.

e2e/nestjs/services/nestjs.ts (1)

1-34: LGTM!

The e2e service initialization logic is straightforward. The code sets up the NestJS module, picks up the supergraph path from arguments, and listens on the configured port. No critical issues identified here.

e2e/nestjs/nestjs.e2e.ts (1)

9-26: Clean up the spawned NestJS server after tests.

You may want to release resources and avoid potential port conflicts by stopping the server after tests. This was previously suggested, so marking as ``.

For example, in an afterAll or afterEach block:

afterAll(async () => {
  /* e.g., call waitForExit() or the appropriate cleanup function here */
});
internal/e2e/src/tenv.ts (2)

687-707: LGTM! Environment variables support added to service method.

The addition of the env parameter and its proper integration with the spawn options is well implemented.


730-734: LGTM! Environment variables support added to container method.

The addition of the env parameter with a default empty object is well implemented and consistent with the service method.

e2e/nestjs/package.json (1)

6-13: LGTM! Dependencies are properly configured.

The use of caret ranges (^) for dependencies is appropriate as this is an example/e2e test project, demonstrating compatibility across different versions.

packages/nestjs/package.json (1)

1-64: LGTM! Package configuration is well structured.

The package.json is properly configured with:

  • Correct metadata and repository information
  • Appropriate peer dependencies
  • Well-organized exports configuration
  • Proper workspace dependencies

Documentation required for NestJS Gateway Driver.

The PR is correctly linked with GW-133, but it currently lacks documentation for the new NestJS Gateway Driver.

Please create a follow-up issue in the graphql-hive/console repository to add comprehensive documentation (including usage, configuration examples, and integration details).

tsconfig.json (2)

63-65: LGTM! Path mapping reformatted for consistency.

The multi-line format aligns with the style used for other similar path mappings in the file.


66-66: LGTM! Path mapping added for the new NestJS package.

The path mapping follows the established pattern and correctly points to the package's entry point.

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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. (Beta)
  • @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.

Copy link

@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: 11

🔭 Outside diff range comments (2)
packages/nestjs/src/index.ts (2)

1-319: 🧹 Nitpick (assertive)

Ensure a corresponding changeset is present for this new feature, and link a Linear issue.

Since this is a new feature in the @graphql-hive/nestjs package, it should include a changeset with a minor semver bump (rather than patch). Additionally, we do not see any mention of a "GW-*" Linear issue in the PR description. Please link the relevant Linear ticket or create one if none exists.

Would you like me to open a follow-up issue or provide a script to confirm the presence of a “GW-*” reference in the PR description?

🧰 Tools
🪛 Biome (1.9.4)

[error] 48-50: This constructor is unnecessary.

Unsafe fix: Remove the unnecessary constructor.

(lint/complexity/noUselessConstructor)


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

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

(lint/complexity/noBannedTypes)


[error] 243-243: Reassigning a function parameter is confusing.

The parameter is declared here:

Use a local variable instead.

(lint/style/noParameterAssign)


[error] 245-245: Use Number.POSITIVE_INFINITY instead of the equivalent global.

ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.POSITIVE_INFINITY instead.

(lint/style/useNumberNamespace)

🪛 GitHub Check: Types

[failure] 85-85:
Argument of type 'boolean | undefined' is not assignable to parameter of type 'boolean'.


1-319: 🧹 Nitpick (assertive)

Consider adding documentation in the console project.

Because a new feature is introduced, it’s typically required to add or update relevant documentation in the graphql-hive/console repository. This ensures end users understand how to configure and use the Hive Gateway Driver for NestJS.

Shall I open a new issue in graphql-hive/console to track adding documentation for the Hive Gateway Driver for NestJS?

🧰 Tools
🪛 Biome (1.9.4)

[error] 48-50: This constructor is unnecessary.

Unsafe fix: Remove the unnecessary constructor.

(lint/complexity/noUselessConstructor)


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

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

(lint/complexity/noBannedTypes)


[error] 243-243: Reassigning a function parameter is confusing.

The parameter is declared here:

Use a local variable instead.

(lint/style/noParameterAssign)


[error] 245-245: Use Number.POSITIVE_INFINITY instead of the equivalent global.

ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.POSITIVE_INFINITY instead.

(lint/style/useNumberNamespace)

🪛 GitHub Check: Types

[failure] 85-85:
Argument of type 'boolean | undefined' is not assignable to parameter of type 'boolean'.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3bb2443 and da7e5e5.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (12)
  • .changeset/sixty-camels-design.md (1 hunks)
  • e2e/nestjs/nest-cli.json (1 hunks)
  • e2e/nestjs/nestjs.e2e.ts (1 hunks)
  • e2e/nestjs/package.json (1 hunks)
  • e2e/nestjs/src/app.module.ts (1 hunks)
  • e2e/nestjs/src/app.service.ts (1 hunks)
  • e2e/nestjs/src/main.ts (1 hunks)
  • e2e/nestjs/tsconfig.build.json (1 hunks)
  • e2e/nestjs/tsconfig.json (1 hunks)
  • packages/nestjs/package.json (1 hunks)
  • packages/nestjs/src/index.ts (1 hunks)
  • tsconfig.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
`e2e/**`: This directory includes end-to-end tests for the g...

e2e/**: This directory includes end-to-end tests for the gateway.
The examples directory is generated based on the code in this directory.

  • e2e/nestjs/tsconfig.build.json
  • e2e/nestjs/nest-cli.json
  • e2e/nestjs/package.json
  • e2e/nestjs/src/app.service.ts
  • e2e/nestjs/src/main.ts
  • e2e/nestjs/tsconfig.json
  • e2e/nestjs/src/app.module.ts
  • e2e/nestjs/nestjs.e2e.ts
`**`: For all PRs, we would like to verify that a Linear iss...

**: For all PRs, we would like to verify that a Linear issue is linked. Check if there's a mention for "GW-*" in the PR description, and the us know when it's missing.

In most cases, when a PR adds a new functionality, we would like to make sure it has documentation in the corresponding console project.
Use the global knowledge feature to search for PRs in graphql-hive/console repository that adds documentation. Suggest to create a follow up issue to add the missing documentation.

  • e2e/nestjs/tsconfig.build.json
  • e2e/nestjs/nest-cli.json
  • e2e/nestjs/package.json
  • e2e/nestjs/src/app.service.ts
  • e2e/nestjs/src/main.ts
  • tsconfig.json
  • e2e/nestjs/tsconfig.json
  • e2e/nestjs/src/app.module.ts
  • e2e/nestjs/nestjs.e2e.ts
  • packages/nestjs/src/index.ts
  • packages/nestjs/package.json
`packages/**`: In this directory we keep all packages releva...

packages/**: In this directory we keep all packages relevant to the gateway.

In most cases, when changes are made to the source code / dependencies in these directories, we also require to have a corresponding changeset file, created using yarn changeset with a full description on the changes with an example.
Also, when new features are added the packages, the changeset file should mention minor semver change. When a bug is fixed, patch needs to be used. The major bump is used for a PR that has breaking changes.

  • packages/nestjs/src/index.ts
  • packages/nestjs/package.json
🪛 GitHub Check: Types
e2e/nestjs/nestjs.e2e.ts

[failure] 16-16:
'nest' is declared but its value is never read.


[failure] 16-16:
'waitForExit' is declared but its value is never read.

packages/nestjs/src/index.ts

[failure] 85-85:
Argument of type 'boolean | undefined' is not assignable to parameter of type 'boolean'.

🪛 Biome (1.9.4)
packages/nestjs/src/index.ts

[error] 48-50: This constructor is unnecessary.

Unsafe fix: Remove the unnecessary constructor.

(lint/complexity/noUselessConstructor)


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

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

(lint/complexity/noBannedTypes)


[error] 243-243: Reassigning a function parameter is confusing.

The parameter is declared here:

Use a local variable instead.

(lint/style/noParameterAssign)


[error] 245-245: Use Number.POSITIVE_INFINITY instead of the equivalent global.

ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.POSITIVE_INFINITY instead.

(lint/style/useNumberNamespace)

⏰ Context from checks skipped due to timeout of 90000ms (27)
  • GitHub Check: E2E / Bun Docker on Ubuntu
  • GitHub Check: E2E / Bun on Ubuntu
  • GitHub Check: E2E / Node Binary on Windows
  • GitHub Check: E2E / Node Binary on Ubuntu
  • GitHub Check: E2E / Node Docker on Ubuntu
  • GitHub Check: Leaks / Node v23
  • GitHub Check: E2E / Node 23 on Ubuntu
  • GitHub Check: Leaks / Node v22
  • GitHub Check: Leaks / Node v20
  • GitHub Check: E2E / Node 22 on Ubuntu
  • GitHub Check: Leaks / Node v18
  • GitHub Check: E2E / Node 20 on Ubuntu
  • GitHub Check: Benchmark / bun / 1000 items
  • GitHub Check: Unit / Bun
  • GitHub Check: Benchmark / bun / 100 items
  • GitHub Check: E2E / Node 18 on Ubuntu
  • GitHub Check: Build
  • GitHub Check: Unit / Node v23
  • GitHub Check: Benchmark / bun / 10 items
  • GitHub Check: Bundle
  • GitHub Check: Unit / Node v22
  • GitHub Check: Benchmark / node / 1000 items
  • GitHub Check: Benchmark / node / 100 items
  • GitHub Check: Unit / Node v20
  • GitHub Check: Benchmark / node / 10 items
  • GitHub Check: Unit / Node v18
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (7)
e2e/nestjs/src/app.service.ts (1)

3-8: Implementation looks good.

The getHello method is straightforward and relies on NestJS dependency injection. Consider adding a unit test for this service or expanding the content to reflect real-world usage in an example if needed.

e2e/nestjs/src/main.ts (1)

4-11: Bootstrap logic is clear and standard.

This entry point follows NestJS conventions. No issues found with the error handling approach, although you could optionally log more contextual errors (e.g., environment details) if needed.

e2e/nestjs/src/app.module.ts (1)

11-13:

❓ Verification inconclusive

Consider validating the supergraph path.

The supergraph path is loaded from an environment variable with a fallback, but there's no validation to ensure the file exists. Consider adding validation during module initialization.


🏁 Script executed:

#!/bin/bash
# Check if the default supergraph file exists in the e2e/nestjs directory
fd -t f "supergraph.graphql" "e2e/nestjs"

Length of output: 39


Action Required: Validate the Supergraph File Existence During Module Initialization

The current code sets the supergraph path from an environment variable or falls back to the relative path ('./supergraph.graphql'), but there’s no runtime check to confirm that the file exists. Automated verification using fd in the e2e/nestjs directory didn’t return any results, so please manually verify whether the file exists in the expected location. If it is missing, adding a file existence check (for example, using Node’s fs.existsSync during module initialization) would help avoid runtime errors.

  • Ensure that if process.env['SUPERGRAPH'] is not provided, the module checks that ./supergraph.graphql exists.
  • If the file is not found, consider logging an error message or throwing an exception during startup.
e2e/nestjs/tsconfig.build.json (1)

1-4: LGTM!

The TypeScript build configuration follows best practices by extending the base config and properly excluding test files and build artifacts.

e2e/nestjs/nest-cli.json (1)

1-8: LGTM! Standard NestJS CLI configuration.

The configuration follows NestJS best practices with proper schema validation and compiler options.

packages/nestjs/package.json (1)

2-4: Update version from 0.0.0 before release.

The version 0.0.0 indicates the package is not ready for release. Update to an appropriate version (e.g., 0.1.0 for initial release).

tsconfig.json (1)

63-66: LGTM! Path mappings are correctly configured.

The new path mapping for @graphql-hive/nestjs and reformatted mapping for @graphql-hive/logger-winston are properly configured.

packages/nestjs/src/index.ts Outdated Show resolved Hide resolved
const strs: string[] = [];
args = args
.flatMap((arg) => (typeof arg === 'function' ? arg() : arg))
.flat(Infinity);
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Use Number.POSITIVE_INFINITY instead of the global Infinity.

For consistency and clarity in modern JavaScript/TypeScript, prefer Number.POSITIVE_INFINITY.

-.flat(Infinity);
+.flat(Number.POSITIVE_INFINITY);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.flat(Infinity);
.flat(Number.POSITIVE_INFINITY);
🧰 Tools
🪛 Biome (1.9.4)

[error] 245-245: Use Number.POSITIVE_INFINITY instead of the equivalent global.

ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.POSITIVE_INFINITY instead.

(lint/style/useNumberNamespace)

packages/nestjs/src/index.ts Outdated Show resolved Hide resolved
packages/nestjs/src/index.ts Outdated Show resolved Hide resolved
packages/nestjs/src/index.ts Outdated Show resolved Hide resolved
e2e/nestjs/nestjs.e2e.ts Outdated Show resolved Hide resolved
e2e/nestjs/nestjs.e2e.ts Outdated Show resolved Hide resolved
.changeset/sixty-camels-design.md Outdated Show resolved Hide resolved
e2e/nestjs/tsconfig.json Outdated Show resolved Hide resolved
e2e/nestjs/package.json Outdated Show resolved Hide resolved
Copy link

@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: 4

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bf73461 and ca8c777.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (12)
  • .changeset/sixty-camels-design.md (1 hunks)
  • e2e/nestjs/nest-cli.json (1 hunks)
  • e2e/nestjs/nestjs.e2e.ts (1 hunks)
  • e2e/nestjs/package.json (1 hunks)
  • e2e/nestjs/src/app.module.ts (1 hunks)
  • e2e/nestjs/src/app.service.ts (1 hunks)
  • e2e/nestjs/src/main.ts (1 hunks)
  • e2e/nestjs/tsconfig.build.json (1 hunks)
  • e2e/nestjs/tsconfig.json (1 hunks)
  • packages/nestjs/package.json (1 hunks)
  • packages/nestjs/src/index.ts (1 hunks)
  • tsconfig.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
`e2e/**`: This directory includes end-to-end tests for the g...

e2e/**: This directory includes end-to-end tests for the gateway.
The examples directory is generated based on the code in this directory.

  • e2e/nestjs/tsconfig.build.json
  • e2e/nestjs/nest-cli.json
  • e2e/nestjs/src/app.service.ts
  • e2e/nestjs/tsconfig.json
  • e2e/nestjs/src/app.module.ts
  • e2e/nestjs/package.json
  • e2e/nestjs/nestjs.e2e.ts
  • e2e/nestjs/src/main.ts
`**`: For all PRs, we would like to verify that a Linear iss...

**: For all PRs, we would like to verify that a Linear issue is linked. Check if there's a mention for "GW-*" in the PR description, and the us know when it's missing.

In most cases, when a PR adds a new functionality, we would like to make sure it has documentation in the corresponding console project.
Use the global knowledge feature to search for PRs in graphql-hive/console repository that adds documentation. Suggest to create a follow up issue to add the missing documentation.

  • e2e/nestjs/tsconfig.build.json
  • e2e/nestjs/nest-cli.json
  • e2e/nestjs/src/app.service.ts
  • e2e/nestjs/tsconfig.json
  • e2e/nestjs/src/app.module.ts
  • e2e/nestjs/package.json
  • tsconfig.json
  • e2e/nestjs/nestjs.e2e.ts
  • packages/nestjs/src/index.ts
  • packages/nestjs/package.json
  • e2e/nestjs/src/main.ts
`packages/**`: In this directory we keep all packages releva...

packages/**: In this directory we keep all packages relevant to the gateway.

In most cases, when changes are made to the source code / dependencies in these directories, we also require to have a corresponding changeset file, created using yarn changeset with a full description on the changes with an example.
Also, when new features are added the packages, the changeset file should mention minor semver change. When a bug is fixed, patch needs to be used. The major bump is used for a PR that has breaking changes.

  • packages/nestjs/src/index.ts
  • packages/nestjs/package.json
🪛 GitHub Check: Types
e2e/nestjs/nestjs.e2e.ts

[failure] 16-16:
'nest' is declared but its value is never read.


[failure] 16-16:
'waitForExit' is declared but its value is never read.

packages/nestjs/src/index.ts

[failure] 85-85:
Argument of type 'boolean | undefined' is not assignable to parameter of type 'boolean'.

🪛 Biome (1.9.4)
packages/nestjs/src/index.ts

[error] 48-50: This constructor is unnecessary.

Unsafe fix: Remove the unnecessary constructor.

(lint/complexity/noUselessConstructor)


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

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

(lint/complexity/noBannedTypes)


[error] 243-243: Reassigning a function parameter is confusing.

The parameter is declared here:

Use a local variable instead.

(lint/style/noParameterAssign)


[error] 245-245: Use Number.POSITIVE_INFINITY instead of the equivalent global.

ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.POSITIVE_INFINITY instead.

(lint/style/useNumberNamespace)

⏰ Context from checks skipped due to timeout of 90000ms (27)
  • GitHub Check: E2E / Bun Docker on Ubuntu
  • GitHub Check: E2E / Bun on Ubuntu
  • GitHub Check: E2E / Node Binary on Windows
  • GitHub Check: E2E / Node Binary on Ubuntu
  • GitHub Check: Unit / Node v23
  • GitHub Check: E2E / Node Docker on Ubuntu
  • GitHub Check: Unit / Node v22
  • GitHub Check: E2E / Node 23 on Ubuntu
  • GitHub Check: Leaks / Node v23
  • GitHub Check: Unit / Node v20
  • GitHub Check: E2E / Node 22 on Ubuntu
  • GitHub Check: Benchmark / bun / 1000 items
  • GitHub Check: Leaks / Node v22
  • GitHub Check: Benchmark / bun / 100 items
  • GitHub Check: E2E / Node 20 on Ubuntu
  • GitHub Check: Bundle
  • GitHub Check: E2E / Node 18 on Ubuntu
  • GitHub Check: Benchmark / bun / 10 items
  • GitHub Check: Unit / Node v18
  • GitHub Check: Benchmark / node / 1000 items
  • GitHub Check: Build
  • GitHub Check: Leaks / Node v20
  • GitHub Check: Benchmark / node / 100 items
  • GitHub Check: Unit / Bun
  • GitHub Check: Benchmark / node / 10 items
  • GitHub Check: Leaks / Node v18
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (16)
packages/nestjs/src/index.ts (7)

1-319: Ensure a corresponding changeset file for the new package code.

Since this file is part of packages/, a changeset file is required to describe the new functionality and determine the correct version bump (likely a minor bump). Please create one with yarn changeset if not already present in this PR.

🧰 Tools
🪛 Biome (1.9.4)

[error] 48-50: This constructor is unnecessary.

Unsafe fix: Remove the unnecessary constructor.

(lint/complexity/noUselessConstructor)


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

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

(lint/complexity/noBannedTypes)


[error] 243-243: Reassigning a function parameter is confusing.

The parameter is declared here:

Use a local variable instead.

(lint/style/noParameterAssign)


[error] 245-245: Use Number.POSITIVE_INFINITY instead of the equivalent global.

ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.POSITIVE_INFINITY instead.

(lint/style/useNumberNamespace)

🪛 GitHub Check: Types

[failure] 85-85:
Argument of type 'boolean | undefined' is not assignable to parameter of type 'boolean'.


28-28: Avoid using '{}' as a type.

This is the same feedback provided previously. Replace '{}' with Record<string, unknown> or a more precise shape to avoid inadvertently allowing all non-nullish values.

🧰 Tools
🪛 Biome (1.9.4)

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

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

(lint/complexity/noBannedTypes)


48-50: Remove the unnecessary constructor.

This constructor calls super() but otherwise doesn't add any logic. It can be safely removed for cleaner code.

🧰 Tools
🪛 Biome (1.9.4)

[error] 48-50: This constructor is unnecessary.

Unsafe fix: Remove the unnecessary constructor.

(lint/complexity/noUselessConstructor)


52-195: Implementation of the start method looks well-structured.

The method properly sets up additional type definitions and resolvers, initializes context plugins, handles multiple ways of configuring subscriptions, and gracefully integrates with Express or Fastify. Good job!

🧰 Tools
🪛 GitHub Check: Types

[failure] 85-85:
Argument of type 'boolean | undefined' is not assignable to parameter of type 'boolean'.


85-85: Fix the type of options.debug.

Coercing options.debug to a boolean (e.g., !!options.debug) or defaulting it to false will avoid type errors where a strictly boolean parameter is expected.

🧰 Tools
🪛 GitHub Check: Types

[failure] 85-85:
Argument of type 'boolean | undefined' is not assignable to parameter of type 'boolean'.


243-243: Avoid reassigning a function parameter.

Use a local variable instead of reassigning args to improve clarity and ensure the original reference remains intact.

🧰 Tools
🪛 Biome (1.9.4)

[error] 243-243: Reassigning a function parameter is confusing.

The parameter is declared here:

Use a local variable instead.

(lint/style/noParameterAssign)


245-245: Use Number.POSITIVE_INFINITY instead of Infinity.

ES2015 encourages using Number.POSITIVE_INFINITY for consistency across the codebase.

🧰 Tools
🪛 Biome (1.9.4)

[error] 245-245: Use Number.POSITIVE_INFINITY instead of the equivalent global.

ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.POSITIVE_INFINITY instead.

(lint/style/useNumberNamespace)

e2e/nestjs/nestjs.e2e.ts (2)

16-22: Add cleanup after test completion.

The test spawns a NestJS server but doesn't clean it up after the test. Consider using the waitForExit function in an afterAll or afterEach block to ensure proper cleanup.

🧰 Tools
🪛 GitHub Check: Types

[failure] 16-16:
'nest' is declared but its value is never read.


[failure] 16-16:
'waitForExit' is declared but its value is never read.


16-16: Address unused variables from destructuring.

The nest variable is declared but never used. Consider removing it if not needed.

🧰 Tools
🪛 GitHub Check: Types

[failure] 16-16:
'nest' is declared but its value is never read.


[failure] 16-16:
'waitForExit' is declared but its value is never read.

.changeset/sixty-camels-design.md (1)

5-5: Enhance the changeset description.

The current description is too brief. Consider adding more details about:

  • What the NestJS driver does
  • Key features or capabilities
  • Any breaking changes or important notes
e2e/nestjs/tsconfig.build.json (1)

1-4: LGTM!

The TypeScript build configuration follows best practices by:

  • Extending the base configuration
  • Properly excluding test files and build artifacts
e2e/nestjs/nest-cli.json (1)

1-8: LGTM!

The NestJS CLI configuration follows best practices with proper schema validation and compiler options.

e2e/nestjs/tsconfig.json (1)

17-19: Consider enabling strict TypeScript checks.

Disabled strict checks could allow type-related bugs to slip through. Consider enabling them for better type safety.

e2e/nestjs/package.json (1)

13-21: Consider pinning dependency versions for stability.

Using caret ranges for critical dependencies could lead to unexpected behavior in CI.

packages/nestjs/package.json (1)

1-61: Missing changeset file for package changes.

According to coding guidelines, a changeset file created using yarn changeset is required for package changes.

tsconfig.json (1)

63-66: LGTM!

The path mappings follow the existing pattern and are correctly configured.

e2e/nestjs/src/main.ts Outdated Show resolved Hide resolved
e2e/nestjs/src/app.module.ts Outdated Show resolved Hide resolved
e2e/nestjs/src/app.service.ts Outdated Show resolved Hide resolved
packages/nestjs/package.json Outdated Show resolved Hide resolved
@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 14, 2025

🚀 Snapshot Release (alpha)

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

Package Version Info
@graphql-hive/gateway 1.10.3-alpha-b49673d6fafd3ac008e225ad198155c7cfb8f8fc npm ↗︎ unpkg ↗︎
@graphql-hive/nestjs 0.0.1-alpha-b49673d6fafd3ac008e225ad198155c7cfb8f8fc npm ↗︎ unpkg ↗︎

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 14, 2025

🚀 Snapshot Release (Binary for Linux-X64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 14, 2025

🚀 Snapshot Release (Binary for macOS-ARM64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

Copy link

@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: 3

🔭 Outside diff range comments (1)
e2e/nestjs/src/main.ts (1)

1-19: 🧹 Nitpick (assertive)

Graceful shutdown and port usage are well-handled.
You might also consider handling SIGINT in addition to SIGTERM if you want consistent local termination handling. Otherwise, this approach appears solid.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ca8c777 and 229345d.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (9)
  • .changeset/sixty-camels-design.md (1 hunks)
  • e2e/nestjs/.gitignore (1 hunks)
  • e2e/nestjs/nestjs.e2e.ts (1 hunks)
  • e2e/nestjs/package.json (1 hunks)
  • e2e/nestjs/src/main.ts (1 hunks)
  • e2e/nestjs/tsconfig.json (1 hunks)
  • packages/nestjs/package.json (1 hunks)
  • packages/nestjs/src/index.ts (1 hunks)
  • tsconfig.json (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
`e2e/**`: This directory includes end-to-end tests for the g...

e2e/**: This directory includes end-to-end tests for the gateway.
The examples directory is generated based on the code in this directory.

  • e2e/nestjs/package.json
  • e2e/nestjs/src/main.ts
  • e2e/nestjs/tsconfig.json
  • e2e/nestjs/nestjs.e2e.ts
`**`: For all PRs, we would like to verify that a Linear iss...

**: For all PRs, we would like to verify that a Linear issue is linked. Check if there's a mention for "GW-*" in the PR description, and the us know when it's missing.

In most cases, when a PR adds a new functionality, we would like to make sure it has documentation in the corresponding console project.
Use the global knowledge feature to search for PRs in graphql-hive/console repository that adds documentation. Suggest to create a follow up issue to add the missing documentation.

  • e2e/nestjs/package.json
  • e2e/nestjs/src/main.ts
  • e2e/nestjs/tsconfig.json
  • tsconfig.json
  • e2e/nestjs/nestjs.e2e.ts
  • packages/nestjs/src/index.ts
  • packages/nestjs/package.json
`packages/**`: In this directory we keep all packages releva...

packages/**: In this directory we keep all packages relevant to the gateway.

In most cases, when changes are made to the source code / dependencies in these directories, we also require to have a corresponding changeset file, created using yarn changeset with a full description on the changes with an example.
Also, when new features are added the packages, the changeset file should mention minor semver change. When a bug is fixed, patch needs to be used. The major bump is used for a PR that has breaking changes.

  • packages/nestjs/src/index.ts
  • packages/nestjs/package.json
🧠 Learnings (1)
e2e/nestjs/package.json (1)
Learnt from: ardatan
PR: graphql-hive/gateway#667
File: e2e/nestjs/package.json:13-21
Timestamp: 2025-02-14T13:52:33.387Z
Learning: In example and e2e test projects within the repository, using caret ranges (^) for dependencies is preferred to demonstrate compatibility across different versions.
⏰ Context from checks skipped due to timeout of 90000ms (31)
  • GitHub Check: Examples / Inspect head commit
  • GitHub Check: Binary built on macos-14
  • GitHub Check: Bun Docker image
  • GitHub Check: Binary built on macos-13
  • GitHub Check: Node Docker image
  • GitHub Check: Binary built on ubuntu-latest
  • GitHub Check: E2E / Bun Docker on Ubuntu
  • GitHub Check: E2E / Bun on Ubuntu
  • GitHub Check: Unit / Bun
  • GitHub Check: E2E / Node Binary on Windows
  • GitHub Check: E2E / Node Binary on Ubuntu
  • GitHub Check: E2E / Node Docker on Ubuntu
  • GitHub Check: E2E / Node 23 on Ubuntu
  • GitHub Check: E2E / Node 22 on Ubuntu
  • GitHub Check: Unit / Node v23
  • GitHub Check: Leaks / Node v23
  • GitHub Check: E2E / Node 20 on Ubuntu
  • GitHub Check: Unit / Node v22
  • GitHub Check: Leaks / Node v22
  • GitHub Check: Benchmark / bun / 1000 items
  • GitHub Check: Benchmark / bun / 100 items
  • GitHub Check: Benchmark / bun / 10 items
  • GitHub Check: E2E / Node 18 on Ubuntu
  • GitHub Check: Benchmark / node / 1000 items
  • GitHub Check: Build
  • GitHub Check: Leaks / Node v20
  • GitHub Check: Benchmark / node / 100 items
  • GitHub Check: Bundle
  • GitHub Check: Benchmark / node / 10 items
  • GitHub Check: Leaks / Node v18
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (15)
packages/nestjs/src/index.ts (6)

1-27: Overall imports look good.
No immediate concerns with the imports or type references. Everything appears consistent with NestJS and the Hive Gateway runtime packages.


42-45: File is in packages/**: verify presence of a changeset.
This file introduces a new driver in the packages/nestjs directory. Please confirm that a .changeset file describing these changes has been added, as per the repository guidelines.


194-197: Graceful stopping logic looks appropriate.
This ensures subscription services and the gateway runtime are properly disposed of. Nicely done.


199-225: Express & Fastify registration are straightforward.
The routing logic for Express and Fastify is correct. The approach to pass the request/response into handleNodeRequestAndResponse is well-structured.


228-315: Logger adapter is well-implemented.
Your approach to flatten arguments and differentiate between string vs. object outputs is a clear pattern for structured logging.


317-323: Helper function for truthy checks is well thought out.
This utility method covers common truthy variants effectively.

e2e/nestjs/nestjs.e2e.ts (1)

13-35: Add cleanup after test completion.
This test spawns a NestJS process but does not shut it down after the test, potentially leaving behind a running server. Consider using a teardown hook or waiting for exit.

 afterAll(async () => {
-  // ...
+  // Ensure server is closed after test completion:
+  await waitForExit();
 });
e2e/nestjs/.gitignore (1)

1-1: LGTM!

Appropriate configuration to ignore build artifacts.

.changeset/sixty-camels-design.md (1)

5-7: Enhance the changeset description.

The current description is too brief. Consider adding more details about:

  • What the NestJS driver does
  • Key features or capabilities
  • Any breaking changes or important notes
e2e/nestjs/tsconfig.json (1)

1-21: LGTM!

The TypeScript configuration follows best practices with strict type checking enabled and appropriate settings for a NestJS application.

e2e/nestjs/package.json (1)

13-20: LGTM!

Dependencies use caret ranges, which is appropriate for example projects to demonstrate compatibility across versions.

packages/nestjs/package.json (1)

1-64: Action Required: Missing Documentation for NestJS Driver

The verification script did not return any open PRs for documentation related to the NestJS driver in the graphql-hive/console repository. This confirms that no corresponding documentation PR is currently present.

#!/bin/bash
# Search for documentation PR in graphql-hive/console repository
gh search prs --repo graphql-hive/console --state open --json title,url \
  --jq '.[] | select(.title | contains("NestJS") or contains("Nest.js") or contains("nest"))'
tsconfig.json (3)

63-66: LGTM!

The path mappings are correctly configured:

  • Reformatted @graphql-hive/logger-winston for consistency
  • Added new @graphql-hive/nestjs mapping following the established pattern

87-89: LGTM!

The exclude patterns are appropriate:

  • Added trailing comma for better maintainability
  • Excluded build artifacts (dist) and local/temporary files (ignored-hidden)

1-91:

❓ Verification inconclusive

Documentation needed for the NestJS driver feature.

The PR description mentions that documentation is missing. Since this is a new feature (NestJS driver), documentation should be added to help users understand and implement it correctly.

Let's check if there's a documentation PR in the console repository:

Please create a follow-up issue to add documentation for the NestJS driver feature in the console repository.


🏁 Script executed:

#!/bin/bash
# Search for PRs in graphql-hive/console repository that might contain NestJS documentation
gh search prs --repo graphql-hive/console "nestjs in:title,body" --state all --json title,url

Length of output: 3412


Documentation missing for NestJS driver feature – please add it.

The PR description indicates that documentation is absent. Our initial attempt to locate any existing NestJS-related documentation in the console repository was inconclusive due to an invalid search parameter (using --state all). It’s likely that no documentation has been added yet. Please verify manually if any NestJS documentation exists in the console repo and, if not, create a follow-up issue to add the necessary documentation for the NestJS driver feature.

packages/nestjs/src/index.ts Show resolved Hide resolved
packages/nestjs/src/index.ts Show resolved Hide resolved
.changeset/sixty-camels-design.md Show resolved Hide resolved
@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 14, 2025

🚀 Snapshot Release (Bun Docker Image)

The latest changes of this PR are available as image on GitHub Container Registry (based on the declared changesets):

ghcr.io/graphql-hive/gateway:1.10.3-alpha-b49673d6fafd3ac008e225ad198155c7cfb8f8fc-bun

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 14, 2025

🚀 Snapshot Release (Node Docker Image)

The latest changes of this PR are available as image on GitHub Container Registry (based on the declared changesets):

ghcr.io/graphql-hive/gateway:1.10.3-alpha-b49673d6fafd3ac008e225ad198155c7cfb8f8fc

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 14, 2025

🚀 Snapshot Release (Binary for macOS-X64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 14, 2025

🚀 Snapshot Release (Binary for Windows-X64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

Copy link

@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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 229345d and 83cf7eb.

📒 Files selected for processing (5)
  • e2e/nestjs/nestjs.e2e.ts (1 hunks)
  • e2e/nestjs/package.json (1 hunks)
  • e2e/nestjs/services/nestjs/app.module.ts (1 hunks)
  • e2e/nestjs/services/nestjs/index.ts (1 hunks)
  • internal/e2e/src/tenv.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`e2e/**`: This directory includes end-to-end tests for the g...

e2e/**: This directory includes end-to-end tests for the gateway.
The examples directory is generated based on the code in this directory.

  • e2e/nestjs/package.json
  • e2e/nestjs/services/nestjs/index.ts
  • e2e/nestjs/services/nestjs/app.module.ts
  • e2e/nestjs/nestjs.e2e.ts
`**`: For all PRs, we would like to verify that a Linear iss...

**: For all PRs, we would like to verify that a Linear issue is linked. Check if there's a mention for "GW-*" in the PR description, and the us know when it's missing.

In most cases, when a PR adds a new functionality, we would like to make sure it has documentation in the corresponding console project.
Use the global knowledge feature to search for PRs in graphql-hive/console repository that adds documentation. Suggest to create a follow up issue to add the missing documentation.

  • e2e/nestjs/package.json
  • e2e/nestjs/services/nestjs/index.ts
  • e2e/nestjs/services/nestjs/app.module.ts
  • internal/e2e/src/tenv.ts
  • e2e/nestjs/nestjs.e2e.ts
🧠 Learnings (1)
e2e/nestjs/package.json (1)
Learnt from: ardatan
PR: graphql-hive/gateway#667
File: e2e/nestjs/package.json:13-21
Timestamp: 2025-02-14T13:52:33.387Z
Learning: In example and e2e test projects within the repository, using caret ranges (^) for dependencies is preferred to demonstrate compatibility across different versions.
⏰ Context from checks skipped due to timeout of 90000ms (33)
  • GitHub Check: Examples / Inspect head commit
  • GitHub Check: Binary built on ubuntu-24.04-arm
  • GitHub Check: Binary built on macos-14
  • GitHub Check: Binary built on macos-13
  • GitHub Check: Bun Docker image
  • GitHub Check: Binary built on ubuntu-latest
  • GitHub Check: Node Docker image
  • GitHub Check: E2E / Bun Docker on Ubuntu
  • GitHub Check: E2E / Bun on Ubuntu
  • GitHub Check: E2E / Node Binary on Windows
  • GitHub Check: Unit / Bun
  • GitHub Check: E2E / Node Binary on Ubuntu
  • GitHub Check: Leaks / Node v23
  • GitHub Check: E2E / Node Docker on Ubuntu
  • GitHub Check: Unit / Node v23
  • GitHub Check: E2E / Node 23 on Ubuntu
  • GitHub Check: Leaks / Node v22
  • GitHub Check: Unit / Node v22
  • GitHub Check: E2E / Node 22 on Ubuntu
  • GitHub Check: Benchmark / bun / 1000 items
  • GitHub Check: Unit / Node v18
  • GitHub Check: Benchmark / bun / 100 items
  • GitHub Check: Leaks / Node v20
  • GitHub Check: Benchmark / bun / 10 items
  • GitHub Check: E2E / Node 20 on Ubuntu
  • GitHub Check: Benchmark / node / 1000 items
  • GitHub Check: Leaks / Node v18
  • GitHub Check: Bundle
  • GitHub Check: Benchmark / node / 100 items
  • GitHub Check: Build
  • GitHub Check: E2E / Node 18 on Ubuntu
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Benchmark / node / 10 items
🔇 Additional comments (8)
e2e/nestjs/services/nestjs/app.module.ts (1)

1-20: LGTM!

The module configuration is well-structured and correctly integrates the HiveGatewayDriver with NestJS. The supergraph configuration is properly handled using the Opts utility.

e2e/nestjs/services/nestjs/index.ts (1)

1-22: LGTM!

The bootstrap implementation is robust with proper error handling and graceful shutdown support.

e2e/nestjs/nestjs.e2e.ts (2)

9-26: LGTM!

The test implementation is well-structured and correctly validates the GraphQL functionality.


19-22: Add cleanup and address unused variables.

  1. Add cleanup after test completion to ensure proper resource management.
  2. The nest variable is declared but never used.

Apply this diff to fix the issues:

 bootstrap().catch((e) => {
   console.error(e);
   process.exit(1);
 });
+
+afterEach(async () => {
+  await waitForExit();
+});

And:

-const [nest, waitForExit] = await spawn('yarn nest', {
+const [, waitForExit] = await spawn('yarn nest', {
internal/e2e/src/tenv.ts (1)

687-707: LGTM!

The environment variable handling is correctly implemented in both service and container methods.

e2e/nestjs/package.json (3)

1-4: LGTM!

The package metadata is well-structured with appropriate name, version, and private flag for an e2e test package.


5-13: LGTM! Versioning strategy aligns with project preferences.

The use of caret ranges for dependencies is appropriate here as this is an e2e test project meant to demonstrate compatibility across versions.


14-31: LGTM! Development dependencies are well configured.

The devDependencies include all necessary tools for building, testing, and development with appropriate versions.

e2e/nestjs/package.json Outdated Show resolved Hide resolved
@theguild-bot
Copy link
Collaborator

🚀 Snapshot Release (Binary for Linux-ARM64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

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.

2 participants