Skip to content

Bulk task deletion must be atomic across running-task checks #402

@ionfwsrijan

Description

@ionfwsrijan

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions