Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result variables shouldn't be merged into the process instance when output mappings exist #4737

Open
abdul99ahad opened this issue Dec 2, 2024 · 6 comments
Assignees
Labels
bug Something isn't working in progress Currently worked on

Comments

@abdul99ahad
Copy link
Contributor

abdul99ahad commented Dec 2, 2024

Describe the bug

When a script task has output mappings defined, only the variables specified in the output mappings should be merged into the process instance. However, the current behavior merges all result variables into the process instance, even when output mappings exist. This leads to unintended variables being accessible at the process level, violating the expected scoping rules.

Dec-02-2024 16-20-58

Here, we shouldn't get foo in the suggestions as output mappings already exists and foo is a result variable.

See Camunda docs
If one or more output mappings are defined, the results variables are set as local variables in the scope where the mapping is defined. Then, the output mappings are applied to the variables and create new variables in this scope. The new variables are merged into the parent scope. If there is no mapping for a job/message variable, the variable is not merged.

If no output mappings are defined, all results variables are merged into the process instance.

this issue first discussed in #4614

Steps to reproduce

  1. Create a script task
  2. Create script variables and output variables
  3. Create a user task
  4. In the user task, see in output or input variables; script variable is suggested

Expected behavior

  • If output mappings exists, the script variable shouldn't be merged in process instance or parent scope
  • If output mappings doesn't exist, the script variable can be merged in process instance or parent scope

Environment

  • OS: MacOS 14.7
  • Camunda Modeler Version: v5.28.0
  • Execution Platform: Camunda 8.6
  • Installed plug-ins: none

Additional context

Related to #4614

@abdul99ahad abdul99ahad added the bug Something isn't working label Dec 2, 2024
@barmac
Copy link
Collaborator

barmac commented Dec 2, 2024

I've added "related" part to the additional context part.

I can reproduce the issue. I've also confirmed that the runtime behaviour is as described in the doc.

@barmac
Copy link
Collaborator

barmac commented Dec 2, 2024

Perhaps it makes sense to tackle this together with #4614? What do you think @abdul99ahad ?

@abdul99ahad
Copy link
Contributor Author

Perhaps it makes sense to tackle this together with #4614? What do you think @abdul99ahad ?

I'm not sure if we could tackle this together. To my understanding, issue #4614 is about parsing the result variables and this is about handling the scope of variables. Let me know if you think otherwise.

@abdul99ahad abdul99ahad self-assigned this Dec 3, 2024
@philippfromme philippfromme changed the title Result variables shouldn't merged into the process instance when output mappings exist Result variables shouldn't be merged into the process instance when output mappings exist Dec 3, 2024
@philippfromme
Copy link
Contributor

@abdul99ahad Should we put this in backlog or ready?

@abdul99ahad abdul99ahad added the ready Ready to be worked on label Dec 3, 2024
@abdul99ahad
Copy link
Contributor Author

Added in ready

@abdul99ahad abdul99ahad added the in progress Currently worked on label Dec 10, 2024 — with bpmn-io-tasks
@abdul99ahad abdul99ahad removed the ready Ready to be worked on label Dec 10, 2024
@barmac
Copy link
Collaborator

barmac commented Dec 13, 2024

To clarify: this is NOT a part of the v5.31.0 release 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in progress Currently worked on
Projects
None yet
Development

No branches or pull requests

3 participants