Skip to content

chore(cdp): remove the legacy Kafka batch hogflow consumer and routing#67274

Merged
meikelmosby merged 1 commit into
masterfrom
chore/cdp-remove-kafka-batch-hogflow
Jul 3, 2026
Merged

chore(cdp): remove the legacy Kafka batch hogflow consumer and routing#67274
meikelmosby merged 1 commit into
masterfrom
chore/cdp-remove-kafka-batch-hogflow

Conversation

@meikelmosby

Copy link
Copy Markdown
Collaborator

Problem

Once PostHog/charts#12716 has soaked and every team is routed to the cyclotron/Postgres batch resolver, the Kafka path (CdpBatchHogFlowRequestsConsumer, CDP_BATCH_RESOLVER_ROUTING matcher, cdp_batch_hogflow_requests topic producer) has zero traffic. This PR removes it end to end so nobody has to hold two paths in their head.

Changes

Deleted:

  • nodejs/src/cdp/consumers/cdp-batch-hogflow.consumer.ts
  • nodejs/src/cdp/consumers/cdp-batch-hogflow.consumer.test.ts (903 lines)

Config cleanup:

  • CDP_BATCH_HOGFLOW_REQUESTS_TOPIC / CDP_BATCH_HOGFLOW_REQUESTS_PRODUCER (fields, defaults, CdpCoreServicesEnv type union, producer-registry registration)
  • CDP_BATCH_RESOLVER_ROUTING (config field, buildIntegerMatcherWithPercentage setup, the routing branch in cdp-api.ts)
  • CDP_BATCH_WORKFLOW_PRODUCER_BATCH_SIZE (only the deleted consumer used it)
  • KAFKA_CDP_BATCH_HOGFLOW_REQUESTS constant
  • BATCH_HOGFLOW_REQUESTS_OUTPUT + BatchHogflowRequestsOutput type
  • PluginServerMode.cdp_batch_hogflow_requests and the cdpBatchHogFlow capability field

cdp-api.ts: the batch invocation handler is now unconditional — always dispatches to the cyclotron resolver, throws early if CYCLOTRON_NODE_DATABASE_URL isn't set (previously the null-producer error hid behind the routing branch).

Test cleanup:

  • cdp-api.test.ts — dropped the two Kafka-asserting tests (queues batch job request to kafka, queues batch job with filters from hog flow config when not provided), simplified the surviving cyclotron test now that there's no routing matcher to stub
  • workflows-e2e.test.ts — dropped the POST /batch_invocations with no routing match falls back to the legacy Kafka path test, dropped CDP_BATCH_RESOLVER_ROUTING: '*' from createHub, updated the stale CdpBatchHogFlowRequestsConsumer reference in a helper comment

Blocking

Merge only after PostHog/charts#12716 has been live for a few days and metrics confirm the Kafka path is idle. Rollback if issues surface: revert this PR + the charts flip together.

How did you test this code?

Agent-authored, no manual runtime verification. Locally:

  • pnpm typescript:check — clean
  • pnpm lint — clean
  • Did not run jest/playwright (per repo convention, human triggers those in CI)

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Tool: Claude Code (Opus 4.7, 1M context). No mandatory skills matched — this is straight deletion of a code path, no DRF, no migrations, no new tests. The writing-tests skill was flagged only because I edited tests, but those edits are mechanical removals of assertions on deleted behavior (exempt per the skill's own carve-out for "touching a test file for an unrelated reason").

Decisions:

  • Merged the "producer required" guard directly into cdp-api.ts at request time instead of at boot. Rationale: matches the existing pattern (dev environments without CYCLOTRON_NODE_DATABASE_URL still boot, they just can't handle batch triggers), avoids a boot-time coupling for a code path most local dev never exercises.
  • Kept convertBatchHogFlowRequestToHogFunctionInvocationGlobals in utils.ts — the new cyclotron resolver still calls it. Name is a bit fossilized but renaming is scope creep.
  • Kept the outputs field wired through cdp-services.ts (still used by other producers like warehouse webhooks and precalculated events). Only pruned the batch-hogflow slot.

All batch hogflow traffic now goes through the cyclotron/Postgres
resolver (charts flip landed and soaked). This rips out the Kafka path:

- CdpBatchHogFlowRequestsConsumer + its tests
- CDP_BATCH_HOGFLOW_REQUESTS_TOPIC / _PRODUCER config + producer registry
- CDP_BATCH_RESOLVER_ROUTING (matcher and per-team allowlist)
- CDP_BATCH_WORKFLOW_PRODUCER_BATCH_SIZE (only the deleted consumer used it)
- PluginServerMode.cdp_batch_hogflow_requests + cdpBatchHogFlow capability
- KAFKA_CDP_BATCH_HOGFLOW_REQUESTS constant
- BATCH_HOGFLOW_REQUESTS_OUTPUT + BatchHogflowRequestsOutput
- Kafka-asserting tests in cdp-api.test.ts; legacy-fallback assertions in
  workflows-e2e.test.ts; stale references in comments

cdp-api's batch invocation handler now always dispatches to the
cyclotron resolver and throws if CYCLOTRON_NODE_DATABASE_URL isn't set.
No follow-up needed on producers/tests — the resolver path is what
production has been running everywhere.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@meikelmosby meikelmosby self-assigned this Jul 1, 2026
@greptile-apps

greptile-apps Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "chore(cdp): remove the legacy Kafka batc..." | Re-trigger Greptile

@meikelmosby meikelmosby marked this pull request as ready for review July 2, 2026 06:46
@meikelmosby meikelmosby requested a review from a team July 2, 2026 06:46
@meikelmosby meikelmosby merged commit 2f5cd35 into master Jul 3, 2026
235 checks passed
@meikelmosby meikelmosby deleted the chore/cdp-remove-kafka-batch-hogflow branch July 3, 2026 05:55
@deployment-status-posthog

deployment-status-posthog Bot commented Jul 3, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-07-03 06:25 UTC Run
prod-us ✅ Deployed 2026-07-03 06:39 UTC Run
prod-eu ✅ Deployed 2026-07-03 06:39 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants