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.

795 B
Raw Blame
import json
from hashlib import sha256

from products.wizard.backend.facade.contracts import CreateWizardRunInput
from products.wizard.backend.logic.runs.mappers import workspace_to_record


def create_run_request_fingerprint(params: CreateWizardRunInput) -> str:
    """
    Request fingerprint helps identify duplicate run requests even if they have different idempotency key.
    """
    workspace_type, workspace = workspace_to_record(params.workspace)

    value = {
        "environment": params.environment.value,
        "program_id": params.program_id,
        "wizard_version": params.wizard_version,
        "workspace": workspace,
        "workspace_type": workspace_type.value,
    }

    return sha256(json.dumps(value, separators=(",", ":"), sort_keys=True).encode()).hexdigest()