Repository navigation
chore: include transformation name in error stack trace - #4547
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (2)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the Summary by CodeRabbit
WalkthroughThe changes introduce a new Changes
Sequence Diagram(s)sequenceDiagram
participant CustomTransformer as customTransformer-v1.js
participant IvmFactory as ivmFactory.js
participant Isolate as isolate.compileModule
CustomTransformer->>IvmFactory: getFactory(..., transformationName)
IvmFactory->>Isolate: compileModule(code, { filename: transformationName })
Isolate-->>IvmFactory: CompiledModule
IvmFactory-->>CustomTransformer: FactoryInstance
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Suggested reviewers
Suggestions for improvement:
✨ 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. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4547 +/- ##
===========================================
+ Coverage 91.63% 91.79% +0.16%
===========================================
Files 643 642 -1
Lines 34020 33886 -134
Branches 8048 8023 -25
===========================================
- Hits 31174 31107 -67
+ Misses 2588 2527 -61
+ Partials 258 252 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
src/util/ivmFactory.js (1)
33-42: Provide default & validation fortransformationName
createIvmnow depends ontransformationNamebeing a non-empty string. Any existing call sites that haven’t been updated (e.g. internal tooling, unit tests, scripts) will hitisolate.compileModule()withundefined, which crashes the isolate before we enter our catch-blocks.A minimal hardening:
async function createIvm( code, libraryVersionIds, transformationId, workspaceId, credentials, secrets, testMode, - transformationName, + transformationName = 'base transformation', ) { + if (typeof transformationName !== 'string' || !transformationName.trim()) { + throw new TypeError('transformationName must be a non-empty string'); + }This keeps backwards compatibility and guarantees a stable filename in the stack trace.
🧹 Nitpick comments (3)
src/util/ivmFactory.js (2)
417-419: Potential filename pollution in stack traces
isolate.compileModule(..., { filename: transformationName })will surface the raw string in stack traces. IftransformationNamecontains path separators, new-lines, or unprintable chars the trace becomes noisy and harder to read.
After adding the default/validation above, consider a lightweight sanitiser:const safeFileName = transformationName.replace(/[^\w\s\-\.]/g, '_'); const customScriptModule = await isolate.compileModule(codeWithWrapper, { filename: safeFileName });
480-501: Long positional parameter list – consider an options objectBoth
createIvmandgetFactorynow carry nine positional parameters, which is error-prone and hard to maintain. Moving to an{ code, libraryVersionIds, … }options object (or using a typed schema) will make future changes safer.src/util/customTransformer-v1.js (1)
66-75: Avoid duplicating the default transformation name
'base transformation'is now hard-coded here and in the safeguard we added toivmFactory. Extracting a shared constant (e.g.const DEFAULT_TRANSFORMATION_NAME = 'base transformation';) keeps the fallback in one place and reduces drift.- userTransformation.name || 'base transformation', + userTransformation.name || DEFAULT_TRANSFORMATION_NAME,Declare the constant either in this module or export it from
ivmFactory.js.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
test/__tests__/user_transformation_errors.test.jsis excluded by!**/test/**
📒 Files selected for processing (2)
src/util/customTransformer-v1.js(1 hunks)src/util/ivmFactory.js(4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit Configuration File
Focus on ESLint errors (max 3) and warnings (max 5).
Files:
src/util/customTransformer-v1.jssrc/util/ivmFactory.js
🧠 Learnings (1)
📓 Common learnings
Learnt from: vinayteki95
PR: rudderlabs/rudder-transformer#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.
⏰ 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). (8)
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- 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: Code Coverage
- GitHub Check: UT Tests
- GitHub Check: test_and_publish
- GitHub Check: Analyze (go)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
src/util/ivmFactory.js (1)
480-501: Ensure all getFactory invocations include the new transformationName parameterOur initial regex didn’t flag any missing arguments, but it can miss multi-line calls. Please manually review every
getFactory(call to confirm you’ve passedtransformationNameas the last argument—otherwise you’ll silently shift parameters (e.g.testModereceiving the name string).• To locate and inspect each call, run:
rg 'getFactory\s*\(' -g '*.js' -A10 -B1and verify each invocation has eight arguments.
|
Allure Test reports for this run are available at:
|
|

What are the changes introduced in this PR?
Write a brief explainer on your code changes.
What is the related Linear task?
Resolves DAW-1526
Please explain the objectives of your changes below
Put down any required details on the broader aspect of your changes. If there are any dependent changes, mandatorily mention them here
Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?
N/A
Any new dependencies introduced with this change?
N/A
Any new generic utility introduced or modified. Please explain the changes.
N/A
Any technical or performance related pointers to consider with the change?
N/A
@coderabbitai review
Developer checklist
My code follows the style guidelines of this project
No breaking changes are being introduced.
All related docs linked with the PR?
All changes manually tested?
Any documentation changes needed with this change?
Is the PR limited to 10 file changes?
Is the PR limited to one linear task?
Are relevant unit and component test-cases added in new readability format?
Reviewer checklist
Is the type of change in the PR title appropriate as per the changes?
Verified that there are no credentials or confidential data exposed with the changes.