From d737d40ab785f5add0c9c4798580bbc732a90940 Mon Sep 17 00:00:00 2001 From: jasquat <2487833+jasquat@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:49:16 -0500 Subject: [PATCH] disabled no task data on completed tasks when rehydrating (#706) Co-authored-by: jasquat --- .../services/process_instance_processor.py | 4 +++- .../spiffworkflow_backend/integration/test_process_api.py | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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 fe5ff28b9..edb9cf21d 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py @@ -647,7 +647,9 @@ class ProcessInstanceProcessor: bpmn_subprocess_id_to_guid_mappings: dict | None = None, ) -> None: json_data_hashes = set() - states_to_not_rehydrate_data = ["COMPLETED", "CANCELLED", "ERROR"] + # disable this while we investigate https://github.com/sartography/spiff-arena/issues/705 + # states_to_not_rehydrate_data = ["COMPLETED", "CANCELLED", "ERROR"] + states_to_not_rehydrate_data: list[str] = [] for task in tasks: if task.state not in states_to_not_rehydrate_data: json_data_hashes.add(task.json_data_hash) diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py index fabf3e7df..4529938c4 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py @@ -9,6 +9,7 @@ from typing import Any import pytest from flask.app import Flask from flask.testing import FlaskClient +from SpiffWorkflow.util.task import TaskState # type: ignore from spiffworkflow_backend.exceptions.process_entity_not_found_error import ProcessEntityNotFoundError from spiffworkflow_backend.models.db import db from spiffworkflow_backend.models.process_group import ProcessGroup @@ -2114,6 +2115,11 @@ class TestProcessApi(BaseTest): processor = ProcessInstanceProcessor(process_instance) spiff_task = processor.get_task_by_bpmn_identifier("script_task_two", processor.bpmn_process_instance) assert spiff_task is not None + + # TODO: remove these 2 lines if we enable no task data on rehydration again from pr-661 + assert spiff_task.state == TaskState.ERROR + assert spiff_task.data == {"my_var": "THE VAR"} + task_model = TaskModel.query.filter_by(guid=str(spiff_task.id)).first() assert task_model is not None assert task_model.state == "ERROR"