Skip to content

chore(release): pull main into develop post release v1.97.0 - #4244

Merged
yashasvibajpai merged 5 commits into
developfrom
main
Apr 10, 2025
Merged

yashasvibajpai merged 5 commits into
developfrom
main

Conversation

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

👑 An automated PR

web-flow and others added 5 commits April 8, 2025 11:25
Added validation in sourceTransformRoutine to ensure sourceEvents is an array.
If not, it throws a TransformationError with message 'Invalid source events'.

Updated the corresponding test to properly handle async error testing by using
await expect().rejects.toThrow() instead of expect().toThrow().

This validation prevents unexpected errors when processing non-array inputs
and provides a clear error message for debugging.
This fix ensures that the processMetadataForRouter function
in marketo_static_list always returns metadata as an array,
 which is required by the router. Previously, it was not
ensuring that the metadata was always an array, which could
 cause issues with the router transform.
* fix: handle invalid logincustomerId depending on subAccount

* chore: address comment

* chore: increase test coverage
@coderabbitai

coderabbitai Bot commented Apr 9, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Updated integration logic for Google Ads conversions to support sub-account processing, ensuring that proper validations are enforced during request construction.
    • Enhanced metadata handling for Marketo integrations to deliver more consistent and reliable data transformation.
  • Bug Fixes

    • Improved input validation in event processing to promptly detect and reject invalid inputs with clearer error reporting.

Walkthrough

This pull request makes several changes across different modules. The ESLint configuration is updated to ignore a new dist-test/ directory. In the source integration service, the sourceTransformRoutine now validates its input by checking if the provided events are an array, throwing a TransformationError otherwise; the related tests have been restructured. For Google Ads integrations, conditional logic now governs the assignment of loginCustomerId based on the presence of a subAccount and integrates this parameter into the delivery request. Additionally, the marketo module’s metadata handling is improved with a utility function, and its tests have been added.

Changes

File(s) Change Summary
.eslintignore Added entry dist-test/ to ensure the directory is ignored by ESLint.
src/services/source/nativeIntegration.ts
src/services/source/__tests__/nativeIntegration.test.ts
Enhanced the sourceTransformRoutine method to validate that source events are arrays and throw a TransformationError on invalid input; restructured tests to separate integration failure from invalid source events scenarios.
src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js
src/v0/destinations/google_adwords_enhanced_conversions/transform.js
Modified the logic for assigning loginCustomerId based on the presence of a subAccount and updated the delivery request parameters to include subAccount with the requisite validations.
src/v0/destinations/marketo_static_list/transform.js
src/v0/destinations/marketo_static_list/transform.test.js
Integrated CommonUtils.toArray for robust metadata handling in the processMetadataForRouter function and added corresponding unit tests to verify behavior with both array and single-object inputs.

Sequence Diagram(s)

sequenceDiagram
    participant C as Client
    participant S as NativeIntegrationService
    C->>S: Call sourceTransformRoutine(sourceEvents)
    alt sourceEvents is not an array
        S-->>C: Throw TransformationError("Invalid source events")
    else Valid sourceEvents
        S->>S: Process and transform events
        S-->>C: Return transformed output
    end
Loading
sequenceDiagram
    participant C as Caller
    participant G as gaecProxyRequest
    participant SDK as GoogleAdsSDK.GoogleAds
    C->>G: Call gaecProxyRequest(params)
    alt params.subAccount exists
        G->>SDK: Initialize with loginCustomerId = params.loginCustomerId
    else params.subAccount missing
        G->>SDK: Initialize with loginCustomerId = ""
    end
    SDK-->>G: Return instance
    G-->>C: Return response
Loading

Suggestions for Improvements

  • Enhanced Logging: Consider adding detailed error logging within the sourceTransformRoutine and related methods to aid in troubleshooting.
  • Expanded Test Coverage: Broaden unit tests to cover additional edge cases, including varied invalid input scenarios.
  • Consistency in Validation: Standardize error messages and validation logic across different integration modules for better maintainability.
  • Centralized Configuration: Evaluate centralizing configuration for parameter validations and error handling to reduce redundancy across files.
  • Documentation Updates: Update inline documentation and API docs to reflect the new behavior and parameters introduced.

📜 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 b37e7c0 and f990bf6.

