Skip to content

feat: add record v1 support to event stream for garl - #4231

Merged
koladilip merged 1 commit into
developfrom
feat/add-record-v1-support-event-streams
Apr 8, 2025
Merged

koladilip merged 1 commit into
developfrom
feat/add-record-v1-support-event-streams

Conversation

@koladilip

Copy link
Copy Markdown
Contributor

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.

@koladilip
koladilip requested review from a team and sivashanmukh as code owners April 3, 2025 12:49
@koladilip
koladilip requested review from a team, chandumlg and utsabc April 3, 2025 12:49
@coderabbitai

coderabbitai Bot commented Apr 3, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Introduced distinct event processing paths to handle various event flows more effectively.
  • Refactor

    • Streamlined the event handling logic for improved clarity and reliability.
    • Updated the extraction of configuration details from event records to ensure consistent processing across scenarios.

Walkthrough

The changes refactor the event processing logic in the recordTransform.js file. The function processRecordInputsV0 has been renamed to processEventStreamRecordV1Events, with modifications to extract configuration parameters from the first record’s destination configuration. The function processRecordInputsV1 is now processVDMV2RecordEvents, retaining similar logic. A new function, processVDMV1RecordEvents, has been introduced to adjust the audienceId using the getOperationAudienceId function. The main processRecordInputs function now explicitly routes calls based on event flow checks.

Changes

File Change Summary
src/v0/.../google_adwords_remarketing_lists/recordTransform.js - Renamed processRecordInputsV0 to processEventStreamRecordV1Events; modified to extract config details from the first record’s destination.Config.
- Renamed processRecordInputsV1 to processVDMV2RecordEvents (logic largely intact).
- Added processVDMV1RecordEvents, which adjusts audienceId via getOperationAudienceId.
- Updated processRecordInputs to explicitly branch using isEventSentByVDMV1Flow and isEventSentByVDMV2Flow, defaulting to processEventStreamRecordV1Events when neither condition applies.

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
Loading

Suggestions for Improvements

  • Modularize Configuration Extraction: Consider refactoring the configuration extraction logic into a helper function to reduce code duplication and improve maintainability.
  • Enhanced Testing: Increase unit test coverage specifically for each event flow branch to ensure robust behavior during future changes.
  • Inline Documentation: Add detailed inline comments or documentation explaining the rationale behind audience ID transformations and flow decisions to assist future developers in understanding the logic.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2db95c487a764943d9dcadd006443d0216d27a8f and a8c6c17.

⛔ Files ignored due to path filters (2)
  • test/integrations/destinations/google_adwords_remarketing_lists/router/data.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_remarketing_lists/router/record.ts is 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/fb_custom_audience/recordTransform.js (8)
  • groupedRecordInputs (207-207)
  • groupedRecordInputs (208-208)
  • groupedRecordInputs (237-237)
  • destination (123-123)
  • destination (209-210)
  • config (74-74)
  • config (121-121)
  • event (269-269)
src/v0/destinations/google_adwords_remarketing_lists/transform.js (1)
  • destination (40-40)
src/v0/util/index.js (2)
  • isEventSentByVDMV1Flow (2325-2325)
  • isEventSentByVDMV2Flow (2327-2328)
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
  • GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: Code Coverage
  • GitHub Check: test_and_publish
  • GitHub Check: UT Tests
  • GitHub Check: ingestion-service-test
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
🔇 Additional comments (4)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (4)

109-130: Good refactoring with clear function naming

The renamed function processEventStreamRecordV1Events accurately reflects its purpose, extracting configuration from destination.Config and preparing the payload with all necessary parameters. This makes the code easier to maintain and understand.


132-153: Clean implementation of the VDM V1 flow processing

The new processVDMV1RecordEvents function follows a consistent pattern with the other processing functions while correctly incorporating the audience ID operation through getOperationAudienceId. This effectively supports the VDM V1 flow as required by the PR objectives.


155-180: Appropriate function rename with preserved logic

Renaming processRecordInputsV1 to processVDMV2RecordEvents improves code clarity while maintaining the existing functionality. The function continues to properly extract configuration from connection.config.destination and transform the records by mapping identifiers to fields.


182-192: Enhanced routing logic with explicit flow checks

