Skip to content

feat: add RichVariableInput component and implement dynamic variable … - #84

Merged
Teja-Budumuru merged 2 commits into
mainfrom
creating-filter-node
Aug 3, 2026
Merged

feat: add RichVariableInput component and implement dynamic variable …#84
Teja-Budumuru merged 2 commits into
mainfrom
creating-filter-node

Conversation

@Teja-Budumuru

@Teja-Budumuru Teja-Budumuru commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

…resolution in execution engine

Summary by CodeRabbit

  • Bug Fixes
    • Improved input safety by preventing raw markup from being interpreted in rich variable fields.
    • Fixed workflow variable interpolation so outputs are reliably associated with the correct workflow steps, including steps run in loops.
    • Preserved existing behavior for retries, skipped steps, persistence, and error handling.
  • Style
    • Standardized workflow execution formatting without changing user-visible behavior.

Copilot AI review requested due to automatic review settings August 3, 2026 09:26
@Teja-Budumuru
Teja-Budumuru requested a review from Vamsi-o as a code owner August 3, 2026 09:26
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR escapes raw variable input and node names before HTML rendering, adds the pill class to generated variable elements, and stores workflow execution outputs in interpolation contexts by node ID. The executor also includes formatting-only changes.

Changes

Input rendering and execution context

Layer / File(s) Summary
Escape input and mark variable pills
apps/web/app/components/ui/RichVariableInput.tsx
parseValueToHtml escapes raw input and node names before placeholder conversion. Generated variable pills now include the pill class.
Track outputs by node ID
apps/worker/src/engine/executor.ts
The executor adds node ID metadata and uses node-ID keyed outputs in normal and per-row interpolation contexts. Successful outputs retain the execution output payload.
Preserve execution flow formatting
apps/worker/src/engine/executor.ts
The executor reformats execution, looping, retry, failure, and persistence code without changing workflow behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: vamsi-o

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the addition of RichVariableInput and dynamic variable resolution, which are the main objectives of the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch creating-filter-node

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/worker/src/engine/executor.ts

Oops! Something went wrong! :(

ESLint: 9.32.0

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './library.js' is not defined by "exports" in /node_modules/@workspace/eslint-config/package.json
Referenced from: /.eslintrc.js
at exportsNotFound (node:internal/modules/esm/resolve:310:10)
at packageExportsResolve (node:internal/modules/esm/resolve:658:9)
at resolveExports (node:internal/modules/cjs/loader:685:36)
at Module._findPath (node:internal/modules/cjs/loader:752:31)
at Module._resolveFilename (node:internal/modules/cjs/loader:1461:27)
at wrapResolveFilename (node:internal/modules/cjs/loader:1049:27)
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1094:12)
at require.resolve (node:internal/modules/helpers:171:31)
at Object.resolve (/node_modules/.pnpm/@eslint+eslintrc@3.3.1/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2447:46)
at ConfigArrayFactory._loadExtendedShareableConfig (/node_modules/.pnpm/@eslint+eslintrc@3.3.1/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3383:33)
(node:2) ESLintRCWarning: You are using an eslintrc configuration file, which is deprecated and support will be removed in v10.0.0. Please migrate to an eslint.config.js file. See https://eslint.org/docs/latest/use/configure/migration-guide for details. An eslintrc configuration file is used because you have the ESLINT_USE_FLAT_CONFIG environment variable set to false. If you want to use an eslint.config.js file, remove the environment variable. If you want to find the location of the eslintrc configuration file, use the --debug flag.
(Use node --trace-warnings ... to show where the warning was created)


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.

Vamsi-o
Vamsi-o previously approved these changes Aug 3, 2026

Copilot AI 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.

Pull request overview

Adds UI support for rich variable placeholders (pill-style) and updates the worker execution engine to resolve {{...}} variables dynamically during workflow execution (including per-row looping for spreadsheet-like inputs).

Changes:

  • Introduces RichVariableInput to render {{node.path}} references as non-editable “pills” in a contentEditable editor.
  • Resolves config variables at execution time using an interpolation context built from previously executed node outputs.
  • Adds looped execution behavior for spreadsheet inputs (per-row execution with retries, skip rules, and aggregated results).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
apps/worker/src/engine/executor.ts Builds interpolation context from prior node outputs and resolves {{...}} variables in node config; adds spreadsheet-driven loop execution path.
apps/web/app/components/ui/RichVariableInput.tsx Adds a pill-based variable editor that converts {{node.path}} into styled spans and serializes them back into template strings.

Comment on lines 303 to 307
// Store this node's output for variable resolution in subsequent nodes
executedNodeOutputs.push({
nodeName: node.name,
nodeName: node.id,
outputData: execute.output
});
Comment on lines 51 to +55
const node = availableNodes.find(n => n.id === nodeId);
const displayName = node ? node.name : "Unknown Node";
const colorClass = getNodeColorClass(nodeId);

