chore(legacy-webhook-service): remove unused group enrichment#60972
Merged
Conversation
Contributor
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
nodejs/tests/helpers/cdp.ts:49-51
`createCdpLegacyEventsConsumerDeps` is now a zero-value pass-through wrapper — it does nothing that calling `createCdpConsumerDeps` directly wouldn't do. Per the "no superfluous parts" principle, the wrapper should be removed and the one remaining caller (`cdp-legacy-event.consumer.test.ts`) updated to call `createCdpConsumerDeps` directly.
```suggestion
// Removed: createCdpLegacyEventsConsumerDeps — callers should use createCdpConsumerDeps directly
```
Reviews (1): Last reviewed commit: "chore(legacy-webhook-service): remove un..." | Re-trigger Greptile |
Contributor
|
amazing, ship it! |
nickbest-ph
approved these changes
Jun 1, 2026
z0br0wn
approved these changes
Jun 1, 2026
Contributor
z0br0wn
left a comment
There was a problem hiding this comment.
you simply love to see it
meikelmosby
approved these changes
Jun 2, 2026
Collaborator
meikelmosby
left a comment
There was a problem hiding this comment.
LGTM. Double check please that this is 100% not used anywhere in the old plugin-world. Happy to be removing dead code!
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
The legacy webhook service (
cdp-legacy-on-event) enriches each event with group properties (event.groups) before processing — fetching group properties from personhog. But nothing in this service consumes that enriched output:HookPayload(nodejs/src/types.ts), which has nogroupsfield, andconvertToHookPayloadassembles the body by explicitly naming fields (no spread), soevent.groupsnever reaches the wire.nodejs/src/cdp/legacy-webhooks/action-matcher.ts) only handlesevent/person/element/cohortfilter types — there is nogroupcase, and none of those handlers readevent.groups.The enrichment was introduced in #59546 (batched to reduce personhog
GetGrouptail latency), carried over from the legacy plugin-server port. On closer inspection it fetches group properties from personhog on every batch and throws them away — pure overhead.Changes
Delete the group enrichment from the legacy webhook service rather than relocate it:
legacy-webhook-service.ts: drop theaddGroupPropertiesToPostIngestionEventsBatchcall (and its try/catch fallback) fromprocessBatch; remove the now-unusedgroupTypeManager/groupRepositoryconstructor params and imports.legacy-webhooks/utils.ts: deleted entirely (bothaddGroupPropertiesToPostIngestionEventandaddGroupPropertiesToPostIngestionEventsBatchplus theirmakeGroupLookupKey/GroupLookupKeyhelpers were the only contents).cdp-legacy-event.consumer.ts/server.ts/tests/helpers/cdp.ts: stop threadinggroupTypeManagerinto the consumer; the legacy consumer now usesCdpConsumerBaseDepsdirectly. This removes the personhog group lookups (fetchGroup/fetchGroupsByKeys) from this path entirely.This is an alternative to #60513, which instead optimizes where the group fetch runs. Since nothing here consumes the enriched groups, deleting the fetch is simpler, removes the personhog round-trips outright, and also eliminates the "a single
fetchGroupsByKeysfailure fails the whole batch" path (flagged by review on #59546).Trade-off: if we ever want group-property-based webhook matching in this service, it would need to be rebuilt — the action matcher never supported a
groupfilter type, so no existing behavior is lost today.How did you test this code?
I'm an agent (Claude Code). Automated tests only — no manual product testing claimed.
legacy-webhook-service.test.ts: removed the obsolete enrichment cases (assertingprocessedEvent.groups, the enrichment-failure fallback, and thefetchGroupsByKeys-throws path) and thePersonHogGroupRepositorycompatibility block. Added two guards: one assertingprocessBatchnever calls the group repository (fetchGroup/fetchGroupsByKeys), and a payload-contract regression test proving the POSTedHookPayloadbody is byte-for-byte identical whether or notgroup_analyticsis enabled (nogroupskey;properties/person/elementsListintact). Deletedutils.test.tsalong withutils.ts.processEventtwice for the same event — once withevent.groupspopulated exactly as the deleted enrichment produced it (i.e. master's output), once without — and confirmed the POSTed webhook body is byte-for-byte identical and never contains agroupskey. SinceconvertToHookPayload/postWebhookare unchanged vs master, this demonstrates the removal does not alter the wire payload.nodejs/src/cdp/legacy-webhooks/suite (56 tests) andcdp-legacy-event.consumer.test.ts(13 tests) against a locally migrated Postgres + Redis — all green.process-groups-step,readonly-process-groups-step,groups-manager.service) constructs and queriesGroupTypeManager/GroupRepositoryindependently, so nothing relied on this service to warm a shared cache.tsc --noEmit),prettier --check, andeslintall pass on the touched files; full CI green (all three Node.js test shards + code quality).Automatic notifications
Docs update
🤖 Agent context
Authored by Claude Code (Agent tool). Approach: verified that the enriched
event.groupshas no consumer in this service — not theHookPayloadwire body (nogroupsfield; explicit field assembly inconvertToHookPayload) and not the action matcher (nogroupfilter case). Given that, chose to delete the fetch outright rather than relocate it (#60513's approach), removing the personhog group lookups from this path.The enrichment originated in #59546; its author confirmed on this PR that deletion is the right call. The constructor-signature change rippled into the consumer,
server.ts, and thetests/helpers/cdp.tsdeps helper; sincegroupTypeManagerwas the only field the legacy consumer's deps interface added over the base, theCdpLegacyEventsConsumerDepsinterface was removed and the consumer now takesCdpConsumerBaseDepsdirectly (a follow-up commit also dropped the now-redundantcreateCdpLegacyEventsConsumerDepstest helper). The key new test locks the payload contract by comparing the webhook body withgroup_analyticson vs off and asserting they're identical — the guard that proves the change is payload-neutral.