: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(workflows): expose the workflow name and id on source (#116092)
Meikel Ratz042a1a9cb7c2
diff --git a/nodejs/src/cdp/services/hogflows/actions/hog_function.test.ts b/nodejs/src/cdp/services/hogflows/actions/hog_function.test.tsindex 457146051e11..892bdd8a5d9f 100644--- a/nodejs/src/cdp/services/hogflows/actions/hog_function.test.ts+++ b/nodejs/src/cdp/services/hogflows/actions/hog_function.test.ts@@ -332,6 +332,20 @@ describe('HogFunctionHandler', () => {})})+ it('renders the workflow name and id from source in function inputs', async () => {+ action.config.inputs.name = { value: '{{ source.name }}|{{ source.id }}', templating: 'liquid' }++ const invocationResult = createInvocationResult<CyclotronJobInvocationHogFlow>(invocation, {+ queue: 'hog',+ queuePriority: 0,+ })++ const handlerResult = await hogFunctionHandler.execute({ invocation, action, result: invocationResult })++ expect(handlerResult.error).toBeUndefined()+ expect(mockFetch.mock.calls[0][1].body).toContain(`"name":"Hog Flow|${invocation.hogFlow.id}"`)+ })+it('should throw an error if template is not found', async () => {const action = findActionByType(invocation.hogFlow, 'function')!action.config.template_id = 'template_123'diff --git a/nodejs/src/cdp/services/hogflows/hogflow-functions.service.ts b/nodejs/src/cdp/services/hogflows/hogflow-functions.service.tsindex 407c2373f9fe..2cdd30cf8ed6 100644--- a/nodejs/src/cdp/services/hogflows/hogflow-functions.service.ts+++ b/nodejs/src/cdp/services/hogflows/hogflow-functions.service.ts@@ -110,7 +110,8 @@ export class HogFlowFunctionsService {// Include workflow-level variablesvariables: invocation.state.variables,source: {- name: hogFunction.name ?? `Hog flow: ${invocation.hogFlow.id}`,+ id: invocation.hogFlow.id,+ name: invocation.hogFlow.name || `Hog flow: ${invocation.hogFlow.id}`,url: `${projectUrl}/workflows/${invocation.hogFlow.id}/workflow?node=${hogFunction.id}`,},project: {