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.

5.6 KB
Raw Blame
{
    "$schema": "https://turbo.build/schema.json",
    "futureFlags": {
        "affectedUsingTaskInputs": true
    },
    "tasks": {
        "backend:test": {
            "inputs": [
                "backend/**/*.py",
                "!backend/**/__pycache__/**",
                // A few products run pytest against roots outside backend/:
                // experiments (stats/), logs (skills/), posthog_ai (scripts/).
                // These globs anchor per-package, so they only match where the
                // dir exists. Do NOT collapse to a leading "**/*.py" — that
                // resolves from the workspace root and marks every product's
                // backend:test affected on any .py change, forcing the full suite.
                "stats/**/*.py",
                "skills/**/*.py",
                "scripts/**/*.py",
                "../../pyproject.toml",
                "../../uv.lock",
                "../../common/**/*.py"
            ],
            "outputs": [],
            "cache": true,
            // PERSON_ON_EVENTS_V2_ENABLED and CLICKHOUSE_HOGQL_USE_NEW_EVENTS_SCHEMA belong in
            // `env`, not passThroughEnv: each changes the SQL a query runner builds, so a
            // result cached under one mode must not satisfy a run in the other.
            "env": [
                "DATABASE_URL",
                "REDIS_URL",
                "CLICKHOUSE_HOST",
                "TEST",
                "PERSON_ON_EVENTS_V2_ENABLED",
                "CLICKHOUSE_HOGQL_USE_NEW_EVENTS_SCHEMA"
            ],
            // Job env that pytest reads. Turbo strips undeclared env vars, so a var set on
            // the CI job never reaches pytest unless listed here, and nothing fails when one
            // is missing. Pass-through, not env: they must not become cache keys.
            // - Credentials and the fork-PR flag the product-run temporal suites need (tasks
            //   sandbox JWT, batch-exports Modal/S3, RUNS_ON_INTERNAL_PR that skips
            //   internal-only tests for external contributors).
            // - COVERAGE_CORE: without it, coverage uses its slower C tracer.
            // - POSTHOG_PYTEST_HARD_EXIT: without it, green shards pay the interpreter teardown.
            "passThroughEnv": [
                "PYTEST_ADDOPTS",
                "RUNNER_NAME",
                "RUNS_ON_INTERNAL_PR",
                "SANDBOX_JWT_PRIVATE_KEY",
                "MODAL_TOKEN_ID",
                "MODAL_TOKEN_SECRET",
                "AWS_S3_ALLOW_UNSAFE_RENAME",
                "COVERAGE_CORE",
                "POSTHOG_PYTEST_HARD_EXIT"
            ]
        },
        "backend:lint": {
            "inputs": ["backend/**/*.py", "!backend/**/__pycache__/**"],
            "outputs": [],
            "cache": true
        },
        "backend:contract-check": {
            "inputs": ["backend/**/*.py", "!backend/**/__pycache__/**"],
            "outputs": [],
            "cache": true
        },
        "prepare": {
            "dependsOn": ["^build"]
        },
        "build": {
            "dependsOn": ["^build"],
            "inputs": ["src", "Cargo.toml", "!**/*.pyc"],
            "outputs": ["dist", "index.node", ".turbo"],
            "env": ["RUST_VERSION", "SHARD_INDEX", "SHARD_COUNT"],
            "passThroughEnv": [
                "RUSTUP_HOME",
                "CARGO_HOME",
                "DATABASE_URL",
                "REDIS_URL",
                "NODE_OPTIONS",
                "SSL_CERT_FILE"
            ]
        },
        "test": {
            "dependsOn": ["^build"],
            "inputs": ["src", "tests", "Cargo.toml", "!**/*.pyc"],
            // JEST_JUNIT_* must live in `env` (the cache key), not just passThroughEnv:
            // flipping them on without invalidating the cache replays a previous run's
            // test logs while skipping jest entirely, which the CI upload step then reads
            // as "no junit files were produced" and the shard silently passes untested.
            "env": [
                "RUST_VERSION",
                "SHARD_INDEX",
                "SHARD_COUNT",
                "JEST_JUNIT_OUTPUT_DIR",
                "JEST_JUNIT_OUTPUT_NAME",
                "JEST_JUNIT_SUITE_NAME",
                "JEST_JUNIT_ADD_FILE_ATTRIBUTE"
            ],
            "passThroughEnv": [
                "RUSTUP_HOME",
                "CARGO_HOME",
                "DATABASE_URL",
                "REDIS_URL",
                "NODE_OPTIONS",
                "PERSONS_DATABASE_URL",
                "PERSONS_READONLY_DATABASE_URL"
            ]
        },
        "start": {
            "dependsOn": ["^build"],
            "persistent": true,
            "cache": false,
            "passThroughEnv": ["SKIP_TYPEGEN", "COREPACK_ENABLE_DOWNLOAD_PROMPT", "SSL_CERT_FILE", "JS_URL"]
        },
        "start-vite": {
            "dependsOn": ["^build"],
            "persistent": true,
            "cache": false,
            // Turbo strips undeclared env vars, so an opt-in set in .env.local never reaches vite.config.mts
            // unless it is listed here. DEV_CODE_INSPECTOR loads the click-to-source plugin, and CODE_EDITOR picks the editor it opens.
            "passThroughEnv": [
                "SKIP_TYPEGEN",
                "COREPACK_ENABLE_DOWNLOAD_PROMPT",
                "SSL_CERT_FILE",
                "JS_URL",
                "DEV_CODE_INSPECTOR",
                "CODE_EDITOR"
            ]
        },
        "dev": {
            "dependsOn": ["^build"],
            "persistent": true,
            "cache": false
        },
        "clean": {
            "dependsOn": ["^clean"],
            "cache": false
        }
    }
}