⛔ Files ignored due to path filters (8)
  • CHANGELOG.md is excluded by !**/*.md
  • package-lock.json is excluded by !**/package-lock.json, !**/*.json
  • package.json is excluded by !**/*.json
  • test/integrations/destinations/google_adwords_enhanced_conversions/dataDelivery/business.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_enhanced_conversions/dataDelivery/oauth.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_enhanced_conversions/network.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_enhanced_conversions/processor/data.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_enhanced_conversions/router/data.ts is excluded by !**/test/**
📒 Files selected for processing (7)
  • .eslintignore (1 hunks)
  • src/services/source/__tests__/nativeIntegration.test.ts (1 hunks)
  • src/services/source/nativeIntegration.ts (2 hunks)
  • src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js (1 hunks)
  • src/v0/destinations/google_adwords_enhanced_conversions/transform.js (1 hunks)
  • src/v0/destinations/marketo_static_list/transform.js (2 hunks)
  • src/v0/destinations/marketo_static_list/transform.test.js (1 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_enhanced_conversions/networkHandler.js
  • src/v0/destinations/marketo_static_list/transform.test.js
  • src/v0/destinations/google_adwords_enhanced_conversions/transform.js
  • src/v0/destinations/marketo_static_list/transform.js
🧬 Code Graph Analysis (2)
src/services/source/__tests__/nativeIntegration.test.ts (3)
src/types/sourceTransformation.ts (1)
  • SourceTransformationResponse (49-51)
src/services/source/postTransformation.ts (1)
  • SourcePostTransformationService (12-50)
src/services/source/nativeIntegration.ts (1)
  • NativeIntegrationSourceService (19-77)
src/v0/destinations/marketo_static_list/transform.js (2)
src/v0/destinations/marketo_static_list/transform.test.js (1)
  • require (1-1)
src/util/common.js (1)
  • CommonUtils (4-31)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Code Coverage
  • GitHub Check: ingestion-service-test
  • GitHub Check: test_and_publish
  • GitHub Check: UT Tests
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
🔇 Additional comments (9)
src/v0/destinations/marketo_static_list/transform.js (2)

17-17: Appropriate utility import added for metadata handling

The addition of CommonUtils import is appropriate for standardizing metadata handling across the codebase.


165-175: Well-structured refactor of metadata processing with improved robustness

The implementation now properly handles both array and non-array metadata inputs by using CommonUtils.toArray(). The code is well-organized with clear comments explaining the purpose of each section. This change enhances resilience against different input formats.

src/v0/destinations/marketo_static_list/transform.test.js (1)

1-29: Good test coverage for metadata processing functionality

The tests thoroughly validate both array and non-array input scenarios for the processMetadataForRouter function. The assertions appropriately check the array type, length, and expected property values. This ensures the function correctly handles different input formats.

src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js (1)

89-89: Approved: Improved handling of loginCustomerId based on subAccount flag

The conditional assignment of loginCustomerId ensures that it's only populated when a subAccount is in use, otherwise defaulting to an empty string. This change aligns with the addition of the subAccount parameter in the transform.js file and improves the integration with Google Ads API.

src/v0/destinations/google_adwords_enhanced_conversions/transform.js (1)

64-64: Approved: Added subAccount parameter to request params

This change passes the subAccount flag to the downstream network handler, enabling the conditional loginCustomerId behavior. The implementation is consistent with the existing validation logic that follows (lines 66-77).

.eslintignore (1)

7-7: LGTM: Added dist-test/ to ESLint ignore list

This change adds the dist-test/ directory to the ESLint ignore list, which is consistent with how other build/distribution directories are handled in this file.

src/services/source/nativeIntegration.ts (2)

1-1: LGTM: Added TransformationError import

The import of TransformationError from @rudderstack/integrations-lib is necessary for the validation check added below.


40-42: LGTM: Added input validation for sourceEvents

Good defensive programming. This validation ensures that the sourceEvents parameter is an array before proceeding with processing, preventing potential runtime errors when .map() is called on line 46.

src/services/source/__tests__/nativeIntegration.test.ts (1)

61-109: LGTM: Restructured tests and added validation test case

The tests for the sourceTransformRoutine method have been well-organized into a describe block with two specific test cases:

  1. The existing integration failure test
  2. A new test for invalid source events that properly verifies the input validation added to the implementation

The test structure is clean and follows good testing practices by focusing each test on a specific aspect of the functionality.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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.

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor Author

Allure Test reports for this run are available at:

@codecov

codecov Bot commented Apr 9, 2025 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 98.31933% with 6 lines in your changes missing coverage. Please review.

Project coverage is 91.17%. Comparing base (6719b79) to head (f990bf6).
Report is 56 commits behind head on develop.

Files with missing lines Patch % Lines
src/middlewares/baseSpreader.ts 93.33% 2 Missing ⚠️
src/util/openfaas/index.js 75.00% 1 Missing ⚠️
src/util/redis/redisConnector.js 94.11% 1 Missing ⚠️
...gle_adwords_enhanced_conversions/networkHandler.js 96.15% 1 Missing ⚠️
src/v0/destinations/mp/util.js 97.50% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4244      +/-   ##
===========================================
+ Coverage    91.06%   91.17%   +0.11%     
===========================================
  Files          635      632       -3     
  Lines        33175    33079      -96     
  Branches      7833     7831       -2     
===========================================
- Hits         30210    30160      -50     
+ Misses        2748     2674      -74     
- Partials       217      245      +28     

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

@sonarqubecloud

sonarqubecloud Bot commented Apr 9, 2025

Copy link
Copy Markdown

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.

6 participants