Make workflow statuses more resilient (#12263)

Workflow statuses are often broken. I did not figured out why yet. But I
see two causes that can be fixed:
- statuses calculation are really complicated today, just to spare a
call to the database
- job is not indempotent, it is using the combination of the previous
statuses + the update to calculate the new statuses. Which means that
once broken, next updates will be broken as well

Instead, we now:
- fetch workflow versions
- get the statuses from these.
It simplifies the code and make the job indempotent.
This commit is contained in:
Thomas Trompette
2025-05-26 15:05:18 +02:00
committed by GitHub
parent 742af7884a
commit ec4e4740d2
7 changed files with 168 additions and 367 deletions
@@ -1,19 +0,0 @@
import { WorkflowStatus } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity';
export const ACTIVE_AND_DRAFT_STATUSES = [
WorkflowStatus.ACTIVE,
WorkflowStatus.DRAFT,
];
export const DEACTIVATED_AND_DRAFT_STATUSES = [
WorkflowStatus.DEACTIVATED,
WorkflowStatus.DRAFT,
];
export const ACTIVE_STATUSES = [WorkflowStatus.ACTIVE];
export const DEACTIVATED_STATUSES = [WorkflowStatus.DEACTIVATED];
export const DRAFT_STATUSES = [WorkflowStatus.DRAFT];
export const NO_STATUSES = [];