fix: reconcile and expose failed product cleanup

This commit is contained in:
2026-09-12 15:24:41 +08:00
parent bd78eef161
commit 21ad6fbf8d
6 changed files with 176 additions and 6 deletions
+2
View File
@@ -1232,6 +1232,8 @@ def delete_product(request: Request, product_id: str) -> ProductRecord:
product = _get_product_or_404(product_id)
if product.status == "pending_cleanup":
raise HTTPException(status_code=409, detail="product is pending cleanup")
if product.status == "failed_cleanup":
raise HTTPException(status_code=409, detail="product cleanup failed; restore it before deleting")
try:
return product_archive_store.mark_pending_cleanup(product_id, now=datetime.now(timezone.utc))
except ValueError as exc: