Problem
Bulk deletion can partially delete completed tasks even when the request should fail because one selected task is still running.
Evidence
Affected areas:
backend/secuscan/routes.py
testing/backend/integration/test_task_cleanup.py
testing/backend/integration/test_bulk_delete_contract.py
The expected contract is: if any selected task is running, reject the entire request and delete nothing.
Impact
Partial deletion can erase historical reports/findings while leaving running tasks behind, corrupting dashboard state and audit history.
Expected fix
- Fetch all selected tasks first
- Validate all IDs exist and none are running before deleting anything
- Perform deletion in a transaction
- Return consistent
{ success, deleted_count } response shape
- Add regression tests for mixed completed/running task lists
Problem
Bulk deletion can partially delete completed tasks even when the request should fail because one selected task is still running.
Evidence
Affected areas:
backend/secuscan/routes.pytesting/backend/integration/test_task_cleanup.pytesting/backend/integration/test_bulk_delete_contract.pyThe expected contract is: if any selected task is running, reject the entire request and delete nothing.
Impact
Partial deletion can erase historical reports/findings while leaving running tasks behind, corrupting dashboard state and audit history.
Expected fix
{ success, deleted_count }response shape