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

Add methods to bull #151

Merged
merged 2 commits into from
Jan 7, 2025
Merged

Add methods to bull #151

merged 2 commits into from
Jan 7, 2025

Conversation

Ryiguchi
Copy link
Contributor

@Ryiguchi Ryiguchi commented Jan 7, 2025

Summary by CodeRabbit

  • New Features

    • Added getDelayed method to ZembleQueueMock for retrieving delayed queue items
  • Refactor

    • Removed JSONObject scalar type from Apple push notifications GraphQL schema
    • Simplified Expo push notifications GraphQL schema by removing Query and Subscription types
  • Bug Fixes

    • Updated GraphQL schema argument requirements for Apple live activity push token registration

Copy link

changeset-bot bot commented Jan 7, 2025

🦋 Changeset detected

Latest commit: 4e01909

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@zemble/bull Patch
@zemble/ignite Patch
minimal Patch
supplement-stack Patch
todo-app-with-auth-backend Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

coderabbitai bot commented Jan 7, 2025

Walkthrough

This pull request introduces several modifications across different packages. In the Bull package, a new getDelayed method is added to the ZembleQueueMock class, enhancing queue mocking capabilities. The Apple Push and Expo Push packages see significant GraphQL schema changes, with the removal of specific scalar types, mutation fields, query, and subscription types. These changes appear to be part of a schema refinement process, simplifying the GraphQL interface by removing previously defined types and resolvers.

Changes

File Change Summary
.changeset/dry-owls-applaud.md Added new method getDelayed documentation
packages/bull/ZembleQueueMock.ts - Added getDelayed method to ZembleQueueMock class
- Updated IZembleQueue interface with getDelayed method signature
packages/push-apple/graphql/schema.generated.ts - Removed JSONObject scalar type
- Updated MutationRegisterAppleUpdateLiveActivityPushTokenArgs
packages/push-expo/graphql/schema.generated.ts - Removed randomNumber mutation field
- Deleted entire Query and Subscription types
- Removed hello, countdown, randomNumber, and tick fields
- Updated resolvers to remove related references

Poem

🐰 Queues and schemas dance and sway,
Mocking methods find their way,
GraphQL types take flight and flee,
Simplicity sets the structure free!
Code evolves with rabbit's might! 🚀


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

pkg-pr-new bot commented Jan 7, 2025

Open in Stackblitz

@zemble/auth-anonymous

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/auth-anonymous@151

@zemble/auth

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/auth@151

@zemble/auth-api-token

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/auth-api-token@151

@zemble/auth-apple

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/auth-apple@151

@zemble/auth-otp

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/auth-otp@151

@zemble/bull

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/bull@151

@zemble/bun

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/bun@151

@zemble/core

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/core@151

create-zemble-app

npm i https://pkg.pr.new/kingstinct/zemble/create-zemble-app@151

create-zemble-plugin

npm i https://pkg.pr.new/kingstinct/zemble/create-zemble-plugin@151

@zemble/debug

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/debug@151

@zemble/email-resend

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/email-resend@151

@zemble/email-sendgrid

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/email-sendgrid@151

eslint-config-kingstinct

npm i https://pkg.pr.new/kingstinct/zemble/eslint-config-kingstinct@151

@zemble/firebase-auth

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/firebase-auth@151

@zemble/graphql

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/graphql@151

@zemble/kv

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/kv@151

@zemble/migrations

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/migrations@151

@zemble/mongodb

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/mongodb@151

@zemble/node

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/node@151

@zemble/pino

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/pino@151

@zemble/push-apple

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/push-apple@151

@zemble/push-expo

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/push-expo@151

@zemble/routes

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/routes@151

@zemble/react

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/react@151

@zemble/sms-46elks

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/sms-46elks@151

@zemble/sms-twilio

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/sms-twilio@151

@zemble/supabase

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/supabase@151

@zemble/utils

npm i https://pkg.pr.new/kingstinct/zemble/@zemble/utils@151

commit: 4e01909

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

🧹 Nitpick comments (1)
.changeset/dry-owls-applaud.md (1)

