Skip to content

chore: sources v2 spec cleanup - #4192

Merged
vinayteki95 merged 9 commits into
developfrom
chore.v2-spec-cleanup
Apr 4, 2025
Merged

vinayteki95 merged 9 commits into
developfrom
chore.v2-spec-cleanup

Conversation

@vinayteki95

@vinayteki95 vinayteki95 commented Mar 21, 2025 •

Copy link
Copy Markdown
Contributor

What are the changes introduced in this PR?

Post the migration to v2 specification, there is no need for any version specific logic as we've consolidated to one final version.

What is the related Linear task?

Resolves INT-2757

Please explain the objectives of your changes below

webhook source improvements project goals

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

Yes, deprecation vo, v1 versioning of sources.

Any new dependencies introduced with this change?

No

Any new generic utility introduced or modified. Please explain the changes.

Yes version conversion strategies are completely removed.

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.

@coderabbitai

coderabbitai Bot commented Mar 21, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Introduced a new route activation check that enables only v2 source transformation endpoints.
    • Updated API paths to expose the unified v2 transformation interface.
  • Refactor

    • Consolidated source transformation functionality to focus on version 2 by removing legacy v0/v1 logic.
    • Streamlined input processing and configuration settings for consistent transformation behavior.

Walkthrough

This pull request removes legacy version (v0/v1) tests and conversion strategies, streamlining the code base for v2 source transformations. The changes include updates to the controller input handling, elimination of outdated conversion logic and version mapping, and simplification of error handling and logging. Additionally, middleware and route logic have been modified to check active versions via a new method, and several tests and test data files have been updated or removed to reflect the new streamlined functionality.

Changes

File(s) Change Summary
src/controllers/__tests__/source.test.ts, src/controllers/util/index.test.ts, src/services/__tests__/misc.test.ts, src/services/source/__tests__/nativeIntegration.test.ts, src/helpers/__tests__/fetchHandlers.test.ts, test/apitests/service.api.test.ts Removed legacy tests for v0/v1 source transformations; updated tests to validate v2 functionality and remove dependency on version parameters.
test/apitests/data_scenarios/source/v1/pipedream.json, test/apitests/data_scenarios/source/v2/failure.json, test/apitests/data_scenarios/source/v2/successful.json Updated/deleted JSON test scenarios to reflect the new event structure and updated error message paths for v2.
test/integrations/component.test.ts, test/integrations/testTypes.ts Removed sourceTransformV2Flag logic and related test setup, simplifying the test case structure.
src/controllers/source.ts, src/interfaces/SourceService.ts Updated input processing to cast request body to SourceInputV2, removed version handling parameters, and simplified the function signature.
src/controllers/util/conversionStrategies/abstractions.ts, src/controllers/util/conversionStrategies/strategyDefault.ts, src/controllers/util/conversionStrategies/strategyV0ToV1.ts, src/controllers/util/conversionStrategies/strategyV1ToV0.ts, src/controllers/util/conversionStrategies/strategyV1ToV2.ts, src/controllers/util/conversionStrategies/strategyV2ToV0.ts, src/controllers/util/conversionStrategies/strategyV2ToV1.ts, src/controllers/util/versionConversion.ts Deleted legacy conversion strategy classes and the version conversion factory, removing deprecated version mapping logic.
src/controllers/util/index.ts, src/helpers/fetchHandlers.ts Removed unused methods and properties (like adaptInputToVersion, sourceVersionMap, etc.), and updated getSourceHandler to remove the version parameter.
src/middlewares/routeActivation.ts, src/routes/source.ts Introduced ACTIVE_SOURCE_ROUTE_VERSIONS and a new method isSourceRouteVersionActive in the middleware; updated route middleware chain to enforce active v2 routes.
src/services/misc.ts, src/services/source/nativeIntegration.ts Simplified service logic by updating getSourceHandler and sourceTransformRoutine method signatures, removing the version parameter, and streamlining error handling and event processing.
src/features.ts Updated the FeaturesConfig interface and default configuration to explicitly set feature flags (supportSourceTransformV1, supportTransformerProxyV1, upgradedToSourceTransformV2) to true.
src/types/sourceTransformation.ts Removed the SourceInputConversionResult type definition to eliminate legacy conversion result representations.

Sequence Diagram(s)

sequenceDiagram
    participant C as Client
    participant RM as RouteActivationMiddleware
    participant SC as SourceController
    participant IS as IntegrationService

    C->>RM: POST /v2/sources/{source}
    RM->>RM: isSourceRouteVersionActive(ctx, next)
    RM-->>SC: Pass valid request
    SC->>IS: sourceTransformRoutine(SourceInputV2, source)
    IS-->>SC: Transformation response
    SC-->>C: Return response
