Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

2.3 KB
Raw Blame
"""
Exported enums for wizard.

If an enum appears in a contract dataclass field, it belongs here.
Internal-only constants (DB magic values, feature flags) stay in
the implementation (logic.py, models.py).
"""

from enum import StrEnum

from posthog.enums import LabeledStrEnum


class WizardSessionRunPhase(StrEnum):
    IDLE = "idle"
    RUNNING = "running"
    COMPLETED = "completed"
    ERROR = "error"


class WizardSessionTaskStatus(StrEnum):
    PENDING = "pending"
    IN_PROGRESS = "in_progress"
    COMPLETED = "completed"

    # These are not currently used, but we want to reserve them for future use.
    FAILED = "failed"
    CANCELED = "canceled"


# Each label repeats its value, because the API documents these choices as plain values.
class WizardTaskStatus(LabeledStrEnum):
    CREATED = "created", "created"
    RUNNING = "running", "running"
    COMPLETED = "completed", "completed"
    FAILED = "failed", "failed"


class WizardRunStatus(LabeledStrEnum):
    CREATED = "created", "created"
    RUNNING = "running", "running"
    COMPLETED = "completed", "completed"
    FAILED = "failed", "failed"
    CANCELLED = "cancelled", "cancelled"


class WizardRunDispatchStatus(StrEnum):
    PENDING = "pending"
    DISPATCHED = "dispatched"


class WizardRunStage(LabeledStrEnum):
    DISPATCHING = "dispatching", "dispatching"
    PROVISIONING = "provisioning", "provisioning"
    PREPARING_WORKSPACE = "preparing_workspace", "preparing_workspace"
    EXECUTING_WIZARD = "executing_wizard", "executing_wizard"
    CREATING_ARTIFACTS = "creating_artifacts", "creating_artifacts"


class WizardWorkerCleanupStatus(StrEnum):
    ACTIVE = "active"
    PENDING = "pending"
    CLEANED = "cleaned"
    FAILED = "failed"


class WizardRunEnvironment(StrEnum):
    LOCAL = "local"
    CLOUD = "cloud"


class WizardWorkspaceType(StrEnum):
    LOCAL_FOLDER = "local_folder"
    GIT_REPOSITORY = "git_repository"


class WizardRunErrorCode(StrEnum):
    TIMEOUT = "timeout"
    PROVISIONING_FAILED = "provisioning_failed"
    REPOSITORY_ACCESS_FAILED = "repository_access_failed"
    WORKSPACE_PREPARATION_FAILED = "workspace_preparation_failed"
    EXECUTION_FAILED = "execution_failed"
    ARTIFACT_CREATION_FAILED = "artifact_creation_failed"
    DISPATCH_FAILED = "dispatch_failed"


class WizardRunArtifactType(StrEnum):
    GIT_DIFF = "git_diff"
    PULL_REQUEST = "pull_request"