1-5: Consider adding more detail to the changeset description.

While the current description is accurate, it could be more informative for future reference.

Consider expanding the description:

---
"@zemble/bull": patch
---

-added getDelayed to ZembleQueueMock
+added getDelayed method to ZembleQueueMock to support querying delayed jobs in test environments
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f62f2a8 and 4e01909.

📒 Files selected for processing (4)
  • .changeset/dry-owls-applaud.md (1 hunks)
  • packages/bull/ZembleQueueMock.ts (3 hunks)
  • packages/push-apple/graphql/schema.generated.ts (1 hunks)
  • packages/push-expo/graphql/schema.generated.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • packages/push-expo/graphql/schema.generated.ts
🔇 Additional comments (4)
packages/bull/ZembleQueueMock.ts (2)

20-20: LGTM! Interface update is well-typed.

The getDelayed method is correctly added to the interface with proper type inheritance from ZembleQueueBull.


42-42: LGTM! Constructor binding follows established pattern.

The getDelayed method is properly bound with jest.fn() for test spying capabilities, consistent with other method bindings.

packages/push-apple/graphql/schema.generated.ts (2)

Line range hint 1-235: Verify if committing this generated file is intentional

This appears to be an auto-generated GraphQL schema file (.generated.ts). A few concerns:

  1. Generated files are typically not committed unless there's a specific reason
  2. The changes in this file (Apple Push notifications) don't align with the PR objectives of "Add methods to bull"

Please verify if:

  • These changes should be part of this PR
  • The source GraphQL schema files should be committed instead
✅ Verification successful

Generated schema files are part of the project convention

The presence of .generated.ts files across all packages and corresponding codegen configurations indicates that committing generated GraphQL schema files is an intentional project convention. This file should remain in the PR.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there are corresponding source GraphQL schema files
fd -e graphql -e gql

Length of output: 1381


Script:

#!/bin/bash
# Check for codegen configuration files
fd 'codegen|graphql.*config' -t f

# Check if there are other .generated.ts files
fd '\.generated\.ts$'

# Check if the source schema files are modified in this PR
git diff HEAD~1 packages/push-apple/graphql/schema.graphql packages/push-apple/graphql/schema.local.graphql

Length of output: 2304


219-219: Breaking Change: Verify impact of removing liveActivityAttributes

The removal of the liveActivityAttributes field from registerAppleUpdateLiveActivityPushToken is a breaking change that could affect existing clients. Please ensure that:

  1. This change is intentional and documented
  2. All clients are updated to handle this change
  3. The version number is bumped appropriately (semver major)

Comment on lines +141 to +144
// eslint-disable-next-line class-methods-use-this
async getDelayed() {
return []
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider enhancing the mock implementation.

The current implementation has several areas for improvement:

  1. The empty array return value might not accurately represent delayed jobs in the queue
  2. The eslint-disable comment seems unnecessary for an async method
  3. Missing documentation to explain the implementation choice

Consider this enhanced implementation:

-  // eslint-disable-next-line class-methods-use-this
-  async getDelayed() {
-    return []
-  }
+  /**
+   * Gets delayed jobs from the mock queue.
+   * @returns Array of delayed jobs based on JobsOptions.delay
+   */
+  async getDelayed() {
+    return this.jobs.filter(job => 
+      job.opts?.delay !== undefined && 
+      job.opts.delay > 0
+    )
+  }

This implementation would:

  • Return actual delayed jobs based on their options
  • Remove unnecessary eslint comment
  • Add documentation
  • Better mirror the real Bull queue behavior

Committable suggestion skipped: line range outside the PR's diff.

@Ryiguchi Ryiguchi requested a review from robertherber January 7, 2025 15:35
Copy link
Member

@robertherber robertherber left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@Ryiguchi Ryiguchi merged commit a3561a5 into main Jan 7, 2025
8 checks passed
@Ryiguchi Ryiguchi deleted the add-methods-to-bull branch January 7, 2025 15:45
@coderabbitai coderabbitai bot mentioned this pull request Jan 30, 2025
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