: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
refactor(tasks): drop custom object embeds and flatten the image zoom presets (#110468)
Shy Alter924512102632
diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/TaskRunArtifacts.stories.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/TaskRunArtifacts.stories.tsxindex f2a6d710759e..c9266da4453a 100644--- a/products/posthog_ai/frontend/scenes/TaskTracker/TaskRunArtifacts.stories.tsx+++ b/products/posthog_ai/frontend/scenes/TaskTracker/TaskRunArtifacts.stories.tsx@@ -4,7 +4,6 @@ import { HttpResponse } from 'msw'import { ReactNode, useEffect } from 'react'import { FEATURE_FLAGS } from 'lib/constants'-import FEATURE_FLAGS_FIXTURE from 'scenes/feature-flags/__mocks__/feature_flags.json'import { urls } from 'scenes/urls'import { userLogic } from 'scenes/userLogic'@@ -14,7 +13,6 @@ import { todayShellLogic } from '~/layout/today/todayShellLogic'import { mswDecorator } from '~/mocks/browser'import TRENDS_LINE_INSIGHT from '~/mocks/fixtures/api/projects/team_id/insights/trendsLine.json'import type { MockSignature } from '~/mocks/utils'-import { NodeKind } from '~/queries/schema/schema-general'import type {TaskRunArtifactResponseApi,@@ -237,69 +235,14 @@ const OBJECT_REFERENCES = [const CITED_INSIGHT = { ...TRENDS_LINE_INSIGHT, short_id: 'aBcD1234', name: 'Trial funnel by step' }-const CITED_FLAG = {- ...FEATURE_FLAGS_FIXTURE.results[0],- id: 7,- key: 'new-plan-picker',- name: 'Pin the start trial button to the top of the plan table',- active: true,- filters: {- groups: [- {- properties: [{ key: 'email', type: 'person', value: 'example.com', operator: 'icontains' }],- rollout_percentage: 100,- description: 'Internal testers',- },- { properties: [], rollout_percentage: 50 },- ],- multivariate: null,- payloads: {},- },-}--const CITED_COHORT = {- id: 3,- name: 'Trial starters on laptops',- count: 1009,- is_static: false,- is_calculating: false,- last_calculation: '2026-09-28T17:00:00Z',- created_at: '2026-09-21T10:00:00Z',- deleted: false,- filters: { properties: { type: 'AND', values: [] } },-}--const COHORT_PEOPLE = ['[email protected]', '[email protected]', '[email protected]', '[email protected]']--/** The insight and cohort embeds each run their own query through the same endpoint. */-async function queryByKind({ request }: { request: Request }): Promise<Record<string, unknown>> {- const { query } = (await request.json()) as { query: { kind: string; source?: { kind: string } } }- if (query.kind === NodeKind.ActorsQuery || query.source?.kind === NodeKind.ActorsQuery) {- return {- columns: ['person_display_name -- Person', 'id', 'created_at'],- results: COHORT_PEOPLE.map((email, index) => [- { display_name: email, id: `person-${index}` },- `person-${index}`,- '2026-09-21T10:00:00Z',- ]),- hasMore: false,- }- }- return { results: CITED_INSIGHT.result }-}--// Each live embed loads its object, then runs the queries its own page runs.+// The live insight embed loads the saved insight, then runs its query.const OBJECT_MOCKS = {get: {'/api/environments/:team_id/insights/': { count: 1, results: [CITED_INSIGHT] },'/api/projects/:team_id/insights/': { count: 1, results: [CITED_INSIGHT] },- '/api/projects/:team_id/feature_flags/7/': CITED_FLAG,- '/api/projects/:team_id/feature_flags/7/status': { status: 'active', reason: 'Feature flag is active' },- '/api/projects/:team_id/cohorts/3/': CITED_COHORT,},post: {- '/api/environments/:team_id/query/': queryByKind,- '/api/environments/:team_id/query/:kind': queryByKind,+ '/api/environments/:team_id/query/': { results: CITED_INSIGHT.result },},}@@ -552,16 +495,6 @@ export const PostHogObjects: Story = {render: () => <StoryPage fileName="phref_trial_funnel" />,}-export const PostHogObjectFlag: Story = {- parameters: { msw: { mocks: objectMocks() } },- render: () => <StoryPage fileName="phref_flag" />,-}--export const PostHogObjectCohort: Story = {- parameters: { msw: { mocks: objectMocks() } },- render: () => <StoryPage fileName="phref_cohort" />,-}-export const PostHogObjectWithoutEmbed: Story = {parameters: { msw: { mocks: objectMocks() } },render: () => <StoryPage fileName="phref_survey" />,diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactImageViewer.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactImageViewer.tsxindex 23399ca6a321..e76a6974ecb3 100644--- a/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactImageViewer.tsx+++ b/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactImageViewer.tsx@@ -1,7 +1,7 @@import { PointerEvent, useCallback, useLayoutEffect, useRef, useState } from 'react'import { IconMinus, IconPlus } from '@posthog/icons'-import { Button, Separator, Text, Toggle, Tooltip, TooltipContent, TooltipTrigger, cn } from '@posthog/quill-primitives'+import { Button, Separator, Text, Tooltip, TooltipContent, TooltipTrigger, cn } from '@posthog/quill-primitives'const ZOOM_STEPS = [0.1, 0.25, 0.5, 0.75, 1, 1.5, 2, 3, 4, 6, 8]// Room the image keeps from the pane edges when it fits, so its border never touches them.@@ -161,20 +161,24 @@ export function ArtifactImageViewer({ src, alt }: { src: string; alt: string }):<IconPlus className="size-4" /></ZoomButton><Separator orientation="vertical" className="mx-1 h-4" />- <Toggle- pressed={zoom === 'fit'}- onPressedChange={() => setZoom('fit')}- data-attr="task-artifact-zoom-fit"- >- Fit- </Toggle>- <Toggle- pressed={zoom === 1}- onPressedChange={() => setZoom(1)}- data-attr="task-artifact-zoom-actual"- >- 100%- </Toggle>+ <div role="radiogroup" aria-label="Zoom preset" className="flex items-center gap-0.5">+ <Button+ role="radio"+ aria-checked={zoom === 'fit'}+ onClick={() => setZoom('fit')}+ data-attr="task-artifact-zoom-fit"+ >+ Fit+ </Button>+ <Button+ role="radio"+ aria-checked={zoom === 1}+ onClick={() => setZoom(1)}+ data-attr="task-artifact-zoom-actual"+ >+ 100%+ </Button>+ </div></div>)}</div>diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactObjectEmbed.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactObjectEmbed.tsxindex 932e483965a9..32ad021d927b 100644--- a/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactObjectEmbed.tsx+++ b/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactObjectEmbed.tsx@@ -1,13 +1,4 @@-import { useValues } from 'kea'--import { NotFound } from 'lib/components/NotFound'-import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'-import { humanFriendlyNumber } from 'lib/utils/numbers'-import { cohortEditLogic } from 'scenes/cohorts/cohortEditLogic'import { Dashboard } from 'scenes/dashboard/Dashboard'-import { featureFlagLogic } from 'scenes/feature-flags/featureFlagLogic'-import { FeatureFlagReleaseConditionsReadonly } from 'scenes/feature-flags/FeatureFlagReleaseConditionsReadonly'-import { FlagActiveToggleTag } from 'scenes/feature-flags/FlagActiveToggleTag'import { SessionRecordingPlayer } from 'scenes/session-recordings/player/SessionRecordingPlayer'import { SessionRecordingPlayerMode } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'@@ -17,69 +8,6 @@ import { DashboardPlacement, InsightShortId } from '~/types'import type { PostHogObjectRef } from '../taskRunArtifacts'-function EmbedLoading(): JSX.Element {- return (- <div className="flex flex-col gap-2 p-4">- <LemonSkeleton className="h-6 w-48" />- <LemonSkeleton className="h-32" />- </div>- )-}--function FlagEmbed({ id }: { id: number }): JSX.Element {- const { featureFlag, featureFlagLoading, featureFlagMissing } = useValues(featureFlagLogic({ id }))- if (featureFlagMissing) {- return <NotFound object="feature flag" />- }- if (featureFlagLoading && !featureFlag.id) {- return <EmbedLoading />- }- return (- <div className="flex flex-col gap-4 p-4">- <div className="flex flex-wrap items-center gap-2">- <span className="font-semibold">{featureFlag.key}</span>- <FlagActiveToggleTag active={featureFlag.active} />- </div>- {featureFlag.is_remote_configuration ? (- <p className="m-0 text-sm text-secondary">Remote config flags do not use release conditions.</p>- ) : (- <FeatureFlagReleaseConditionsReadonly- id={String(featureFlag.id)}- filters={featureFlag.filters}- isDisabled={!featureFlag.active}- evaluationRuntime={featureFlag.evaluation_runtime}- />- )}- </div>- )-}--function CohortEmbed({ id }: { id: number }): JSX.Element {- const { cohort, cohortLoading, cohortMissing, query } = useValues(cohortEditLogic({ id }))- if (cohortMissing) {- return <NotFound object="cohort" />- }- if (cohortLoading && cohort.id !== id) {- return <EmbedLoading />- }- return (- <div className="flex flex-col gap-3 p-4">- {cohort.count != null ? (- <span className="text-sm text-secondary">- {humanFriendlyNumber(cohort.count)} {cohort.count === 1 ? 'person' : 'persons'}- </span>- ) : null}- <div className="overflow-hidden rounded-md border border-primary bg-surface-primary">- <Query- uniqueKey={`task-artifact-cohort-${id}`}- query={{ ...query, full: false, embedded: true, showOpenEditorButton: false }}- readOnly- />- </div>- </div>- )-}-function EmbedBody({ objectKind, objectId }: PostHogObjectRef): JSX.Element | null {if (objectKind === 'insight') {return (@@ -128,12 +56,6 @@ function EmbedBody({ objectKind, objectId }: PostHogObjectRef): JSX.Element | nu</div>)}- if (objectKind === 'flag') {- return <FlagEmbed id={Number(objectId)} />- }- if (objectKind === 'cohort') {- return <CohortEmbed id={Number(objectId)} />- }return null}diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/taskRunArtifacts.ts b/products/posthog_ai/frontend/scenes/TaskTracker/taskRunArtifacts.tsindex 8951966a75dd..b6bcec6175e7 100644--- a/products/posthog_ai/frontend/scenes/TaskTracker/taskRunArtifacts.ts+++ b/products/posthog_ai/frontend/scenes/TaskTracker/taskRunArtifacts.ts@@ -49,14 +49,7 @@ export interface PostHogObjectRef {}/** Object kinds the preview shows live, with the components their own pages use. Others show a card. */-export const LIVE_OBJECT_KINDS: ReadonlySet<string> = new Set([- 'insight',- 'hogql',- 'dashboard',- 'replay',- 'flag',- 'cohort',-])+export const LIVE_OBJECT_KINDS: ReadonlySet<string> = new Set(['insight', 'hogql', 'dashboard', 'replay'])export function postHogObjectRef(artifact: TaskRunArtifactResponseApi): PostHogObjectRef | null {const metadata = artifact.metadata