Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/services/service-automation/src/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export class AutomationEngine implements IAutomationService {
// TODO: Replace with safe expression evaluator (e.g., jexl) for production.
let resolved = expression;
for (const [key, value] of variables) {
resolved = resolved.replaceAll(`{${key}}`, String(value));
resolved = resolved.split(`{${key}}`).join(String(value));
}
Comment on lines 231 to 233

Copilot AI Feb 20, 2026

Copy link

Choose a reason for hiding this comment

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

Using split().join() is not fully equivalent to replaceAll() when the replacement string contains "$" sequences (e.g. "$&", "$1"); replaceAll interprets those as replacement patterns, while join inserts them literally. Please confirm the intended semantics for template substitution (literal insertion is usually what you want here); if you need to preserve replaceAll’s behavior, you’ll need an ES2020-compatible polyfill that reproduces those "$" replacement patterns.

Copilot uses AI. Check for mistakes.
try {
return new Function(`return (${resolved})`)() as boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class LogicNodesPlugin implements Plugin {
// TODO: Replace with safe expression evaluator (e.g., jexl) for production.
let expr = cond.expression;
for (const [k, v] of variables) {
expr = expr.replaceAll(`{${k}}`, String(v));
expr = expr.split(`{${k}}`).join(String(v));

Copilot AI Feb 20, 2026

Copy link

Choose a reason for hiding this comment

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

Same as in engine.ts: split().join() inserts the replacement literally and does not interpret "$" sequences the way replaceAll() does. Please confirm literal insertion is intended for decision expressions (it avoids surprising "$1"/"$&" behavior in values); otherwise you’ll need an ES2020-compatible implementation that preserves replaceAll semantics.

Suggested change
expr = expr.split(`{${k}}`).join(String(v));
expr = expr.replaceAll(`{${k}}`, String(v));

Copilot uses AI. Check for mistakes.
}
try {
if (new Function(`return (${expr})`)()) {
Expand Down