Repository navigation
feat: add record v1 support to event stream for garl - #4231
Conversation
Summary by CodeRabbit
WalkthroughThe changes refactor the event processing logic in the Changes
Sequence Diagram(s)sequenceDiagram
participant S as Event Source
participant P as processRecordInputs
participant V1 as processVDMV1RecordEvents
participant V2 as processVDMV2RecordEvents
participant EV as processEventStreamRecordV1Events
S->>P: Send grouped record inputs
alt Event sent by VDMV1 Flow
P->>V1: Call processVDMV1RecordEvents
else alt Event sent by VDMV2 Flow
P->>V2: Call processVDMV2RecordEvents
else
P->>EV: Call processEventStreamRecordV1Events
end
Suggestions for Improvements
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📥 CommitsReviewing files that changed from the base of the PR and between 2db95c487a764943d9dcadd006443d0216d27a8f and a8c6c17. ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)`**/*.js`: Focus on ESLint errors (max 3) and warnings (max 5).
🧬 Code Definitions (1)src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (3)
⏰ Context from checks skipped due to timeout of 90000ms (9)
🔇 Additional comments (4)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (1)
109-192: Consider adding documentation for the different flowsWhile the implementation is solid, adding some inline documentation explaining the differences between event stream, VDM V1, and VDM V2 flows would improve maintainability for future developers.
+ /** + * Helper functions to process different types of record events: + * - processEventStreamRecordV1Events: Processes events from event stream with record v1 format + * - processVDMV1RecordEvents: Processes events sent by VDM V1 flow + * - processVDMV2RecordEvents: Processes events sent by VDM V2 flow + * + * Each function extracts configuration differently based on the flow type and + * passes it to preparePayload for further processing. + */ function processEventStreamRecordV1Events(groupedRecordInputs) {
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between c82d934 and 50f497a93c28dcf328066f070df073f41cdf5902.
⛔ Files ignored due to path filters (2)
test/integrations/destinations/google_adwords_remarketing_lists/router/data.tsis excluded by!**/test/**test/integrations/destinations/google_adwords_remarketing_lists/router/record.tsis excluded by!**/test/**
📒 Files selected for processing (1)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.js`: Focus on ESLint errors (max 3) and warnings (max 5).
**/*.js: Focus on ESLint errors (max 3) and warnings (max 5).
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Code Coverage
- GitHub Check: ingestion-service-test
- GitHub Check: UT Tests
- GitHub Check: test_and_publish
🔇 Additional comments (4)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (4)
109-130: Function rename improves clarity of purposeThe renaming from
processRecordInputsV0toprocessEventStreamRecordV1Eventsclearly indicates this function's specific purpose of handling event stream with record v1 format. The implementation correctly extracts configuration parameters from the destination config and passes them to thepreparePayloadfunction.
132-153: Well-implemented VDM V1 flow handlingThis new function properly handles VDM V1 flow events with the key distinction of modifying the
audienceIdusing thegetOperationAudienceIdfunction. The implementation follows the established pattern while addressing the specific requirements of this flow.
155-180: Clearer function naming for VDM V2 processingRenaming from
processRecordInputsV1toprocessVDMV2RecordEventsmakes the function's purpose more explicit. The implementation correctly handles the VDM V2 flow by extracting configuration from connection settings and transforming records appropriately.
182-192: Improved routing logic with clear flow checksThe updated implementation provides clearer routing based on explicit event flow checks using the imported utility functions. The conditional logic is well-structured and includes a sensible default fallback to the event stream processor.
|
Allure Test reports for this run are available at:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #4231 +/- ##
===========================================
+ Coverage 91.05% 91.06% +0.01%
===========================================
Files 627 630 +3
Lines 33049 33056 +7
Branches 7818 7825 +7
===========================================
+ Hits 30092 30103 +11
- Misses 2710 2736 +26
+ Partials 247 217 -30 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
50f497a to
257e4a1
Compare
|
Allure Test reports for this run are available at:
|
257e4a1 to
6e83fe6
Compare
|
Allure Test reports for this run are available at:
|
6e83fe6 to
68a98f4
Compare
|
Allure Test reports for this run are available at:
|
68a98f4 to
6ab7709
Compare
|
Allure Test reports for this run are available at:
|
6ab7709 to
32a66f6
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (3)
109-130: Well-structured renaming of processRecordInputsV0The function has been appropriately renamed to
processEventStreamRecordV1Eventswhich better reflects its purpose. The implementation correctly extracts necessary configuration parameters from the destination Config and constructs a config object for the preparePayload function.Consider adding validation for required configuration parameters to handle potential missing fields gracefully.
function processEventStreamRecordV1Events(groupedRecordInputs) { const { destination } = groupedRecordInputs[0]; const { audienceId, typeOfList, isHashRequired, userSchema, userDataConsent, personalizationConsent, } = destination.Config; + // Validate required parameters + if (!audienceId || !typeOfList) { + throw new InstrumentationError('Missing required configuration parameters: audienceId or typeOfList'); + } const config = { audienceId, typeOfList, userSchema, isHashRequired, userDataConsent, personalizationConsent, }; return preparePayload(groupedRecordInputs, config); }
182-192: Improved event routing logicThe main
processRecordInputsfunction has been updated with clear and explicit routing logic that checks for different event flows using dedicated helper functions. This approach is more maintainable and better aligns with the single responsibility principle.Consider documenting the intended precedence of these checks in case an event could satisfy multiple conditions.
function processRecordInputs(groupedRecordInputs) { const event = groupedRecordInputs[0]; + // Process events with explicit routing: + // 1. VDM V1 Flow has highest precedence + // 2. VDM V2 Flow has second precedence + // 3. Default to event stream record v1 events if (isEventSentByVDMV1Flow(event)) { return processVDMV1RecordEvents(groupedRecordInputs); } if (isEventSentByVDMV2Flow(event)) { return processVDMV2RecordEvents(groupedRecordInputs); } return processEventStreamRecordV1Events(groupedRecordInputs); }
109-192: Consider reducing code duplication in configuration extractionThere's duplication in configuration extraction and setup across the three processing functions. Consider refactoring this common logic into a helper function to improve maintainability.
+function extractConfig(event, isVDMV1 = false) { + const { destination, message, connection } = event; + + if (connection?.config?.destination) { + // VDM V2 flow + const { audienceId, typeOfList, isHashRequired, userDataConsent, personalizationConsent } = + connection.config.destination; + + const userSchema = message?.identifiers ? Object.keys(message.identifiers) : undefined; + + return { + audienceId, + typeOfList, + userSchema, + isHashRequired, + userDataConsent, + personalizationConsent + }; + } else { + // VDM V1 or Event Stream flow + const { + audienceId, + typeOfList, + isHashRequired, + userSchema, + userDataConsent, + personalizationConsent, + } = destination.Config; + + return { + audienceId: isVDMV1 ? getOperationAudienceId(audienceId, message) : audienceId, + typeOfList, + userSchema, + isHashRequired, + userDataConsent, + personalizationConsent, + }; + } +} function processEventStreamRecordV1Events(groupedRecordInputs) { - const { destination } = groupedRecordInputs[0]; - const { - audienceId, - typeOfList, - isHashRequired, - userSchema, - userDataConsent, - personalizationConsent, - } = destination.Config; - - const config = { - audienceId, - typeOfList, - userSchema, - isHashRequired, - userDataConsent, - personalizationConsent, - }; + const config = extractConfig(groupedRecordInputs[0]); return preparePayload(groupedRecordInputs, config); } function processVDMV1RecordEvents(groupedRecordInputs) { - const { destination, message } = groupedRecordInputs[0]; - const { - audienceId, - typeOfList, - isHashRequired, - userSchema, - userDataConsent, - personalizationConsent, - } = destination.Config; - - const config = { - audienceId: getOperationAudienceId(audienceId, message), - typeOfList, - userSchema, - isHashRequired, - userDataConsent, - personalizationConsent, - }; + const config = extractConfig(groupedRecordInputs[0], true); return preparePayload(groupedRecordInputs, config); } function processVDMV2RecordEvents(groupedRecordInputs) { - const { connection, message } = groupedRecordInputs[0]; - const { audienceId, typeOfList, isHashRequired, userDataConsent, personalizationConsent } = - connection.config.destination; - - const userSchema = message?.identifiers ? Object.keys(message.identifiers) : undefined; - + const config = extractConfig(groupedRecordInputs[0]); const events = groupedRecordInputs.map((record) => ({ ...record, message: { ...record.message, fields: record.message.identifiers, }, })); - const config = { - audienceId, - typeOfList, - userSchema, - isHashRequired, - userDataConsent, - personalizationConsent, - }; - return preparePayload(events, config); }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 6ab77096566101bf55ba99bd570ec6016b641685 and 32a66f6ea4320606191e01b2b08f7e96ede53d8d.
⛔ Files ignored due to path filters (2)
test/integrations/destinations/google_adwords_remarketing_lists/router/data.tsis excluded by!**/test/**test/integrations/destinations/google_adwords_remarketing_lists/router/record.tsis excluded by!**/test/**
📒 Files selected for processing (1)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.js`: Focus on ESLint errors (max 3) and warnings (max 5).
**/*.js: Focus on ESLint errors (max 3) and warnings (max 5).
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js
🧬 Code Definitions (1)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (3)
src/v0/destinations/google_adwords_remarketing_lists/transform.js (1)
destination(40-40)src/v0/destinations/fb_custom_audience/transform.js (1)
preparePayload(34-57)src/v0/util/index.js (2)
isEventSentByVDMV1Flow(2325-2325)isEventSentByVDMV2Flow(2327-2328)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Code Coverage
- GitHub Check: UT Tests
- GitHub Check: ingestion-service-test
- GitHub Check: test_and_publish
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
🔇 Additional comments (2)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (2)
132-153: Good implementation of new VDM V1 record event processingThis new function properly handles the VDM V1 flow events by applying the
getOperationAudienceIdfunction to adjust the audienceId based on the message. The implementation is aligned with the PR objective to add record v1 support.
155-180: Clean renaming of processRecordInputsV1 functionThe function has been appropriately renamed to
processVDMV2RecordEventswhich better reflects its purpose. The implementation maintains the existing logic for VDM V2 flow events and correctly transforms message identifiers into the required fields format.
|
Allure Test reports for this run are available at:
|
32a66f6 to
eb71f97
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (1)
182-192: Clear routing logic with appropriate checksThe updated routing logic in
processRecordInputsprovides a clear flow determination strategy. The function correctly routes to different processing functions based on the event type, with a sensible default to the event stream processor.Consider adding some debug logging to help with troubleshooting when unexpected event types are encountered. This would make it easier to identify which flow path was chosen during execution.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 32a66f6ea4320606191e01b2b08f7e96ede53d8d and eb71f97266f5cbd1b6706282b9aa814db85ef9b8.
⛔ Files ignored due to path filters (2)
test/integrations/destinations/google_adwords_remarketing_lists/router/data.tsis excluded by!**/test/**test/integrations/destinations/google_adwords_remarketing_lists/router/record.tsis excluded by!**/test/**
📒 Files selected for processing (1)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.js`: Focus on ESLint errors (max 3) and warnings (max 5).
**/*.js: Focus on ESLint errors (max 3) and warnings (max 5).
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js
🧬 Code Definitions (1)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (3)
src/v0/destinations/google_adwords_remarketing_lists/transform.js (1)
destination(40-40)src/v0/destinations/fb_custom_audience/transform.js (1)
preparePayload(34-57)src/v0/util/index.js (2)
isEventSentByVDMV1Flow(2325-2325)isEventSentByVDMV2Flow(2327-2328)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Code Coverage
- GitHub Check: test_and_publish
- GitHub Check: ingestion-service-test
- GitHub Check: UT Tests
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
🔇 Additional comments (3)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (3)
109-130: Well-structured processing function for event stream record eventsThe renamed function provides a clear purpose through its naming. It correctly extracts configuration parameters from the destination config and organizes them into a structured object before passing to
preparePayload. This approach maintains good separation of concerns.
132-153: Good implementation of VDM V1 flow processingThe new function follows a consistent pattern with other processing functions while adapting for the VDM V1 flow. The key difference here is the modification of
audienceIdusing thegetOperationAudienceIdhelper function, which appropriately handles audience ID transformations for this flow.
155-180: Well-implemented VDM V2 processing functionThe renamed function properly handles the VDM V2 flow with appropriate configuration extraction and event transformation. The approach to derive
userSchemafrom message identifiers is elegant and the mapping of records to include field identifiers is implemented effectively.
|
Allure Test reports for this run are available at:
|
64a9143 to
2db95c4
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (4)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (4)
109-130: Improved function naming with clear purposeThe renaming from
processRecordInputsV0toprocessEventStreamRecordV1Eventsprovides better clarity about the function's purpose. The implementation correctly extracts configuration from the destination Config object.Consider adding JSDoc documentation to clarify the purpose and parameters of this function:
+/** + * Process record events from the Event Stream Record V1 flow + * @param {Array} groupedRecordInputs - Array of record inputs grouped by action + * @returns {Array} Processed payload for Google AdWords remarketing lists + */ function processEventStreamRecordV1Events(groupedRecordInputs) {
132-153: Good addition of VDM V1 flow handlingThis new function properly handles the VDM V1 flow by adjusting the audienceId using the
getOperationAudienceIdfunction. This separation of concerns improves code maintainability.There is some code duplication in the config extraction between this function and the other processing functions. Consider refactoring the config extraction logic into a separate helper function to reduce duplication:
+/** + * Extract and format config from destination configuration + * @param {Object} destination - Destination object + * @param {Object} message - Optional message for audience ID customization + * @returns {Object} Formatted config object + */ +function extractDestinationConfig(destination, message = null) { + const { + audienceId, + typeOfList, + isHashRequired, + userSchema, + userDataConsent, + personalizationConsent, + } = destination.Config; + + return { + audienceId: message ? getOperationAudienceId(audienceId, message) : audienceId, + typeOfList, + userSchema, + isHashRequired, + userDataConsent, + personalizationConsent, + }; +}
155-180: Clear naming for VDM V2 record handlingRenaming from
processRecordInputsV1toprocessVDMV2RecordEventsimproves clarity. The function preserves the existing functionality while making the code more maintainable.Consider adding JSDoc documentation for consistency with other functions:
+/** + * Process record events from the VDM V2 flow + * @param {Array} groupedRecordInputs - Array of record inputs grouped by action + * @returns {Array} Processed payload for Google AdWords remarketing lists + */ function processVDMV2RecordEvents(groupedRecordInputs) {
182-192: Improved routing logic in processRecordInputsThe updated routing logic in
processRecordInputsis cleaner and more explicit, using appropriate utility functions to determine the event flow type. The default case appropriately calls the event stream processing function.Consider adding error logging for unexpected event formats to help with debugging:
function processRecordInputs(groupedRecordInputs) { const event = groupedRecordInputs[0]; + // Log event type for debugging purposes + console.debug(`Processing record inputs with event type: ${ + isEventSentByVDMV1Flow(event) ? 'VDM V1' : + isEventSentByVDMV2Flow(event) ? 'VDM V2' : 'Event Stream V1' + }`); if (isEventSentByVDMV1Flow(event)) { return processVDMV1RecordEvents(groupedRecordInputs); } if (isEventSentByVDMV2Flow(event)) { return processVDMV2RecordEvents(groupedRecordInputs); } return processEventStreamRecordV1Events(groupedRecordInputs); }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between eb71f97266f5cbd1b6706282b9aa814db85ef9b8 and 2db95c487a764943d9dcadd006443d0216d27a8f.
⛔ Files ignored due to path filters (2)
test/integrations/destinations/google_adwords_remarketing_lists/router/data.tsis excluded by!**/test/**test/integrations/destinations/google_adwords_remarketing_lists/router/record.tsis excluded by!**/test/**
📒 Files selected for processing (1)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.js`: Focus on ESLint errors (max 3) and warnings (max 5).
**/*.js: Focus on ESLint errors (max 3) and warnings (max 5).
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js
🧬 Code Definitions (1)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (3)
src/v0/destinations/google_adwords_remarketing_lists/transform.js (1)
destination(40-40)src/v0/destinations/fb_custom_audience/transform.js (1)
preparePayload(34-57)src/v0/util/index.js (2)
isEventSentByVDMV1Flow(2325-2325)isEventSentByVDMV2Flow(2327-2328)
⏰ Context from checks skipped due to timeout of 90000ms (9)
- GitHub Check: Code Coverage
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: test_and_publish
- GitHub Check: UT Tests
- GitHub Check: ingestion-service-test
- GitHub Check: Analyze (javascript-typescript)
|
Allure Test reports for this run are available at:
|
2db95c4 to
a8c6c17
Compare
|
Allure Test reports for this run are available at:
|
|



What are the changes introduced in this PR?
Add support for record v1 (new format) for event stream flows for google adwords remarketing list destination.
What is the related Linear task?
Resolves INT-3474
Please explain the objectives of your changes below
Put down any required details on the broader aspect of your changes. If there are any dependent changes, mandatorily mention them here
Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?
N/A
Any new dependencies introduced with this change?
N/A
Any new generic utility introduced or modified. Please explain the changes.
N/A
Any technical or performance related pointers to consider with the change?
N/A
@coderabbitai review
Developer checklist
My code follows the style guidelines of this project
No breaking changes are being introduced.
All related docs linked with the PR?
All changes manually tested?
Any documentation changes needed with this change?
Is the PR limited to 10 file changes?
Is the PR limited to one linear task?
Are relevant unit and component test-cases added in new readability format?
Reviewer checklist
Is the type of change in the PR title appropriate as per the changes?
Verified that there are no credentials or confidential data exposed with the changes.