Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: cm360 transformerproxy V1 features.json update #2848

Merged
merged 7 commits into from
Nov 30, 2023

Conversation

aashishmalik
Copy link
Contributor

@aashishmalik aashishmalik commented Nov 23, 2023

Description of the change

add the new v1 handler for transformer proxy

Approach:

Updated the handler map to have both v0, v1 ... based on version returning corresponding handler in networkFactory method

// handles = {
// v0: {
// dest: handler
// },
// v1: {
// dest: handler
// },
// generic: GenericNetworkHandler,
// }

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Related issues

Fix #1

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • "Ready for review" label attached to the PR and reviewers mentioned in a comment
  • Changes have been reviewed by at least one other engineer
  • Issue from task tracker has a link to this pull request

Summary by CodeRabbit

  • New Features

    • Introduced versioning for network handlers to support multiple API versions.
    • Added new version 'v1' to the list of supported versions for network operations.
  • Enhancements

    • Updated delivery methods to accept a 'version' parameter for improved service handling.
    • Enhanced error handling with more descriptive messages in network operations.
  • Bug Fixes

    • Fixed an issue with the delivery controller to correctly handle errors using TypeScript's error variable syntax.
  • Tests

    • Added tests to ensure network handlers return the correct versions.
    • Implemented new test data for integration with the "campaign_manager" module, covering both successful and failed data deliveries.

Copy link

codecov bot commented Nov 23, 2023

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (0e7adc6) 87.17% compared to head (2e5a137) 87.25%.

Files Patch % Lines
...v1/destinations/campaign_manager/networkHandler.js 87.50% 6 Missing and 1 partial ⚠️
src/services/comparator.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2848      +/-   ##
===========================================
+ Coverage    87.17%   87.25%   +0.07%     
===========================================
  Files          772      775       +3     
  Lines        28805    28865      +60     
  Branches      6767     6780      +13     
===========================================
+ Hits         25112    25185      +73     
+ Misses        3350     3340      -10     
+ Partials       343      340       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aashishmalik aashishmalik marked this pull request as ready for review November 27, 2023 05:01
@aashishmalik aashishmalik requested review from a team and sivashanmukh as code owners November 27, 2023 05:01
Copy link
Contributor

coderabbitai bot commented Nov 27, 2023

Important

Auto Review Skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

Walkthrough

The changes involve introducing versioning to network handlers and destination services, allowing for different versions of network interactions and data processing. This includes updates to method signatures to accommodate a new version parameter, the addition of tests to ensure correct handler retrieval based on version, and updates to constants to support new versions. The changes aim to enhance the flexibility and maintainability of the codebase by allowing for version-specific logic in network operations and data delivery.

Changes

File Path Change Summary
src/adapters/networkHandlerFactory.js
src/services/destination/nativeIntegration.ts
src/v1/destinations/campaign_manager/networkHandler.js
Added version handling to network handlers.
src/adapters/networkHandlerFactory.test.js
test/integrations/destinations/campaign_manager/network.ts
Introduced tests for version-specific network handlers.
src/controllers/delivery.ts
src/interfaces/DestinationService.ts
src/services/comparator.ts
Updated method signatures to include version parameter.
src/routes/utils/constants.js Added new version to supported versions and updated constants.
test/integrations/destinations/campaign_manager/dataDelivery/data.ts Added test data for different response scenarios.

Assessment against linked issues

Objective Addressed Explanation
#1: Merging GATransformer artifacts into master branch of rudder-transformer repository The provided summary and changes do not mention GATransformer artifacts or the merging of such artifacts into the master branch.

Poem

In the land of code where versions thrive,
A rabbit hopped, making handlers come alive.
With each new tag, a handler's born,
Ensuring data through the net is deftly shorn. 🐇💻✨


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 10

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 9eda50e and abe40e5.
Files ignored due to filter (1)
  • src/features.json
Files selected for processing (8)
  • src/adapters/networkHandlerFactory.js (2 hunks)
  • src/adapters/networkHandlerFactory.test.js (1 hunks)
  • src/controllers/delivery.ts (1 hunks)
  • src/interfaces/DestinationService.ts (1 hunks)
  • src/routes/utils/constants.js (2 hunks)
  • src/services/comparator.ts (1 hunks)
  • src/services/destination/nativeIntegration.ts (1 hunks)
  • src/v1/destinations/campaign_manager/networkHandler.js (1 hunks)
