fix: quarantine failed product cleanups in failed_cleanup state

This commit is contained in:
2026-09-12 15:00:33 +08:00
parent b3ab1bfc52
commit bd78eef161
7 changed files with 149 additions and 19 deletions
+2 -2
View File
@@ -21,7 +21,7 @@ from .schemas import ProductVersionRecord
class ProductPendingCleanupError(ValueError):
"""Raised when a soft-deleted product is changed before restoration."""
"""Raised when a pending or failed-cleanup product is changed before recovery."""
class ProductArchiveService:
@@ -83,7 +83,7 @@ class ProductArchiveService:
if not isinstance(document, dict):
raise ValueError("document must be a JSON object")
product = self.store.get_product(product_id)
if product.status == "pending_cleanup":
if product.status in ("pending_cleanup", "failed_cleanup"):
raise ProductPendingCleanupError("product is pending cleanup")
if product.status != "active":
raise ValueError("product is not active")