diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py index 4204f776..6a36e38d 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py @@ -30,8 +30,7 @@ from SpiffWorkflow.bpmn.exceptions import WorkflowTaskException # type: ignore from SpiffWorkflow.bpmn.parser.ValidationException import ValidationException # type: ignore from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine # type: ignore from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import BasePythonScriptEngineEnvironment # type: ignore -from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import Box -from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import BoxedTaskDataEnvironment +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import TaskDataEnvironment from SpiffWorkflow.bpmn.serializer.default.task_spec import EventConverter # type: ignore from SpiffWorkflow.bpmn.serializer.helpers.registry import DefaultRegistry # type: ignore from SpiffWorkflow.bpmn.serializer.workflow import BpmnWorkflowSerializer # type: ignore @@ -139,7 +138,7 @@ class MissingProcessInfoError(Exception): pass -class BoxedTaskDataBasedScriptEngineEnvironment(BoxedTaskDataEnvironment): # type: ignore +class TaskDataBasedScriptEngineEnvironment(TaskDataEnvironment): # type: ignore def __init__(self, environment_globals: dict[str, Any]): self._last_result: dict[str, Any] = {} super().__init__(environment_globals) @@ -190,8 +189,6 @@ class NonTaskDataBasedScriptEngineEnvironment(BasePythonScriptEngineEnvironment) context: dict[str, Any], external_methods: dict[str, Any] | None = None, ) -> Any: - # TODO: once integrated look at the tests that fail without Box - Box.convert_to_box(context) state = {} state.update(self.globals) state.update(external_methods or {}) @@ -205,9 +202,6 @@ class NonTaskDataBasedScriptEngineEnvironment(BasePythonScriptEngineEnvironment) context: dict[str, Any], external_methods: dict[str, Any] | None = None, ) -> bool: - # TODO: once integrated look at the tests that fail without Box - # context is task.data - Box.convert_to_box(context) self.state.update(self.globals) self.state.update(external_methods or {}) self.state.update(context) @@ -268,12 +262,7 @@ class NonTaskDataBasedScriptEngineEnvironment(BasePythonScriptEngineEnvironment) self.state[result_variable] = task.data.pop(result_variable) -# SpiffWorkflow at revision f162aac43af3af18d1a55186aeccea154fb8b05d runs script tasks on ready -# which means that our will_complete_task hook does not have the correct env state when it runs -# so save everything to task data for now until we can figure out a better way to hook into that. -# Revision 6cad2981712bb61eca23af1adfafce02d3277cb9 is the last revision that can run with this. -# class CustomScriptEngineEnvironment(NonTaskDataBasedScriptEngineEnvironment): -class CustomScriptEngineEnvironment(BoxedTaskDataBasedScriptEngineEnvironment): +class CustomScriptEngineEnvironment(TaskDataBasedScriptEngineEnvironment): pass @@ -345,7 +334,7 @@ class CustomBpmnScriptEngine(PythonScriptEngine): # type: ignore def _evaluate( self, expression: str, - context: dict[str, Box | str], + context: dict[str, Any], task: SpiffTask | None = None, external_methods: dict[str, Any] | None = None, ) -> Any: diff --git a/spiffworkflow-backend/tests/data/message_send_two_conversations/message_receiver_one.bpmn b/spiffworkflow-backend/tests/data/message_send_two_conversations/message_receiver_one.bpmn index 62236cc4..b87a3f7f 100644 --- a/spiffworkflow-backend/tests/data/message_send_two_conversations/message_receiver_one.bpmn +++ b/spiffworkflow-backend/tests/data/message_send_two_conversations/message_receiver_one.bpmn @@ -34,8 +34,8 @@ { -"topica_one": payload_var_one.topica_one, -"topicb_one": payload_var_one.topicb_one, +"topica_one": payload_var_one["topica_one"], +"topicb_one": payload_var_one["topicb_one"], "second_var_one": second_var_one } @@ -54,7 +54,7 @@ Flow_0rx0bxv Flow_197lbl3 - second_var_one = payload_var_one.initial_var_one + 1 + second_var_one = payload_var_one["initial_var_one"] + 1 Flow_0rx0bxv diff --git a/spiffworkflow-backend/tests/data/message_send_two_conversations/message_receiver_two.bpmn b/spiffworkflow-backend/tests/data/message_send_two_conversations/message_receiver_two.bpmn index a1bbe6f0..4afc9149 100644 --- a/spiffworkflow-backend/tests/data/message_send_two_conversations/message_receiver_two.bpmn +++ b/spiffworkflow-backend/tests/data/message_send_two_conversations/message_receiver_two.bpmn @@ -34,8 +34,8 @@ { -"topic_two_a": payload_var_two.topica_two, -"topic_two_b": payload_var_two.topicb_two, +"topic_two_a": payload_var_two["topica_two"], +"topic_two_b": payload_var_two["topicb_two"], "second_var_two": second_var_two } @@ -54,7 +54,7 @@ Flow_0rx0bxv Flow_197lbl3 - second_var_two = payload_var_two.initial_var_two + 1 + second_var_two = payload_var_two["initial_var_two"] + 1 Flow_0rx0bxv