The updated processRecordInputs function now uses clear, explicit checks with isEventSentByVDMV1Flow and isEventSentByVDMV2Flow to route events to the appropriate processing function. The flow is logical and defaults to processEventStreamRecordV1Events as a fallback, which aligns with the PR's goal of adding record v1 support.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 flows

While 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.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_remarketing_lists/router/record.ts is 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 purpose

The renaming from processRecordInputsV0 to processEventStreamRecordV1Events clearly 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 the preparePayload function.


132-153: Well-implemented VDM V1 flow handling

This new function properly handles VDM V1 flow events with the key distinction of modifying the audienceId using the getOperationAudienceId function. The implementation follows the established pattern while addressing the specific requirements of this flow.


155-180: Clearer function naming for VDM V2 processing

Renaming from processRecordInputsV1 to processVDMV2RecordEvents makes 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 checks

The 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.

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@codecov

codecov Bot commented Apr 3, 2025 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.06%. Comparing base (322ddbc) to head (a8c6c17).
Report is 14 commits behind head on develop.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@koladilip
koladilip force-pushed the feat/add-record-v1-support-event-streams branch from 50f497a to 257e4a1 Compare April 4, 2025 05:32
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@koladilip
koladilip force-pushed the feat/add-record-v1-support-event-streams branch from 257e4a1 to 6e83fe6 Compare April 4, 2025 06:13
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@koladilip
koladilip force-pushed the feat/add-record-v1-support-event-streams branch from 6e83fe6 to 68a98f4 Compare April 4, 2025 07:51
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@koladilip
koladilip force-pushed the feat/add-record-v1-support-event-streams branch from 68a98f4 to 6ab7709 Compare April 7, 2025 04:34
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@koladilip
koladilip force-pushed the feat/add-record-v1-support-event-streams branch from 6ab7709 to 32a66f6 Compare April 7, 2025 13:05

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (3)

109-130: Well-structured renaming of processRecordInputsV0

The function has been appropriately renamed to processEventStreamRecordV1Events which 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 logic

The main processRecordInputs function 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 extraction

There'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.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_remarketing_lists/router/record.ts is 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 processing

This new function properly handles the VDM V1 flow events by applying the getOperationAudienceId function 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 function

The function has been appropriately renamed to processVDMV2RecordEvents which 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.

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@koladilip
koladilip force-pushed the feat/add-record-v1-support-event-streams branch from 32a66f6 to eb71f97 Compare April 7, 2025 14:02

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (1)

182-192: Clear routing logic with appropriate checks

The updated routing logic in processRecordInputs provides 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.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_remarketing_lists/router/record.ts is 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 events

The 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 processing

The 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 audienceId using the getOperationAudienceId helper function, which appropriately handles audience ID transformations for this flow.


155-180: Well-implemented VDM V2 processing function

The renamed function properly handles the VDM V2 flow with appropriate configuration extraction and event transformation. The approach to derive userSchema from message identifiers is elegant and the mapping of records to include field identifiers is implemented effectively.

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@koladilip
koladilip force-pushed the feat/add-record-v1-support-event-streams branch 2 times, most recently from 64a9143 to 2db95c4 Compare April 8, 2025 00:47
@koladilip
koladilip requested a review from krishna2020 April 8, 2025 00:48

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (4)

109-130: Improved function naming with clear purpose

The renaming from processRecordInputsV0 to processEventStreamRecordV1Events provides 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 handling

This new function properly handles the VDM V1 flow by adjusting the audienceId using the getOperationAudienceId function. 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 handling

Renaming from processRecordInputsV1 to processVDMV2RecordEvents improves 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 processRecordInputs

The updated routing logic in processRecordInputs is 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.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_remarketing_lists/router/record.ts is 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)

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@koladilip
koladilip force-pushed the feat/add-record-v1-support-event-streams branch from 2db95c4 to a8c6c17 Compare April 8, 2025 07:05
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@sonarqubecloud

sonarqubecloud Bot commented Apr 8, 2025

Copy link
Copy Markdown

@koladilip
koladilip merged commit 8e28808 into develop Apr 8, 2025
@koladilip
koladilip deleted the feat/add-record-v1-support-event-streams branch April 8, 2025 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants