Add vulnerabilities bulk Duo workflow management services
What does this MR do and why?
This MR introduces service objects to manage the lifecycle of vulnerabilities bulk Duo workflow executions.
Execution flow
For example, when processing 10,000 vulnerabilities with a GraphQL limit of 1,000 items per request:
FindOrCreate
│
▼
GraphQL(after: nil)
│
▼
Append(1-1000)
│
▼
GraphQL(after: C1)
│
▼
Append(1001-2000)
│
▼
...
│
▼
Append(9001-10000)
│
▼
Start
│
▼
Worker processes internal batches (e.g. 100 items)
│
├── Batch complete → next batch
├── Cancel → drain → Cancelled
└── Finished → CompletedResume flow
Execution state is stored server-side in Redis. To support resuming after page reloads or from another browser session, the GraphQL pagination state can be stored in the execution workflow_metadata, for example:
{
"next_page_cursor": "eyJpZCI6MTAwMH0=",
"has_next_page": true
}On each successful append, the client updates the execution workflow_metadata with the latest GraphQL endCursor and hasNextPage.
On resume:
FindOrCreate
│
▼
Returns execution +
workflow_metadata
│
▼
has_next_page?
│
├── true
│ │
│ ▼
│ GraphQL(after: next_page_cursor)
│ │
│ ▼
│ Append
│
└── false
│
▼
StartSince appends are idempotent, replaying the last page after an interruption is safe because findings already present in a stage are ignored while new findings are added.
Changes
- Add a base service to centralize authorization and shared execution behavior.
- Add a find-or-create execution service to reuse an active execution or create a new one.
- Add an append-by-severity service to group findings by severity and append them to the corresponding execution stages.
- Add a start execution service to transition an execution to the running state and dispatch the first batch to the appropriate workflow workers.
- Add a cancel execution service to cancel an active execution.
- Update execution state handling to distinguish already-running executions.
- Add comprehensive specs covering the execution lifecycle services, including authorization, success, and error scenarios.
References
- Issue: #598839
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.