Loading

Suggested reviewers

  • sivashanmukh
  • krishna2020

📜 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 f2d1964 and 40ea550.

⛔ Files ignored due to path filters (1)
  • test/apitests/service.api.test.ts is excluded by !**/test/**
📒 Files selected for processing (3)
  • src/features.ts (2 hunks)
  • src/middlewares/routeActivation.ts (2 hunks)
  • src/routes/source.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/routes/source.ts
  • src/middlewares/routeActivation.ts
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: Build User 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 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: ingestion-service-test
  • GitHub Check: UT Tests
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
🔇 Additional comments (2)
src/features.ts (2)

4-6: Interface properties hardcoded to true instead of boolean

The interface properties have been changed from boolean types to literal true values. This makes the types more restrictive, ensuring these features are always enabled. This aligns with the PR objective of cleaning up sources v2 specification, making it explicit that v1 support mechanisms are still in place while v2 is now the standard.


117-117:

Details

❓ Verification inconclusive

Environment variable dependency removed

The code now hardcodes upgradedToSourceTransformV2 to true rather than checking the environment variable. This simplifies the configuration and ensures consistency across environments.


🏁 Script executed:

#!/bin/bash
# Check if there are any remaining references to the UPGRADED_TO_SOURCE_TRANSFORM_V2 environment variable
rg "UPGRADED_TO_SOURCE_TRANSFORM_V2" --type ts --type js

Length of output: 56


Subject: Confirming Environment Variable Dependency Removal

The change in src/features.ts now hardcodes upgradedToSourceTransformV2 to true, effectively removing the dependency on the UPGRADED_TO_SOURCE_TRANSFORM_V2 environment variable. No references to that environment variable were found via the initial search. Please verify manually or via additional scripts to ensure no residual usage exists.

  • File & Location: src/features.ts at line 117.
  • Change Impact: The configuration now remains consistent across environments as it does not rely on any external environment variable.
✨ 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.

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@codecov

codecov Bot commented Mar 21, 2025 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.05%. Comparing base (342c82d) to head (322ddbc).
Report is 28 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4192      +/-   ##
===========================================
- Coverage    91.06%   91.05%   -0.01%     
===========================================
  Files          635      627       -8     
  Lines        33179    33049     -130     
  Branches      7836     7818      -18     
===========================================
- Hits         30213    30092     -121     
+ Misses        2718     2710       -8     
+ Partials       248      247       -1     

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

@krishna2020
krishna2020 force-pushed the chore.shopify-v2-migration2 branch from 5b8cc3e to 1bc6754 Compare March 21, 2025 12:45
Base automatically changed from chore.shopify-v2-migration2 to develop March 21, 2025 13:06
@vinayteki95
vinayteki95 force-pushed the chore.v2-spec-cleanup branch from 50553ad to 0085218 Compare March 21, 2025 13:14
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@vinayteki95
vinayteki95 force-pushed the chore.v2-spec-cleanup branch from 0085218 to 8e8a111 Compare March 26, 2025 19:58
@vinayteki95
vinayteki95 marked this pull request as ready for review March 26, 2025 20:00
@vinayteki95
vinayteki95 requested review from a team and sivashanmukh as code owners March 26, 2025 20:00
@vinayteki95
vinayteki95 requested review from a team, chandumlg and yashasvibajpai March 26, 2025 20:00
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@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: 1

🧹 Nitpick comments (2)
src/helpers/fetchHandlers.ts (1)

23-28: Consider using class name instead of this in static methods

Static analysis tools flagged the use of this in a static context, which can be confusing.

-    if (this.sourceHandlerMap.has(source)) {
-      sourceHandler = this.sourceHandlerMap.get(source);
-    } else {
-      sourceHandler = MiscService.getSourceHandler(source);
-      this.sourceHandlerMap.set(source, sourceHandler);
-    }
+    if (FetchHandler.sourceHandlerMap.has(source)) {
+      sourceHandler = FetchHandler.sourceHandlerMap.get(source);
+    } else {
+      sourceHandler = MiscService.getSourceHandler(source);
+      FetchHandler.sourceHandlerMap.set(source, sourceHandler);
+    }
🧰 Tools
🪛 Biome (1.9.4)

[error] 23-23: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 24-24: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 27-27: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

src/features.ts (1)

117-117: Default behavior change for upgradedToSourceTransformV2

The logic has been inverted to make v2 the default transformation version unless explicitly disabled. This aligns with the PR objective of focusing on v2 support only. The double negative in the expression !(process.env.UPGRADED_TO_SOURCE_TRANSFORM_V2 === 'false') is functionally correct but could be slightly improved for readability.

-  upgradedToSourceTransformV2: !(process.env.UPGRADED_TO_SOURCE_TRANSFORM_V2 === 'false'),
+  upgradedToSourceTransformV2: process.env.UPGRADED_TO_SOURCE_TRANSFORM_V2 !== 'false',
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8931015 and 8e8a111.

📒 Files selected for processing (29)
  • src/controllers/__tests__/source.test.ts (3 hunks)
  • src/controllers/source.ts (1 hunks)
  • src/controllers/util/conversionStrategies/abstractions.ts (0 hunks)
  • src/controllers/util/conversionStrategies/strategyDefault.ts (0 hunks)
  • src/controllers/util/conversionStrategies/strategyV0ToV1.ts (0 hunks)
  • src/controllers/util/conversionStrategies/strategyV1ToV0.ts (0 hunks)
  • src/controllers/util/conversionStrategies/strategyV1ToV2.ts (0 hunks)
  • src/controllers/util/conversionStrategies/strategyV2ToV0.ts (0 hunks)
  • src/controllers/util/conversionStrategies/strategyV2ToV1.ts (0 hunks)
  • src/controllers/util/index.test.ts (0 hunks)
  • src/controllers/util/index.ts (0 hunks)
  • src/controllers/util/versionConversion.ts (0 hunks)
  • src/features.ts (1 hunks)
  • src/helpers/__tests__/fetchHandlers.test.ts (1 hunks)
  • src/helpers/fetchHandlers.ts (1 hunks)
  • src/interfaces/SourceService.ts (1 hunks)
  • src/middlewares/routeActivation.ts (2 hunks)
  • src/routes/source.ts (1 hunks)
  • src/services/__tests__/misc.test.ts (1 hunks)
  • src/services/misc.ts (1 hunks)
  • src/services/source/__tests__/nativeIntegration.test.ts (5 hunks)
  • src/services/source/nativeIntegration.ts (2 hunks)
  • test/apitests/data_scenarios/source/v1/pipedream.json (0 hunks)
  • test/apitests/data_scenarios/source/v2/failure.json (2 hunks)
  • test/apitests/data_scenarios/source/v2/successful.json (1 hunks)
  • test/apitests/service.api.test.ts (1 hunks)
  • test/integrations/component.test.ts (1 hunks)
  • test/integrations/sources/shopify/webhookTestScenarios/IdentifyTests.ts (1 hunks)
  • test/integrations/testTypes.ts (0 hunks)
💤 Files with no reviewable changes (12)
  • test/integrations/testTypes.ts
  • src/controllers/util/versionConversion.ts
  • src/controllers/util/conversionStrategies/strategyDefault.ts
  • src/controllers/util/conversionStrategies/strategyV0ToV1.ts
  • src/controllers/util/index.test.ts
  • src/controllers/util/conversionStrategies/strategyV2ToV1.ts
  • src/controllers/util/index.ts
  • src/controllers/util/conversionStrategies/abstractions.ts
  • test/apitests/data_scenarios/source/v1/pipedream.json
  • src/controllers/util/conversionStrategies/strategyV1ToV0.ts
  • src/controllers/util/conversionStrategies/strategyV1ToV2.ts
  • src/controllers/util/conversionStrategies/strategyV2ToV0.ts
🧰 Additional context used
🧬 Code Definitions (6)
src/routes/source.ts (1)
src/middlewares/routeActivation.ts (1)
  • RouteActivationMiddleware (22-119)
src/services/__tests__/misc.test.ts (1)
src/services/misc.ts (1)
  • MiscService (8-75)
src/helpers/__tests__/fetchHandlers.test.ts (2)
src/services/misc.ts (1)
  • MiscService (8-75)
src/helpers/fetchHandlers.ts (1)
  • FetchHandler (3-42)
src/helpers/fetchHandlers.ts (1)
src/services/misc.ts (1)
  • MiscService (8-75)
src/controllers/__tests__/source.test.ts (1)
src/services/source/nativeIntegration.ts (1)
  • NativeIntegrationSourceService (19-74)
test/apitests/service.api.test.ts (11)
test/integrations/sources/shopify/data.ts (1)
  • data (1497-1510)
test/integrations/sources/adjust/data.ts (1)
  • data (8-184)
src/v0/util/index.test.js (1)
  • data (977-984)
test/integrations/destinations/customerio_audience/router/data.ts (1)
  • data (196-377)
src/sources/webhook/transform.js (3)
  • response (15-20)
  • response (37-37)
  • request (13-13)
src/sources/extole/transform.js (1)
  • response (35-35)
src/sources/gainsightpx/transform.js (1)
  • response (90-90)
src/sources/monday/transform.js (1)
  • response (70-72)
src/sources/olark/transform.js (1)
  • response (54-54)
src/sources/satismeter/transform.js (1)
  • response (24-24)
src/sources/slack/transform.js (2)
  • response (79-79)
  • response (109-111)
🪛 Biome (1.9.4)
src/helpers/fetchHandlers.ts

[error] 23-23: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 24-24: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: ingestion-service-test
  • GitHub Check: Check PR Title
  • 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: test_and_publish
🔇 Additional comments (36)
test/apitests/data_scenarios/source/v2/successful.json (1)

4-5: Updated test case structure aligns with v2 specification

The change from using an event object to a request.body string follows the updated v2 specification. This ensures consistent data structure for source transformations.

test/apitests/data_scenarios/source/v2/failure.json (2)

4-5: Structure updated to match v2 specification

The test case now correctly uses the request.body structure consistent with v2 specification, matching the successful case structure.


18-18: Error message path fixed

The error message has been updated to remove the undefined/ segment from the module path, making it more accurate and cleaner.

src/routes/source.ts (1)

9-9: Added version validation middleware

The isRouteVersionActive middleware ensures that only supported versions can access the endpoint. This aligns with the v2 specification cleanup by preventing access to deprecated v0/v1 versions.

src/helpers/fetchHandlers.ts (2)

21-21: Simplified method signature by removing version parameter

Removing the version parameter from getSourceHandler streamlines the API to support only v2, which aligns with the overall goal of cleaning up the source specifications.


26-26: Updated call to MiscService.getSourceHandler

The call has been updated to match the new signature that no longer requires a version parameter. This ensures consistent handler retrieval across the application.

src/services/misc.ts (1)

16-17: Function simplified to standardize on v2 source handlers

The method has been simplified by removing the version parameter, which aligns with the PR objective to focus solely on version v2. This change helps streamline the codebase by eliminating conditional logic for handling different versions.

src/middlewares/routeActivation.ts (2)

7-7: Added constant to explicitly define supported source versions

The constant ACTIVE_SOURCE_ROUTE_VERSIONS clearly defines that only 'v2' is supported, which aligns with the PR objective of cleaning up the sources specification to focus on v2.


47-54: Added middleware to enforce v2 route access

This new middleware method properly implements version validation by checking if the requested version is in the list of active versions. If not, it appropriately returns a 404 response. This is a good way to explicitly enforce the v2-only policy.

src/interfaces/SourceService.ts (1)

1-1: Updated imports to reflect v2 standardization

The imports have been updated to use SourceInputV2 instead of SourceInputConversionResult, which aligns with the PR objective of standardizing on v2.

src/helpers/__tests__/fetchHandlers.test.ts (2)

17-17: Version parameter removed from getSourceHandler

The mock implementation now expects only source parameter instead of (source, version). This aligns with the v2 spec cleanup that removes version-specific source handler logic.


24-26: Updated test assertions for sourceHandlerMap

The assertions now correctly reference source variable instead of previously using dest, and they test the source handler map without version parameter. This change is consistent with the simplified source handler retrieval approach.

src/controllers/__tests__/source.test.ts (4)

44-44: Test suite now focuses on V2 only

The test description has been updated to specifically mention "V2 Source transform tests", confirming that v0 and v1 support has been removed as part of the spec cleanup.


52-54: Removed version parameter from mock implementation

The mock implementation now expects data from getV2Data() and no longer requires a version parameter. This simplifies the API and matches the updated source transform method signature.


64-66: Updated endpoint to v2 and simplified request

The test now uses the /v2/sources/__rudder_test__ endpoint and sends data directly from getV2Data(), aligning with the v2-only approach.


93-97: Updated error handling in failing test

The mock implementation now throws an error directly instead of returning an error response. This change reflects updated error handling behavior in the v2 source transformation implementation.

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

23-26: Updated event structure to match v2 format

The event object structure has been updated to use the v2 format with a nested request.body property containing stringified JSON, which aligns with the standardized v2 specification.


37-37: Simplified getSourceHandler mock implementation

The mock implementation no longer expects a version parameter, which is consistent with the v2 spec cleanup that removes version-specific handling.


54-54: Removed version parameter from sourceTransformRoutine call

The call to sourceTransformRoutine has been updated to exclude the version parameter, aligning with the simplified method signature that focuses only on v2.


65-68: Updated event structure in failure test

Similar to the success test, the event structure in the failure test has been updated to match the v2 format with a nested request.body property.


75-75: Simplified getSourceHandler mock in failure test

Consistent with the previous changes, the mock implementation in the failure test no longer expects a version parameter.


92-92: Removed version parameter from sourceTransformRoutine call in failure test

Similar to the success test, the call to sourceTransformRoutine in the failure test has been updated to exclude the version parameter.

test/integrations/component.test.ts (3)

210-212: Simplified test data generation

The extendedTestData generation has been simplified to no longer create multiple test cases based on version flags, as part of the v2 spec cleanup that removes support for multiple versions.


220-220: Simplified test function signature

The test function now takes a simpler parameter structure, removing what was likely version-related parameters, as the tests now only need to handle v2.


228-228: Added initialization of sourceHandlerMap

Added explicit initialization of FetchHandler['sourceHandlerMap'] to a new Map before running source tests, ensuring clean state for each test run and preventing potential test interference.

src/services/__tests__/misc.test.ts (1)

19-19: Removal of version parameter aligns with the codebase standardization.

The test has been updated to remove the second argument ('v2') when calling MiscService.getSourceHandler. This is consistent with the changes in src/services/misc.ts where the method signature was simplified to only require the source parameter.

test/integrations/sources/shopify/webhookTestScenarios/IdentifyTests.ts (1)

1-258: New test file looks well-structured and comprehensive.

This new test file properly covers the Shopify customer update event transformation from the Pixel app. The test scenario is detailed and includes both input and expected output, which is valuable for regression testing.

A few observations:

  • The test is specific to v2, aligning with the sources v2 spec cleanup objective
  • The test data contains comprehensive customer information, including addresses and consent details
  • The expected output includes appropriate structure for Rudder's identify call
src/controllers/source.ts (2)

7-7: Import of SourceInputV2 type is appropriate.

Adding the SourceInputV2 import supports the type casting on line 13, which provides better type safety for the request body.


13-14: Simplified parameter handling improves code clarity.

The changes here properly implement the v2 spec cleanup by:

  1. Casting the request body to SourceInputV2[] for better type safety
  2. Removing the version parameter from the destructuring, as it's no longer needed
src/services/source/nativeIntegration.ts (4)

9-9: Import of SourceInputV2 type is appropriate.

Adding the SourceInputV2 import supports the parameter type definition on line 35, providing better type safety.


35-36: Parameter type update improves type safety.

Changing the parameter type from a conversion result type to NonNullable<SourceInputV2>[] simplifies the interface and improves type safety, aligning with the v2 spec cleanup goal.


40-40: Handler retrieval simplification is consistent with API changes.

Removing the version parameter from FetchHandler.getSourceHandler() aligns with the changes in the MiscService.getSourceHandler() method, maintaining consistency throughout the codebase.


45-47: Process flow simplification improves code readability.

The processing logic has been simplified by:

  1. Using a more specific return type for respEvents
  2. Directly calling sourceHandler.process(sourceEvent) without version-specific handling
  3. Unconditionally returning the result of handleSuccessEventsSource

This makes the code more maintainable and focused on v2 processing.

test/apitests/service.api.test.ts (3)

474-475: Good update to v2 path for failure test data!

Properly updating the data path from v1 to v2 to reflect the new versioning strategy.


477-477: Endpoint correctly updated to v2!

This change aligns with the source transformation v2 specification cleanup by ensuring the test uses the v2 endpoint.


484-490: Good test for backward incompatibility!

This test replaces the previous success test for pipedream with a more appropriate test that verifies deprecated version endpoints (v0) return 404 errors. This ensures proper error handling for clients still using older API versions.

Comment thread src/interfaces/SourceService.ts Resolved
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

Comment thread src/features.ts Resolved
Comment thread src/middlewares/routeActivation.ts Resolved
Comment thread src/routes/source.ts Resolved
Comment thread test/apitests/service.api.test.ts Resolved
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

Comment thread src/features.ts Resolved
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@sonarqubecloud

sonarqubecloud Bot commented Apr 4, 2025

Copy link
Copy Markdown

@vinayteki95
vinayteki95 merged commit cc81cfe into develop Apr 4, 2025
@vinayteki95
vinayteki95 deleted the chore.v2-spec-cleanup branch April 4, 2025 04:49
@coderabbitai coderabbitai Bot mentioned this pull request Aug 19, 2025
10 tasks
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