Repository navigation
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
Contributor
|
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the |
Silthus
force-pushed
the
workflows-tracking/creation-event
branch
from
October 20, 2026 11:00
b32d9e5 to
b7a3008
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A data suggestion saved by a Celery task creates its workflow inside the worker, where the global analytics client can lose queued events when the child exits. Capture through the scoped client, which flushes on exit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Silthus
force-pushed
the
workflows-tracking/creation-event
branch
from
October 26, 2026 09:05
8bfa93f to
b170c9c
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
hog_flow_created. Only the API create view and premade data-suggestion saves (#119724) emit it.Impact
Closes a gap in two Grow Workflows leading metrics: Started orgs (organizations whose first workflow creation falls in the month) and activation rate (the share of started orgs whose first billed action comes within 30 days of that creation). Both are defined on the first
hog_flow_created, so an organization whose first workflow came from an accepted data-suggestion draft or a transactional email workflow is counted late or never. Once these metrics readworkflows workflow created, they count every creation path. Expected move: no change in product usage; Started orgs stops undercounting, and activation rate is measured from the real first creation.Merge Danger
Note
🔵 Merge risk: low · two-way door (merge-risk rubric)
try/exceptbehindon_commit, so it never fails or rolls back a creation. Reverting removes the event and nothing else; events already sent stay sent.Changes
workflows workflow created, whatever path created it.workflow_id,origin_product,actions_count. The event carries the project and organization groups.workflows workflow created; keephog_flow_createdfor user and channel attribution.HogFlowpost_savereceiver queues the capture withtransaction.on_commiton the signal's own connection.ph_scoped_capture, which flushes on exit. The global client can lose events in a Celery worker (AGENTS.md forbids it there), and the generated data-suggestion save runs in one.region: E2Eto the US project, so per-team counts should filterregiontoUSandEU.USorEU) as itsregionproperty, like events from the global client.Recreates Silthus/posthog#358, originally #111727 (closed).
How did you test this code?
Test rationale: four cases in the existing
TestHogFlowmodel tests, at the model seam every creation path passes.They catch a duplicate event on update, a capture before commit, wrong groups or properties, a wrong region, a capture after rollback, and an analytics failure that breaks creation.
The existing receiver tests cover only worker reloads. The tests patch
ph_scoped_capture, as the repo's other scoped-capture callers do.The first version of these tests failed before the receiver existed and passed after it. Swapping
event_region=forregion=fails the region case.Live run at
b170c9c, through the real DRF API with a logged-in Django test client against an isolated local database.posthog.ph_client.is_cloudwas forced toTrue, andPosthog.capturewas replaced by a recorder, so nothing reached PostHog Cloud:PATCHa workflow written before this changePOSTa new workflow (origin_product: broadcasts, one action)PATCHthe new workflowBoth events carried the team's UUID as
distinct_id, the project and organization groups, the right properties, and went to the scoped client forus.i.posthog.com. The global client saw no creation event.Lane gate, run locally on
b170c9c:ruff,ty check,mypyon the two changed files,products/workflows/backend/test/test_hog_flow.py(10 passed), the repo guard tests inposthog/test/repo_invariants(289 passed),lint-imports, andhogli ci:preflight --strict(0 failures).Gaps:
origin_productandactions_count.Release status
Docs update
None. No existing doc covers Workflows analytics events.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Agent: T3 Code with Claude Code, Claude Opus 5.5 (
claude-opus-5-5). An earlier Codex worker (GPT-6.1 Sol) recreated the change test-first before its session dropped.ph_scoped_captureat the model receiver, so Celery-side creations deliver too; replaces flushing the global client in the data-suggestion task onlyhog_flow_createdto every path?hog_flow_createdstays for user and channel attributionInvolvement: rebased onto master on 2026-10-20 and 2026-10-26, no conflicts; two QA panel rounds (GPT-6.1 Sol: correctness, risk, design, systems, author perspective; Claude Opus 5.5: fresh eyes) and two final reads; no review bot ran; live run proof captured.
modernize-pr,qa-swarm,tdd,pr-description,writing-voice,running-ci-preflight.🤖 Generated with Claude Code