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>
26 lines
847 B
Python
26 lines
847 B
Python
"""Lifecycle policies for Phase 11.10 analytics aggregates."""
|
|
from app.models.types import AnalyticsReportStatus as R, AnalyticsSnapshotStatus as S
|
|
from app.validators.integrations import ensure_transition
|
|
|
|
_TRANSITIONS = {
|
|
R: {
|
|
R.DRAFT: frozenset({R.ACTIVE, R.ARCHIVED}),
|
|
R.ACTIVE: frozenset({R.ARCHIVED}),
|
|
R.ARCHIVED: frozenset(),
|
|
},
|
|
S: {
|
|
S.ACTIVE: frozenset({S.ARCHIVED}),
|
|
S.ARCHIVED: frozenset(),
|
|
},
|
|
}
|
|
|
|
|
|
class AnalyticsReportDefinitionPolicy:
|
|
def assert_status_change(self, *, current, target):
|
|
ensure_transition(current, target, _TRANSITIONS[R], "analytics_report_definition")
|
|
|
|
|
|
class AnalyticsSnapshotPolicy:
|
|
def assert_status_change(self, *, current, target):
|
|
ensure_transition(current, target, _TRANSITIONS[S], "analytics_snapshot")
|