feat: expose per-writer value variants on merged variables#125
Conversation
Emit FEEL-resolved variable records with the single origin they were resolved for, snapshotting the value before cross-origin type unions. Merged output is unchanged; this enables accurate per-writer values. Related to camunda/camunda-modeler#5985
Merged variables now carry a variants array, one variable-shaped entry per writing element, so consumers can display individual values instead of only the merged representation. Related to camunda/camunda-modeler#5985
Same-named variables in different scopes each keep exactly their own writers' variants, guarding against cross-scope leakage. Related to camunda/camunda-modeler#5985
…-merged, and C7 cases Covers five writers incl. script result expressions, per-writer info on uncertain expressions, mixed null pre-merged origins, same-element contribution combining, and the Camunda 7 resolver. Related to camunda/camunda-modeler#5985
One element writing a variable via a plain and a hierarchical output mapping yields one variant carrying the combined nested entries. Related to camunda/camunda-modeler#5985
A variable materialized purely from hierarchical output mappings of one element yields a synthesized base record with one combined variant. Related to camunda/camunda-modeler#5985
There was a problem hiding this comment.
Pull request overview
This PR adds per-writer variants to merged variable records so downstream consumers (notably @bpmn-io/variable-outline) can visualize individual write “incarnations” without losing the existing merged representation used for autocomplete and other integrations.
Changes:
- Add
variantsto merged variables in the base resolver, including recursive editor-format mapping. - Adjust FEEL mapping resolution to preserve origin-specific results (so values/types don’t get cross-origin-unioned into a single “writer”).
- Add extensive test coverage and fixtures for variant behavior across Zeebe + Camunda resolvers, including same-element contribution merging and non-leakage of entries.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/base/VariableResolver.js | Collect and maintain per-origin variants during merge; ensure editor-format mapping includes variants. |
| lib/zeebe/util/feelUtility.js | Preserve per-origin resolution results when computing FEEL-mapped variables. |
| test/assertions.js | Extend test matcher utilities to support origin-aware matching and variants assertions. |
| test/spec/zeebe/ZeebeVariableResolver.spec.js | Add resolver-level tests for variants behavior (per-writer, scoping, hierarchical variables, etc.). |
| test/spec/zeebe/Mappings.spec.js | Add mapping-focused tests asserting variant splitting/combining behavior across multiple mapping scenarios. |
| test/spec/camunda/CamundaVariableResolver.spec.js | Add Camunda-side variant exposure test coverage. |
| test/fixtures/zeebe/mappings/merging.per-element.bpmn | New fixture for per-element write scenarios (result expressions / multiple writers). |
| test/fixtures/zeebe/mappings/merging.same-element.bpmn | New fixture for same-element multi-write contribution merging. |
| test/fixtures/zeebe/mappings/merging.same-element.paths.bpmn | New fixture for same-element path-only contributions merging. |
| README.md | Document the new variants property on merged variables. |
| CHANGELOG.md | Note the new feature and FEEL per-origin resolution behavior in unreleased changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The matcher filters by origin since the variants support, so failures must show it to disambiguate same-named variables. Related to camunda/camunda-modeler#5985
Aligns the variants example with the README convention of quoting element ids in origin arrays. Related to camunda/camunda-modeler#5985
|
What this delivers is variants per variable, FEEL expression "variable created". What this does not deliver is variants per expression: Above will still be merged Proposed in nikku/lezer-feel#87 is to support that feature "all the way". Above Your call to which level you want to support it. |
I think these two differ in what they provide us with;
So I am unsure if I would have called nikku/lezer-feel#87 supporting the "feature" "all the way" as these two topics deliver different values in my opinion. I would suggest we consider this pull request as-is to enable variable-outline and nikku/lezer-feel#87 could be considered later for variable intelligence from the feel-editor (autocomplete) perspective etc. Nevertheless, as always, I am happy to be corrected in case I happen to deviate from the vision for the sake of variable intelligence. |
nikku
left a comment
There was a problem hiding this comment.
Good stuff. Let's get this incorporated.
Proposed Changes
This pull request aims to introduce a
variantsproperty per variable per origin so that individual incarnations of variable writes can be visualized in the user interface.I have aimed to;
This pull request should enable
@bpmn-io/variable-outlineto visualize variable incarnations individually rather than merged.This screenshot is subject to iteration. However, you are welcome to share feedback!
The variable-outline branch is not there yet. It'll be linked here once it's created.
Related to camunda/camunda-modeler#5985
Checklist
Ensure you provide everything we need to review your contribution:
Closes {LINK_TO_ISSUE}orRelated to {LINK_TO_ISSUE}@bpmn-io/srtool