return `<span contenteditable="false" class="inline-flex items-center px-1.5 py-0.5 mx-1 rounded text-[10px] border align-middle font-mono select-all cursor-default ${colorClass}" data-id="${nodeId}" data-path="${path}">${displayName} &gt; ${path}</span>`;
// 3. IMPORTANT: Added the "pill" class at the start of the class list
return `<span contenteditable="false" class="pill inline-flex items-center px-1.5 py-0.5 mx-1 rounded text-[10px] border align-middle font-mono select-all cursor-default ${colorClass}" data-id="${nodeId}" data-path="${path}">${displayName} &gt; ${path}</span>`;
Comment on lines +4 to 8
import {
resolveConfigVariables,
buildInterpolationContext,
InterpolationContext
} from "@repo/common/zod";

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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web/app/components/ui/RichVariableInput.tsx`:
- Line 55: Update the HTML generation around the rich variable input renderer to
escape displayName before interpolating it into the span returned by the
relevant function. Reuse an existing HTML-escaping utility if available, and
ensure node names containing markup render as text without changing rawValue
sanitization or the surrounding pill attributes.

In `@apps/worker/src/engine/executor.ts`:
- Around line 303-306: Update the output-context storage in the node execution
flow around executedNodeOutputs so the context key uses node.id exactly, without
lowercasing or replacing spaces. Ensure buildInterpolationContext and
resolveVariable can resolve RichVariableInput tokens in the {{nodeId.path}} form
while preserving existing output data.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d505de22-462d-46c1-9376-66a5ebc43f1f

📥 Commits

Reviewing files that changed from the base of the PR and between 7942de1 and 4252631.

📒 Files selected for processing (2)
  • apps/web/app/components/ui/RichVariableInput.tsx
  • apps/worker/src/engine/executor.ts

Comment thread apps/web/app/components/ui/RichVariableInput.tsx
Comment thread apps/worker/src/engine/executor.ts

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

🧹 Nitpick comments (1)
apps/worker/src/engine/executor.ts (1)

11-14: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Make nodeId required in NodeExecutionOutput.

Every execution output comes from a node with a required ID. If a producer omits nodeId, the guards at Line 106 and Line 176 silently skip ID-based context entries, so {{nodeId.path}} cannot resolve. Change nodeId?: string to nodeId: string and remove the silent omission path after all producers provide node.id.

Proposed type fix
 interface NodeExecutionOutput {
   nodeName: string;
-  nodeId?: string;
+  nodeId: string;
   outputData: any;
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/worker/src/engine/executor.ts` around lines 11 - 14, Update the
NodeExecutionOutput interface to make nodeId required, then update every
producer of NodeExecutionOutput to always provide its node.id. Remove the
optional-ID guards in the execution handling paths around the nodeId-based
context entries so valid outputs are not silently skipped.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/worker/src/engine/executor.ts`:
- Around line 105-107: Update buildInterpolationContext and its
executedNodeOutputs loop so raw node IDs cannot overwrite normalized node-name
keys; use a distinct ID namespace for ID-based entries, or detect and
reject/report collisions before insertion, while preserving name-based
interpolation values.

---

Nitpick comments:
In `@apps/worker/src/engine/executor.ts`:
- Around line 11-14: Update the NodeExecutionOutput interface to make nodeId
required, then update every producer of NodeExecutionOutput to always provide
its node.id. Remove the optional-ID guards in the execution handling paths
around the nodeId-based context entries so valid outputs are not silently
skipped.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 816e5a6b-55d5-4cb4-b192-98d36923ebff

📥 Commits

Reviewing files that changed from the base of the PR and between 4252631 and 84dab1f.

📒 Files selected for processing (2)
  • apps/web/app/components/ui/RichVariableInput.tsx
  • apps/worker/src/engine/executor.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/app/components/ui/RichVariableInput.tsx

Comment on lines +105 to +107
for (const out of executedNodeOutputs) {
if (out.nodeId) interpolationContext[out.nodeId] = out.outputData;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

rg -n -C 8 \
  'buildInterpolationContext|normalizedName|resolveVariable|resolveConfigVariables|nodeId|node\.name|model .*Node|`@default`\(cuid\)|`@default`\(uuid\)' \
  --glob '*.ts' --glob '*.tsx' --glob '*.prisma' . || true

Repository: Dev-Pross/BuildFlow

Length of output: 50376


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== interpolation implementation =="
sed -n '50,115p' packages/common/src/interpolation.ts

echo "== prisma schema Node and relation fields =="
sed -n '67,95p' packages/db/prisma/schema.prisma
sed -n '113,127p' packages/db/prisma/schema.prisma

echo "== workflow/node creation snippets =="
rg -n -C 5 'workflow\.nodes|nodes:|AvailableNodeID|NodeId|nodeId|name.*\s*:|name\s*:' --glob '*.ts' --glob '*.tsx' --glob '*.prisma' . || true

echo "== focused UUID prefix checks via static patterns =="
rg -n 'uuid\\(\\)|node\\.id|nodeId|node.*name|AvailableNode#|AvailableNodeID|createMany\\(|create\\(' --glob '*.ts' --glob '*.tsx' --glob '*.prisma' . || true

Repository: Dev-Pross/BuildFlow

Length of output: 50376


Prevent node IDs from overwriting normalized node-name keys.

buildInterpolationContext maps sanitized node names, then the execution loop writes raw node.id keys into the same context object. Since node IDs are UUIDs and node names can normalize to any lowercase snake_case string, interpolationContext[out.nodeId] = out.outputData can silently replace a name-based variable source. Use a separate ID namespace or block/emit a collision before insertion.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/worker/src/engine/executor.ts` around lines 105 - 107, Update
buildInterpolationContext and its executedNodeOutputs loop so raw node IDs
cannot overwrite normalized node-name keys; use a distinct ID namespace for
ID-based entries, or detect and reject/report collisions before insertion, while
preserving name-based interpolation values.

@Teja-Budumuru
Teja-Budumuru merged commit 68e0666 into main Aug 3, 2026
2 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.

4 participants