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.

fix(workflows): carry groups into hogflow invocation for test mode (#65600)

Arthur Moreira de Deus3c9394432607
diff --git a/nodejs/src/cdp/services/hogflows/hogflow-executor.service.test.ts b/nodejs/src/cdp/services/hogflows/hogflow-executor.service.test.ts
index b2ccd092dff8..237d1e65c7ec 100644
--- a/nodejs/src/cdp/services/hogflows/hogflow-executor.service.test.ts
+++ b/nodejs/src/cdp/services/hogflows/hogflow-executor.service.test.ts
@@ -1474,6 +1474,48 @@ describe('Hogflow Executor', () => {
})
})
+ describe('group propagation', () => {
+ it('carries groups from globals onto the invocation', () => {
+ const hogFlow: HogFlow = new FixtureHogFlowBuilder()
+ .withWorkflow({
+ actions: {
+ trigger: { type: 'trigger', config: { type: 'event', filters: {} } },
+ exit: { type: 'exit', config: {} },
+ },
+ edges: [{ from: 'trigger', to: 'exit', type: 'continue' }],
+ })
+ .build()
+
+ const groups = {
+ organization: {
+ id: 'acme-123',
+ type: 'organization',
+ index: 0,
+ url: '',
+ properties: {},
+ },
+ }
+ const globals = {
+ event: {
+ event: 'test',
+ properties: {},
+ url: '',
+ distinct_id: '',
+ timestamp: '',
+ uuid: '',
+ elements_chain: '',
+ },
+ project: { id: 1, name: 'Test Project', url: '' },
+ person: { id: 'person_id', name: 'John Doe', properties: {}, url: '' },
+ groups,
+ }
+
+ const invocation = createHogFlowInvocation(globals, hogFlow, {} as any)
+
+ expect(invocation.groups).toEqual(groups)
+ })
+ })
+
describe('output variable mapping', () => {
let hogFlowBuilder: (outputVariable: any) => Promise<HogFlow>
diff --git a/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts b/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts
index ef5bcbdee55d..f7f9f1d68172 100644
--- a/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts
+++ b/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts
@@ -71,6 +71,7 @@ export function createHogFlowInvocation(
functionId: hogFlow.id, // TODO: Include version?
hogFlow,
person: globals.person, // This is outside of state as we don't persist it
+ groups: globals.groups, // Same as person: in-memory only (test path); real execution re-resolves on dequeue
filterGlobals,
queue: 'hogflow',
queuePriority: 1,