Additional comments: 9
src/controllers/delivery.ts (1)
  • 16-27: The changes to the deliverToDestination method, including the addition of the version parameter and its use in the integrationService.deliver call, are correctly implemented.
src/routes/utils/constants.js (3)
  • 1-1: The addition of 'v1' to the SUPPORTED_VERSIONS array is consistent with the pull request's goal to introduce a new version endpoint for the transformer proxy.

  • 11-12: The addition of a comma after the 'sources' property in the CHANNELS object is a minor syntax change that may indicate preparation for future additions to this object.

  • 2-2: Verify whether the API_VERSION constant is intended to remain '2' or if it should be updated to reflect the new versioning changes.

src/services/comparator.ts (2)
  • 379-379: The error log statement in the deliver method suggests that the live compare test is not implemented for the delivery routine. Verify if this is a placeholder for future implementation or if it should be removed to avoid confusion.

  • 368-380: The deliver method does not include comparison logic like the other transformation methods. If comparison logic is required for the deliver method, consider implementing it to maintain consistency with the other methods.

src/services/destination/nativeIntegration.ts (1)
  • 172-181: The changes to the deliver method correctly incorporate the new version parameter and use it to obtain the appropriate network handler. Ensure that all invocations of this method are updated to pass the version argument.
src/v1/destinations/campaign_manager/networkHandler.js (2)
  • 56-108: The responseHandler function's error handling and response transformation logic appears to be correctly implemented.

  • 110-115: The networkHandler function correctly assigns methods to the instance of the object.

src/interfaces/DestinationService.ts Show resolved Hide resolved
src/adapters/networkHandlerFactory.js Show resolved Hide resolved
src/adapters/networkHandlerFactory.js Show resolved Hide resolved
src/adapters/networkHandlerFactory.js Show resolved Hide resolved
src/controllers/delivery.ts Show resolved Hide resolved
src/adapters/networkHandlerFactory.test.js Show resolved Hide resolved
src/adapters/networkHandlerFactory.test.js Show resolved Hide resolved
src/adapters/networkHandlerFactory.test.js Show resolved Hide resolved
src/adapters/networkHandlerFactory.test.js Show resolved Hide resolved
@aashishmalik aashishmalik requested a review from a team as a code owner November 27, 2023 15:21
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between abe40e5 and d570d87.
Files ignored due to filter (2)
  • test/tests/data/campaign_manager_proxy_input.json
  • test/tests/data/campaign_manager_proxy_output.json
Files selected for processing (2)
  • test/integrations/destinations/campaign_manager/dataDelivery/data.ts (1 hunks)
  • test/integrations/destinations/campaign_manager/network.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • test/integrations/destinations/campaign_manager/network.ts
Additional comments: 3
test/integrations/destinations/campaign_manager/dataDelivery/data.ts (3)
  • 7-11: There seems to be a potential discrepancy between the 'version' field in the data object (set to 'v0') and the 'version' field within the request body (set to '1'). Please verify if this is intentional and consistent with the versioning system used.

  • 188-189: The 'description' field for the third data object is identical to the second one ('Failure insert request'). If this is not a copy-paste error, consider providing a more descriptive message that differentiates the two test cases.

  • 150-151: The 'statTags' field includes 'destinationId' and 'workspaceId' with the value 'Non-determininable'. If these are placeholders, they should be replaced with actual values or removed if not applicable to the test case.

Also applies to: 251-252

Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

81.2% 81.2% Coverage
0.0% 0.0% Duplication

@aashishmalik aashishmalik merged commit 27f0797 into develop Nov 30, 2023
16 checks passed
anantjain45823 pushed a commit that referenced this pull request Dec 1, 2023
* feat: cm360 transformerproxy, V1 features.json update

* feat: add support for both v0,v1 in handler for old server support

* fix: addressed comments

* chore: added tests for V1 too
@devops-github-rudderstack devops-github-rudderstack deleted the feat.v1-networkHandler branch March 1, 2024 01:26
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