Conversation
There was a problem hiding this comment.
Pull request overview
This pull request implements functionality to extract and track variables used in FEEL expressions within BPMN process definitions. The feature analyzes input mappings and script task expressions to identify which variables are required as inputs, creating "input requirement" entries that track dependencies between variables.
Changes:
- Added FEEL expression analysis using
@bpmn-io/feel-analyzerto extract input variables from expressions - Introduced
usedByproperty on ProcessVariable objects to track which target variables depend on each input - Added
getInputRequirementsForElementAPI method to retrieve input requirements for specific elements
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Added dependencies for @bpmn-io/feel-analyzer and @camunda/feel-builtins to enable FEEL expression analysis |
| package-lock.json | Updated dependency tree with new packages and peer dependency resolutions |
| lib/zeebe/util/feelUtility.js | Core implementation: analyzes expressions with FeelAnalyzer, builds input requirements with deduplication and entry merging, filters scoped variables |
| lib/zeebe/VariableResolver.js | Integrates input requirements into the variable resolution pipeline |
| lib/base/VariableResolver.js | Adds getInputRequirementsForElement method, updates scope filtering to exclude input requirements, fixes async return type documentation |
| test/spec/zeebe/Mappings.spec.js | Comprehensive tests for input requirement extraction covering simple/nested expressions, deduplication, merging, scoping, and script tasks |
| test/fixtures/zeebe/mappings/input-requirements.bpmn | Test fixture with various input mapping scenarios |
| test/fixtures/zeebe/mappings/script-task-inputs.bpmn | Test fixture for script task input extraction |
| test/fixtures/zeebe/mappings/script-task-with-input-mappings.bpmn | Test fixture combining script tasks with input mappings |
Comments suppressed due to low confidence (3)
lib/base/VariableResolver.js:320
- The new public method
getInputRequirementsForElementhas no test coverage. Consider adding tests to verify that it correctly filters input requirements by element and handles edge cases like elements with no input requirements, multiple input requirements, and both diagram-js elements and moddle elements as parameters.
async getInputRequirementsForElement(element) {
const allVariablesByRoot = await this.getVariables()
.catch(() => {
return {};
});
const allVariables = Object.values(allVariablesByRoot).flat();
return allVariables.filter(v =>
v.usedBy && v.usedBy.length > 0
&& v.origin.length === 1 && v.origin[0].id === element.id
);
}
lib/base/VariableResolver.js:305
- The parameter type annotation for
elementshould be{ModdleElement}to be consistent with other methods in this class likegetProcessVariablesandgetVariablesForElementwhich use the same parameter type.
* @param {Object} element
lib/base/VariableResolver.js:318
- The method compares
v.origin[0].idwithelement.iddirectly, but the method might be called with a diagram-js element (which has a.businessObjectproperty) or a moddle element directly. Consider usinggetBusinessObject(element)likegetVariablesForElementdoes on line 256 to handle both cases correctly.
&& v.origin.length === 1 && v.origin[0].id === element.id
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@barmac I've adjusted the behavior to follow the input mapping chain |
Hmm it looks that we still remove the variable which is required for the execution: Screen.Recording.2026-02-20.at.14.07.03.mov |
|
Sorry I didn't update the task testing PR yet. you need to test with (updated description) Screen.Recording.2026-02-20.at.14.20.03.mov |
|
Variables ordering in script:
So the script can use the inputs contrary to what the screenshot indicates. |
|
ATM it only looks at io mappings and script expressions. I can either just include all feel expressions (in the sense of any value starting with |
|
Gotcha. In that case, I think it's fine to move the complete support to a separate issue, but let's either fix or remove the script part. |
|
We don't want to check all of the values starting with |
ccce04e to
3120e8a
Compare
There was a problem hiding this comment.
Let's discuss the things mentioned:
- Performance - are we now "fast enough" with all built-ins used?
- Parsing - we parse the AST twice (this library, and
feel-analyzer) - does it matter, if so, how? inputRequrements, is that the name we want to use?- output mappings may establish dependencies
|
Via #74 (review) I wanted us to show the E2E scope of this change - ensuring we add "used variables" in an integrated way. I went ahead and sketched how that integration could look like in this document. SummaryTo summarize the main takeaways:
Proposed addition to existing API// return only read variables, excluding local ones
const consumedVariables = variableResolver.getVariablesForElement(element, { read: true, local: false });
// return all written variables
const allWrittenVariables = variableResolver.getVariablesForElement(element, { written: true });
// return all variables (default)
const allVariables = variableResolver.getVariablesForElement(element); |
d873ddf to
dd46c34
Compare
dd46c34 to
6b96a34
Compare
|
i've adjusted the tests to match (dc02ab2) , note the DetailsOldand combination of defined filters Given
Read
Read / local
Read / global
NewAnd combination of true filters Given
Read
Read/local
Read / global
|
dc02ab2 to
ef354f4
Compare
|
@Buckwich I don't understand this:
==> |
ef354f4 to
10ec2a1
Compare
note: internal usedby gets merged, thats why i added both tasks
10ec2a1 to
d9e8707
Compare




Related to camunda/camunda-modeler#5639
Proposed Changes
different consumers:
follow up PRs:
Checklist
Ensure you provide everything we need to review your contribution:
Closes {LINK_TO_ISSUE}orRelated to {LINK_TO_ISSUE}@bpmn-io/srtool