-
Notifications
You must be signed in to change notification settings - Fork 4
[LFXV2-787] Add NATS event for project settings updates #35
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
Conversation
Add a new NATS event that is published whenever project settings are updated. This allows downstream services (like the meeting service) to react to settings changes by receiving both the old and new settings state. Changes: - Add ProjectSettingsUpdatedSubject constant (lfx.projects-api.project_settings.updated) - Add ProjectSettingsUpdatedMessage model with project_uid, old_settings, new_settings - Add SendProjectEventMessage method to MessageBuilder interface and implementation - Integrate event publishing into UpdateProjectSettings operation - Add tests for SendProjectEventMessage - Update README with documentation for the new NATS event 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Andres Tobon <[email protected]>
WalkthroughThe pull request adds a feature to publish project settings update events to NATS messaging. A new SendProjectEventMessage method is introduced to the MessageBuilder interface with implementations in the infrastructure layer. ProjectSettingsUpdatedMessage carries old and new settings data. The service layer integrates event emission during project settings updates. Changes
Sequence DiagramsequenceDiagram
participant Client as Caller
participant Service as UpdateProjectSettings
participant MessageBuilder as NATS MessageBuilder
participant NATS as NATS Broker
Client->>Service: UpdateProjectSettings(...)
Service->>Service: Update settings in database
par Concurrent Event Emission
Service->>MessageBuilder: SendProjectEventMessage(ctx, ProjectSettingsUpdatedSubject, message)
MessageBuilder->>MessageBuilder: JSON serialize message
MessageBuilder->>NATS: Publish JSON payload
NATS-->>MessageBuilder: Ack
MessageBuilder-->>Service: Return error or nil
end
Service-->>Client: Return result
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (8)
🧰 Additional context used📓 Path-based instructions (3)**/*.go📄 CodeRabbit inference engine (CLAUDE.md)
Files:
README.md📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*_test.go📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (2)📓 Common learnings📚 Learning: 2025-09-29T19:12:32.725ZApplied to files:
🧬 Code graph analysis (4)internal/service/project_operations.go (4)
internal/infrastructure/nats/message.go (2)
internal/domain/models/message.go (1)
internal/infrastructure/nats/message_test.go (6)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (8)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. 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.
Pull request overview
This PR adds a new NATS event that is published when project settings are updated, allowing downstream services to react to changes by receiving both the old and new settings states. The implementation follows existing patterns for NATS message publishing using asynchronous publish.
Key Changes:
- Added
ProjectSettingsUpdatedSubjectconstant andProjectSettingsUpdatedMessagemodel for the new event - Implemented
SendProjectEventMessagemethod in MessageBuilder for publishing project events asynchronously - Integrated event publishing into the
UpdateProjectSettingsoperation using errgroup for concurrent message delivery
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/constants/nats.go | Added new NATS subject constant for project settings update events |
| internal/domain/models/message.go | Added ProjectSettingsUpdatedMessage model containing project UID and both old/new settings |
| internal/domain/message.go | Extended MessageBuilder interface with SendProjectEventMessage method |
| internal/domain/mock.go | Added mock implementation for SendProjectEventMessage |
| internal/infrastructure/nats/message.go | Implemented SendProjectEventMessage to marshal and publish events asynchronously |
| internal/infrastructure/nats/message_test.go | Added comprehensive unit tests for the new message sending method |
| internal/service/project_operations.go | Integrated event publishing into UpdateProjectSettings using errgroup |
| README.md | Documented the new NATS event format and purpose |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Changes
ProjectSettingsUpdatedSubjectconstant (lfx.projects-api.project_settings.updated)ProjectSettingsUpdatedMessagemodel withproject_uid,old_settings,new_settingsfieldsSendProjectEventMessagemethod toMessageBuilderinterface for publishing project eventsUpdateProjectSettingsoperationSendProjectEventMessageMessage Format
{ "project_uid": "string", "old_settings": { /* ProjectSettings object */ }, "new_settings": { /* ProjectSettings object */ } }Test plan
SendProjectEventMessagepassTicket
LFXV2-787
🤖 Generated with Claude Code