feat(eventbus): add PublishEvent method for pre-built CloudEvents#197
feat(eventbus): add PublishEvent method for pre-built CloudEvents#197
Conversation
📋 API Contract Changes Summary✅ No breaking changes detected - only additions and non-breaking modifications Changed Components:Core FrameworkContract diff saved to artifacts/diffs/core.json Module: authContract diff saved to artifacts/diffs/auth.json Module: cacheContract diff saved to artifacts/diffs/cache.json Module: chimuxContract diff saved to artifacts/diffs/chimux.json Module: databaseContract diff saved to artifacts/diffs/database.json Module: eventbusContract diff saved to artifacts/diffs/eventbus.json Module: eventloggerContract diff saved to artifacts/diffs/eventlogger.json Module: httpclientContract diff saved to artifacts/diffs/httpclient.json Module: httpserverContract diff saved to artifacts/diffs/httpserver.json Module: jsonschemaContract diff saved to artifacts/diffs/jsonschema.json Module: letsencryptContract diff saved to artifacts/diffs/letsencrypt.json Module: logmaskerContract diff saved to artifacts/diffs/logmasker.json Module: reverseproxyContract diff saved to artifacts/diffs/reverseproxy.json Module: schedulerContract diff saved to artifacts/diffs/scheduler.json Artifacts📁 Full contract diffs and JSON artifacts are available in the workflow artifacts. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #197 +/- ##
==========================================
- Coverage 61.54% 56.62% -4.92%
==========================================
Files 82 82
Lines 17706 17708 +2
==========================================
- Hits 10897 10028 -869
- Misses 5769 6576 +807
- Partials 1040 1104 +64
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a new PublishEvent API to the eventbus module so callers can publish a fully constructed CloudEvents event (including custom extensions like encryption metadata) without the module rebuilding/wrapping it.
Changes:
- Add
EventBusModule.PublishEvent(ctx, event)to route a pre-built CloudEvent directly through the engine router. - Add a unit test verifying
PublishEventroutes the event and preserves extensions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| modules/eventbus/module.go | Introduces PublishEvent to publish pre-built CloudEvents events via the router while keeping existing publish metrics/emission behavior. |
| modules/eventbus/module_test.go | Adds coverage ensuring PublishEvent delivers the event to subscribers and preserves CloudEvent extensions. |
You can also share your feedback on Copilot code review. Take the survey.
- Capture event.SetData error in test - Assert no error on deferred Stop and Cancel calls - Suppress gosec G118 false positives for context.WithCancel stored on struct
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
You can also share your feedback on Copilot code review. Take the survey.
Summary
PublishCloudEventmethod toEventBusModulethat accepts a pre-built CloudEvents event and routes it directly, bypassing the internal event construction inPublishencryption,encryptedfields,keyid) before publishingContext
Part of PLT-318 (messaging event encryption). The existing
Publish(ctx, topic, payload)method constructs the CloudEvent internally, which doesn't allow callers to attach encryption extensions.PublishCloudEventlets the caller build the full CloudEvent — including field-level encryption metadata per ADR-010 — and hand it off for routing.The timing, error formatting, and telemetry emission shared between
PublishandPublishCloudEventare centralised in a privatepublishEventhelper to keep the two paths from drifting.