: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(autoresearch): speed up openapi generation (#101221)
Matt Puaa7d050510233
diff --git a/hogli.yaml b/hogli.yamlindex 36dc2c06556e..914c65dff3ca 100644--- a/hogli.yaml+++ b/hogli.yaml@@ -555,14 +555,52 @@ build:steps:- build:openapi-schema- build:widget-types- - build:openapi-types- - build:openapi-mcp-types- - build:openapi-mcp- - build:openapi-mcp-tools+ - cmd: |+ log_dir=$(mktemp -d)+ generator_names=(frontend_types mcp_types mcp_tools task_catalog exec_docs)+ generator_pids=()+ generator_statuses=()+ setsid hogli build:openapi-types >"$log_dir/frontend_types.log" 2>&1 &+ generator_pids+=("$!")+ setsid hogli build:openapi-mcp-types >"$log_dir/mcp_types.log" 2>&1 &+ generator_pids+=("$!")+ setsid sh -c 'hogli build:openapi-mcp && exec hogli build:openapi-mcp-tools' >"$log_dir/mcp_tools.log" 2>&1 &+ generator_pids+=("$!")+ setsid hogli build:task-model-catalog >"$log_dir/task_catalog.log" 2>&1 &+ generator_pids+=("$!")+ setsid hogli build:openapi-exec-docs >"$log_dir/exec_docs.log" 2>&1 &+ generator_pids+=("$!")+ pids="${generator_pids[*]}"+ trap 'for pid in $pids; do kill -- -"$pid" 2>/dev/null || true; done' INT TERM+ generation_status=0+ for index in "${!generator_names[@]}"; do+ if wait "${generator_pids[$index]}"; then+ generator_statuses[$index]=0+ else+ generator_statuses[$index]=$?+ generation_status=1+ fi+ done+ for expected_status in 0 1; do+ for index in "${!generator_names[@]}"; do+ if [ "$expected_status" -eq 0 ]; then+ if [ "${generator_statuses[$index]}" -ne 0 ]; then+ continue+ fi+ elif [ "${generator_statuses[$index]}" -eq 0 ]; then+ continue+ fi+ name="${generator_names[$index]}"+ printf '::group::%s (exit %s)\n' "$name" "${generator_statuses[$index]}"+ cat "$log_dir/$name.log"+ printf '::endgroup::\n'+ done+ done+ rm -rf "$log_dir"+ trap - INT TERM+ exit "$generation_status"- build:openapi-mcp-scopes- - build:task-model-catalog- build:openapi-cli-agent-scopes- - build:openapi-exec-docsdescription: 'Generate OpenAPI schema and TypeScript types from the backend.Needs the dev stack running (Postgres and ClickHouse): Django startsbefore the schema is generated. Start it with hogli up -d'diff --git a/products/dashboards/frontend/bin/generate-widget-config-zod.mjs b/products/dashboards/frontend/bin/generate-widget-config-zod.mjsindex 26f63334d28f..78cca90c1498 100644--- a/products/dashboards/frontend/bin/generate-widget-config-zod.mjs+++ b/products/dashboards/frontend/bin/generate-widget-config-zod.mjs@@ -307,10 +307,13 @@ import { z as zod } from 'zod'fs.writeFileSync(outputFile, `${header}${importLines.join('\n')}\n\n${aliasLines.join('\n')}\n\n${footer}`)- execSync(`pnpm exec oxfmt ${outputFile} ${widgetConfigSchemasDir}`, {- stdio: 'pipe',- cwd: repoRoot,- })+ execSync(+ `pnpm exec oxfmt ${outputFile} ${widgetConfigSchemasDir} ${path.join(dashboardsGeneratedDir, 'widget-config-property-keys.json')}`,+ {+ stdio: 'pipe',+ cwd: repoRoot,+ }+ )console.log(` ✓ dashboards:widget-config-zod → ${path.relative(repoRoot, outputFile)} (${copiedSchemas.length} Orval schema files)`)diff --git a/services/mcp/scripts/generate-mcp-types.mjs b/services/mcp/scripts/generate-mcp-types.mjsindex 5e86d7d59ff1..15941fa08161 100644--- a/services/mcp/scripts/generate-mcp-types.mjs+++ b/services/mcp/scripts/generate-mcp-types.mjs@@ -12,7 +12,6 @@* Invoked by `hogli build:openapi-mcp-types`.*//* eslint-disable no-console */-import { spawnSync } from 'node:child_process'import fs from 'node:fs'import os from 'node:os'import path from 'node:path'@@ -44,7 +43,7 @@ const tempSchemaFile = path.join(tmpDir, 'openapi.json')const tempTargetFile = path.join(tmpDir, 'generated.ts')const tempSchemasFile = path.join(tmpDir, 'generated.schemas.ts')-fs.writeFileSync(tempSchemaFile, JSON.stringify(schema, null, 2))+fs.writeFileSync(tempSchemaFile, JSON.stringify(schema))const results = await runOrvalParallel([{@@ -112,10 +111,5 @@ ${indented}fs.writeFileSync(targetFile, output)-spawnSync(path.join(repoRoot, 'bin/hogli'), ['format:js', targetFile], {- stdio: 'pipe',- cwd: repoRoot,-})-const schemaCount = Object.keys(schema.components?.schemas ?? {}).lengthconsole.log(`MCP types: generated ${schemaCount} schemas → src/api/generated.ts`)