fix(events): correct GROUP_UPDATE typo to GROUPS_UPDATE#2652
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideStandardizes the GROUPS_UPDATE event name across configuration, validation schemas, integration controller, and deployment defaults so that groups.update events can be correctly enabled and delivered via all transports. Sequence diagram for GROUPS_UPDATE event flow after standardizationsequenceDiagram
participant Env as EnvVars
participant Config as ConfigService
participant EventCtrl as EventController
participant Receiver as WebhookReceiver
Env->>Config: RABBITMQ_EVENTS_GROUPS_UPDATE
Config->>Config: set eventsRabbitmq.GROUPS_UPDATE
EventCtrl->>Config: get eventsRabbitmq
alt GROUPS_UPDATE enabled
EventCtrl-->>Receiver: groups.update event
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- Since the env var and config keys for this event were renamed from GROUP_UPDATE to GROUPS_UPDATE, consider temporarily supporting both names (with a clear precedence) to avoid silently breaking existing deployments that still use the old env var.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Since the env var and config keys for this event were renamed from GROUP_UPDATE to GROUPS_UPDATE, consider temporarily supporting both names (with a clear precedence) to avoid silently breaking existing deployments that still use the old env var.
## Individual Comments
### Comment 1
<location path="src/validate/instance.schema.ts" line_range="81" />
<code_context>
'CHATS_DELETE',
'GROUPS_UPSERT',
- 'GROUP_UPDATE',
+ 'GROUPS_UPDATE',
'GROUP_PARTICIPANTS_UPDATE',
'CONNECTION_UPDATE',
</code_context>
<issue_to_address>
**issue (bug_risk):** Updating the allowed event value to `GROUPS_UPDATE` may break clients still sending `GROUP_UPDATE`.
This aligns with the config rename, but any client still sending `GROUP_UPDATE` will now fail validation. If backward compatibility is needed, consider temporarily accepting both values and mapping `GROUP_UPDATE` to `GROUPS_UPDATE` internally, then deprecating the old value later.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| 'CHATS_DELETE', | ||
| 'GROUPS_UPSERT', | ||
| 'GROUP_UPDATE', | ||
| 'GROUPS_UPDATE', |
There was a problem hiding this comment.
issue (bug_risk): Updating the allowed event value to GROUPS_UPDATE may break clients still sending GROUP_UPDATE.
This aligns with the config rename, but any client still sending GROUP_UPDATE will now fail validation. If backward compatibility is needed, consider temporarily accepting both values and mapping GROUP_UPDATE to GROUPS_UPDATE internally, then deprecating the old value later.
There was a problem hiding this comment.
i'm not familiar enough with the code to know if this is really needed here. i'll leave it up to the human reviewer :)
|
please, send to develop (we dont accept to main) @fabi125 |
dcbafe8 to
831407e
Compare
oops, sorry. rebased and updated the PR |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Renaming the config fields and env vars from GROUP_UPDATE to GROUPS_UPDATE is potentially breaking for existing deployments; consider temporarily supporting both names (e.g., fallback reads of the old env var) to ease migration.
- This typo suggests event names are duplicated across multiple places (types, schema, config, env); consider centralizing these event keys in a shared enum/constant to avoid future mismatches.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Renaming the config fields and env vars from GROUP_UPDATE to GROUPS_UPDATE is potentially breaking for existing deployments; consider temporarily supporting both names (e.g., fallback reads of the old env var) to ease migration.
- This typo suggests event names are duplicated across multiple places (types, schema, config, env); consider centralizing these event keys in a shared enum/constant to avoid future mismatches.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
@gomessguii @pastoriniMatheus review |
📋 Description
In src/api/types/wa.types.ts the event is defined as groups.update, but in the configuration its often referred to as the singular GROUP_UPDATE, the env vars that are being read are a mix of both. This fixes this so groups.update events are being correctly sent to receivers.
🔗 Related Issue
n/a
🧪 Type of Change
🧪 Testing
Previously there was no way to get groups.update events to be sent to a webhook receiver, now this works as expected.
📸 Screenshots (if applicable)
n/a
✅ Checklist
📝 Additional Notes
Summary by Sourcery
Align event configuration to use the plural GROUPS_UPDATE name consistently for group update events
Bug Fixes:
Enhancements:
Deployment: