WPB-28421 add an opt in policy for dropping unsupported federated notifications - #5501
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces an opt-in per-message policy for how the background worker should handle federated backend-notification bundles when there is no common federation API version with the target backend. It extends the RabbitMQ payload format in a backward-compatible way (defaulting to the safe “keep queued” behavior) while enabling producers to explicitly request dropping unsupported notifications.
Changes:
- Add
UnsupportedVersionPolicyand extendPayloadBundlewith an optionalunsupportedVersionPolicyfield (defaults toKeepQueuedon decode). - Update the background worker pusher to either keep the message queued (and mark the queue as stuck) or ack+count-drop based on the policy.
- Add Prometheus metric
wire_backend_notifications_dropped_unsupported_versionand extend tests to cover default/combination behavior and drop-vs-keep behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| services/background-worker/test/Test/Wire/BackendNotificationPusherSpec.hs | Adds coverage for payload bundle defaulting/semigroup behavior and pushNotification behavior for unsupported versions under both policies. |
| services/background-worker/src/Wire/BackgroundWorker/Env.hs | Adds a new Prometheus counter for dropped-unsupported-version notifications. |
| services/background-worker/src/Wire/BackendNotificationPusher.hs | Implements policy-driven behavior when no compatible API version exists (keep queued vs drop+ack), and updates metrics/gauge accordingly. |
| libs/wire-api-federation/src/Wire/API/Federation/BackendNotifications.hs | Introduces UnsupportedVersionPolicy, extends PayloadBundle schema with a backward-compatible optional field, and defines safe Semigroup behavior. |
| changelog.d/6-federation/WPB-28421 | Changelog entry for the new opt-in drop policy. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
8263832 to
95c63ed
Compare
| <*> unsupportedVersionPolicy | ||
| .= fmap | ||
| (fromMaybe KeepQueued) | ||
| (optField "unsupportedVersionPolicy" schema) |
There was a problem hiding this comment.
Why default to KeepQueued? Looks like previous idea was to ignore the notification?
There was a problem hiding this comment.
Because this is explicitly an opt-in policy. If the default was to ignore/drop we would risk a state drift between remotes.
95c63ed to
d0f39cf
Compare
https://wearezeta.atlassian.net/browse/WPB-28421
Checklist
changelog.d