-
Notifications
You must be signed in to change notification settings - Fork 1
Feat/job grpc #219
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
Feat/job grpc #219
Conversation
Summary of ChangesHello @mizhm, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces gRPC endpoints for worker management and job retrieval, which is a great step towards a more efficient communication layer. The changes include new proto files, updates to the main application to run a gRPC microservice, and new gRPC method handlers in the controllers.
My main concern is with the implementation of GrpcWorkerTokenGuard, which is currently a stub and presents a critical security vulnerability by not validating tokens. I've provided a detailed comment and a suggested implementation to fix this.
Additionally, I've made a couple of minor suggestions for improving code clarity and debuggability in the WorkersController.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds gRPC support to the core API, enabling workers to communicate with the job registry service via gRPC in addition to the existing REST API. The implementation introduces bidirectional streaming capabilities for worker health checks and unary RPCs for job management.
Key changes include:
- New gRPC service definitions for worker registration/health checks and job registry operations
- gRPC method implementations alongside existing REST endpoints in both Workers and JobsRegistry controllers
- Authentication guard for validating worker tokens in gRPC requests
- Data transformation logic to handle gRPC message format conversions
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| core-api/src/proto/workers.proto | Defines WorkersService with Join (unary) and Alive (bidirectional streaming) RPCs |
| core-api/src/proto/jobs_registry.proto | Defines JobsRegistryService with Next and Result RPCs, plus comprehensive message types for job data |
| core-api/src/modules/workers/workers.controller.ts | Adds grpcJoin and grpcAlive$ methods to handle gRPC worker registration and health checks |
| core-api/src/modules/jobs-registry/jobs-registry.controller.ts | Adds next and result gRPC methods with worker token authentication for job retrieval and result submission |
| core-api/src/modules/jobs-registry/dto/jobs-registry.dto.ts | Adds Transform decorator and Expose decorators to handle gRPC-specific data transformations |
| core-api/src/main.ts | Configures and starts gRPC microservice with Transport.GRPC |
| core-api/src/common/guards/grpc-worker-token.guard.ts | Implements authentication guard that validates worker tokens from gRPC metadata |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
l1ttps
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mizhm for this excellent PR! The gRPC integration for worker management and job distribution looks great.
I particularly like:
- The clean separation of concerns with dedicated proto files for workers and jobs
- The proper authentication implementation with GrpcWorkerTokenGuard securing the endpoints
- The stream-based heartbeat implementation for worker alive checks
- How the gRPC services integrate well with the existing NestJS structure
- The comprehensive proto definitions that cover all the necessary data types
The implementation addresses the need for efficient worker communication and job distribution. The worker lifecycle management (Join/Alive) and job distribution (Next/Result) are well-implemented.
Great work on adding this important infrastructure for the distributed system!
No description provided.