Skip to content

fix(code-node): handle regex literals in JavaScript defaults - #44409

Open
mikamikasuki wants to merge 10 commits into
langgenius:mainfrom
mikamikasuki:fix/js-code-node-regex-default-44407
Open

mikamikasuki wants to merge 10 commits into
langgenius:mainfrom
mikamikasuki:fix/js-code-node-regex-default-44407

Conversation

@mikamikasuki

@mikamikasuki mikamikasuki commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The JavaScript Code node parameter scanner counts delimiters inside regex literals as signature structure. A valid default such as /[(]/ can therefore make extraction return no parameters; applying generated code then drops the node inputs. This change skips regex literal contents while scanning the main signature and top-level parameters, while preserving ordinary division. Regression cases cover regexes after operators, arrow defaults, control-flow bodies, and standalone blocks.

Fixes #44407

Validation

  • ../node_modules/.bin/vp test --project unit app/components/workflow/nodes/code/__tests__/code-parser.spec.ts — 67 passed.
  • ../node_modules/.bin/vp test --project unit --coverage --coverage.include=app/components/workflow/nodes/code/code-parser.ts --coverage.reporter=text app/components/workflow/nodes/code/__tests__/code-parser.spec.ts — 67 passed; 98.42% line coverage and 93.75% branch coverage for code-parser.ts.
  • ../node_modules/.bin/vp check app/components/workflow/nodes/code/code-parser.ts app/components/workflow/nodes/code/__tests__/code-parser.spec.ts — formatting, lint, and type checks passed.
  • git diff --check — passed.
  • On upstream main aa35579b66615a9620c6dfb0410b1d6cd99a4fea, regression cases for regexes after else, catch, finally, and switch blocks fail; they pass on this branch.
  • GitHub checks for head 3e2e886: 35 successful, 9 skipped. Codecov reports 99.10% patch coverage with one changed line uncovered; its report is one commit behind the current head.

Review gate

At least one approving review from a reviewer with write access is required; both requested code-owner reviews are pending.

Checklist

  • I understand that this PR may be closed if there was no previous discussion or issues.
  • I verified the change and added regression tests.

From Codex

@github-actions github-actions Bot added size:L This PR changes 100-499 lines, ignoring generated files. web This relates to changes on the web. labels Oct 20, 2026
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.10714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.80%. Comparing base (75989ef) to head (08df1b2).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
.../app/components/workflow/nodes/code/code-parser.ts 99.10% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #44409   +/-   ##
=======================================
  Coverage   88.80%   88.80%           
=======================================
  Files        5558     5558           
  Lines      332910   333008   +98     
  Branches    66663    66721   +58     
=======================================
+ Hits       295635   295723   +88     
- Misses      32093    32103   +10     
  Partials     5182     5182           
Flag Coverage Δ
dify-ui 91.67% <ø> (ø)
web 88.47% <99.10%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mikamikasuki
mikamikasuki force-pushed the fix/js-code-node-regex-default-44407 branch from 0286908 to 27452a8 Compare October 20, 2026 08:11
@mikamikasuki
mikamikasuki force-pushed the fix/js-code-node-regex-default-44407 branch from 27452a8 to c8002c1 Compare October 20, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JavaScript Code node parsing stops on regex literals in parameter defaults

1 participant