Repository navigation
chore(release): pull main into develop post release v1.105.2 - #4536
Conversation
…okup maps fix: lint errors fix: lint errors chore: upgrade workflow engine fix: use simple array map
Summary by CodeRabbit
WalkthroughThis update refactors the error-checking logic for batch event processing in the Iterable destination integration. It introduces a batch error checker utility for efficient event validation, updates related tests for broader coverage, and adds a new test suite for the Changes
Sequence Diagram(s)sequenceDiagram
participant TestSuite as Test Suite
participant BatchChecker as createBatchErrorChecker
participant Event as Event Object
TestSuite->>BatchChecker: createBatchErrorChecker(destinationResponse)
BatchChecker-->>TestSuite: returns checkEventError function
loop For each event
TestSuite->>BatchChecker: checkEventError(event)
BatchChecker-->>TestSuite: { isAbortable, errorMsg }
end
sequenceDiagram
participant TrackIdentifyStrategy
participant BatchChecker as createBatchErrorChecker
participant Event as Event
TrackIdentifyStrategy->>BatchChecker: createBatchErrorChecker(destinationResponse)
BatchChecker-->>TrackIdentifyStrategy: checkEventError function
loop For each event
TrackIdentifyStrategy->>BatchChecker: checkEventError(event)
BatchChecker-->>TrackIdentifyStrategy: { isAbortable, errorMsg }
TrackIdentifyStrategy->>TrackIdentifyStrategy: Build response object
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Suggestions for improvement:
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/v1/destinations/iterable/utils.test.ts (1)
221-250: Valuable performance benchmark testThe large dataset test (1000s of entries) validates that the Map/Set optimization performs well at scale. This is crucial for confirming the refactoring achieves its performance goals.
Consider adding a comment about the expected performance characteristics or time complexity to document the optimization benefit.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
CHANGELOG.mdis excluded by!**/*.mdpackage-lock.jsonis excluded by!**/package-lock.json,!**/*.jsonpackage.jsonis excluded by!**/*.json
📒 Files selected for processing (4)
src/v1/destinations/iterable/strategies/track-identify.test.ts(1 hunks)src/v1/destinations/iterable/strategies/track-identify.ts(2 hunks)src/v1/destinations/iterable/utils.test.ts(3 hunks)src/v1/destinations/iterable/utils.ts(2 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: ItsSudip
PR: rudderlabs/rudder-transformer#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: rudderlabs/rudder-transformer#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/v1/destinations/iterable/strategies/track-identify.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: 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.
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/v1/destinations/iterable/strategies/track-identify.test.ts (5)
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: 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.
Learnt from: vinayteki95
PR: #4220
File: src/middlewares/destTransformCompactedPayloadV1.ts:13-19
Timestamp: 2025-04-02T08:16:58.002Z
Learning: In the Rudder Transformer project, error handling should throw errors with descriptive messages (after logging them) rather than returning HTTP status codes, so that Bugsnag can catch them for debugging purposes.
Learnt from: maheshkutty
PR: #4364
File: src/v0/util/index.js:2220-2242
Timestamp: 2025-06-02T06:25:17.338Z
Learning: In the rudderlabs/rudder-transformer codebase, jobId values are guaranteed by system contract to always be valid numbers and never undefined or infinite. Additional validation for these edge cases in sorting functions like sortBatchesByMinJobId is not necessary.
src/v1/destinations/iterable/utils.ts (3)
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.
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/v1/destinations/iterable/utils.test.ts (6)
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.
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.
Learnt from: anantjain45823
PR: #2842
File: src/v1/sources/shopify/enrichmentLayer.js:36-42
Timestamp: 2024-10-08T15:52:59.819Z
Learning: The user clarified that errors in the setExtraNonEcomProperties function should not cause the event to fail, indicating a preference for resilience over strict error propagation.
Learnt from: anantjain45823
PR: #2842
File: src/v1/sources/shopify/enrichmentLayer.js:36-42
Timestamp: 2024-07-27T07:02:57.329Z
Learning: The user clarified that errors in the setExtraNonEcomProperties function should not cause the event to fail, indicating a preference for resilience over strict error propagation.
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.
⏰ 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: UT Tests
- GitHub Check: test_and_publish
- GitHub Check: Analyze (go)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
🔇 Additional comments (12)
src/v1/destinations/iterable/strategies/track-identify.ts (2)
3-3: Import statement updated correctlyThe import change aligns with the new batch-optimized approach.
19-34: Excellent performance optimization with batch error checkerThe refactoring from per-event checking to batch preprocessing is a solid improvement. Creating the error checker once (line 20) and reusing it for all events reduces complexity from O(n*m) to O(n+m) where n is events and m is error entries.
The switch from
forEachwith array push tomapis also cleaner and more functional.src/v1/destinations/iterable/strategies/track-identify.test.ts (3)
5-15: Well-structured helper function for test dataThe
createMetadatahelper reduces boilerplate and ensures consistent test data structure across all tests.
24-297: Comprehensive test coverage for handleSuccess methodThe test suite covers all important scenarios:
- Successful responses with events and users
- Partial failures with invalid emails and disallowed event names
- Empty arrays and missing data
- Complex error scenarios with multiple error types
Each test is well-structured with clear arrange-act-assert pattern.
299-472: Thorough error handling test coverageThe handleError tests validate proper TransformerProxyError throwing with various response formats (params, msg, message). The tests correctly verify error messages and status codes are properly propagated.
src/v1/destinations/iterable/utils.ts (4)
10-31: Excellent documentation updateThe JSDoc clearly explains the factory pattern and performance optimization. The references to API documentation are helpful for understanding the context.
32-37: Smart early return optimizationReturning a no-op function when
failCountis 0 avoids unnecessary processing for successful batches.
39-72: Efficient preprocessing with Map/Set data structuresThe use of Map for emails/userIds (to track multiple paths) and Set for eventNames is the right choice. The O(1) lookups will significantly improve performance for large batches compared to the previous O(n) array searches.
The logic correctly handles multiple occurrences of the same value across different error paths.
74-101: Clean error message constructionThe returned function efficiently checks each event against the preprocessed maps and constructs detailed error messages with all relevant paths. The concatenation approach ensures all error information is captured.
src/v1/destinations/iterable/utils.test.ts (3)
3-21: Correct adaptation to factory patternTests properly create the batch error checker once and reuse it, matching the intended usage pattern.
23-41: Good edge case coverage for null/undefined fieldsImportant to verify the function handles missing or null fields gracefully without throwing errors.
120-170: Excellent coverage of multiple error pathsThese tests verify that when the same value appears in multiple error arrays, all paths are correctly concatenated in the error message. This ensures complete error information is preserved.
|
Allure Test reports for this run are available at:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4536 +/- ##
===========================================
+ Coverage 91.44% 91.57% +0.13%
===========================================
Files 639 639
Lines 33774 33786 +12
Branches 7978 7989 +11
===========================================
+ Hits 30885 30940 +55
+ Misses 2655 2616 -39
+ Partials 234 230 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|



👑 An automated PR