: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(cdp): review, publish and discard staged destination drafts in the ui (#116906)
Harley Alexanderafa1d842137d
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex dac5b36fb992..1ada189d2f10 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -11139,13 +11139,17 @@ snapshots:scenes-app-hogfunctions-destination--backfills-with-data--light:hash: v1.k794b7964.f971c9b24daa779751f4ca9c4a58a6d640b1f1dc482c989521b5aed68d07f5ee.MRVlqmTBTYcUbMQypG59y05w-tbxT3zVWBzTz0rPUF4scenes-app-hogfunctions-destination--configuration--dark:- hash: v1.k794b7964.968a9c4559917467a693e73c4ed755314ce150072199f08e183f5cbc7211e566.jfvFyiw7QFRmI5ZycfwvHM0FaeV1RK9xjTRt74uWgmg+ hash: v1.k794b7964.75d91cc8e738d7af7d366eed0444db2e2847140a7c2d1e504640e64a5774b398.jhNFw0phOqH0cWdndciHwNxMxiVVR0mIE2clnJ0LkZoscenes-app-hogfunctions-destination--configuration--light:- hash: v1.k794b7964.90552c2f27ea69c80e19de0938bdb788247b88d84e5cc9e24e03a3754c21205d.5Qr5PUJCjfkn63QYBaLbRJJA097ATMp04-j4h11IL5E+ hash: v1.k794b7964.37457e69f69da7a378cf9ae1d23e622e64fe8071538a51ce4623f8052434a134.crjRvx7V7GOQtVxbLOA1hYOzwrppJ_wEGDf1kpLAGX8+ scenes-app-hogfunctions-destination--configuration-with-staged-draft--dark:+ hash: v1.k794b7964.a4f5686a7d83fa8a230abe8cc345d1dc9803482451e0a688c6ecda7479ded0d3.Y7ZBksBfkCH68UQCBHtLIgrvb0nAjkQ442GqK8Xr9BM+ scenes-app-hogfunctions-destination--configuration-with-staged-draft--light:+ hash: v1.k794b7964.a1a6f8611473f098ebdfaf7ecefd547b8172e131decede07075325613ad3acea.gIPQs7vYIsWaFA7cRzU-_GrkGgKhMZ5wMT1H2QJL5hEscenes-app-hogfunctions-destination--configuration-with-templating-warning--dark:- hash: v1.k794b7964.65e48165030ca28b21dd3da4ca4f2cec93f8b6fbafc0de8fe19b111b543a4116.8t-UuMDHFS2ZaL4tCi-gSxgfSWtv7d6rhPLgcJ0qSC8+ hash: v1.k794b7964.a5a26e484030fffcb6d40e70d81aa3782ce4cb382c76681ec31a9b5222a3daa9.E-Ab3DMfm-0eKVkdmCrLER54lQjSgU7JfQx0vaz5pusscenes-app-hogfunctions-destination--configuration-with-templating-warning--light:- hash: v1.k794b7964.89b85f293e81075f29d75ecb3d2113edc0e558737de3db7a289734eb1d8d10b1.vQFy8PlG2IBmyBFZZ7fOoOwYORYo31hbv03jo8HbeWM+ hash: v1.k794b7964.c9d954253a1760fe78ed7b58eb9982f8234ea2d7ea3c4a2660b58e078ea98017.l95Py6_dl33znc_eXwnFecd9mbe8_qYscGrLaoOG8WEscenes-app-hogfunctions-destination--runs-empty--dark:hash: v1.k794b7964.9338d457e2d64f5a491115541fa681db1c44ab049531d9eec24d58fa056a31f0.mhgFOxcURq4YcXhnV16BaRPW4OAZ5mFkUBgjhDazfhgscenes-app-hogfunctions-destination--runs-empty--light:@@ -14875,21 +14879,21 @@ snapshots:scenes-app-surveys--surveys-list--light:hash: v1.k794b7964.cf5d73f8325b5294303cd755262266b76376caf5d2181dc8fdb7d52bbbf45ca4.j1dVq5PZXR13I9Zx2LZMfuZ23EghxOvikpJ8affvZgYscenes-app-surveys-surveyresponsekeysreference--discord--dark:- hash: v1.k794b7964.422a626fef25543d1395c2539d9b2d3d4f595dd980e3272b79a8797dfb30ce62.C88jAaOzR3auZqzFX_N0zQBEZUznbbG5SW5AGcdWG5M+ hash: v1.k794b7964.5a5000abed4c4cf3a8aa48a47c63836f2ddfa722c14ba7327ee0af5ec6459b7a.hj2iP_lwaL-bZQajuMu64jioVP_RQQQ31Xfyppd8uegscenes-app-surveys-surveyresponsekeysreference--discord--light:- hash: v1.k794b7964.51dd0ba62cb17c44f7a1562a978cb21936cf3d332ec79984bde790b0988985bd.tFaqx15WU0PChVRdRgC2P17J2IHsLRSiaBqrAG2aWPc+ hash: v1.k794b7964.29262fa6aec3b9ae9241aa00480fe1f69de867c2267f90ddf156e6e5109b12be.HsqwspRBh0rNh8vS0t7sfZz2QyJEu0IpaDds_sZFqecscenes-app-surveys-surveyresponsekeysreference--microsoft-teams--dark:- hash: v1.k794b7964.1cdf7a985cda26a5039e6e6add0762be53715ca92865f7d0a1b7b2d4e9f3f5c2.pBpMwQSQZ0eY-BuZRwlRivvt3VuEeczvwvHKye5Z5Tw+ hash: v1.k794b7964.13dfc90d45f219faced40af8e200902c6deb3238fc5864a82a7f41d409164e5c.A8ckJfaGrJlxTouG5GwEy-vW79DL-FtyLkdHMgAztvoscenes-app-surveys-surveyresponsekeysreference--microsoft-teams--light:- hash: v1.k794b7964.e547a3f9c13ed2572b2ce7fe722c4969de3ddc8e0c177b9d5eb1bafb017ffdda.OIyAyKB5E3tEPJnUUeSE5A4irhZNc8_at3gqk1NPzrs+ hash: v1.k794b7964.1d81e23353665b83e53614d631dd01174358ada216e1133620b1cf7f3a342f10.TC-6YolWp7ygiLkye-B2f4JFCCYG5aJs3nRzNjW20KEscenes-app-surveys-surveyresponsekeysreference--slack--dark:- hash: v1.k794b7964.54bb9166880d12404e388d78526c8ffcf7dd33369d1cc62a67f712545e68aeaf.pUtEsYwfzNWI4FSJ5bDSvuY8pBSHuXG1d7cGwDc5uMs+ hash: v1.k794b7964.1b6207ec1bf4e03a438d84cbf118d8e72a553d37a025834c2b9e1ba338f14488.nzYS2PNpmOpL9SGAW06tJuOqINvgnpGww9yovaYl-V4scenes-app-surveys-surveyresponsekeysreference--slack--light:- hash: v1.k794b7964.6c59a7b8c08111b749a2698eb7bd506596c28f261f838ae90abb537942b4b08f.odEWmBrNrB-8CVTaa1ghSyQAa2IZlQneQ1pBNqtE8p8+ hash: v1.k794b7964.4d058c31545fdb5dd12a5d6fb206c602305b9c034cd96d94271238be0db3bb29.Uti3B91lNo2fliSceKcN7E5vRBwjLt6wmCrwAh3wc-Yscenes-app-surveys-surveyresponsekeysreference--webhook--dark:- hash: v1.k794b7964.d8a5500ec2e7cf9698cd1ea2152673944cfebe2e34bb01d2c3d08d98133a0194.110Cn5w6K28Ir9DJJSE4zHmdx-vMZWsoRW2IwkHJrCQ+ hash: v1.k794b7964.d995d97b57f4f59bb8dc939caf24e4e55c281cc285346294bfa87b6d1eea2704.Hzrjq8RxJoV_56QLwvXu2GpZ9LY0znNlt7nE0mTGU3oscenes-app-surveys-surveyresponsekeysreference--webhook--light:- hash: v1.k794b7964.c2676130771cba15a3b1cd5b9c511f42fce4d3345f761a1c112e8f12ca1dfcc0.N4q5DAtNnKGEGrtCJv-vQYe5KOhn7D9Ocu6IRBkp9yE+ hash: v1.k794b7964.8ef4b5c783ffd4573eb731af1dcd9f71b08b3e4c7dd88ade92aa0fd3e455064e.aTHtJMuWSqF3Qf_AtoxYn69r_raGtlMM0ukJGuXO308scenes-app-tasks--ai-task-selected--dark:hash: v1.k794b7964.d4169f92563f1a61588ba823f6be7392267558bfbb86124b6e53ec9b18056418.iKEx9vQEw72HqX58dUDsyxmsH-qtEXIeb6MqQMByB8Yscenes-app-tasks--ai-task-selected--light:diff --git a/frontend/src/scenes/hog-functions/HogFunctionScene.stories.tsx b/frontend/src/scenes/hog-functions/HogFunctionScene.stories.tsxindex 1698d597c55a..ea1aa47cc843 100644--- a/frontend/src/scenes/hog-functions/HogFunctionScene.stories.tsx+++ b/frontend/src/scenes/hog-functions/HogFunctionScene.stories.tsx@@ -118,11 +118,78 @@ const MOCK_HOG_FUNCTION_TEMPLATING_WARNING = {},}+const MOCK_HOG_FUNCTION_WITH_DRAFT_ID = '0196b144-1f82-0000-0d0d-a01de54d6751'++const MOCK_HOG_FUNCTION_WITH_DRAFT = {+ ...MOCK_HOG_FUNCTION,+ id: MOCK_HOG_FUNCTION_WITH_DRAFT_ID,+ batch_export_id: null,+ // A large staged change, so the publish dialog shows how a multi-field diff renders.+ draft: {+ hog: [+ 'if (empty(inputs.url)) {',+ " throw Error('Webhook URL is required')",+ '}',+ '',+ 'let payload := {',+ " 'event': event.event,",+ " 'distinct_id': event.distinct_id,",+ " 'timestamp': event.timestamp,",+ " 'summary': f'{person.name} submitted a score of {event.properties.score}',",+ '}',+ '',+ 'let res := fetch(inputs.url, {',+ " 'headers': inputs.headers,",+ " 'body': payload,",+ " 'method': inputs.method",+ '});',+ '',+ 'if (res.status >= 400) {',+ " throw Error(f'Webhook returned {res.status}: {res.body}')",+ '}',+ '',+ 'if (inputs.thread_details and res.body.ts) {',+ ' fetch(inputs.url, {',+ " 'headers': inputs.headers,",+ " 'body': {'thread_ts': res.body.ts, 'properties': event.properties},",+ " 'method': inputs.method",+ ' })',+ '}',+ ].join('\n'),+ inputs_schema: [+ ...MOCK_HOG_FUNCTION.inputs_schema,+ { key: 'headers', type: 'dictionary', label: 'Headers', secret: false, required: false },+ {+ key: 'thread_details',+ type: 'boolean',+ label: 'Post details in a thread',+ secret: false,+ required: false,+ },+ ],+ inputs: {+ url: { value: 'https://example.com/webhook-v2' },+ method: { value: 'POST' },+ headers: { value: { 'Content-Type': 'application/json' } },+ thread_details: { value: true },+ },+ filters: {+ events: [{ id: 'survey sent', type: 'events', name: 'survey sent', order: 0 }],+ properties: [{ key: '$survey_id', value: 'example-survey', operator: 'exact', type: 'event' }],+ filter_test_accounts: true,+ },+ mappings: null,+ masking: null,+ },+ draft_updated_at: '2024-01-14T10:00:00Z',+}+const commonMocks = {get: {[`/api/environments/:team_id/hog_functions/${MOCK_HOG_FUNCTION_ID}/`]: MOCK_HOG_FUNCTION,[`/api/environments/:team_id/hog_functions/${MOCK_HOG_FUNCTION_TEMPLATING_WARNING_ID}/`]:MOCK_HOG_FUNCTION_TEMPLATING_WARNING,+ [`/api/environments/:team_id/hog_functions/${MOCK_HOG_FUNCTION_WITH_DRAFT_ID}/`]: MOCK_HOG_FUNCTION_WITH_DRAFT,'/api/environments/:team_id/hog_functions/': { count: 1, results: [MOCK_HOG_FUNCTION], next: null },[`/api/environments/:team_id/batch_exports/${MOCK_BATCH_EXPORT_ID}/`]: MOCK_BATCH_EXPORT,[`/api/environments/:team_id/batch_exports/${MOCK_BATCH_EXPORT_ID}/runs/`]: { results: [], next: null },@@ -132,6 +199,13 @@ const commonMocks = {[`/api/environments/:team_id/hog_functions/${MOCK_HOG_FUNCTION_ID}/enable_backfills/`]: {batch_export_id: MOCK_BATCH_EXPORT_ID,},+ [`/api/environments/:team_id/hog_functions/${MOCK_HOG_FUNCTION_WITH_DRAFT_ID}/publish/`]: {+ published: false,+ draft_updated_at: MOCK_HOG_FUNCTION_WITH_DRAFT.draft_updated_at,+ confirm_token: 'mock-confirm-token',+ changed_fields: ['filters', 'hog', 'inputs', 'inputs_schema'],+ function: null,+ },},}@@ -249,3 +323,9 @@ export const ConfigurationWithTemplatingWarning: Story = {pageUrl: urls.hogFunction(MOCK_HOG_FUNCTION_TEMPLATING_WARNING_ID),},}++export const ConfigurationWithStagedDraft: Story = {+ parameters: {+ pageUrl: urls.hogFunction(MOCK_HOG_FUNCTION_WITH_DRAFT_ID),+ },+}diff --git a/frontend/src/scenes/hog-functions/HogFunctionScene.tsx b/frontend/src/scenes/hog-functions/HogFunctionScene.tsxindex ed56a57287b9..3870cede68fe 100644--- a/frontend/src/scenes/hog-functions/HogFunctionScene.tsx+++ b/frontend/src/scenes/hog-functions/HogFunctionScene.tsx@@ -54,6 +54,7 @@ import {HogFunctionConfigurationSaveButton,} from './configuration/components/HogFunctionConfigurationButtons'import { HogFunctionIconEditable } from './configuration/HogFunctionIcon'+import { HogFunctionPublishDraftButton } from './configuration/HogFunctionPublishDraftButton'import { humanizeHogFunctionType } from './hog-function-utils'import { HogInvocations } from './invocations/HogInvocations'import { TransformationInvocations } from './invocations/TransformationInvocations'@@ -475,6 +476,7 @@ function HogFunctionHeader(): JSX.Element {)}<HogFunctionConfigurationClearChangesButton /><HogFunctionConfigurationSaveButton />+ {logicProps.id ? <HogFunctionPublishDraftButton logicProps={logicProps} /> : null}</>}/>diff --git a/frontend/src/scenes/hog-functions/configuration/HogFunctionConfiguration.tsx b/frontend/src/scenes/hog-functions/configuration/HogFunctionConfiguration.tsxindex 1f11f661a564..2b9116b574be 100644--- a/frontend/src/scenes/hog-functions/configuration/HogFunctionConfiguration.tsx+++ b/frontend/src/scenes/hog-functions/configuration/HogFunctionConfiguration.tsx@@ -35,6 +35,8 @@ import { HogFunctionInputs } from './components/HogFunctionInputs'import { HogFunctionSourceWebhookInfo } from './components/HogFunctionSourceWebhookInfo'import { HogFunctionSourceWebhookTest } from './components/HogFunctionSourceWebhookTest'import { HogFunctionTemplateOptions } from './components/HogFunctionTemplateOptions'+import { hogFunctionDraftLogic } from './hogFunctionDraftLogic'+import { HogFunctionDraftStatusBar } from './HogFunctionDraftStatusBar'import { HogFunctionTest } from './HogFunctionTest'export interface HogFunctionConfigurationProps {@@ -67,6 +69,7 @@ export function HogFunctionConfiguration({survey,} = useValues(logic)const { loadHogFunction } = useActions(logic)+ const { draftActionPending } = useValues(hogFunctionDraftLogic(logicProps))// The section components attach the config blobs (code, inputs, filters) as unkeyed values; only a// keyed item renders its id into the context line, and the agent needs the id for cdp-functions-partial-update.@@ -82,14 +85,14 @@ export function HogFunctionConfiguration({: null)- // An approved `cdp-functions-partial-update` mutates the function server-side while this form keeps- // pre-update state, so the scene (and the approval-card diff for any later proposal, e.g. a revert)- // would show stale values. Refetch on completion — `loadHogFunctionSuccess` resets the form, which+ // An approved `cdp-functions-partial-update` (or a publish or discard of its staged draft) mutates+ // the function server-side while this form keeps pre-update state, so the scene (and the+ // approval-card diff for any later proposal, e.g. a revert) would show stale values. Refetch on completion — `loadHogFunctionSuccess` resets the form, which// also discards unsaved manual edits; tool results land in the open scene. A plain tool-stream// listener, not `useMcpToolApplyBack`: the refetch is idempotent, so it must not be dropped by the// apply-back claim gating (claims snapshot the targets mounted at prompt-send and release each turn).useToolStreamListener({- tools: ['cdp-functions-partial-update'],+ tools: ['cdp-functions-partial-update', 'cdp-functions-publish', 'cdp-functions-discard-draft'],onEvent: (event) => {if (event.phase !== 'completed' || !hogFunction?.id) {return@@ -101,6 +104,10 @@ export function HogFunctionConfiguration({if (targetId && targetId !== hogFunction.id) {return}+ // A publish without confirm only previews, so a reload would reset unsaved edits for nothing.+ if (event.toolName === 'cdp-functions-publish' && innerInput?.confirm !== true) {+ return+ }loadHogFunction()},})@@ -133,6 +140,7 @@ export function HogFunctionConfiguration({return (<div className="deprecated-space-y-3"><BindLogic logic={hogFunctionConfigurationLogic} props={logicProps}>+ {hogFunction?.type === 'destination' ? <HogFunctionDraftStatusBar logicProps={logicProps} /> : null}{hogFunction?.filters?.bytecode_error ? (<div><LemonBanner type="error">@@ -176,86 +184,91 @@ export function HogFunctionConfiguration({</div>) : null}- <Form- logic={hogFunctionConfigurationLogic}- props={logicProps}- formKey="configuration"- className="deprecated-space-y-3"- >- <div className="flex flex-wrap gap-4 items-start">- <div className="flex flex-col flex-1 gap-4 min-w-100">- <div className={clsx('p-3 rounded border deprecated-space-y-2 bg-surface-primary')}>- <div className="flex items-center justify-between">- <LemonLabel>Status</LemonLabel>- {hogFunction && <HogFunctionStatusIndicator hogFunction={hogFunction} />}+ <div className="relative">+ {/* Publish and discard end in a reload that resets the form, so edits made meanwhile would be lost. */}+ {draftActionPending ? <SpinnerOverlay /> : null}+ <Form+ logic={hogFunctionConfigurationLogic}+ props={logicProps}+ formKey="configuration"+ className="deprecated-space-y-3"+ >+ <div className="flex flex-wrap gap-4 items-start">+ <div className="flex flex-col flex-1 gap-4 min-w-100">+ <div className={clsx('p-3 rounded border deprecated-space-y-2 bg-surface-primary')}>+ <div className="flex items-center justify-between">+ <LemonLabel>Status</LemonLabel>+ {hogFunction && <HogFunctionStatusIndicator hogFunction={hogFunction} />}+ </div>+ <LemonField name="enabled">+ {({ value, onChange }) => (+ <LemonSwitch+ onChange={() => onChange(!value)}+ checked={value}+ disabled={loading}+ bordered+ fullWidth+ label={type === 'transformation_log' ? 'Enable' : 'Enable destination'}+ tooltip={+ <>+ {type === 'transformation_log'+ ? value+ ? 'Enabled. Log records will be processed.'+ : 'Disabled. Log records will not be processed.'+ : value+ ? 'Enabled. Events will be processed.'+ : 'Disabled. Events will not be processed.'}+ </>+ }+ />+ )}+ </LemonField>++ {templateInfo}</div>- <LemonField name="enabled">- {({ value, onChange }) => (- <LemonSwitch- onChange={() => onChange(!value)}- checked={value}- disabled={loading}- bordered- fullWidth- label={type === 'transformation_log' ? 'Enable' : 'Enable destination'}- tooltip={- <>- {type === 'transformation_log'- ? value- ? 'Enabled. Log records will be processed.'- : 'Disabled. Log records will not be processed.'- : value- ? 'Enabled. Events will be processed.'- : 'Disabled. Events will not be processed.'}- </>- }- />- )}- </LemonField>- {templateInfo}+ {type === 'source_webhook' && <HogFunctionSourceWebhookInfo />}+ {showFilters && <HogFunctionFilters />}+ {survey && <SurveyResponseKeysReference questions={survey.questions} />}+ {showExpectedVolume ? <HogFunctionEventEstimates /> : null}</div>- {type === 'source_webhook' && <HogFunctionSourceWebhookInfo />}- {showFilters && <HogFunctionFilters />}- {survey && <SurveyResponseKeysReference questions={survey.questions} />}- {showExpectedVolume ? <HogFunctionEventEstimates /> : null}- </div>-- <div className="deprecated-space-y-4 flex-2 min-w-100">- {mightDropEvents && (- <div>- <LemonBanner type="info">- {type === 'transformation_log' ? (- <>- <b>Warning:</b> This transformation can drop log records irreversibly- (any record it returns null for is discarded). Double check your code- before enabling.- </>- ) : (- <>- <b>Warning:</b> This transformation can filter out events, dropping them- irreversibly. Make sure to double check your configuration, and use- filters to limit the events that this transformation is applied to.- </>- )}- </LemonBanner>- </div>- )}- <HogFunctionInputs />+ <div className="deprecated-space-y-4 flex-2 min-w-100">+ {mightDropEvents && (+ <div>+ <LemonBanner type="info">+ {type === 'transformation_log' ? (+ <>+ <b>Warning:</b> This transformation can drop log records+ irreversibly (any record it returns null for is discarded). Double+ check your code before enabling.+ </>+ ) : (+ <>+ <b>Warning:</b> This transformation can filter out events, dropping+ them irreversibly. Make sure to double check your configuration, and+ use filters to limit the events that this transformation is applied+ to.+ </>+ )}+ </LemonBanner>+ </div>+ )}+ <HogFunctionInputs />- <HogFunctionMappings />+ <HogFunctionMappings />- {canEditSource && <HogFunctionCode />}- {showTesting ? <HogFunctionTest /> : null}- {type === 'source_webhook' && <HogFunctionSourceWebhookTest />}- <div className="flex gap-2 justify-end">- <HogFunctionConfigurationClearChangesButton />- <HogFunctionConfigurationSaveButton />+ {canEditSource && <HogFunctionCode />}+ {showTesting ? <HogFunctionTest /> : null}+ {type === 'source_webhook' && <HogFunctionSourceWebhookTest />}+ <div className="flex gap-2 justify-end">+ <HogFunctionConfigurationClearChangesButton />+ <HogFunctionConfigurationSaveButton />+ </div></div></div>- </div>- </Form>+ </Form>+ </div></BindLogic></div>)diff --git a/frontend/src/scenes/hog-functions/configuration/HogFunctionDraftStatusBar.tsx b/frontend/src/scenes/hog-functions/configuration/HogFunctionDraftStatusBar.tsxnew file mode 100644index 000000000000..8ce2ac269374--- /dev/null+++ b/frontend/src/scenes/hog-functions/configuration/HogFunctionDraftStatusBar.tsx@@ -0,0 +1,37 @@+import { useValues } from 'kea'++import { LemonTag } from '@posthog/lemon-ui'++import { HogFunctionConfigurationLogicProps } from './hogFunctionConfigurationLogic'+import { hogFunctionDraftLogic } from './hogFunctionDraftLogic'++/** Mirrors the status tags in the workflows status bar, so both products describe a staged draft the same way. */+export function HogFunctionDraftStatusBar({+ logicProps,+}: {+ logicProps: HogFunctionConfigurationLogicProps+}): JSX.Element | null {+ const { hogFunction, hasStagedDraft } = useValues(hogFunctionDraftLogic(logicProps))++ // A disabled function without a draft has nothing live to protect; the Status card already says so.+ if (!hogFunction || (!hogFunction.enabled && !hasStagedDraft)) {+ return null+ }++ return (+ <div className="flex items-center gap-3 px-2 py-1.5 border rounded bg-surface-secondary min-w-0 flex-wrap">+ {hasStagedDraft ? (+ <LemonTag type="warning">Editing draft</LemonTag>+ ) : (+ <LemonTag type="success">Live</LemonTag>+ )}+ {hogFunction.enabled && (+ <span className="text-xs text-secondary truncate">+ {hasStagedDraft+ ? 'The live version keeps running until you publish.'+ : 'Agent changes save as a draft.'}+ </span>+ )}+ </div>+ )+}diff --git a/frontend/src/scenes/hog-functions/configuration/HogFunctionPublishDraftButton.tsx b/frontend/src/scenes/hog-functions/configuration/HogFunctionPublishDraftButton.tsxnew file mode 100644index 000000000000..3b2c58ee6657--- /dev/null+++ b/frontend/src/scenes/hog-functions/configuration/HogFunctionPublishDraftButton.tsx@@ -0,0 +1,59 @@+import { useActions, useValues } from 'kea'++import { IconTrash } from '@posthog/icons'+import { LemonButton } from '@posthog/lemon-ui'++import { LemonMenuOverlay } from 'lib/lemon-ui/LemonMenu/LemonMenu'++import { HogFunctionConfigurationLogicProps } from './hogFunctionConfigurationLogic'+import { hogFunctionDraftLogic } from './hogFunctionDraftLogic'++export function HogFunctionPublishDraftButton({+ logicProps,+}: {+ logicProps: HogFunctionConfigurationLogicProps+}): JSX.Element | null {+ const logic = hogFunctionDraftLogic(logicProps)+ const { hogFunction, hasStagedDraft, draftActionPending, draftActionDisabledReason } = useValues(logic)+ const { publishDraft, discardDraft } = useActions(logic)++ if (!hogFunction || !hasStagedDraft) {+ return null+ }++ return (+ <LemonButton+ type="primary"+ size="small"+ onClick={publishDraft}+ loading={draftActionPending === 'publish'}+ disabledReason={draftActionPending === 'publish' ? undefined : draftActionDisabledReason}+ tooltip="This has an unpublished draft. Publish to review the changes and send them live."+ data-attr="hog-function-draft-publish"+ // Discarding is rare and destructive, so it sits in the menu, as it does for workflows.+ sideAction={{+ 'data-attr': 'hog-function-draft-actions',+ 'aria-label': 'More draft actions',+ dropdown: {+ placement: 'bottom-end',+ overlay: (+ <LemonMenuOverlay+ items={[+ {+ label: 'Discard draft',+ icon: <IconTrash />,+ status: 'danger',+ onClick: () => discardDraft(),+ disabledReason: draftActionDisabledReason,+ 'data-attr': 'hog-function-draft-discard',+ },+ ]}+ />+ ),+ },+ }}+ >+ Publish+ </LemonButton>+ )+}diff --git a/frontend/src/scenes/hog-functions/configuration/HogFunctionPublishDraftDialog.tsx b/frontend/src/scenes/hog-functions/configuration/HogFunctionPublishDraftDialog.tsxnew file mode 100644index 000000000000..8e9cd97a99b2--- /dev/null+++ b/frontend/src/scenes/hog-functions/configuration/HogFunctionPublishDraftDialog.tsx@@ -0,0 +1,67 @@+import { LemonDialog } from '@posthog/lemon-ui'++import { HogFunctionConfigDiff } from './HogFunctionConfigDiff'+import { HogFunctionFieldDiff, hogFunctionFieldLabel } from './hogFunctionConfigDiffUtils'++interface HogFunctionPublishDraftDialogProps {+ diffs: HogFunctionFieldDiff[]+ changedFields: string[]+ enabled: boolean+}++function HogFunctionPublishDraftContent({+ diffs,+ changedFields,+ enabled,+}: HogFunctionPublishDraftDialogProps): JSX.Element {+ // The API masks secret values, so a draft that only stages a new secret has no visible diff.+ const hiddenChanges = changedFields.filter((field) => !diffs.some((diff) => diff.field === field))++ return (+ <div className="flex flex-col gap-3 min-w-0">+ <p className="mb-0">+ This replaces the live config with the staged changes.{' '}+ {enabled+ ? 'New events use the published version right away.'+ : 'It is disabled, so nothing runs until you enable it.'}+ </p>+ {changedFields.length === 0 ? (+ <p className="mb-0">The staged changes match the live config. Publishing clears the draft.</p>+ ) : (+ <>+ {diffs.length > 0 && (+ // Capped so a large draft scrolls inside the dialog and the publish button stays in view.+ <div className="max-h-[60vh] overflow-y-auto">+ <HogFunctionConfigDiff diffs={diffs} />+ </div>+ )}+ {hiddenChanges.length > 0 && (+ <p className="mb-0 text-secondary">+ Secret values also change in:{' '}+ {hiddenChanges.map((field) => hogFunctionFieldLabel(field)).join(', ')}. They stay hidden.+ </p>+ )}+ </>+ )}+ </div>+ )+}++export function openHogFunctionPublishDraftDialog({+ onConfirm,+ ...props+}: HogFunctionPublishDraftDialogProps & { onConfirm: () => void }): void {+ LemonDialog.open({+ title: 'Publish staged changes?',+ maxWidth: '48rem',+ description: <HogFunctionPublishDraftContent {...props} />,+ primaryButton: {+ children: 'Publish',+ onClick: onConfirm,+ 'data-attr': 'hog-function-draft-publish-confirm',+ },+ secondaryButton: {+ children: 'Cancel',+ },+ })+}diff --git a/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigDiffUtils.test.ts b/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigDiffUtils.test.tsindex 49c788e734ec..ec6b67de8fc7 100644--- a/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigDiffUtils.test.ts+++ b/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigDiffUtils.test.ts@@ -1,4 +1,4 @@-import { buildHogFunctionConfigDiff } from './hogFunctionConfigDiffUtils'+import { buildHogFunctionConfigDiff, buildHogFunctionDraftDiff } from './hogFunctionConfigDiffUtils'describe('buildHogFunctionConfigDiff', () => {it('classifies each proposed field as added / removed / changed and drops unchanged ones', () => {@@ -61,4 +61,56 @@ describe('buildHogFunctionConfigDiff', () => {expect(diffs[0].currentText).not.toContain('xoxb-mapping-secret')expect(diffs[0].currentText).toContain('[secret]')})++ it('compares a staged draft with the live config, ignoring compiled values and masked secrets', () => {+ const inputsSchema = [+ { key: 'url', type: 'string' },+ { key: 'token', type: 'string', secret: true },+ ]+ const live = {+ hog: 'return event',+ inputs_schema: inputsSchema,+ inputs: { url: { value: 'https://old', bytecode: ['_H', 1], order: 0 }, token: { secret: true } },+ filters: { events: [{ id: '$pageview' }], bytecode: ['_H', 1, 32] },+ mappings: null,+ masking: null,+ }+ const draft = {+ hog: 'return event',+ inputs_schema: inputsSchema,+ inputs: { url: { value: 'https://new', bytecode: ['_H', 2] }, token: { secret: true } },+ filters: { events: [{ id: '$pageview' }], bytecode: ['_H', 1, 99], bytecode_error: null },+ mappings: null,+ masking: null,+ }+ const diffs = buildHogFunctionDraftDiff(live, draft)+ expect(diffs.map((diff) => diff.field)).toEqual(['inputs'])+ expect(diffs[0].currentText).toContain('https://old')+ expect(diffs[0].proposedText).toContain('https://new')+ })++ it('shows a draft change that only touches input templating or a nested value key', () => {+ const live = {+ inputs: {+ body: { value: '{event.event}', templating: 'hog' },+ payload: { value: { value: 'a' } },+ },+ }+ const draft = {+ inputs: {+ body: { value: '{event.event}', templating: 'liquid' },+ payload: { value: { value: 'b' } },+ },+ }+ const diffs = buildHogFunctionDraftDiff(live, draft)+ expect(diffs.map((diff) => diff.field)).toEqual(['inputs'])+ expect(diffs[0].proposedText).toContain('liquid')+ expect(diffs[0].proposedText).toContain('"b"')+ })++ it('treats a missing input templating as hog, so a values-only agent edit adds no noise', () => {+ const live = { inputs: { url: { value: 'https://x', templating: 'hog' } } }+ const draft = { inputs: { url: { value: 'https://x' } } }+ expect(buildHogFunctionDraftDiff(live, draft)).toEqual([])+ })})diff --git a/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigDiffUtils.ts b/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigDiffUtils.tsindex dc848d534d75..c4adc966e291 100644--- a/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigDiffUtils.ts+++ b/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigDiffUtils.ts@@ -141,10 +141,11 @@ function redactCurrentValue(field: string, current: Record<string, unknown>): un*/export function buildHogFunctionConfigDiff(current: Record<string, unknown>,- proposed: Record<string, unknown>+ proposed: Record<string, unknown>,+ fields: DiffableField[] = DIFFABLE_FIELDS): HogFunctionFieldDiff[] {const diffs: HogFunctionFieldDiff[] = []- for (const { field, label, kind, normalize } of DIFFABLE_FIELDS) {+ for (const { field, label, kind, normalize } of fields) {if (!(field in proposed)) {continue}@@ -175,3 +176,77 @@ export function buildHogFunctionConfigDiff(}return diffs}++/** Mirrors DRAFT_CONTENT_FIELDS in products/cdp/backend/api/hog_function.py. Keep the two lists in sync. */+export const HOG_FUNCTION_DRAFT_CONTENT_FIELDS = ['hog', 'inputs_schema', 'inputs', 'filters', 'mappings', 'masking']++export function hogFunctionFieldLabel(field: string): string {+ return DIFFABLE_FIELDS.find((diffable) => diffable.field === field)?.label ?? field+}++const DERIVED_FILTER_KEYS = ['bytecode', 'bytecode_error', 'bytecode_contract', 'transpiled']+const DERIVED_INPUT_KEYS = ['bytecode', 'bytecode_contract', 'transpiled', 'order']++// Both sides of a draft diff come from the API, so `comparableContent` already strips derived input+// keys. Value-only inputs would hide a templating change.+const DRAFT_DIFFABLE_FIELDS: DiffableField[] = DIFFABLE_FIELDS.filter(({ field }) =>+ HOG_FUNCTION_DRAFT_CONTENT_FIELDS.includes(field)+).map((diffable) => ({ ...diffable, normalize: undefined }))++function withoutKeys(value: unknown, keys: string[]): unknown {+ if (!value || typeof value !== 'object' || Array.isArray(value)) {+ return value+ }+ return Object.fromEntries(Object.entries(value as Record<string, unknown>).filter(([key]) => !keys.includes(key)))+}++function comparableInputs(inputs: unknown, inputsSchema: unknown): unknown {+ if (!inputs || typeof inputs !== 'object') {+ return inputs+ }+ const redacted = redactSecretHogFunctionInputs(+ inputs as Record<string, CyclotronJobInputType>,+ (inputsSchema ?? []) as CyclotronJobInputSchemaType[]+ )+ return Object.fromEntries(+ Object.entries(redacted).map(([key, entry]) => {+ // The server treats a missing `templating` as Hog, and an agent edit often sends values only.+ const derived = entry?.templating === 'hog' ? [...DERIVED_INPUT_KEYS, 'templating'] : DERIVED_INPUT_KEYS+ return [key, withoutKeys(entry, derived)]+ })+ )+}++/**+ * Mirrors `comparable_content` in products/cdp/backend/api/hog_function.py: drops the values the+ * server compiles from the config (bytecode, transpiled JS, input ordering), so a recompile does not+ * read as a change. Secrets are redacted on both sides, because the API masks them anyway.+ */+function comparableContent(content: Record<string, unknown>): Record<string, unknown> {+ const mappings = content.mappings+ return {+ ...content,+ inputs: comparableInputs(content.inputs, content.inputs_schema),+ filters: withoutKeys(content.filters, DERIVED_FILTER_KEYS),+ masking: withoutKeys(content.masking, ['bytecode']),+ mappings: Array.isArray(mappings)+ ? mappings.map((mapping) =>+ mapping && typeof mapping === 'object'+ ? {+ ...mapping,+ filters: withoutKeys(mapping.filters, DERIVED_FILTER_KEYS),+ inputs: comparableInputs(mapping.inputs, mapping.inputs_schema),+ }+ : mapping+ )+ : mappings,+ }+}++/** Field-level diff of a function's staged draft against its live config. */+export function buildHogFunctionDraftDiff(+ live: Record<string, unknown>,+ draft: Record<string, unknown>+): HogFunctionFieldDiff[] {+ return buildHogFunctionConfigDiff(comparableContent(live), comparableContent(draft), DRAFT_DIFFABLE_FIELDS)+}diff --git a/frontend/src/scenes/hog-functions/configuration/hogFunctionDraftLogic.ts b/frontend/src/scenes/hog-functions/configuration/hogFunctionDraftLogic.tsnew file mode 100644index 000000000000..766dfc5f2840--- /dev/null+++ b/frontend/src/scenes/hog-functions/configuration/hogFunctionDraftLogic.ts@@ -0,0 +1,271 @@+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'+import posthog from 'posthog-js'++import { ApiError } from 'lib/api-error'+import { dayjs } from 'lib/dayjs'+import { LemonDialog } from 'lib/lemon-ui/LemonDialog'+import { lemonToast } from 'lib/lemon-ui/LemonToast'+import { teamLogic } from 'scenes/teamLogic'++import { HogFunctionType, HogFunctionTypeType } from '~/types'++import {+ hogFunctionsDiscardDraftCreate,+ hogFunctionsPublishCreate,+ hogFunctionsRetrieve,+} from 'products/cdp/frontend/generated/api'+import type { HogFunctionApi, HogFunctionPublishResponseApi } from 'products/cdp/frontend/generated/api.schemas'++import { buildHogFunctionDraftDiff } from './hogFunctionConfigDiffUtils'+import { HogFunctionConfigurationLogicProps, hogFunctionConfigurationLogic } from './hogFunctionConfigurationLogic'+import { openHogFunctionPublishDraftDialog } from './HogFunctionPublishDraftDialog'++export type HogFunctionDraftAction = 'publish' | 'discard'++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface hogFunctionDraftLogicValues {+ configurationChanged: boolean // hogFunctionConfigurationLogic+ hogFunction: HogFunctionType | null // hogFunctionConfigurationLogic+ type: HogFunctionTypeType // hogFunctionConfigurationLogic+ currentTeamIdStrict: number | string // teamLogic+ draftActionDisabledReason: string | undefined+ draftActionPending: HogFunctionDraftAction | null+ hasStagedDraft: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface hogFunctionDraftLogicActions {+ loadHogFunction: () => any // hogFunctionConfigurationLogic+ loadHogFunctionFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ } // hogFunctionConfigurationLogic+ loadHogFunctionSuccess: (+ hogFunction: HogFunctionType | null,+ payload?: any+ ) => {+ hogFunction: HogFunctionType | null+ payload?: any+ } // hogFunctionConfigurationLogic+ confirmDiscardDraft: () => {+ value: true+ }+ confirmPublishDraft: (confirmToken: string) => {+ confirmToken: string+ }+ discardDraft: () => {+ value: true+ }+ publishDraft: () => {+ value: true+ }+ setDraftActionPending: (pending: HogFunctionDraftAction | null) => {+ pending: HogFunctionDraftAction | null+ }+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface hogFunctionDraftLogicMeta {+ key: string+ __keaTypeGenInternalSelectorTypes: {+ hasStagedDraft: (hogFunction: HogFunctionType | null) => boolean+ draftActionDisabledReason: (+ configurationChanged: boolean,+ draftActionPending: HogFunctionDraftAction | null+ ) => string | undefined+ }+}++export type hogFunctionDraftLogicType = MakeLogicType<+ hogFunctionDraftLogicValues,+ hogFunctionDraftLogicActions,+ HogFunctionConfigurationLogicProps,+ hogFunctionDraftLogicMeta+>++/**+ * The staged-draft lifecycle of an existing function: review, publish, discard. Agents (MCP) stage+ * config edits to an enabled destination as a draft instead of changing it live, and this is where a+ * person promotes or throws away that draft.+ */+export const hogFunctionDraftLogic = kea<hogFunctionDraftLogicType>([+ path((key) => ['scenes', 'hog-functions', 'configuration', 'hogFunctionDraftLogic', key]),+ props({} as HogFunctionConfigurationLogicProps),+ key(({ id, logicKey }) => (logicKey ? `${logicKey}_${id ?? 'new'}` : (id ?? 'new'))),+ connect((props: HogFunctionConfigurationLogicProps) => ({+ values: [+ teamLogic,+ ['currentTeamIdStrict'],+ hogFunctionConfigurationLogic(props),+ ['hogFunction', 'configurationChanged', 'type'],+ ],+ actions: [+ hogFunctionConfigurationLogic(props),+ ['loadHogFunction', 'loadHogFunctionSuccess', 'loadHogFunctionFailure'],+ ],+ })),+ actions({+ publishDraft: true,+ confirmPublishDraft: (confirmToken: string) => ({ confirmToken }),+ discardDraft: true,+ confirmDiscardDraft: true,+ setDraftActionPending: (pending: HogFunctionDraftAction | null) => ({ pending }),+ }),+ reducers({+ // Drives the buttons' loading and disabled state, so publish and discard can't race each other+ // or double-submit. The configuration page locks the form while it is set. It clears only once+ // fresh function data lands: a failed reload keeps the lock, because the form would hold config+ // that is no longer live, and saving it would undo the publish.+ draftActionPending: [+ null as HogFunctionDraftAction | null,+ {+ setDraftActionPending: (_, { pending }) => pending,+ loadHogFunctionSuccess: () => null,+ },+ ],+ }),+ selectors({+ hasStagedDraft: [+ (s) => [s.hogFunction],+ (hogFunction: HogFunctionType | null): boolean => !!hogFunction?.draft,+ ],+ draftActionDisabledReason: [+ (s) => [s.configurationChanged, s.draftActionPending],+ (configurationChanged: boolean, draftActionPending: HogFunctionDraftAction | null): string | undefined =>+ // Publish and discard reload the function, and the reload resets the form.+ configurationChanged+ ? 'Save or clear your edits first'+ : draftActionPending+ ? 'Another draft action is in progress'+ : undefined,+ ],+ }),+ listeners(({ actions, values }) => ({+ loadHogFunctionFailure: () => {+ if (values.draftActionPending) {+ lemonToast.error('Could not reload this destination. Refresh the page before you edit it.')+ }+ },+ publishDraft: async (_, breakpoint) => {+ const id = values.hogFunction?.id+ const type = values.type+ if (!id || values.draftActionPending) {+ return+ }+ actions.setDraftActionPending('publish')+ const projectId = String(values.currentTeamIdStrict)+ let preview: HogFunctionPublishResponseApi+ let latest: HogFunctionApi+ try {+ // Two-step publish: the unconfirmed call only previews what changes and mints the token+ // a confirmed publish must return, so a draft that moved since can't go live blind.+ preview = await hogFunctionsPublishCreate(projectId, id, { confirm: false })+ // Read after the preview, so the diff shows the draft the token signs. A draft edit in+ // between fails the stamp check below, and a live edit fails the token on confirm.+ latest = await hogFunctionsRetrieve(projectId, id)+ } catch {+ lemonToast.error('Could not load the publish preview. Try again.')+ return+ } finally {+ actions.setDraftActionPending(null)+ }+ // Stops here if the scene unmounted during the requests, so no dialog opens for a dead logic.+ breakpoint()+ const { draft, draft_updated_at } = latest+ if (+ !draft ||+ !draft_updated_at ||+ !preview.draft_updated_at ||+ !dayjs(draft_updated_at).isSame(preview.draft_updated_at)+ ) {+ lemonToast.warning('The draft changed while the preview loaded. Review it and publish again.')+ // Applies the read already in hand, so no reload leaves the form open to edits it would reset.+ actions.loadHogFunctionSuccess(latest as unknown as HogFunctionType)+ return+ }+ const changedFields = preview.changed_fields ?? []+ openHogFunctionPublishDraftDialog({+ diffs: buildHogFunctionDraftDiff(+ latest as unknown as Record<string, unknown>,+ draft as Record<string, unknown>+ ).filter((diff) => changedFields.includes(diff.field)),+ changedFields,+ enabled: !!latest.enabled,+ onConfirm: () => actions.confirmPublishDraft(preview.confirm_token ?? ''),+ })+ // pinned: analytics event name+ posthog.capture('hog function draft publish previewed', { type })+ },+ confirmPublishDraft: async ({ confirmToken }) => {+ const id = values.hogFunction?.id+ const type = values.type+ // draftActionPending also guards the dialog's close animation, where a fast double-click+ // on the confirm button dispatches twice.+ if (!id || values.draftActionPending) {+ return+ }+ actions.setDraftActionPending('publish')+ try {+ const response = await hogFunctionsPublishCreate(String(values.currentTeamIdStrict), id, {+ confirm: true,+ confirm_token: confirmToken,+ })+ lemonToast.success('Changes published')+ // pinned: analytics event name+ posthog.capture('hog function draft published', { type })+ // The response carries the published function, so the form gets the new live config+ // without a second request that could fail.+ if (response.function) {+ actions.loadHogFunctionSuccess(response.function as unknown as HogFunctionType)+ return+ }+ } catch (error) {+ lemonToast.error(+ error instanceof ApiError && error.status !== 409 && error.detail+ ? error.detail+ : 'Publishing failed. Review the staged changes and try again.'+ )+ }+ actions.loadHogFunction()+ },+ discardDraft: () => {+ if (values.draftActionPending) {+ return+ }+ LemonDialog.open({+ title: 'Discard staged changes?',+ description: 'This deletes the staged changes. The live version does not change.',+ primaryButton: {+ children: 'Discard',+ status: 'danger',+ onClick: () => actions.confirmDiscardDraft(),+ 'data-attr': 'hog-function-draft-discard-confirm',+ },+ secondaryButton: {+ children: 'Cancel',+ },+ })+ },+ confirmDiscardDraft: async () => {+ const id = values.hogFunction?.id+ const type = values.type+ if (!id || values.draftActionPending) {+ return+ }+ actions.setDraftActionPending('discard')+ try {+ const hogFunction = await hogFunctionsDiscardDraftCreate(String(values.currentTeamIdStrict), id)+ lemonToast.success('Staged changes discarded')+ // pinned: analytics event name+ posthog.capture('hog function draft discarded', { type })+ actions.loadHogFunctionSuccess(hogFunction as unknown as HogFunctionType)+ } catch {+ lemonToast.error('Could not discard the staged changes. Try again.')+ actions.loadHogFunction()+ }+ },+ })),+])diff --git a/frontend/src/scenes/hog-functions/list/HogFunctionsList.tsx b/frontend/src/scenes/hog-functions/list/HogFunctionsList.tsxindex 40e932e1dccf..bf268e5f163d 100644--- a/frontend/src/scenes/hog-functions/list/HogFunctionsList.tsx+++ b/frontend/src/scenes/hog-functions/list/HogFunctionsList.tsx@@ -194,6 +194,13 @@ export function HogFunctionList({{hogFunction.type === 'internal_destination' && (<NotificationContextTag hogFunction={hogFunction} />)}+ {hogFunction.draft_updated_at && (+ <Tooltip title="Staged changes are waiting to be published. Open it to review them.">+ <LemonTag size="small" type="warning" className="ml-1">+ Unpublished changes+ </LemonTag>+ </Tooltip>+ )}</>}description={hogFunction.description}diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex 47c4e077b2b0..93a8aac9fd81 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -7501,8 +7501,15 @@ export type HogFunctionType = {batch_export_id?: string | nulltemplate_id?: stringdeleted?: boolean+ /** Config staged for review by an agent, not live until published. Null when nothing is staged. */+ draft?: HogFunctionDraftType | null+ draft_updated_at?: string | null}+export type HogFunctionDraftType = Partial<+ Pick<HogFunctionType, 'hog' | 'inputs_schema' | 'inputs' | 'filters' | 'mappings' | 'masking'>+>+export type HogFunctionTemplateStatus = 'stable' | 'alpha' | 'beta' | 'deprecated' | 'coming_soon' | 'hidden'// Contexts change the way the UI is rendered allowing different teams to customize the UI for their use case