Repository navigation
Conversation
Summary by CodeRabbit
Summary by CodeRabbit
WalkthroughThis update introduces a dynamic configuration system for the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Utils
participant Config
participant NetworkHandler
Client->>Utils: buildRequestConfig()
Utils->>Config: getBaseEndpoint()
Utils->>Config: isDebugMode()
Utils-->>Client: Request config with dynamic endpoint and debug flag
Client->>NetworkHandler: responseHandler(responseParams)
NetworkHandler->>NetworkHandler: getTestBehaviorFromRequest(request)
alt TestBehavior triggers error
NetworkHandler-->>Client: Throw NetworkError
else Status not successful
NetworkHandler-->>Client: Throw NetworkError
else Success
NetworkHandler-->>Client: Success response
end
Possibly related PRs
Suggested reviewers
Suggestions for improvement:
✨ Finishing Touches
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: 4
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 4d3449a and c63bd2e201eea7233cd7fe34f7f9fa65407feb87.
⛔ Files ignored due to path filters (5)
src/v0/destinations/rudder_test/README.mdis excluded by!**/*.mdtest/integrations/destinations/rudder_test/common.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/dataDelivery/data.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/dataDelivery/proxyV0.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/network.tsis excluded by!**/test/**
📒 Files selected for processing (2)
src/v0/destinations/rudder_test/config.ts(1 hunks)src/v0/destinations/rudder_test/networkHandler.js(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.js`: Focus on ESLint errors (max 3) and warnings (max 5).
**/*.js: Focus on ESLint errors (max 3) and warnings (max 5).
src/v0/destinations/rudder_test/networkHandler.js
🪛 Biome (1.9.4)
src/v0/destinations/rudder_test/networkHandler.js
[error] 39-39: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
🪛 GitHub Check: Check for formatting & lint errors
src/v0/destinations/rudder_test/networkHandler.js
[failure] 24-24:
'getTestBehaviorFromRequest' was used before it was defined
[failure] 21-21:
'response' is assigned a value but never used
[failure] 8-8:
'BASE_ENDPOINT' is assigned a value but never used
🪛 GitHub Actions: Verify
src/v0/destinations/rudder_test/networkHandler.js
[error] 8-8: ESLint: 'BASE_ENDPOINT' is assigned a value but never used. (@typescript-eslint/no-unused-vars)
⏰ Context from checks skipped due to timeout of 90000ms (11)
- 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 ARM64
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Code Coverage
- GitHub Check: UT Tests
- GitHub Check: test_and_publish
- GitHub Check: check-health
- GitHub Check: Analyze (go)
- GitHub Check: Analyze (actions)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (3)
src/v0/destinations/rudder_test/config.ts (1)
3-9: LGTM! Well-structured configuration additions.The new constants are appropriately named and the PROXY_ENDPOINTS structure provides good extensibility for future testing scenarios. The endpoint URL consistency with BASE_ENDPOINT is appropriate for the test destination.
src/v0/destinations/rudder_test/networkHandler.js (2)
18-59: Overall implementation looks solid for test destination.The response handler logic is well-structured with appropriate error handling and test behavior simulation. The error type mapping and NetworkError usage follow established patterns.
83-88: Constructor pattern follows established conventions.The networkHandler constructor properly exposes the required methods for proxy functionality, maintaining consistency with other destination handlers.
c63bd2e to
250b9cb
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (4)
src/v0/destinations/rudder_test/networkHandler.js (4)
21-21: Remove unused variable.The
responsevariable is assigned but never used. Consider removing it to clean up the code.- const { response, status } = destinationResponse; + const { status } = destinationResponse;
39-39: Use optional chaining for safer property access.Replace the logical AND chain with optional chaining for better readability and safety.
- if (testBehavior && testBehavior.statusCode && testBehavior.statusCode !== 200) { + if (testBehavior?.statusCode && testBehavior.statusCode !== 200) {
8-8: Remove unused import.The
BASE_ENDPOINTimport is not used anywhere in this file and should be removed to eliminate the ESLint error.-const { BASE_ENDPOINT } = require('./config');
24-24: Fix function declaration hoisting issue.The function
getTestBehaviorFromRequestis used before it's declared, which can cause issues. Move the function declaration before its usage.Move the
getTestBehaviorFromRequestfunction declaration (lines 65-81) above theresponseHandlerfunction to resolve the hoisting issue.
🧹 Nitpick comments (1)
src/v0/destinations/rudder_test/networkHandler.js (1)
65-81: Consider adding input validation for header parsing.The function handles JSON parsing errors gracefully, but consider adding validation for the header value format to ensure it's valid JSON before parsing.
// Check if test behavior is in headers for proxy testing const headers = destinationRequest?.headers || {}; if (headers['x-test-behavior']) { + // Validate that header value looks like JSON before parsing + const headerValue = headers['x-test-behavior']; + if (typeof headerValue === 'string' && (headerValue.startsWith('{') || headerValue.startsWith('['))) { return JSON.parse(headers['x-test-behavior']); + } }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between c63bd2e201eea7233cd7fe34f7f9fa65407feb87 and 250b9cb32a266b107de82e670c252e61a275e33f.
⛔ Files ignored due to path filters (5)
src/v0/destinations/rudder_test/README.mdis excluded by!**/*.mdtest/integrations/destinations/rudder_test/common.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/dataDelivery/data.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/dataDelivery/proxyV0.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/network.tsis excluded by!**/test/**
📒 Files selected for processing (2)
src/v0/destinations/rudder_test/config.ts(1 hunks)src/v0/destinations/rudder_test/networkHandler.js(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/v0/destinations/rudder_test/config.ts
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.js`: Focus on ESLint errors (max 3) and warnings (max 5).
**/*.js: Focus on ESLint errors (max 3) and warnings (max 5).
src/v0/destinations/rudder_test/networkHandler.js
🪛 Biome (1.9.4)
src/v0/destinations/rudder_test/networkHandler.js
[error] 39-39: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
🪛 GitHub Check: Check for formatting & lint errors
src/v0/destinations/rudder_test/networkHandler.js
[failure] 24-24:
'getTestBehaviorFromRequest' was used before it was defined
[failure] 21-21:
'response' is assigned a value but never used
[failure] 8-8:
'BASE_ENDPOINT' is assigned a value but never used
🪛 GitHub Actions: Verify
src/v0/destinations/rudder_test/networkHandler.js
[error] 8-8: ESLint: 'BASE_ENDPOINT' is assigned a value but never used. (@typescript-eslint/no-unused-vars)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: test_and_publish
- GitHub Check: UT Tests
- GitHub Check: check-health
- GitHub Check: Analyze (go)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (actions)
🔇 Additional comments (1)
src/v0/destinations/rudder_test/networkHandler.js (1)
83-88: LGTM! Clean constructor pattern implementation.The constructor function properly assigns the required methods for proxy handling, following established patterns from other destinations.
250b9cb to
21cc32e
Compare
|
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 #4422 +/- ##
========================================
Coverage 91.14% 91.14%
========================================
Files 638 638
Lines 33478 33478
Branches 7902 7905 +3
========================================
Hits 30513 30513
Misses 2696 2696
Partials 269 269 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
28485de to
5009fd3
Compare
|
Allure Test reports for this run are available at:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/v0/destinations/rudder_test/networkHandler.test.js (2)
4-6: Consider simplifying the test setup.The current approach of creating an instance and then destructuring the
responseHandlerworks but adds unnecessary complexity. Consider using the instance directly in tests for better clarity.-// Extract the functions for direct testing -const networkHandlerInstance = new networkHandler(); -const { responseHandler } = networkHandlerInstance; +// Create instance for testing +const networkHandlerInstance = new networkHandler();Then use
networkHandlerInstance.responseHandler()in the tests.
107-110: Make error message assertion more robust.The current test directly matches the error message string, which could be brittle if the message format changes. Consider testing the error type and optionally using a pattern match.
- expect(() => { - responseHandler(responseParams); - }).toThrow('Test error simulated for RUDDER_TEST'); + expect(() => { + responseHandler(responseParams); + }).toThrow(NetworkError); + + // Or if you need to test the message: + try { + responseHandler(responseParams); + } catch (error) { + expect(error).toBeInstanceOf(NetworkError); + expect(error.message).toContain('Test error simulated for RUDDER_TEST'); + }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 21cc32e12d9e804db98e74ba3f2a1b012cf261e8 and 5009fd3c097a03b3a8dee63a2cbe4c45fe717810.
⛔ Files ignored due to path filters (6)
.vscode/launch.jsonis excluded by!**/*.jsonsrc/v0/destinations/rudder_test/README.mdis excluded by!**/*.mdtest/integrations/destinations/rudder_test/common.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/dataDelivery/data.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/dataDelivery/proxyV0.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/network.tsis excluded by!**/test/**
📒 Files selected for processing (3)
src/v0/destinations/rudder_test/config.ts(1 hunks)src/v0/destinations/rudder_test/networkHandler.js(1 hunks)src/v0/destinations/rudder_test/networkHandler.test.js(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- src/v0/destinations/rudder_test/config.ts
- src/v0/destinations/rudder_test/networkHandler.js
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.js`: Focus on ESLint errors (max 3) and warnings (max 5).
**/*.js: Focus on ESLint errors (max 3) and warnings (max 5).
src/v0/destinations/rudder_test/networkHandler.test.js
⏰ Context from checks skipped due to timeout of 90000ms (8)
- 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: 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: test_and_publish
- GitHub Check: UT Tests
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
🔇 Additional comments (2)
src/v0/destinations/rudder_test/networkHandler.test.js (2)
245-258: Excellent constructor validation test.This test thoroughly validates the networkHandler interface, ensuring all required methods are present and are functions. Good defensive programming practice.
8-259: Comprehensive test coverage with good structure.This test suite provides excellent coverage of the networkHandler functionality with well-organized test cases covering success scenarios, error simulation, edge cases, and interface validation. The tests are clearly named and follow good testing practices.
|
Allure Test reports for this run are available at:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
test.js (1)
1-1: Remove redundant 'use strict' directive.JavaScript modules are automatically in strict mode, making this directive unnecessary.
-'use strict'; -
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 5009fd3c097a03b3a8dee63a2cbe4c45fe717810 and 40ef752d12ae062ce96ed849e950215be2eaabfb.
⛔ Files ignored due to path filters (3)
METRICS_DOCUMENTATION.mdis excluded by!**/*.mdpr_description.mdis excluded by!**/*.mdrudder_transformer_metrics.csvis excluded by!**/*.csv
📒 Files selected for processing (3)
src/v0/destinations/rudder_test/networkHandler.test.ts(1 hunks)src/v0/destinations/rudder_test/networkHandler.ts(1 hunks)test.js(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.js`: Focus on ESLint errors (max 3) and warnings (max 5).
**/*.js: Focus on ESLint errors (max 3) and warnings (max 5).
test.js
🪛 Biome (1.9.4)
test.js
[error] 1-1: Redundant use strict directive.
The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.
(lint/suspicious/noRedundantUseStrict)
🪛 GitHub Actions: Verify
src/v0/destinations/rudder_test/networkHandler.test.ts
[warning] 1-1: File ignored because of a matching ignore pattern. Use "--no-ignore" to override.
src/v0/destinations/rudder_test/networkHandler.ts
[error] 88-88: ESLint: Do not use "@ts-ignore" because it alters compilation errors. (rule: @typescript-eslint/ban-ts-comment)
🪛 GitHub Check: Check for formatting & lint errors
src/v0/destinations/rudder_test/networkHandler.ts
[failure] 94-94:
Do not use "@ts-ignore" because it alters compilation errors
[failure] 92-92:
Do not use "@ts-ignore" because it alters compilation errors
[failure] 90-90:
Do not use "@ts-ignore" because it alters compilation errors
[failure] 88-88:
Do not use "@ts-ignore" because it alters compilation errors
⏰ Context from checks skipped due to timeout of 90000ms (11)
- 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: 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: UT Tests
- GitHub Check: check-health
- GitHub Check: test_and_publish
- GitHub Check: Analyze (actions)
- GitHub Check: Analyze (go)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (6)
test.js (1)
3-6: Well-structured immutability test.The test logic correctly demonstrates the
deepFreezePropertyfunctionality by attempting to modify a frozen property, which should throw a TypeError in strict mode. This provides a clear validation of the immutability enforcement.src/v0/destinations/rudder_test/networkHandler.ts (2)
14-37: Robust test behavior extraction logic.The function handles multiple input sources (JSON body and headers) with appropriate fallbacks and error handling. The JSON validation for headers (checking if it starts with
{or[) is a practical approach to avoid parsing non-JSON strings.
44-85: Well-implemented response simulation logic.The response handler effectively simulates various error scenarios while maintaining proper error typing and messaging. The precedence of actual HTTP errors over simulated test behavior is appropriate for a testing framework.
src/v0/destinations/rudder_test/networkHandler.test.ts (3)
4-240: Excellent comprehensive test coverage.The test suite thoroughly covers all critical scenarios including:
- Success and error response handling
- Test behavior extraction from both body and headers
- Robust error handling for malformed inputs
- Precedence rules between different test behavior sources
- Edge cases with invalid JSON and missing data
The test organization is clear and follows Jest best practices with descriptive test names and proper setup/assertions.
242-255: Comprehensive constructor testing.The test validates that all required methods are properly attached to the handler instance, ensuring the constructor function works as expected despite the TypeScript typing issues in the implementation.
257-304: Thorough utility function testing.The tests for
getTestBehaviorFromRequestcover all the extraction scenarios and edge cases, providing confidence in the robustness of the test behavior parsing logic.
79113ef to
d9237ab
Compare
d9237ab to
179b1d2
Compare
179b1d2 to
650d68b
Compare
650d68b to
556d4c5
Compare
|
Allure Test reports for this run are available at:
|
556d4c5 to
1b48852
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between d856396354abdfd485fd3f5941504867fb46e787 and 1b488524f6d5c7e15a49d572d902f3bb2d13f440.
⛔ Files ignored due to path filters (5)
src/v0/destinations/rudder_test/README.mdis excluded by!**/*.mdtest/integrations/destinations/rudder_test/common.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/dataDelivery/data.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/dataDelivery/proxyV0.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/network.tsis excluded by!**/test/**
📒 Files selected for processing (4)
sonar-project.properties(1 hunks)src/v0/destinations/rudder_test/config.ts(1 hunks)src/v0/destinations/rudder_test/networkHandler.test.ts(1 hunks)src/v0/destinations/rudder_test/networkHandler.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- sonar-project.properties
- src/v0/destinations/rudder_test/config.ts
- src/v0/destinations/rudder_test/networkHandler.test.ts
⏰ Context from checks skipped due to timeout of 90000ms (9)
- 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
- GitHub Check: UT Tests
- GitHub Check: Analyze (go)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (3)
src/v0/destinations/rudder_test/networkHandler.ts (3)
1-8: LGTM! Clean imports and constants.The imports are well-organized and follow established patterns from the codebase. The DESTINATION constant is appropriately defined.
83-91: LGTM! Clean class-based approach addresses previous concerns.The NetworkHandler class properly encapsulates the handler methods as properties, which addresses the previous review comment about @ts-ignore directives. This approach provides better type safety and follows TypeScript best practices.
93-93: LGTM! Appropriate exports for the module.The exports are clean and provide the necessary public interface for the network handler.
4f77006 to
214a4a2
Compare
- Add proxy v0 network handler for comprehensive HTTP testing capabilities - Implement error simulation based on testBehavior.statusCode and testBehavior.errorMessage - Support test behavior in both JSON body and request headers - Add proper error type mapping (retryable, aborted, throttled) - Include comprehensive test suite with 7 proxy v0 test scenarios - Add network mocks for proxy endpoint testing - Maintain backward compatibility with existing transform functionality - Add detailed README with usage examples and test scenarios Test Coverage: - Success scenarios without test behavior - HTTP error codes: 400, 401, 422, 429, 500 - All error types: aborted, retryable, throttled - Header-based test behavior support - Integration with existing mutation test behavior This enables comprehensive testing of HTTP scenarios for destination integrations. fix: address PR review comments - Use optional chaining for safer property access in testBehavior check - Add input validation for header parsing to ensure valid JSON format - Improve code safety and readability based on CodeRabbit feedback Addresses PR review comments from #4422 test: add comprehensive unit tests for networkHandler - Add direct unit tests for responseHandler function to satisfy Sonar coverage - Test all code paths including success, error, and edge cases - Cover test behavior extraction from both body and headers - Test input validation and error handling scenarios - Include constructor validation tests Coverage: 13 unit tests covering all networkHandler functionality Addresses Sonar code coverage requirements for networkHandler.js refactor: convert networkHandler to TypeScript for consistency fix: include TypeScript files in SonarQube coverage analysis - Update sonar.inclusions to include **/*.ts files - This resolves SonarQube 0.0% coverage issue for networkHandler.ts - Ensures TypeScript files are properly analyzed by SonarQube quality gate Fixes SonarQube Quality Gate failure for new TypeScript code coverage refactor: replace @ts-ignore with class-based NetworkHandler - Replace function-based networkHandler with class-based NetworkHandler - Remove all @ts-ignore directives that suppressed TypeScript errors - Implement proper TypeScript typing without type suppressions - Add proper spacing between class members for linting compliance - Maintain backward compatibility with existing functionality Addresses CodeRabbit review comment about improving type safety Fixes ESLint errors for @typescript-eslint/ban-ts-comment rule fix: improve JSON parsing safety with error handling - Add try-catch block around JSON.parse in getTestBehaviorFromRequest - Return null gracefully if header JSON parsing fails - Maintain graceful degradation for malformed JSON headers - Ensure robust error handling for test behavior extraction Addresses CodeRabbit review comment about JSON parsing safety Prevents potential runtime errors from malformed JSON in headers feat: add environment variable override support for component tests - Add EnvManager utility class for managing environment variable snapshots - Extend TestCaseData interface with envOverrides property for test-level env config - Update component test runner to handle environment variable overrides with automatic cleanup - Add comprehensive unit tests for EnvManager with 7 test cases covering all scenarios - Implement dynamic environment variable reading in rudder_test destination - Replace static constants with runtime functions for proper test isolation - Add practical examples demonstrating API endpoint and debug mode overrides - Update documentation with usage examples and feature descriptions All 34 component tests passing including new environment variable override examples. Test isolation ensured with automatic environment variable restoration after each test. docs: add best practices for environment variables in new code - Add comprehensive guide for creating testable environment variables - Document DO/DON'T patterns with code examples - Include dynamic vs static reading patterns - Add complex configuration class examples - Provide testing guidelines for new environment variables - Cover key principles for environment variable compatibility - Ensure new code works with component test override system This guide helps developers write environment variables that are compatible with the test override system and follow consistent patterns across the codebase. fix: replace logical OR with nullish coalescing for environment variables - Replace || with ?? in environment variable access patterns for safer defaults - Update rudder_test config.ts to use nullish coalescing operator - Update README documentation examples to use ?? instead of || - Ensure environment variables with falsy values (0, '', false) are preserved - Addresses SonarCloud code quality recommendations The nullish coalescing operator (??) only returns the right-hand side when the left-hand side is null or undefined, making it safer than logical OR which treats all falsy values as triggers for the default. Revert "fix: replace logical OR with nullish coalescing for environment variables" This reverts commit 4f770060d16b7d555813a3c2d4f116c8bed59ee4.
214a4a2 to
567a8f7
Compare
|
Allure Test reports for this run are available at:
|
Check failure
Code scanning / CodeQL
Insecure randomness
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI over 1 year ago
To address the issue, replace all instances of Math.random() with a cryptographically secure random number generator. For Node.js, the crypto module provides the crypto.randomBytes method, which can be used to generate secure random values. Specifically:
- Replace
Math.random()with a secure alternative that usescrypto.randomBytes. - Update methods like
generateRandomId,generateRandomString, andgetRandomArrayItemto use secure randomness. - Ensure the changes maintain the original functionality while improving security.
| @@ -360,3 +360,4 @@ | ||
| private getRandomArrayItem<T>(array: T[]): T { | ||
| return array[Math.floor(Math.random() * array.length)]; | ||
| const randomIndex = crypto.randomBytes(4).readUInt32BE() % array.length; // Secure random index | ||
| return array[randomIndex]; | ||
| } | ||
| @@ -367,3 +368,4 @@ | ||
| private generateRandomId(): string { | ||
| return Math.random().toString(36).substring(2, 15); | ||
| const randomBytes = crypto.randomBytes(8); // Generate 8 random bytes | ||
| return randomBytes.toString('hex'); // Convert to a hexadecimal string | ||
| } | ||
| @@ -377,3 +379,4 @@ | ||
| for (let i = 0; i < length; i++) { | ||
| result += chars.charAt(Math.floor(Math.random() * chars.length)); | ||
| const randomIndex = crypto.randomBytes(4).readUInt32BE() % chars.length; // Secure random index | ||
| result += chars.charAt(randomIndex); | ||
| } |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (11)
.github/workflows/integration-test-notification.yml (11)
44-44: Fix trailing spaces.Remove trailing whitespace for better code hygiene.
- merge_commit="${{ github.event.pull_request.merge_commit_sha }}" - + merge_commit="${{ github.event.pull_request.merge_commit_sha }}" +
47-47: Fix trailing spaces.Remove trailing whitespace.
- pr_title_escaped=$(echo "$pr_title" | sed 's/"/\\"/g' | sed "s/'/\\'/g") - + pr_title_escaped=$(echo "$pr_title" | sed 's/"/\\"/g' | sed "s/'/\\'/g") +
60-60: Fix trailing spaces.Remove trailing whitespace.
- target_branch="${{ steps.pr-info.outputs.target_branch }}" - + target_branch="${{ steps.pr-info.outputs.target_branch }}" +
79-79: Fix trailing spaces.Remove trailing whitespace.
- echo "🧪 Starting integration tests for ${{ steps.test-config.outputs.environment }} environment..." - + echo "🧪 Starting integration tests for ${{ steps.test-config.outputs.environment }} environment..." +
82-82: Fix trailing spaces.Remove trailing whitespace.
- mkdir -p test/integrations/destinations/rudder_test/integration/results - + mkdir -p test/integrations/destinations/rudder_test/integration/results +
86-86: Fix trailing spaces.Remove trailing whitespace.
- output_file="test/integrations/destinations/rudder_test/integration/results/integration-test-${timestamp}.json" - + output_file="test/integrations/destinations/rudder_test/integration/results/integration-test-${timestamp}.json" +
89-89: Fix trailing spaces.Remove trailing whitespace.
- npm run test:integration -- --config ${{ steps.test-config.outputs.config }} --output "$output_file" - + npm run test:integration -- --config ${{ steps.test-config.outputs.config }} --output "$output_file" +
99-99: Fix trailing spaces.Remove trailing whitespace.
- output_file="${{ steps.integration-tests.outputs.output_file }}" - + output_file="${{ steps.integration-tests.outputs.output_file }}" +
109-109: Fix trailing spaces.Remove trailing whitespace.
- avg_throughput=$(jq '[.[].throughput] | add / length' "$output_file") - + avg_throughput=$(jq '[.[].throughput] | add / length' "$output_file") +
118-118: Fix trailing spaces.Remove trailing whitespace.
- fi - + fi +
312-312: Add newline at end of file and fix trailing spaces.The file should end with a newline character and remove trailing whitespace.
- exit 1 + exit 1 +
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 567a8f7 and e749e7088a104ba761e19d790ef544401382da46.
⛔ Files ignored due to path filters (18)
docs/RELEASE_PROCESS.mdis excluded by!**/*.md,!docs/**package.jsonis excluded by!**/*.jsontest/integrations/baseIntegrationTest.tsis excluded by!**/test/**test/integrations/common/generators.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/common.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/dataDelivery/proxyV0.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/README.mdis excluded by!**/*.md,!**/test/**test/integrations/destinations/rudder_test/integration/contextGenerator.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/dataGenerator.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/fieldGenerator.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/integrationTest.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/run.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/types.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/processor/data.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/router/data.tsis excluded by!**/test/**test/integrations/integrationTestUtils.tsis excluded by!**/test/**test/integrations/testUtils.tsis excluded by!**/test/**test/integrations/transformerServiceManager.tsis excluded by!**/test/**
📒 Files selected for processing (7)
.github/workflows/integration-test-notification.yml(1 hunks).gitignore(1 hunks)jest.config.js(1 hunks)src/cdk/v2/destinations/rudder_test/procWorkflow.yaml(1 hunks)src/cdk/v2/destinations/rudder_test/rtWorkflow.yaml(1 hunks)src/v0/destinations/rudder_test/networkHandler.test.ts(1 hunks)src/v0/destinations/rudder_test/networkHandler.ts(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- .gitignore
- src/cdk/v2/destinations/rudder_test/rtWorkflow.yaml
- src/cdk/v2/destinations/rudder_test/procWorkflow.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
- src/v0/destinations/rudder_test/networkHandler.ts
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.js`: Focus on ESLint errors (max 3) and warnings (max 5).
**/*.js: Focus on ESLint errors (max 3) and warnings (max 5).
jest.config.js
🪛 GitHub Check: CodeQL
.github/workflows/integration-test-notification.yml
[warning] 13-312: Workflow does not contain permissions
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}
🪛 YAMLlint (1.37.1)
.github/workflows/integration-test-notification.yml
[error] 44-44: trailing spaces
(trailing-spaces)
[error] 47-47: trailing spaces
(trailing-spaces)
[error] 60-60: trailing spaces
(trailing-spaces)
[error] 79-79: trailing spaces
(trailing-spaces)
[error] 82-82: trailing spaces
(trailing-spaces)
[error] 86-86: trailing spaces
(trailing-spaces)
[error] 89-89: trailing spaces
(trailing-spaces)
[error] 99-99: trailing spaces
(trailing-spaces)
[error] 109-109: trailing spaces
(trailing-spaces)
[error] 118-118: trailing spaces
(trailing-spaces)
[error] 312-312: no new line character at the end of file
(new-line-at-end-of-file)
[error] 312-312: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- 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: UT Tests
- GitHub Check: test_and_publish
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (8)
jest.config.js (1)
159-162: LGTM! Good separation of integration and unit tests.The configuration change appropriately excludes integration tests that require external services from the standard test suite. The inline comment clearly explains the rationale.
src/v0/destinations/rudder_test/networkHandler.test.ts (5)
1-3: Clean imports and good test file structure.The imports are well-organized and include all necessary dependencies for testing the networkHandler functionality.
4-133: Comprehensive responseHandler test coverage.The test suite covers all critical scenarios:
- Success path with status 200
- Error scenarios with status >= 400
- Test behavior simulation from request body
- Default error message handling
- Edge cases with missing data
The tests are well-structured and follow Jest best practices.
135-148: Good constructor validation.The test verifies that all required methods are present and properly typed on the networkHandler instance.
150-223: Thorough mock proxy function testing.The test suite covers all proxy-related methods with various scenarios including success responses, error simulation based on testBehavior, and edge cases. Good use of async/await pattern for testing proxy methods.
225-258: Comprehensive utility function testing.The getTestBehaviorFromRequest tests cover all relevant scenarios including successful extraction, missing data, and invalid request structures.
.github/workflows/integration-test-notification.yml (2)
75-94: Well-structured integration test execution.The workflow properly handles test execution with dynamic configuration, error handling with
continue-on-error, and result file management. The timestamped output files will help with tracking and debugging.
144-307: Comprehensive Slack notification system.The notification system provides detailed test results and handles both success and failure scenarios appropriately. The use of different channels and mentions based on target branch is a good practice for team communication.
e749e70 to
535f86f
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (1)
.github/workflows/integration-test-notification.yml (1)
3-10: Add explicitpermissionsblock – security best-practice already requested
Security scanners (and a prior review comment) still flag the missingpermissionsblock. Please add it immediately after theon:section to scope the defaultGITHUB_TOKEN.branches: - develop - main + +permissions: + contents: read + actions: read + pull-requests: read
🧹 Nitpick comments (1)
.github/workflows/integration-test-notification.yml (1)
94-148: Trim trailing whitespace – YAML-lint is failing
Multiple lines in this range end with superfluous spaces, causingyamllinterrors and potentially breaking copy-pasting. A quick pass withsed -i 's/[ \t]*$//'or any formatter will clear the warnings.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between e749e7088a104ba761e19d790ef544401382da46 and 535f86ffa053e8e2f7d61c67afc98e140553cf09.
⛔ Files ignored due to path filters (18)
docs/RELEASE_PROCESS.mdis excluded by!**/*.md,!docs/**package.jsonis excluded by!**/*.jsontest/integrations/baseIntegrationTest.tsis excluded by!**/test/**test/integrations/common/generators.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/common.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/dataDelivery/proxyV0.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/README.mdis excluded by!**/*.md,!**/test/**test/integrations/destinations/rudder_test/integration/contextGenerator.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/dataGenerator.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/fieldGenerator.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/integrationTest.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/run.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/types.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/processor/data.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/router/data.tsis excluded by!**/test/**test/integrations/integrationTestUtils.tsis excluded by!**/test/**test/integrations/testUtils.tsis excluded by!**/test/**test/integrations/transformerServiceManager.tsis excluded by!**/test/**
📒 Files selected for processing (7)
.github/workflows/integration-test-notification.yml(1 hunks).gitignore(1 hunks)jest.config.js(1 hunks)src/cdk/v2/destinations/rudder_test/procWorkflow.yaml(1 hunks)src/cdk/v2/destinations/rudder_test/rtWorkflow.yaml(1 hunks)src/v0/destinations/rudder_test/networkHandler.test.ts(1 hunks)src/v0/destinations/rudder_test/networkHandler.ts(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- .gitignore
- src/cdk/v2/destinations/rudder_test/rtWorkflow.yaml
🚧 Files skipped from review as they are similar to previous changes (4)
- jest.config.js
- src/cdk/v2/destinations/rudder_test/procWorkflow.yaml
- src/v0/destinations/rudder_test/networkHandler.test.ts
- src/v0/destinations/rudder_test/networkHandler.ts
🧰 Additional context used
🪛 GitHub Check: CodeQL
.github/workflows/integration-test-notification.yml
[warning] 47-413: Workflow does not contain permissions
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}
🪛 YAMLlint (1.37.1)
.github/workflows/integration-test-notification.yml
[error] 94-94: trailing spaces
(trailing-spaces)
[error] 97-97: trailing spaces
(trailing-spaces)
[error] 116-116: trailing spaces
(trailing-spaces)
[error] 132-132: trailing spaces
(trailing-spaces)
[error] 148-148: trailing spaces
(trailing-spaces)
[error] 163-163: trailing spaces
(trailing-spaces)
[error] 166-166: trailing spaces
(trailing-spaces)
[error] 170-170: trailing spaces
(trailing-spaces)
[error] 173-173: trailing spaces
(trailing-spaces)
[error] 178-178: trailing spaces
(trailing-spaces)
[error] 181-181: trailing spaces
(trailing-spaces)
[error] 191-191: trailing spaces
(trailing-spaces)
[error] 201-201: trailing spaces
(trailing-spaces)
[error] 210-210: trailing spaces
(trailing-spaces)
[error] 413-413: no new line character at the end of file
(new-line-at-end-of-file)
[error] 413-413: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Code Coverage
- 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: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: test_and_publish
- GitHub Check: UT Tests
- GitHub Check: Analyze (javascript-typescript)
|
Allure Test reports for this run are available at:
|
535f86f to
b5a9e24
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (4)
.github/workflows/integration-test-notification.yml (4)
3-6: Addactions: readand downgradepull-requeststo read-only.The workflow still grants write permissions on
pull-requestsand omits the recommendedactions: read.
For least-privilege, add the missing scope and avoid unnecessary write access:permissions: contents: read - pull-requests: write + actions: read + pull-requests: read
99-104: Replace ad-hocsedescaping with robust JSON encoding.The two-stage
sedchain still fails for back-slashes/newlines and risks malformed Slack payloads.
Usejq -R -s @json(already suggested earlier) for fully-compliant escaping:-# Escape special characters for JSON -pr_title_escaped=$(echo "$pr_title" | sed 's/"/\\"/g' | sed "s/'/\\'/g") +# Escape special characters for JSON in a single, safe pass +pr_title_escaped=$(printf %s "$pr_title" | jq -R -s @json | sed 's/^"//;s/"$//')
198-205: Guard against division-by-zero when no scenarios are returned.
avg_response_timeandavg_throughputdivide bylengthwithout checkingtotal_scenarios > 0, reproducing the previously flagged crash.-total_scenarios=$(jq length "$output_file") -... -avg_response_time=$(jq '[.[].averageResponseTime] | add / length' "$output_file") -avg_throughput=$(jq '[.[].throughput] | add / length' "$output_file") +total_scenarios=$(jq length "$output_file") +if [ "$total_scenarios" -eq 0 ]; then + avg_response_time=0 + avg_throughput=0 +else + avg_response_time=$(jq '[.[].averageResponseTime] | add / length' "$output_file") + avg_throughput=$(jq '[.[].throughput] | add / length' "$output_file") +fi
413-417: Fail-workflow condition fires when results are missing.When
results_availableisfalse,failed_scenariosis unset ('') and'' != '0'still evaluates to true, causing a double failure.-if: steps.test-results.outputs.failed_scenarios != '0' +if: steps.test-results.outputs.results_available == 'true' && steps.test-results.outputs.failed_scenarios != '0'
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 535f86ffa053e8e2f7d61c67afc98e140553cf09 and b5a9e243c491369a96a603d9bd7903cd50452373.
⛔ Files ignored due to path filters (18)
docs/RELEASE_PROCESS.mdis excluded by!**/*.md,!docs/**package.jsonis excluded by!**/*.jsontest/integrations/baseIntegrationTest.tsis excluded by!**/test/**test/integrations/common/generators.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/common.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/dataDelivery/proxyV0.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/README.mdis excluded by!**/*.md,!**/test/**test/integrations/destinations/rudder_test/integration/contextGenerator.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/dataGenerator.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/fieldGenerator.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/integrationTest.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/run.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/types.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/processor/data.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/router/data.tsis excluded by!**/test/**test/integrations/integrationTestUtils.tsis excluded by!**/test/**test/integrations/testUtils.tsis excluded by!**/test/**test/integrations/transformerServiceManager.tsis excluded by!**/test/**
📒 Files selected for processing (8)
.github/workflows/integration-test-notification.yml(1 hunks).gitignore(1 hunks)jest.config.js(1 hunks)src/cdk/v2/destinations/rudder_test/procWorkflow.yaml(1 hunks)src/cdk/v2/destinations/rudder_test/rtWorkflow.yaml(1 hunks)src/v0/destinations/rudder_test/networkHandler.test.ts(1 hunks)src/v0/destinations/rudder_test/networkHandler.ts(1 hunks)src/v0/destinations/rudder_test/utils.ts(4 hunks)
✅ Files skipped from review due to trivial changes (1)
- .gitignore
🚧 Files skipped from review as they are similar to previous changes (6)
- jest.config.js
- src/cdk/v2/destinations/rudder_test/rtWorkflow.yaml
- src/v0/destinations/rudder_test/utils.ts
- src/cdk/v2/destinations/rudder_test/procWorkflow.yaml
- src/v0/destinations/rudder_test/networkHandler.test.ts
- src/v0/destinations/rudder_test/networkHandler.ts
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/integration-test-notification.yml
[error] 98-98: trailing spaces
(trailing-spaces)
[error] 101-101: trailing spaces
(trailing-spaces)
[error] 120-120: trailing spaces
(trailing-spaces)
[error] 136-136: trailing spaces
(trailing-spaces)
[error] 152-152: trailing spaces
(trailing-spaces)
[error] 167-167: trailing spaces
(trailing-spaces)
[error] 170-170: trailing spaces
(trailing-spaces)
[error] 174-174: trailing spaces
(trailing-spaces)
[error] 177-177: trailing spaces
(trailing-spaces)
[error] 182-182: trailing spaces
(trailing-spaces)
[error] 185-185: trailing spaces
(trailing-spaces)
[error] 195-195: trailing spaces
(trailing-spaces)
[error] 205-205: trailing spaces
(trailing-spaces)
[error] 214-214: trailing spaces
(trailing-spaces)
[error] 417-417: no new line character at the end of file
(new-line-at-end-of-file)
[error] 417-417: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (9)
- GitHub Check: check-health
- 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: UT Tests
- GitHub Check: test_and_publish
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
b5a9e24 to
1c1a4ff
Compare
Major enhancements: - Add comprehensive integration testing framework for rudder_test destination - Create automated GitHub workflow for PR merge testing and Slack notifications - Refactor and simplify integration test code architecture - Add CDK v2 workflow support and testing capabilities - Create reusable test utilities and generators for other destinations Integration Testing Framework: - Add BaseIntegrationTest class and CLI utilities - Create TransformerServiceManager for service lifecycle management - Add generic context and field generators in common/generators.ts - Implement performance analysis and CDK v2 vs Native comparison - Add comprehensive test scenarios with load testing capabilities GitHub Workflow Automation: - Add integration-test-notification.yml workflow - Automatically run integration tests on PR merge to develop/main - Send detailed Slack notifications with test results and metrics - Branch-specific test configurations (quick for develop, comprehensive for main) - Upload test results as GitHub artifacts Code Refactoring: - Split complex integration test code into focused modules - Replace 'any' types with proper TypeScript interfaces - Eliminate code duplication and simplify conditional logic - Create reusable components for other destinations - Add proper error handling and type safety Documentation: - Update RELEASE_PROCESS.md with workflow documentation - Add comprehensive integration test README - Include troubleshooting and customization guides - Document security considerations and configuration Infrastructure: - Add CDK v2 workflow YAML files for rudder_test destination - Update .gitignore to exclude test results - Add npm scripts for various integration test configurations - Enhance test utilities with better error handling
1c1a4ff to
da67ac9
Compare
- Remove 'unknown' from union types that override other types - Make return types more specific instead of using 'unknown' - Fix mockProcessAxiosResponse parameter and return types - Improve type safety in responseHandler return type Resolves TypeScript error: 'unknown' overrides all other types in union
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (3)
.github/workflows/integration-test-notification.yml (3)
99-101: Use reliable JSON escaping forpr_titleThe sed chain still breaks on back-slashes and newlines (see previous review). Replace with
jq -R -s @jsonfor bullet-proof escaping.-pr_title_escaped=$(echo "$pr_title" | sed 's/"/\\"/g' | sed "s/'/\\'/g") +pr_title_escaped=$(printf %s "$pr_title" | jq -R -s @json | sed 's/^"//;s/"$//')
198-205: Guard against division-by-zero when no scenarios returned
add / lengthwill abort whenlengthis 0. The earlier suggestion to short-circuit whentotal_scenarios == 0is still missing here.
413-417: Fail-workflow condition still fires when results are absentIf the results file is missing,
failed_scenariosis empty ('') so the comparison'' != '0'is true and the job fails twice. Add theresults_availablecheck as previously recommended.
🧹 Nitpick comments (2)
.github/workflows/verify-server-start.yml (1)
30-35: Backgroundnpm startcan orphan or mask errorsLaunching the server with
npm start &detaches the process but gives no guarantee that it keeps running or that its exit code is captured. If the start-up script dies immediately the health-check loop will just keep retrying while the real failure is hidden.Consider using a more robust pattern:
- - name: Start server - run: npm start & + - name: Start server + run: | + nohup npm start >server.log 2>&1 & + echo $! > server.pidThis records logs and the PID so you can kill the process in a
poststep if needed..github/workflows/integration-test-notification.yml (1)
1-417: Trailing whitespace and missing newlineYAML-lint reports multiple trailing-space issues and a missing final newline (line 417). These don’t break execution but do fail linting and clutter diffs—worth cleaning up.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between b5a9e243c491369a96a603d9bd7903cd50452373 and feab9da.
⛔ Files ignored due to path filters (18)
docs/RELEASE_PROCESS.mdis excluded by!**/*.md,!docs/**package.jsonis excluded by!**/*.jsontest/integrations/baseIntegrationTest.tsis excluded by!**/test/**test/integrations/common/generators.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/common.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/dataDelivery/proxyV0.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/README.mdis excluded by!**/*.md,!**/test/**test/integrations/destinations/rudder_test/integration/contextGenerator.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/dataGenerator.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/fieldGenerator.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/integrationTest.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/run.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/integration/types.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/processor/data.tsis excluded by!**/test/**test/integrations/destinations/rudder_test/router/data.tsis excluded by!**/test/**test/integrations/integrationTestUtils.tsis excluded by!**/test/**test/integrations/testUtils.tsis excluded by!**/test/**test/integrations/transformerServiceManager.tsis excluded by!**/test/**
📒 Files selected for processing (9)
.github/workflows/integration-test-notification.yml(1 hunks).github/workflows/verify-server-start.yml(1 hunks).gitignore(1 hunks)jest.config.js(1 hunks)src/cdk/v2/destinations/rudder_test/procWorkflow.yaml(1 hunks)src/cdk/v2/destinations/rudder_test/rtWorkflow.yaml(1 hunks)src/v0/destinations/rudder_test/networkHandler.test.ts(1 hunks)src/v0/destinations/rudder_test/networkHandler.ts(1 hunks)src/v0/destinations/rudder_test/utils.ts(4 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
- .gitignore
- jest.config.js
- src/cdk/v2/destinations/rudder_test/rtWorkflow.yaml
- src/cdk/v2/destinations/rudder_test/procWorkflow.yaml
- src/v0/destinations/rudder_test/utils.ts
- src/v0/destinations/rudder_test/networkHandler.test.ts
- src/v0/destinations/rudder_test/networkHandler.ts
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/integration-test-notification.yml
[error] 98-98: trailing spaces
(trailing-spaces)
[error] 101-101: trailing spaces
(trailing-spaces)
[error] 120-120: trailing spaces
(trailing-spaces)
[error] 136-136: trailing spaces
(trailing-spaces)
[error] 152-152: trailing spaces
(trailing-spaces)
[error] 167-167: trailing spaces
(trailing-spaces)
[error] 170-170: trailing spaces
(trailing-spaces)
[error] 174-174: trailing spaces
(trailing-spaces)
[error] 177-177: trailing spaces
(trailing-spaces)
[error] 182-182: trailing spaces
(trailing-spaces)
[error] 185-185: trailing spaces
(trailing-spaces)
[error] 195-195: trailing spaces
(trailing-spaces)
[error] 205-205: trailing spaces
(trailing-spaces)
[error] 214-214: trailing spaces
(trailing-spaces)
[error] 417-417: no new line character at the end of file
(new-line-at-end-of-file)
[error] 417-417: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (9)
- GitHub Check: Code Coverage
- 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: 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: test_and_publish
- GitHub Check: UT Tests
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
🔇 Additional comments (1)
.github/workflows/integration-test-notification.yml (1)
175-184: 👍evalremoved – safer executionSwitching to an argument array eliminates shell-injection risk and improves readability.
|
Allure Test reports for this run are available at:
|
- Fix type compatibility issues in networkHandler tests - Update test mocks to match proper TypeScript interfaces - Handle null destinationRequest in ResponseParams interface - Fix test expectations for processAxiosResponse return values - Update test assertions to match actual function behavior All 16 tests now pass successfully.
a6c77ca to
04150aa
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/v0/destinations/rudder_test/networkHandler.ts (1)
41-43: Consider adding header-based test behavior extraction.The current implementation only extracts test behavior from the request body. Based on the past review comments, there was discussion about supporting test behavior in headers for proxy testing scenarios.
Consider adding support for header-based test behavior:
const getTestBehaviorFromRequest = ( destinationRequest: DestinationRequest, -): TestBehavior | undefined => destinationRequest?.body?.JSON?.testBehavior; +): TestBehavior | undefined => { + // First check body for test behavior + const bodyBehavior = destinationRequest?.body?.JSON?.testBehavior; + if (bodyBehavior) { + return bodyBehavior; + } + + // Check headers for test behavior (useful for proxy testing) + const headers = destinationRequest?.headers ?? {}; + if (headers['x-test-behavior']) { + const headerValue = headers['x-test-behavior']; + if (typeof headerValue === 'string' && headerValue.startsWith('{')) { + try { + return JSON.parse(headerValue); + } catch { + return undefined; + } + } + } + + return undefined; +};.github/workflows/integration-test-notification.yml (1)
98-98: Clean up trailing whitespace and add final newline.The file has trailing whitespace on multiple lines and is missing a final newline character. These formatting issues should be addressed for consistency.
Run the following command to clean up the formatting:
sed -i 's/[[:space:]]*$//' .github/workflows/integration-test-notification.yml echo >> .github/workflows/integration-test-notification.ymlAlso applies to: 101-101, 120-120, 136-136, 152-152, 167-167, 170-170, 174-174, 177-177, 182-182, 185-185, 195-195, 210-210, 219-219, 422-422
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
src/v0/destinations/rudder_test/README.mdis excluded by!**/*.md
📒 Files selected for processing (3)
.github/workflows/integration-test-notification.yml(1 hunks)src/v0/destinations/rudder_test/networkHandler.test.ts(1 hunks)src/v0/destinations/rudder_test/networkHandler.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/v0/destinations/rudder_test/networkHandler.test.ts
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/integration-test-notification.yml
[error] 98-98: trailing spaces
(trailing-spaces)
[error] 101-101: trailing spaces
(trailing-spaces)
[error] 120-120: trailing spaces
(trailing-spaces)
[error] 136-136: trailing spaces
(trailing-spaces)
[error] 152-152: trailing spaces
(trailing-spaces)
[error] 167-167: trailing spaces
(trailing-spaces)
[error] 170-170: trailing spaces
(trailing-spaces)
[error] 174-174: trailing spaces
(trailing-spaces)
[error] 177-177: trailing spaces
(trailing-spaces)
[error] 182-182: trailing spaces
(trailing-spaces)
[error] 185-185: trailing spaces
(trailing-spaces)
[error] 195-195: trailing spaces
(trailing-spaces)
[error] 210-210: trailing spaces
(trailing-spaces)
[error] 219-219: trailing spaces
(trailing-spaces)
[error] 422-422: no new line character at the end of file
(new-line-at-end-of-file)
[error] 422-422: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (9)
- 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: 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: UT Tests
- GitHub Check: test_and_publish
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
🔇 Additional comments (7)
src/v0/destinations/rudder_test/networkHandler.ts (3)
1-35: Well-structured type definitions and imports.The imports are appropriate for the functionality, and the type definitions provide good type safety. The interfaces are comprehensive and well-defined for the network handler's requirements.
49-82: Solid mock proxy implementation with good error simulation.The implementation correctly simulates different response scenarios based on test behavior. The error handling and success case are well-structured, and the mock response format is consistent.
170-180: Excellent resolution of previous TypeScript issues.The class-based approach successfully eliminates the need for @ts-ignore directives while maintaining clean method assignment. This is a significant improvement over the previous function-based approach with type suppressions.
.github/workflows/integration-test-notification.yml (4)
3-6: Good security improvement with explicit permissions.The explicit permissions block addresses the previous security concern about limiting GITHUB_TOKEN permissions. This follows GitHub Actions security best practices.
99-100: Excellent improvement in JSON escaping.The use of
jq -R -s @jsonprovides robust JSON escaping that handles all special characters including backslashes and newlines, addressing the previous security concern about incomplete escaping.
175-184: Good resolution of shell injection vulnerability.The replacement of
evalwith array-based command construction eliminates the shell injection risk while maintaining the same functionality. This is a significant security improvement.
203-209: Proper division-by-zero protection.The conditional check for
total_scenariosbeing zero before performing division operations prevents shell errors and provides safe defaults. This addresses the previous arithmetic concern.
|
Allure Test reports for this run are available at:
|
|



What are the changes introduced in this PR?
This PR adds comprehensive proxy v0 support to the rudder_test destination for HTTP testing capabilities.
What is the related Linear task?
Resolves https://linear.app/rudderstack/issue/INT-3615/add-integration-tests-for-dynamic-config-feature
Please explain the objectives of your changes below
The objective is to enhance the rudder_test destination with proxy v0 capabilities to enable comprehensive HTTP scenario testing for destination integrations. This includes:
Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?
No breaking changes to existing capabilities. All existing transform functionality remains unchanged and backward compatible. The new proxy v0 functionality is additive only.
Any new dependencies introduced with this change?
No new external dependencies. Uses existing imports from the rudder-transformer codebase.
Any new generic utility introduced or modified. Please explain the changes.
No generic utilities modified. All changes are specific to the rudder_test destination.
Any technical or performance related pointers to consider with the change?
Test Coverage Added
This enables comprehensive testing of HTTP scenarios for destination integrations and maintains full backward compatibility.
@coderabbitai review
Developer checklist
Reviewer checklist