Skip to content

fix: improve user validation and error handling in execution routes#67

Merged
Vamsi-o merged 1 commit into
mainfrom
execution-flow-for-both-single-and-multi-nodes
Feb 1, 2026
Merged

fix: improve user validation and error handling in execution routes#67
Vamsi-o merged 1 commit into
mainfrom
execution-flow-for-both-single-and-multi-nodes

Conversation

@TejaBudumuru3

@TejaBudumuru3 TejaBudumuru3 commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Enhanced authentication validation for execution requests to require proper user identification.
    • Improved error handling to display clearer error messages when execution fails.
  • Improvements

    • Execution records now consistently capture input data for better tracking and debugging.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Feb 1, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Three files across the execution pipeline are being refined: authentication validation now requires explicit user ID presence, execution payloads ensure input data is consistently populated, and error handling in the registry is improved with safer type casting.

Changes

Cohort / File(s) Summary
HTTP Backend Route Validation
apps/http-backend/src/routes/userRoutes/executionRoutes.ts
Strengthened authentication check to require req.user.sub instead of accepting any truthy req.user; changed execution result handling to explicitly check executionResult.success rather than relying on truthiness.
Worker Execution Payload
apps/worker/src/engine/executor.ts
Added inputData field to nodeExecution creation payload with default empty object fallback, ensuring consistent data structure for downstream processing.
Execution Registry Error Handling
packages/nodes/src/registry/execution.registory.ts
Improved error transformation to extract error.message from Error instances before returning; simplified executor type-casts by removing redundant as unknown intermediate cast layer.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • Vamsi-o

Poem

🐰 Hoppy paths, now safer, strong and true,
User IDs required—no empty slots for you!
Input data bundled, never left behind,
Errors cast with care, a gentler kind.
Execution flows smoother, onward we go!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: stricter user validation (requiring req.user.sub), improved error handling (error.message extraction), and execution result handling improvements across the three files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch execution-flow-for-both-single-and-multi-nodes

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/worker/src/engine/executor.ts (1)

46-52: ⚠️ Potential issue | 🟠 Major

Avoid dropping valid falsy inputData and keep context/storage consistent.

Using a truthy check turns valid inputs like 0, "", or false into {} and also diverges from context.inputData (which still uses the original value). Normalize once with nullish coalescing and reuse it for both persistence and context.

🔧 Proposed fix
-    const nodeExecution = await prismaClient.nodeExecution.create({
+    const normalizedInputData = currentInputData ?? {};
+    const nodeExecution = await prismaClient.nodeExecution.create({
       data:{
         nodeId: node.id,
         workflowExecId: workflowExecutionId,
         status: "Start",
-        inputData: currentInputData ? currentInputData : {},
+        inputData: normalizedInputData,
         startedAt: new Date()
       }
     })
@@
-      inputData: currentInputData,
+      inputData: normalizedInputData,
     };

@Vamsi-o Vamsi-o merged commit faaefdf into main Feb 1, 2026
3 checks passed
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