fix: all: add correct source in cloud events#311
Conversation
Signed-off-by: hsaizsierra <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #311 +/- ##
==========================================
- Coverage 46.86% 46.68% -0.18%
==========================================
Files 136 136
Lines 9769 9810 +41
==========================================
+ Hits 4578 4580 +2
- Misses 4800 4839 +39
Partials 391 391
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:
|
Signed-off-by: hsaizsierra <[email protected]>
There was a problem hiding this comment.
Pull Request Overview
This pull request improves AWS IoT policy management and cloud event source handling by implementing selective policy updates, refining source context propagation, and standardizing source URI format.
- Enhanced AWS IoT policy registration to only update new or changed policies during automatic registration
- Fixed source context handling to prevent overwriting existing source values
- Updated AWS IoT source URI format and removed HTTP prefix from source headers
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| connectors/awsiot/pkg/models.go | Updated AWS IoT source URI format to use new scheme |
| connectors/awsiot/pkg/event-handlers.go | Added logic to selectively register/update only new or changed AWS IoT policies |
| backend/pkg/routes/middlewares/basic-header-extractors/extractors_test.go | Updated test to match new source format without HTTP prefix |
| backend/pkg/routes/middlewares/basic-header-extractors/extractors.go | Removed unused fmt import and HTTP prefix from source header processing |
| backend/pkg/middlewares/eventpub/utils.go | Added check to prevent overwriting existing source context |
| backend/pkg/assemblers/dms-manager_events_test.go | Added missing defer statement for router cleanup |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]> Signed-off-by: Juanjo Rodriguez <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Juanjo Rodriguez <[email protected]>
Signed-off-by: hsaizsierra <[email protected]>
|



This pull request introduces improvements to the handling of AWS IoT policy updates, source context propagation, and source formatting in the backend. The main changes focus on ensuring that only new or changed AWS IoT policies are registered or updated, refining how source context is set and propagated, and updating the format of the AWS IoT source string.
AWS IoT Policy Management
createOrUpdateDMSHandlerto register or update only new or changed AWS IoT policies during automatic registration, reducing unnecessary operations.Source Context Handling
EventPublisherWithSourceMiddleware, added a check to ensure the source context is set only if it's missing, preventing overwriting an existing source.updateContextWithRequestWithSourcefunction to set the source context directly from the header value without prefixing it, simplifying source extraction.Source Formatting
AWSIoTSourceto use a new URI scheme for improved clarity and consistency.Minor Cleanup
fmtimport from thebasic-header-extractors/extractors.gofile.