Add the experience service with sites through analytics/AI hooks, migrations through 0011, and phase docs/manifests marking the track complete. Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
"""Lifecycle policies for Phase 11.10 AI content hook aggregates."""
|
|
from app.models.types import AiContentDispatchStatus as D, AiContentHookStatus as H
|
|
from app.validators.integrations import ensure_transition
|
|
|
|
_TRANSITIONS = {
|
|
H: {
|
|
H.DRAFT: frozenset({H.ACTIVE, H.RETIRED}),
|
|
H.ACTIVE: frozenset({H.SUSPENDED, H.RETIRED}),
|
|
H.SUSPENDED: frozenset({H.ACTIVE, H.RETIRED}),
|
|
H.RETIRED: frozenset(),
|
|
},
|
|
D: {
|
|
D.PENDING: frozenset({D.GENERATED, D.FAILED, D.CANCELLED}),
|
|
D.GENERATED: frozenset(),
|
|
D.FAILED: frozenset({D.PENDING, D.CANCELLED}),
|
|
D.CANCELLED: frozenset(),
|
|
},
|
|
}
|
|
|
|
|
|
class AiContentHookRegistrationPolicy:
|
|
def assert_status_change(self, *, current, target):
|
|
ensure_transition(current, target, _TRANSITIONS[H], "ai_content_hook_registration")
|
|
|
|
|
|
class AiContentDispatchPolicy:
|
|
def assert_status_change(self, *, current, target):
|
|
ensure_transition(current, target, _TRANSITIONS[D], "ai_content_dispatch")
|