Skip to content

chore(release): pull main into develop post release v1.106.0 - #4543

Merged
koladilip merged 1 commit into
developfrom
main
Jul 31, 2025
Merged

koladilip merged 1 commit into
developfrom
main

Conversation

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

👑 An automated PR

* chore: ai generated docs for airship

* chore: migrate some streaming destination to new test format (#4435)

* chore: migrate some streaming destination to new test format

* chore: rebase to develop

* fix: type

* chore: review comments

* chore: ing-svc workflow takes latest go tests

* chore: restart deployment after creating a develop image (#4528)

* chore: restart deployment after creating a develop image

* fix: review comments

* fix: add dependencies for kubectl

* chore: review comments

* chore: review comments

* chore: add another job for dedicated deployment

* chore: update sku mappings for product viewed event (#4467)

* chore: update sku mappings for product viewed event, fix skipped tests

* chore: remove skip false

---------

Co-authored-by: Mahesh Kutty <[email protected]>

* chore: add checkout step for deployment restart action (#4532)

* chore: auto create ing-svc pr for go-tests

* chore: restructure workflows

* chore: workflow add permissions

* chore: address security and compatibility issues

* refactor: remove unused marketo bulk upload metrics (#4537)

- Remove 13 unused marketo_bulk_upload metrics that were defined but not collected
- These metrics were from old implementation and not actively used
- Reduces Prometheus cardinality and improves performance
- Keeps only actively used marketo metrics: fetch_token, lead_lookup, activity

Fixes INT-3978

* chore: use latest vars for pod restart (#4538)

* chore: gitworkflow version upgrades

* chore: scan push revert to old version

* chore: add lint rules to catch invalid or unresolved imports (#4531)

* feat: onboard postscript destination (#4438)

* feat: onboard postscript destination

* chore: add nwhandler tests

* chore: add comments, update tests, fix properties inconsistencies

* chore: address comments

* chore: add util tests

* feat: onboard postscript destination

* chore: add nwhandler tests

* chore: add comments, update tests, fix properties inconsistencies

* chore: address comments

* chore: add util tests

* chore: address comments

* fix: subscriber updation logic

* chore: add tests for code coverage

* chore: address comments

* chore: address comments, add docs

* chore: remove catch

---------

Co-authored-by: Mahesh Kutty <[email protected]>
Co-authored-by: Mahesh Kutty <[email protected]>

* chore(release): 1.106.0

---------

Co-authored-by: Vinay Teki <[email protected]>
Co-authored-by: Dilip Kola <[email protected]>
Co-authored-by: Manish Kumar <[email protected]>
Co-authored-by: Mahesh Kutty <[email protected]>
Co-authored-by: Yashasvi Bajpai <[email protected]>
Co-authored-by: Mahesh Kutty <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 31, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Introduced Postscript destination integration for SMS marketing, supporting subscriber management and custom event tracking.
    • Added feature flag to enable Postscript router transform.
    • Implemented comprehensive transformation logic, configuration, and utility functions for Postscript.
    • Added type definitions for Postscript integration.
    • Provided robust error handling and network response processing for Postscript API interactions.
  • Bug Fixes

    • Improved validation in EventBridge destination to reject events with empty configuration.
  • Tests

    • Added extensive unit tests for Postscript transformation logic, utilities, and network handling.
    • Enhanced test coverage for Shopify pixel utilities.
  • Chores

    • Updated GitHub Actions workflows with new jobs for Kubernetes deployment restarts and ingestion service updates.
    • Upgraded versions of several GitHub Actions (Docker Buildx, SonarCloud, Slack notifications).
    • Ensured ingestion service tests use the current branch for Go module dependencies.
  • Refactor

    • Removed obsolete Marketo bulk upload Prometheus metrics.
  • Documentation

    • Added documentation and configuration for new GitHub Actions and workflows.
  • Style

    • Minor improvements for code clarity and maintainability.

Walkthrough

This update introduces a new Postscript destination integration, including configuration, transformation logic, utility functions, and comprehensive unit tests. Additionally, it adds new and updated GitHub Actions workflows for deployment automation, dependency updates, and notification improvements. Several workflow versions are bumped, and minor feature flag and type definition changes are included.

Changes

Cohort / File(s) Change Summary
GitHub Actions: New K8s Restart Action & Jobs
.github/actions/restart-deployment/action.yml, .github/workflows/prepare-for-dev-deploy.yml
Introduces a custom composite GitHub Action to restart Kubernetes deployments and adds jobs to use this action for various namespaces and deployments.
GitHub Actions: Ingestion Service Update Automation
.github/workflows/prepare-for-prod-dt-deploy.yml, .github/workflows/update-ingestion-service.yml
Adds a new workflow and job to automate updating the ingestion service dependency on the transformer, including branch management and PR creation.
GitHub Actions: Workflow Version Bumps
.github/workflows/build-push-docker-image.yml, .github/workflows/dt-test-and-report-code-coverage.yml, .github/workflows/publish-new-release.yml, .github/workflows/slack-notify.yml
Updates action versions for Docker Buildx, SonarCloud, and Slack notification steps; no logic changes.
GitHub Actions: Ingestion Service Test Go Module Patch
.github/workflows/ingestion-service-test.yml
Adds a step to patch the Go module to use the local transformer branch for testing.
Feature Flag Addition
src/features.ts
Adds a POSTSCRIPT feature flag under routerTransform.
Type Extension
src/types/controlPlaneConfig.ts
Adds an optional ResponseRules property to the DestinationDefinition type.
Prometheus Metrics Cleanup
src/util/prometheus.js
Removes all Marketo bulk upload Prometheus metric definitions.
EventBridge Config Validation
src/v0/destinations/eventbridge/transform.js
Enhances config validation by rejecting empty configuration objects.
Postscript Destination: Config, Types, and Logic
src/v0/destinations/postscript/config.ts, src/v0/destinations/postscript/types.ts, src/v0/destinations/postscript/transform.ts, src/v0/destinations/postscript/utils.ts
Introduces all configuration, type definitions, transformation, and utility logic for the new Postscript destination integration.
Postscript Destination: Unit Tests
src/v0/destinations/postscript/transform.test.ts, src/v0/destinations/postscript/utils.test.ts
Adds comprehensive unit tests for Postscript transformation and utility logic.
Postscript V1 Network Handler
src/v1/destinations/postscript/networkHandler.ts, src/v1/destinations/postscript/networkHandler.test.ts
Adds a V1 network handler for Postscript with response handling and corresponding unit tests.
Shopify Webpixel Test Update
src/sources/shopify/webpixelTransformations/pixelUtils.test.js
Updates a test case to include a non-empty SKU value.

Sequence Diagram(s)

sequenceDiagram
    participant GitHubActions
    participant EKSCluster
    participant K8sAPI

    GitHubActions->>GitHubActions: Setup AWS credentials & kubectl
    GitHubActions->>EKSCluster: Update kubeconfig
    loop For each namespace and deployment
        GitHubActions->>K8sAPI: kubectl rollout restart deployment
        GitHubActions->>K8sAPI: kubectl rollout status deployment
    end
    GitHubActions->>GitHubActions: Output completion message
Loading
sequenceDiagram
    participant RudderStack
    participant PostscriptTransform
    participant PostscriptAPI

    loop For each event in batch
        RudderStack->>PostscriptTransform: Process event
        alt Identify event with lookup
            PostscriptTransform->>PostscriptAPI: Lookup subscriber
            PostscriptAPI-->>PostscriptTransform: Lookup result
            PostscriptTransform->>PostscriptAPI: Create or update subscriber
        else Track event
            PostscriptTransform->>PostscriptAPI: Create custom event
        end
        PostscriptAPI-->>PostscriptTransform: API response
    end
    PostscriptTransform->>RudderStack: Batch response
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

  • The introduction of a new destination (Postscript) with full config, types, transformation logic, utilities, and comprehensive tests is substantial and requires careful review.
  • Multiple workflow and automation changes, while individually moderate, collectively increase scope.
  • Minor changes (feature flags, type tweaks, metrics cleanup) are straightforward but add to the breadth.

Possibly related PRs

Suggested reviewers

  • sivashanmukh
  • koladilip
  • manish339k
  • ItsSudip
  • krishna2020

Suggestions for improvement:

  • Consider splitting large PRs into smaller, focused units for easier review and traceability.
  • Ensure that all new workflow steps and custom actions are documented for maintainability.
  • For the Postscript integration, provide API contract references and example payloads in documentation to assist future contributors.
  • Maintain comprehensive test coverage as demonstrated—this is excellent practice.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch main

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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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:

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

🧹 Nitpick comments (11)
.github/actions/restart-deployment/action.yml (2)

41-43: Trim whitespace for deployment names as well
DEPLOYMENTS may inherit spaces ("foo, bar"). Mirror the namespace trimming to avoid label-mismatch.

-        IFS=',' read -ra DEPLOYMENTS <<< "${{ inputs.deployment-name }}"
+        IFS=',' read -ra DEPLOYMENTS <<< "${{ inputs.deployment-name }}"
+        for i in "${!DEPLOYMENTS[@]}"; do
+          DEPLOYMENTS[$i]=$(echo "${DEPLOYMENTS[$i]}" | xargs)
+        done

49-58: Remove trailing spaces – YAML-lint flagged
Blank lines 52 and 57 contain stray spaces. They are harmless at runtime but fail yamllint in pedantic mode.

.github/workflows/prepare-for-dev-deploy.yml (2)

88-105: Consider dropping the extra checkout – composite action does not require source
restart-deployment only needs the action directory itself, which is already in the workspace. Skipping checkout speeds the job ~30 s.


118-122: Strip trailing spaces & add terminal newline
Line 121 has padding after the deployment name, and the file lacks a final newline – both flagged by yamllint.

-          deployment-name: rudderstack-transformer         
+          deployment-name: rudderstack-transformer
+
.github/workflows/update-ingestion-service.yml (2)

76-81: go get is deprecated for editing go.mod

Since Go 1.20, go get outside go install is discouraged.
A future‐proof alternative:

go mod edit -require=github.com/rudderlabs/rudder-transformer/go@${LATEST_SHA}
go mod tidy

Nothing breaks today, but switching avoids deprecation warnings.


101-108: Remove trailing spaces to satisfy yamllint

Line 107 contains whitespace-only content, tripping the lint check.
Simply delete the spaces on the blank line.

-          
+
src/v1/destinations/postscript/networkHandler.ts (1)

85-90: Consider modernizing the network handler pattern

The current implementation uses legacy function constructor syntax. Consider refactoring to use ES6 class syntax or a factory function for better readability and type safety:

-function networkHandler(this) {
-  this.prepareProxy = prepareProxyRequest;
-  this.proxy = proxyRequest;
-  this.processAxiosResponse = processAxiosResponse;
-  this.responseHandler = responseHandler;
-}
+class NetworkHandler {
+  prepareProxy = prepareProxyRequest;
+  proxy = proxyRequest;
+  processAxiosResponse = processAxiosResponse;
+  responseHandler = responseHandler;
+}
+
+export { NetworkHandler as networkHandler };

Alternatively, if maintaining consistency with other handlers in the codebase is important, the current implementation is acceptable.

src/v0/destinations/postscript/transform.ts (1)

262-269: Consider validating connection parameter instead of providing defaults

The fallback object for the connection parameter might mask configuration issues. Consider validating that the connection is properly provided:

-    postscriptConnection ?? {
-      sourceId: 'default-source-id',
-      destinationId: 'default-destination-id',
-      enabled: true,
-      config: {
-        destination: {},
-      },
-    },
+    postscriptConnection,

If the connection is required, it's better to fail early with a clear error rather than using defaults that might not be meaningful.

src/v0/destinations/postscript/utils.test.ts (1)

599-602: Maintain consistent return structure

For consistency with other test cases, include the subscriberId: undefined property in the return objects.

expect(results).toEqual([
-  { exists: false, identifierValue: '+1234567890', identifierType: 'phone' },
-  { exists: false, identifierValue: '+0987654321', identifierType: 'phone' },
+  { exists: false, subscriberId: undefined, identifierValue: '+1234567890', identifierType: 'phone' },
+  { exists: false, subscriberId: undefined, identifierValue: '+0987654321', identifierType: 'phone' },
]);
src/v0/destinations/postscript/utils.ts (1)

308-340: Clean batch response implementation

The implementation correctly creates individual responses for each event. Consider documenting why PostScript uses individual responses instead of true batching for future maintainers.

Add a comment explaining the individual response approach:

+ // PostScript API doesn't support bulk operations, so we create individual requests for each event
  // For PostScript, we create individual responses for each event
  events.forEach((event) => {
src/v0/destinations/postscript/types.ts (1)

167-173: Consider removing redundant interface

The RespList interface appears to duplicate fields from ProcessedEvent. Consider whether this interface is necessary or if ProcessedEvent can be used directly.

If this interface is not used elsewhere in the codebase, consider removing it to reduce redundancy and maintenance overhead.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e136c9d and 7ae313f.

⛔ Files ignored due to path filters (32)
  • .eslintrc.json is excluded by !**/*.json
  • CHANGELOG.md is excluded by !**/*.md
  • go/webhook/testcases/testdata/testcases/shopify/identify_call_for_customers_create_event_0.json is excluded by !**/*.json
  • package-lock.json is excluded by !**/package-lock.json, !**/*.json
  • package.json is excluded by !**/*.json
  • src/sources/shopify/pixelEventsMappings/productViewedEventMapping.json is excluded by !**/*.json
  • src/v0/destinations/airship/README.md is excluded by !**/*.md
  • src/v0/destinations/airship/docs/businesslogic.md is excluded by !**/*.md
  • src/v0/destinations/airship/docs/retl.md is excluded by !**/*.md
  • src/v0/destinations/postscript/README.md is excluded by !**/*.md
  • src/v0/destinations/postscript/data/postscriptSubscriberConfig.json is excluded by !**/*.json
  • src/v0/destinations/postscript/docs/businesslogic.md is excluded by !**/*.md
  • src/v0/destinations/postscript/docs/retl.md is excluded by !**/*.md
  • test/integrations/component.test.ts is excluded by !**/test/**
  • test/integrations/destinations/eventbridge/processor/data.ts is excluded by !**/test/**
  • test/integrations/destinations/kafka/batch/data.ts is excluded by !**/test/**
  • test/integrations/destinations/kafka/processor/data.ts is excluded by !**/test/**
  • test/integrations/destinations/kinesis/processor/data.ts is excluded by !**/test/**
  • test/integrations/destinations/personalize/processor/data.ts is excluded by !**/test/**
  • test/integrations/destinations/postscript/common.ts is excluded by !**/test/**
  • test/integrations/destinations/postscript/dataDelivery/business.ts is excluded by !**/test/**
  • test/integrations/destinations/postscript/dataDelivery/data.ts is excluded by !**/test/**
  • test/integrations/destinations/postscript/dataDelivery/network.ts is excluded by !**/test/**
  • test/integrations/destinations/postscript/router/errorHandlingTestData.ts is excluded by !**/test/**
  • test/integrations/destinations/postscript/router/identifyTestData.ts is excluded by !**/test/**
  • test/integrations/destinations/postscript/router/mixedEventsTestData.ts is excluded by !**/test/**
  • test/integrations/destinations/postscript/router/trackTestData.ts is excluded by !**/test/**
  • test/integrations/sources/shopify/pixelMappingTests/CheckoutEventsTests.ts is excluded by !**/test/**
  • test/integrations/sources/shopify/pixelMappingTests/CheckoutStepsTests.ts is excluded by !**/test/**
  • test/integrations/sources/shopify/pixelMappingTests/ProductEventsTests.ts is excluded by !**/test/**
  • test/integrations/testTypes.ts is excluded by !**/test/**
  • test/integrations/testUtils.ts is excluded by !**/test/**
📒 Files selected for processing (22)
  • .github/actions/restart-deployment/action.yml (1 hunks)
  • .github/workflows/build-push-docker-image.yml (3 hunks)
  • .github/workflows/dt-test-and-report-code-coverage.yml (1 hunks)
  • .github/workflows/ingestion-service-test.yml (1 hunks)
  • .github/workflows/prepare-for-dev-deploy.yml (1 hunks)
  • .github/workflows/prepare-for-prod-dt-deploy.yml (1 hunks)
  • .github/workflows/publish-new-release.yml (1 hunks)
  • .github/workflows/slack-notify.yml (1 hunks)
  • .github/workflows/update-ingestion-service.yml (1 hunks)
  • src/features.ts (1 hunks)
  • src/sources/shopify/webpixelTransformations/pixelUtils.test.js (2 hunks)
  • src/types/controlPlaneConfig.ts (1 hunks)
  • src/util/prometheus.js (5 hunks)
  • src/v0/destinations/eventbridge/transform.js (2 hunks)
  • src/v0/destinations/postscript/config.ts (1 hunks)
  • src/v0/destinations/postscript/transform.test.ts (1 hunks)
  • src/v0/destinations/postscript/transform.ts (1 hunks)
  • src/v0/destinations/postscript/types.ts (1 hunks)
  • src/v0/destinations/postscript/utils.test.ts (1 hunks)
  • src/v0/destinations/postscript/utils.ts (1 hunks)
  • src/v1/destinations/postscript/networkHandler.test.ts (1 hunks)
  • src/v1/destinations/postscript/networkHandler.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js

⚙️ CodeRabbit Configuration File

Focus on ESLint errors (max 3) and warnings (max 5).

Files:

  • src/sources/shopify/webpixelTransformations/pixelUtils.test.js
  • src/v0/destinations/eventbridge/transform.js
  • src/util/prometheus.js
🧠 Learnings (7)
src/sources/shopify/webpixelTransformations/pixelUtils.test.js (3)

Learnt from: krishna2020
PR: #4178
File: src/sources/shopify/transform.js:37-45
Timestamp: 2025-03-21T12:32:28.443Z
Learning: The getBodyFromV2SpecPayload function in Shopify source transformation throws an error if request is not defined, making additional null checks in getEventFromV2Request function unnecessary.

Learnt from: krishna2020
PR: #4178
File: src/sources/shopify/transform.js:37-45
Timestamp: 2025-03-21T12:32:28.443Z
Learning: The getBodyFromV2SpecPayload function in the Shopify source throws an error if request is not defined, making additional null checks in getEventFromV2Request function unnecessary.

Learnt from: anantjain45823
PR: #2842
File: src/v1/sources/shopify/identifierEventsLayer.test.js:5-40
Timestamp: 2024-07-27T07:02:57.329Z
Learning: The processIdentifierEvent function in identifierEventsLayer.test.js is designed to succeed for any input, hence no negative test cases are required.

src/v0/destinations/eventbridge/transform.js (6)

Learnt from: krishna2020
PR: #4178
File: src/sources/shopify/transform.js:37-45
Timestamp: 2025-03-21T12:32:28.443Z
Learning: The getBodyFromV2SpecPayload function in Shopify source transformation throws an error if request is not defined, making additional null checks in getEventFromV2Request function unnecessary.

Learnt from: vinayteki95
PR: #4220
File: src/middlewares/routerTransformCompactedPayloadV1.ts:13-24
Timestamp: 2025-04-02T08:21:38.217Z
Learning: In the Rudder Transformer codebase, use generic Error objects instead of TransformationError when error monitoring with Bugsnag is needed, as TransformationError is configured to not trigger Bugsnag alerts.

Learnt from: ItsSudip
PR: #4186
File: src/middlewares/arraySpreader.ts:48-63
Timestamp: 2025-04-08T02:59:55.677Z
Learning: In the ArraySpreader/BaseSpreader middleware, error handling for the transform function is already implemented in the caller (BaseSpreader's middleware method), making additional error handling in individual transform functions unnecessary.

Learnt from: krishna2020
PR: #4178
File: src/sources/shopify/transform.js:37-45
Timestamp: 2025-03-21T12:32:28.443Z
Learning: The getBodyFromV2SpecPayload function throws an error if request is not defined, making additional null checks in the getEventFromV2Request function unnecessary.

Learnt from: maheshkutty
PR: #4359
File: src/v0/util/index.js:2272-2272
Timestamp: 2025-05-29T13:29:39.436Z
Learning: The combineBatchRequestsWithSameJobIds function in src/v0/util/index.js is used by both Mixpanel and Google AdWords Offline Conversions destinations in production. The function assumes metadata is always an array in multiple operations (forEach, filter, sort, map) and needs defensive programming to handle non-array metadata cases to prevent runtime errors.

Learnt from: krishna2020
PR: #4178
File: src/sources/shopify/transform.js:37-45
Timestamp: 2025-03-21T12:32:28.443Z
Learning: The getBodyFromV2SpecPayload function in the Shopify source throws an error if request is not defined, making additional null checks in getEventFromV2Request function unnecessary.

src/v0/destinations/postscript/transform.ts (2)

Learnt from: ItsSudip
PR: #4497
File: src/v0/destinations/tiktok_ads/transformV2.js:686-691
Timestamp: 2025-07-15T06:27:07.528Z
Learning: For TikTok Ads destination in src/v0/destinations/tiktok_ads/transformV2.js, there are plans for a future enhancement to group events by eventSource when batching to ensure all events in a batch have the same event_source value, as acknowledged by ItsSudip in PR #4497.

Learnt from: maheshkutty
PR: #4359
File: src/v0/util/index.js:2272-2272
Timestamp: 2025-05-29T13:29:39.436Z
Learning: The combineBatchRequestsWithSameJobIds function in src/v0/util/index.js is used by both Mixpanel and Google AdWords Offline Conversions destinations in production. The function assumes metadata is always an array in multiple operations (forEach, filter, sort, map) and needs defensive programming to handle non-array metadata cases to prevent runtime errors.

src/v0/destinations/postscript/transform.test.ts (3)

Learnt from: anantjain45823
PR: #2842
File: src/v1/sources/shopify/identifierEventsLayer.test.js:5-40
Timestamp: 2024-07-27T07:02:57.329Z
Learning: The processIdentifierEvent function in identifierEventsLayer.test.js is designed to succeed for any input, hence no negative test cases are required.

Learnt from: maheshkutty
PR: #4359
File: src/v0/util/index.js:2272-2272
Timestamp: 2025-05-29T13:29:39.436Z
Learning: The combineBatchRequestsWithSameJobIds function in src/v0/util/index.js is used by both Mixpanel and Google AdWords Offline Conversions destinations in production. The function assumes metadata is always an array in multiple operations (forEach, filter, sort, map) and needs defensive programming to handle non-array metadata cases to prevent runtime errors.

Learnt from: ItsSudip
PR: #4497
File: src/v0/destinations/tiktok_ads/transformV2.js:686-691
Timestamp: 2025-07-15T06:27:07.528Z
Learning: For TikTok Ads destination in src/v0/destinations/tiktok_ads/transformV2.js, there are plans for a future enhancement to group events by eventSource when batching to ensure all events in a batch have the same event_source value, as acknowledged by ItsSudip in PR #4497.

src/v0/destinations/postscript/utils.test.ts (4)

Learnt from: maheshkutty
PR: #4359
File: src/v0/util/index.js:2272-2272
Timestamp: 2025-05-29T13:29:39.436Z
Learning: The combineBatchRequestsWithSameJobIds function in src/v0/util/index.js is used by both Mixpanel and Google AdWords Offline Conversions destinations in production. The function assumes metadata is always an array in multiple operations (forEach, filter, sort, map) and needs defensive programming to handle non-array metadata cases to prevent runtime errors.

Learnt from: anantjain45823
PR: #2842
File: src/v1/sources/shopify/identifierEventsLayer.test.js:5-40
Timestamp: 2024-07-27T07:02:57.329Z
Learning: The processIdentifierEvent function in identifierEventsLayer.test.js is designed to succeed for any input, hence no negative test cases are required.

Learnt from: ItsSudip
PR: #4497
File: src/v0/destinations/tiktok_ads/transformV2.js:686-691
Timestamp: 2025-07-15T06:27:07.528Z
Learning: For TikTok Ads destination in src/v0/destinations/tiktok_ads/transformV2.js, there are plans for a future enhancement to group events by eventSource when batching to ensure all events in a batch have the same event_source value, as acknowledged by ItsSudip in PR #4497.

Learnt from: maheshkutty
PR: #4359
File: src/v0/util/index.js:2272-2272
Timestamp: 2025-05-29T13:29:39.436Z
Learning: The combineBatchRequestsWithSameJobIds function in src/v0/util/index.js assumes metadata is always an array throughout its implementation, but defensive programming should be added to handle cases where metadata might not be an array type to prevent runtime errors.

src/util/prometheus.js (1)

Learnt from: maheshkutty
PR: #4359
File: src/v0/util/index.js:2272-2272
Timestamp: 2025-05-29T13:29:39.436Z
Learning: The combineBatchRequestsWithSameJobIds function in src/v0/util/index.js is used by both Mixpanel and Google AdWords Offline Conversions destinations in production. The function assumes metadata is always an array in multiple operations (forEach, filter, sort, map) and needs defensive programming to handle non-array metadata cases to prevent runtime errors.

src/v0/destinations/postscript/utils.ts (2)

Learnt from: maheshkutty
PR: #4359
File: src/v0/util/index.js:2272-2272
Timestamp: 2025-05-29T13:29:39.436Z
Learning: The combineBatchRequestsWithSameJobIds function in src/v0/util/index.js is used by both Mixpanel and Google AdWords Offline Conversions destinations in production. The function assumes metadata is always an array in multiple operations (forEach, filter, sort, map) and needs defensive programming to handle non-array metadata cases to prevent runtime errors.

Learnt from: ItsSudip
PR: #4497
File: src/v0/destinations/tiktok_ads/transformV2.js:686-691
Timestamp: 2025-07-15T06:27:07.528Z
Learning: For TikTok Ads destination in src/v0/destinations/tiktok_ads/transformV2.js, there are plans for a future enhancement to group events by eventSource when batching to ensure all events in a batch have the same event_source value, as acknowledged by ItsSudip in PR #4497.

🧬 Code Graph Analysis (4)
src/v1/destinations/postscript/networkHandler.test.ts (2)
src/v1/destinations/postscript/networkHandler.ts (1)
  • networkHandler (92-92)
src/v0/destinations/postscript/config.ts (1)
  • DESTINATION_NAME (27-27)
src/v0/destinations/postscript/transform.ts (5)
src/v0/destinations/postscript/types.ts (3)
  • PostscriptRouterRequest (191-195)
  • ProcessedEvent (143-152)
  • SubscriberLookupResult (157-162)
src/v0/util/index.js (4)
  • getFieldValueFromMessage (687-693)
  • getDestinationExternalID (1161-1170)
  • getEventType (1950-1950)
  • handleRtTfSingleEventError (1789-1806)
src/v0/destinations/postscript/config.ts (3)
  • EXTERNAL_ID_TYPES (20-24)
  • SUBSCRIBERS_ENDPOINT (11-11)
  • CUSTOM_EVENTS_ENDPOINT (12-12)
src/v0/destinations/postscript/utils.ts (4)
  • buildSubscriberPayload (78-153)
  • buildCustomEventPayload (164-212)
  • performSubscriberLookup (223-295)
  • batchResponseBuilder (308-340)
src/constants/index.js (1)
  • EventType (1-10)
src/v1/destinations/postscript/networkHandler.ts (3)
src/types/destinationTransformation.ts (3)
  • ResponseHandlerParams (247-257)
  • ResponseProxyObject (262-270)
  • DeliveryJobState (229-233)
src/v0/destinations/postscript/config.ts (1)
  • DESTINATION_NAME (27-27)
src/adapters/utils/networkUtils.js (1)
  • getDynamicErrorType (87-95)
src/v0/destinations/postscript/utils.test.ts (4)
src/v0/util/index.js (5)
  • getFieldValueFromMessage (687-693)
  • getDestinationExternalID (1161-1170)
  • constructPayload (1073-1147)
  • getSuccessRespEvents (499-511)
  • generateExclusionList (1350-1353)
src/v0/destinations/postscript/utils.ts (6)
  • buildHeaders (44-49)
  • validateRequiredFields (58-67)
  • buildSubscriberPayload (78-153)
  • buildCustomEventPayload (164-212)
  • performSubscriberLookup (223-295)
  • batchResponseBuilder (308-340)
src/types/rudderEvents.ts (1)
  • RudderMessage (43-43)
src/v0/destinations/postscript/types.ts (2)
  • ProcessedEvent (143-152)
  • PostscriptDestination (179-179)
🪛 YAMLlint (1.37.1)
.github/actions/restart-deployment/action.yml

[error] 52-52: trailing spaces

(trailing-spaces)


[error] 57-57: trailing spaces

(trailing-spaces)

.github/workflows/prepare-for-dev-deploy.yml

[error] 122-122: no new line character at the end of file

(new-line-at-end-of-file)


[error] 122-122: trailing spaces

(trailing-spaces)

.github/workflows/update-ingestion-service.yml

[error] 107-107: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Code Coverage
  • 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 (28)
.github/workflows/slack-notify.yml (1)

25-25: Slack action version bump looks good – double-check for breaking changes
Moving from v2.1.0 to v2.1.1 is normally a patch-level, non-breaking upgrade, but Slack’s action has introduced breaking API changes before. Please skim the release notes to be safe.

.github/workflows/dt-test-and-report-code-coverage.yml (1)

86-86: SonarQube scan action upgraded – verify marketplace deprecations
v5.3.0 was released only days after v5.2.0. Ensure none of the deprecations or new required inputs in 5.3 affect the scan (they occasionally tweak default Java versions).

.github/workflows/publish-new-release.yml (1)

169-169: Patch upgrade for Slack notifier acknowledged
No objections; consistent with the other workflow bumps.

.github/workflows/build-push-docker-image.yml (1)

110-112: Confirm Buildx v3.11.1 availability on self-hosted runners

The runners previously used v3.7.1; bumping straight to v3.11.1 should be harmless, but the binary is downloaded at runtime.
Double-check that:

  1. All self-hosted runners (ARM64 and AMD64 pools) can resolve and pull the new tag.
  2. No breaking changes were introduced between 3.7.x → 3.11.x that would affect docker buildx bake/imagetools.

If you haven’t already, run a dry-run build on each runner class.

Also applies to: 166-168, 218-218

.github/workflows/ingestion-service-test.yml (1)

37-43: Local replace path: verify it resolves on CI

go mod edit -replace github.com/rudderlabs/rudder-transformer/go=../go assumes the module directory is <repo-root>/go.
That’s correct today, but CI failures will be opaque if the layout changes.

Consider guarding with a quick existence check:

test -d ../go || { echo "../go not found" ; exit 1 ; }

Not blocking, but worth tightening.

.github/workflows/prepare-for-prod-dt-deploy.yml (1)

174-179: Job executes independently – intentional?

update-ingestion-service has no needs, so it can run in parallel with image build/chart update jobs.
If the ingestion-service PR must reference the just-built tag (or rely on generate-tag-names), add an explicit dependency:

needs: [generate-tag-names, build-transformer-image]

Otherwise, confirm that running concurrently is acceptable.

src/sources/shopify/webpixelTransformations/pixelUtils.test.js (1)

241-241: LGTM! Test data enhancement improves coverage.

The update from an empty SKU to 'sku-tcs-liquid' provides better test coverage by validating the handling of actual SKU values rather than just edge cases. This ensures the productViewedEventBuilder correctly processes and includes SKU data in the message properties.

Also applies to: 257-257

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

25-25: Good defensive programming enhancement.

The additional !isEmptyObject(event.destination.Config) check strengthens the validation by ensuring the configuration object is not only present but also contains actual data. This prevents processing events with empty configuration objects and maintains consistent error handling.

src/features.ts (1)

100-100: LGTM! Feature flag addition follows established pattern.

The new POSTSCRIPT: true flag enables the Postscript destination integration and follows the consistent pattern used for other destination feature flags in the configuration.

src/types/controlPlaneConfig.ts (1)

9-9: LGTM! Type definition extension maintains backward compatibility.

The optional ResponseRules property extends the DestinationDefinition type to support response rule configurations while maintaining backward compatibility. The Record<string, unknown> | null type provides appropriate flexibility for various response rule structures.

src/v1/destinations/postscript/networkHandler.test.ts (1)

1-361: Excellent comprehensive test coverage for network handler.

This test suite demonstrates excellent testing practices with:

  • Comprehensive status code coverage: Tests success (2xx), client errors (4xx), server errors (5xx), and throttling (429)
  • Proper error type validation: Correctly validates NetworkError, RetryableError, and ThrottledError are thrown for appropriate status codes
  • Edge case handling: Tests empty/null response bodies and error metadata preservation
  • Clean test structure: Uses data-driven approach with well-defined test cases and helper functions
  • Error metadata verification: Validates that error tags are properly included for 4xx errors but not for throttling/retryable errors

The parameterized testing approach with the TestCase interface makes the tests maintainable and easy to extend.

src/v1/destinations/postscript/networkHandler.ts (1)

26-77: Well-structured response handler implementation

The response handler correctly processes PostScript API responses with comprehensive error handling. The implementation properly:

  • Creates the required response array for V1 delivery status tracking
  • Handles all standard HTTP status codes with appropriate error types
  • Uses the shared getDynamicErrorType utility for consistent error categorization
src/v0/destinations/postscript/config.ts (1)

10-27: Clean and well-organized configuration

The configuration file properly structures all necessary constants for the PostScript destination. Good practices observed:

  • Clear separation of concerns (API endpoints, mappings, ID types)
  • Consistent naming conventions
  • Proper use of const declarations
src/util/prometheus.js (1)

299-299: Appropriate cleanup of unused metrics

The removal of Marketo bulk upload metrics appears to be a clean refactoring that removes unused metric definitions. This helps reduce memory overhead and simplifies the metrics registry.

Also applies to: 342-342, 632-632, 663-663, 735-735

src/v0/destinations/postscript/transform.test.ts (1)

1-453: Comprehensive test coverage with well-structured test cases

The test suite provides excellent coverage of the PostScript transform functionality:

  • Proper mock isolation of external dependencies
  • Clear test organization with descriptive test names
  • Coverage of both success and error scenarios
  • Good use of helper functions to reduce duplication
  • Tests for edge cases (null inputs, missing fields)
src/v0/destinations/postscript/transform.ts (1)

152-274: Well-implemented batch processing with proper error handling

The router transformation function demonstrates excellent design:

  • Concurrent event processing with mapInBatches
  • Smart subscriber lookup batching for efficiency
  • Proper separation of successful and failed events
  • Event order preservation after lookup updates

The implementation correctly handles the lookup-based approach for determining create vs update operations.

src/v0/destinations/postscript/utils.test.ts (5)

17-75: Well-structured mock setup

The mock setup is comprehensive and follows best practices for unit testing. Good use of TypeScript type assertions for the mocked functions.


110-135: Comprehensive header building tests

Good coverage of both scenarios - with and without the partner API key environment variable. The tests correctly verify the header structure.


137-183: Thorough validation testing

Excellent coverage of validation scenarios including edge cases like empty required fields array. The error message assertions ensure proper user feedback.


365-505: Well-designed event payload tests

Comprehensive coverage of identification fallback logic and edge cases like missing event names. The timestamp handling tests ensure proper ISO format conversion.


624-791: Thorough batch response testing

Good coverage of different endpoints and methods. The tests correctly verify that PostScript creates individual responses for each event rather than true batching.

src/v0/destinations/postscript/utils.ts (4)

44-49: Clean header construction

Simple and effective implementation. Good use of environment variable for partner API key configuration.


58-67: Effective validation logic

Good use of filter to identify missing fields and providing a clear error message with all missing fields listed.


164-212: Well-implemented event payload builder

Good fallback logic for subscriber identification and proper timestamp conversion to ISO format. The custom properties extraction is handled cleanly.


223-295: Robust subscriber lookup implementation

Excellent error handling with fallback behavior and proper logging. The batch lookup approach optimizes API calls effectively.

src/v0/destinations/postscript/types.ts (3)

20-48: Well-designed configuration schemas

Good use of zod for validation with appropriate error messages. The passthrough() allows for future extensibility without breaking changes.


59-136: Comprehensive API type definitions

The payload and response types are well-structured with appropriate optional fields. Good inclusion of pagination metadata in lookup responses.


218-245: Robust error handling types

Excellent error type definitions that handle both single errors and field-specific validation errors. The network error structure provides good context for debugging.

Comment on lines +37 to +46
- name: Restart Pods in the provided Namespaces
shell: bash
run: |
# Split comma-separated namespaces and restart deployment in each
IFS=',' read -ra NAMESPACES <<< "${{ inputs.k8s-namespace }}"
IFS=',' read -ra DEPLOYMENTS <<< "${{ inputs.deployment-name }}"

echo "🚀 Starting deployment restart process..."
echo "Deployment: ${{ inputs.deployment-name }}"
echo "Namespaces: ${{ inputs.k8s-namespace }}"

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.

🛠️ Refactor suggestion

Add set -euo pipefail for robust Bash execution
Currently a failed kubectl command will only fail the step if it returns a non-zero exit, but undetected unset variables or pipeline failures may slip through. Placing strict mode at the top of the script guards against silent errors.

-      run: |
+      run: |
+        set -euo pipefail
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Restart Pods in the provided Namespaces
shell: bash
run: |
# Split comma-separated namespaces and restart deployment in each
IFS=',' read -ra NAMESPACES <<< "${{ inputs.k8s-namespace }}"
IFS=',' read -ra DEPLOYMENTS <<< "${{ inputs.deployment-name }}"
echo "🚀 Starting deployment restart process..."
echo "Deployment: ${{ inputs.deployment-name }}"
echo "Namespaces: ${{ inputs.k8s-namespace }}"
- name: Restart Pods in the provided Namespaces
shell: bash
run: |
set -euo pipefail
# Split comma-separated namespaces and restart deployment in each
IFS=',' read -ra NAMESPACES <<< "${{ inputs.k8s-namespace }}"
IFS=',' read -ra DEPLOYMENTS <<< "${{ inputs.deployment-name }}"
echo "🚀 Starting deployment restart process..."
echo "Deployment: ${{ inputs.deployment-name }}"
echo "Namespaces: ${{ inputs.k8s-namespace }}"
🤖 Prompt for AI Agents
In .github/actions/restart-deployment/action.yml around lines 37 to 46, add the
line "set -euo pipefail" at the very beginning of the bash script under the run
section. This will enable strict mode in bash, causing the script to exit
immediately on errors, unset variables, or pipeline failures, making the
deployment restart process more robust and error-proof.

Comment on lines +253 to +288
it('should build subscriber payload for update operation', () => {
const message: RudderMessage = {
type: 'identify',
userId: 'user123',
traits: {
phone: '+1234567890',
email: '[email protected]',
},
context: {
traits: {
subscriberId: 'sub_123',
},
},
} as RudderMessage;
mockGetDestinationExternalID.mockReturnValue('sub_123'); // Has subscriber ID (update operation)
mockConstructPayload.mockReturnValue({
subscriber_id: 'sub_123',
phone_number: '+1234567890',
email: '[email protected]',
});

// Mock extractCustomFields to not add any custom properties
mockExtractCustomFields.mockImplementation(() => {
// No custom properties for this test
});

const payload = buildSubscriberPayload(message);

expect(payload).not.toHaveProperty('subscriber_id'); // Should be removed for updates
expect(payload).toEqual({
phone_number: '+1234567890',
email: '[email protected]',
external_id: 'sub_123',
shopify_customer_id: NaN,
});
});

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.

⚠️ Potential issue

Fix NaN in shopify_customer_id field

The test expects shopify_customer_id: NaN at line 286, which indicates the implementation converts undefined/null to Number() without proper validation. This could cause API errors.

The implementation should only include shopify_customer_id when a valid numeric value is available:

if (shopifyCustomerId) {
-  payload.shopify_customer_id = Number(shopifyCustomerId);
+  const numericId = Number(shopifyCustomerId);
+  if (!isNaN(numericId)) {
+    payload.shopify_customer_id = numericId;
+  }
}

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/v0/destinations/postscript/utils.test.ts around lines 253 to 288, the
test expects shopify_customer_id to be NaN, which suggests the code converts
undefined or null to Number() without validation. To fix this, update the
implementation so that shopify_customer_id is only included in the payload if it
has a valid numeric value; otherwise, omit this field entirely to prevent
sending NaN in the API payload.

Comment on lines +111 to +113
if (shopifyCustomerId) {
payload.shopify_customer_id = Number(shopifyCustomerId);
}

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.

⚠️ Potential issue

Validate numeric conversion for shopify_customer_id

The conversion to Number without validation can result in NaN values being sent to the API, which could cause errors.

if (shopifyCustomerId) {
-  payload.shopify_customer_id = Number(shopifyCustomerId);
+  const numericId = Number(shopifyCustomerId);
+  if (!isNaN(numericId)) {
+    payload.shopify_customer_id = numericId;
+  }
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (shopifyCustomerId) {
payload.shopify_customer_id = Number(shopifyCustomerId);
}
if (shopifyCustomerId) {
const numericId = Number(shopifyCustomerId);
if (!isNaN(numericId)) {
payload.shopify_customer_id = numericId;
}
}
🤖 Prompt for AI Agents
In src/v0/destinations/postscript/utils.ts around lines 111 to 113, the code
converts shopifyCustomerId to a Number without validation, which may produce NaN
values. Add a check to ensure the conversion result is a valid number before
assigning it to payload.shopify_customer_id. Only assign the numeric value if it
is a valid number to prevent sending NaN to the API.

@codecov

codecov Bot commented Jul 31, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.19820% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.63%. Comparing base (20c80de) to head (7ae313f).
⚠️ Report is 25 commits behind head on develop.

Files with missing lines Patch % Lines
src/v0/destinations/postscript/utils.ts 96.29% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4543      +/-   ##
===========================================
+ Coverage    91.57%   91.63%   +0.05%     
===========================================
  Files          639      643       +4     
  Lines        33786    34020     +234     
  Branches      7989     8048      +59     
===========================================
+ Hits         30940    31174     +234     
+ Misses        2616     2588      -28     
- Partials       230      258      +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

Copy link
Copy Markdown

@koladilip
koladilip enabled auto-merge July 31, 2025 06:18
@koladilip
koladilip disabled auto-merge July 31, 2025 06:20
@koladilip
koladilip merged commit d495e00 into develop Jul 31, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Aug 14, 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.

3 participants