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.

chore(devex): use the projects api path in product frontends (#104355)

Julian Bez280a04c70250
diff --git a/.semgrep/rules/devex/no-environments-api-urls-frontend.yaml b/.semgrep/rules/devex/no-environments-api-urls-frontend.yaml
index 3e73fe71f628..ea270c3f0e77 100644
--- a/.semgrep/rules/devex/no-environments-api-urls-frontend.yaml
+++ b/.semgrep/rules/devex/no-environments-api-urls-frontend.yaml
@@ -50,8 +50,6 @@ rules:
# Each file below still constructs hand-coded `/api/environments/`
# or `api/environments/` URLs. Removing a file from this list
# re-enables the gate for it.
- - '/products/groups/frontend/logics/groupLogic.ts'
- - '/products/groups/frontend/logics/relatedGroupsLogic.ts'
- '/products/ai_observability/frontend/aiObservabilitySessionDataLogic.ts'
- '/products/ai_observability/frontend/clusters/clusteringConfigLogic.ts'
- '/products/ai_observability/frontend/clusters/clusteringJobsLogic.ts'
@@ -70,13 +68,6 @@ rules:
- '/products/ai_observability/frontend/tags/llmTaggersLogic.ts'
- '/products/ai_observability/frontend/text-view/textViewLogic.ts'
- '/products/ai_observability/frontend/traceReviews/traceReviewsApi.ts'
- - '/products/conversations/frontend/components/SavedViews/ticketViewsLogic.ts'
- - '/products/conversations/frontend/scenes/tickets/supportTicketsSceneLogic.ts'
- - '/products/error_tracking/frontend/scenes/ErrorTrackingScene/ErrorTrackingScene.tsx'
- - '/products/logs/frontend/components/LogsViewer/Filters/serviceFilterLogic.ts'
- - '/products/logs/frontend/components/LogsViews/logsViewsLogic.ts'
- - '/products/mcp_store/frontend/scene/ServerDetailPanel.tsx'
- - '/products/workflows/frontend/OptOuts/customerIOImportLogic.ts'
# No leading slash on the regex — catches both `/api/environments/` and
# bare `api/environments/` (the form used by api.get/create callers).
pattern-regex: 'api/environments/'
diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingScene/ErrorTrackingScene.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingScene/ErrorTrackingScene.tsx
index 3f575813b0b0..28bb76597ec5 100644
--- a/products/error_tracking/frontend/scenes/ErrorTrackingScene/ErrorTrackingScene.tsx
+++ b/products/error_tracking/frontend/scenes/ErrorTrackingScene/ErrorTrackingScene.tsx
@@ -174,7 +174,7 @@ const Header = (): JSX.Element => {
},
{
$type: 'http',
- $message: 'GET /api/environments/:team_id/error_tracking/issues/',
+ $message: 'GET /api/projects/:team_id/error_tracking/issues/',
$level: 'info',
$timestamp: new Date(now.getTime() - 1200).toISOString(),
},
diff --git a/products/groups/frontend/logics/relatedGroupsLogic.ts b/products/groups/frontend/logics/relatedGroupsLogic.ts
index c41d084402b6..7a4ea2c228bb 100644
--- a/products/groups/frontend/logics/relatedGroupsLogic.ts
+++ b/products/groups/frontend/logics/relatedGroupsLogic.ts
@@ -87,7 +87,7 @@ export const relatedGroupsLogic = kea<relatedGroupsLogicType>([
[] as ActorType[],
{
loadRelatedActors: async () => {
- const url = `api/environments/${values.currentTeamId}/groups/related?${toParams({
+ const url = `api/projects/${values.currentTeamId}/groups/related?${toParams({
group_type_index: props.groupTypeIndex,
id: props.id,
})}`
diff --git a/products/logs/frontend/components/LogsViewer/Filters/serviceFilterLogic.ts b/products/logs/frontend/components/LogsViewer/Filters/serviceFilterLogic.ts
index a910fa00d294..9cf5e1a5fa40 100644
--- a/products/logs/frontend/components/LogsViewer/Filters/serviceFilterLogic.ts
+++ b/products/logs/frontend/components/LogsViewer/Filters/serviceFilterLogic.ts
@@ -101,7 +101,7 @@ export const serviceFilterLogic = kea<serviceFilterLogicType>([
[] as string[],
{
loadServiceNames: async () => {
- const url = combineUrl(`api/environments/${values.currentTeamId}/logs/values`, {
+ const url = combineUrl(`api/projects/${values.currentTeamId}/logs/values`, {
key: 'service.name',
attribute_type: 'resource',
value: values.search,
diff --git a/products/logs/frontend/components/LogsViews/logsViewsLogic.ts b/products/logs/frontend/components/LogsViews/logsViewsLogic.ts
index 8817ff494018..52f8e1fe923f 100644
--- a/products/logs/frontend/components/LogsViews/logsViewsLogic.ts
+++ b/products/logs/frontend/components/LogsViews/logsViewsLogic.ts
@@ -19,7 +19,7 @@ export interface LogsViewsLogicProps {
id: string
}
-const logsViewsUrl = (teamId: number | null): string => `api/environments/${teamId}/logs/views`
+const logsViewsUrl = (teamId: number | null): string => `api/projects/${teamId}/logs/views`
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface logsViewsLogicValues {
diff --git a/products/mcp_store/frontend/scene/ServerDetailPanel.tsx b/products/mcp_store/frontend/scene/ServerDetailPanel.tsx
index be0aac745b1f..eea3a7f6f3e9 100644
--- a/products/mcp_store/frontend/scene/ServerDetailPanel.tsx
+++ b/products/mcp_store/frontend/scene/ServerDetailPanel.tsx
@@ -19,7 +19,7 @@ import { ServerIcon } from './icons'
import { ToolRow } from './ToolRow'
function authorizeUrl(teamId: number | null, installationId: string): string {
- return `/api/environments/${teamId}/mcp_server_installations/authorize/?installation_id=${installationId}`
+ return `/api/projects/${teamId}/mcp_server_installations/authorize/?installation_id=${installationId}`
}
function countBy<T>(items: T[], predicate: (item: T) => boolean): number {
diff --git a/products/workflows/frontend/OptOuts/customerIOImportLogic.ts b/products/workflows/frontend/OptOuts/customerIOImportLogic.ts
index dbb7c6ee5dcb..2502f33f4160 100644
--- a/products/workflows/frontend/OptOuts/customerIOImportLogic.ts
+++ b/products/workflows/frontend/OptOuts/customerIOImportLogic.ts
@@ -488,7 +488,7 @@ export const customerIOImportLogic = kea<customerIOImportLogicType>([
(s) => [s.currentTeamIdStrict],
(currentTeamIdStrict: number | string): string => {
const host = window.location.origin
- return `${host}/api/environments/${currentTeamIdStrict}/messaging/customerio/webhook/`
+ return `${host}/api/projects/${currentTeamIdStrict}/messaging/customerio/webhook/`
},
],
stepCompletion: [
@@ -585,7 +585,7 @@ export const customerIOImportLogic = kea<customerIOImportLogicType>([
try {
const response = await fetch(
- `/api/environments/${values.currentTeamIdStrict}/messaging_categories/import_preferences_csv/`,
+ `/api/projects/${values.currentTeamIdStrict}/messaging_categories/import_preferences_csv/`,
{
method: 'POST',
body: formData,