: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(products): emit a ProductTreePath literal union from the manifests (#83147)
Arno Hillen3be2719ad819
diff --git a/frontend/build-products.mjs b/frontend/build-products.mjsindex 3a89d8310685..f8d3dff3d83e 100644--- a/frontend/build-products.mjs+++ b/frontend/build-products.mjs@@ -334,6 +334,12 @@ function buildProductManifests() {)const serializedTreeItemsNew = makeArrExpr(treeItemsNew)const serializedTreeItemsProducts = makeArrExpr(treeItemsProducts)+ // A literal union of product tree paths, so code that hardcodes a path (e.g. sidebar companion+ // maps) fails to compile on a typo instead of silently matching nothing.+ const serializedProductTreePaths = Object.keys(treeItemsProducts)+ .sort((a, b) => a.localeCompare(b))+ .map((p) => JSON.stringify(p))+ .join(' | ')const serializedTreeItemsGames = makeArrExpr(treeItemsGames)const serializedTreeItemsMetadata = makeArrExpr(treeItemsMetadata)@@ -370,6 +376,9 @@ function buildProductManifests() {${autogenDisclaimer}export const getTreeItemsNew = (): FileSystemImport[] => ${serializedTreeItemsNew}+ ${autogenDisclaimer}+ export type ProductTreePath = ${serializedProductTreePaths}+${autogenDisclaimer}export const getTreeItemsProducts = (): FileSystemImport[] => ${serializedTreeItemsProducts}diff --git a/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx b/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsxindex 96a3924de366..bb73a2941b01 100644--- a/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx+++ b/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx@@ -46,6 +46,7 @@ import {} from '~/layout/panel-layout/ProjectTree/utils'import { FEATURE_FLAGS } from '~/lib/constants'import { groupsModel } from '~/models/groupsModel'+import type { ProductTreePath } from '~/products'import { FileSystemEntry, FileSystemIconType, FileSystemImport } from '~/queries/schema/schema-general'import { UserBasicType } from '~/types'@@ -73,7 +74,7 @@ const SHORTCUTS_LOADER_TIMEOUT_MS = 10000*/const MOVE_TIMEOUT_MS = 30000export const PAGINATION_LIMIT = 100-const PRODUCTS_SHOWN_WITH_SELECTED_PRODUCTS: Record<string, string[]> = {+const PRODUCTS_SHOWN_WITH_SELECTED_PRODUCTS: Partial<Record<ProductTreePath, readonly ProductTreePath[]>> = {'LLM analytics': ['MCP analytics'],// Replay vision scans the recordings Session replay captures, so alone it has nothing to work on.'Session replay': ['Replay vision'],@@ -1642,7 +1643,8 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([for (const item of customProducts) {for (const productPath of [item.product_path,- ...(PRODUCTS_SHOWN_WITH_SELECTED_PRODUCTS[item.product_path] ?? []),+ // product_path arrives as a plain string; a path not in the union just misses the map.+ ...(PRODUCTS_SHOWN_WITH_SELECTED_PRODUCTS[item.product_path as ProductTreePath] ?? []),]) {if (selectedProductPaths.has(productPath)) {continuediff --git a/frontend/src/products.tsx b/frontend/src/products.tsxindex 897513d00ade..3ff16a2e6804 100644--- a/frontend/src/products.tsx+++ b/frontend/src/products.tsx@@ -1798,6 +1798,58 @@ export const getTreeItemsNew = (): FileSystemImport[] => [},]+/** This const is auto-generated, as is the whole file */+export type ProductTreePath =+ | 'AI gateway'+ | 'Apps'+ | 'Business knowledge'+ | 'Clusters'+ | 'Code review'+ | 'Customer analytics'+ | 'Dashboards'+ | 'Data catalog'+ | 'Data warehouse'+ | 'Datasets'+ | 'Early access features'+ | 'Endpoints'+ | 'Engineering analytics'+ | 'Error tracking'+ | 'Evaluations'+ | 'Experiments'+ | 'Feature flags'+ | 'Heatmaps'+ | 'Identity matching'+ | 'Inbox'+ | 'Links'+ | 'Live Debugger'+ | 'LLM analytics'+ | 'Logs'+ | 'Marketing analytics'+ | 'MCP analytics'+ | 'MCP servers'+ | 'Metrics'+ | 'Notebooks'+ | 'Playground'+ | 'Product analytics'+ | 'Product tours'+ | 'Prompts'+ | 'Pulse'+ | 'Replay vision'+ | 'Session replay'+ | 'Skills'+ | 'SQL editor'+ | 'Support'+ | 'Surveys'+ | 'Taggers'+ | 'Tasks'+ | 'Toolbar'+ | 'Tracing'+ | 'User research'+ | 'Visual review'+ | 'Web analytics'+ | 'Web scripts'+ | 'Workflows'+/** This const is auto-generated, as is the whole file */export const getTreeItemsProducts = (): FileSystemImport[] => [{