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.

feat(personhog): add delete personless distinct ids (#64388)

Zach Brown8b1ccdc5c2be
diff --git a/posthog/personhog_client/client.py b/posthog/personhog_client/client.py
index 07593613f682..84ef3a35393f 100644
--- a/posthog/personhog_client/client.py
+++ b/posthog/personhog_client/client.py
@@ -37,6 +37,8 @@ from posthog.personhog_client.proto import (
DeleteGroupTypeMappingsBatchForTeamResponse,
DeleteHashKeyOverridesByTeamsRequest,
DeleteHashKeyOverridesByTeamsResponse,
+ DeletePersonlessDistinctIdsBatchForTeamRequest,
+ DeletePersonlessDistinctIdsBatchForTeamResponse,
DeletePersonsBatchForTeamRequest,
DeletePersonsBatchForTeamResponse,
DeletePersonsRequest,
@@ -211,6 +213,11 @@ class PersonHogClient:
) -> DeletePersonsBatchForTeamResponse:
return self._stub.DeletePersonsBatchForTeam(request, timeout=timeout or self._timeout)
+ def delete_personless_distinct_ids_batch_for_team(
+ self, request: DeletePersonlessDistinctIdsBatchForTeamRequest, timeout: float | None = None
+ ) -> DeletePersonlessDistinctIdsBatchForTeamResponse:
+ return self._stub.DeletePersonlessDistinctIdsBatchForTeam(request, timeout=timeout or self._timeout)
+
# -- Person split --
def split_person(self, request: SplitPersonRequest, timeout: float | None = None) -> SplitPersonResponse:
diff --git a/posthog/personhog_client/fake_client.py b/posthog/personhog_client/fake_client.py
index fa9280af230b..703674c9d870 100644
--- a/posthog/personhog_client/fake_client.py
+++ b/posthog/personhog_client/fake_client.py
@@ -595,6 +595,15 @@ class FakePersonHogClient:
self.calls.append(_Call("delete_persons_batch_for_team", request, response))
return response
+ def delete_personless_distinct_ids_batch_for_team(
+ self, request: person_pb2.DeletePersonlessDistinctIdsBatchForTeamRequest, timeout: float | None = None
+ ) -> person_pb2.DeletePersonlessDistinctIdsBatchForTeamResponse:
+ # The fake does not model personless distinct IDs, so this records the
+ # call for assertions and reports nothing deleted.
+ response = person_pb2.DeletePersonlessDistinctIdsBatchForTeamResponse(deleted_count=0)
+ self.calls.append(_Call("delete_personless_distinct_ids_batch_for_team", request, response))
+ return response
+
# ── Person split ──────────────────────────────────────────────────
def split_person(
diff --git a/posthog/personhog_client/proto/__init__.py b/posthog/personhog_client/proto/__init__.py
index 69a0898d2346..8f1e54ea8ecf 100644
--- a/posthog/personhog_client/proto/__init__.py
+++ b/posthog/personhog_client/proto/__init__.py
@@ -66,6 +66,8 @@ from posthog.personhog_client.proto.generated.personhog.types.v1.group_pb2 impor
UpdateGroupTypeMappingResponse,
)
from posthog.personhog_client.proto.generated.personhog.types.v1.person_pb2 import (
+ DeletePersonlessDistinctIdsBatchForTeamRequest,
+ DeletePersonlessDistinctIdsBatchForTeamResponse,
DeletePersonsBatchForTeamRequest,
DeletePersonsBatchForTeamResponse,
DeletePersonsRequest,
diff --git a/posthog/personhog_client/proto/generated/personhog/service/v1/service_pb2.py b/posthog/personhog_client/proto/generated/personhog/service/v1/service_pb2.py
index c2413afcc918..4141d5af05e0 100644
--- a/posthog/personhog_client/proto/generated/personhog/service/v1/service_pb2.py
+++ b/posthog/personhog_client/proto/generated/personhog/service/v1/service_pb2.py
@@ -20,7 +20,7 @@ from ....personhog.types.v1 import (
)
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
- b"\n\"personhog/service/v1/service.proto\x12\x14personhog.service.v1\x1a\x1fpersonhog/types/v1/person.proto\x1a\x1epersonhog/types/v1/group.proto\x1a\x1fpersonhog/types/v1/cohort.proto\x1a%personhog/types/v1/feature_flag.proto2\xbb$\n\x10PersonHogService\x12X\n\tGetPerson\x12$.personhog.types.v1.GetPersonRequest\x1a%.personhog.types.v1.GetPersonResponse\x12X\n\nGetPersons\x12%.personhog.types.v1.GetPersonsRequest\x1a#.personhog.types.v1.PersonsResponse\x12d\n\x0fGetPersonByUuid\x12*.personhog.types.v1.GetPersonByUuidRequest\x1a%.personhog.types.v1.GetPersonResponse\x12f\n\x11GetPersonsByUuids\x12,.personhog.types.v1.GetPersonsByUuidsRequest\x1a#.personhog.types.v1.PersonsResponse\x12p\n\x15GetPersonByDistinctId\x120.personhog.types.v1.GetPersonByDistinctIdRequest\x1a%.personhog.types.v1.GetPersonResponse\x12\x91\x01\n\x1dGetPersonsByDistinctIdsInTeam\x128.personhog.types.v1.GetPersonsByDistinctIdsInTeamRequest\x1a6.personhog.types.v1.PersonsByDistinctIdsInTeamResponse\x12\x7f\n\x17GetPersonsByDistinctIds\x122.personhog.types.v1.GetPersonsByDistinctIdsRequest\x1a0.personhog.types.v1.PersonsByDistinctIdsResponse\x12\x82\x01\n\x17GetDistinctIdsForPerson\x122.personhog.types.v1.GetDistinctIdsForPersonRequest\x1a3.personhog.types.v1.GetDistinctIdsForPersonResponse\x12\x85\x01\n\x18GetDistinctIdsForPersons\x123.personhog.types.v1.GetDistinctIdsForPersonsRequest\x1a4.personhog.types.v1.GetDistinctIdsForPersonsResponse\x12\x88\x01\n\x19GetHashKeyOverrideContext\x124.personhog.types.v1.GetHashKeyOverrideContextRequest\x1a5.personhog.types.v1.GetHashKeyOverrideContextResponse\x12\x7f\n\x16UpsertHashKeyOverrides\x121.personhog.types.v1.UpsertHashKeyOverridesRequest\x1a2.personhog.types.v1.UpsertHashKeyOverridesResponse\x12\x94\x01\n\x1dDeleteHashKeyOverridesByTeams\x128.personhog.types.v1.DeleteHashKeyOverridesByTeamsRequest\x1a9.personhog.types.v1.DeleteHashKeyOverridesByTeamsResponse\x12w\n\x15CheckCohortMembership\x120.personhog.types.v1.CheckCohortMembershipRequest\x1a,.personhog.types.v1.CohortMembershipResponse\x12s\n\x12CountCohortMembers\x12-.personhog.types.v1.CountCohortMembersRequest\x1a..personhog.types.v1.CountCohortMembersResponse\x12s\n\x12DeleteCohortMember\x12-.personhog.types.v1.DeleteCohortMemberRequest\x1a..personhog.types.v1.DeleteCohortMemberResponse\x12\x82\x01\n\x17DeleteCohortMembersBulk\x122.personhog.types.v1.DeleteCohortMembersBulkRequest\x1a3.personhog.types.v1.DeleteCohortMembersBulkResponse\x12v\n\x13InsertCohortMembers\x12..personhog.types.v1.InsertCohortMembersRequest\x1a/.personhog.types.v1.InsertCohortMembersResponse\x12v\n\x13ListCohortMemberIds\x12..personhog.types.v1.ListCohortMemberIdsRequest\x1a/.personhog.types.v1.ListCohortMemberIdsResponse\x12U\n\x08GetGroup\x12#.personhog.types.v1.GetGroupRequest\x1a$.personhog.types.v1.GetGroupResponse\x12U\n\tGetGroups\x12$.personhog.types.v1.GetGroupsRequest\x1a\".personhog.types.v1.GroupsResponse\x12g\n\x0eGetGroupsBatch\x12).personhog.types.v1.GetGroupsBatchRequest\x1a*.personhog.types.v1.GetGroupsBatchResponse\x12[\n\nListGroups\x12%.personhog.types.v1.ListGroupsRequest\x1a&.personhog.types.v1.ListGroupsResponse\x12\x86\x01\n\x1cGetGroupTypeMappingsByTeamId\x127.personhog.types.v1.GetGroupTypeMappingsByTeamIdRequest\x1a-.personhog.types.v1.GroupTypeMappingsResponse\x12\x8d\x01\n\x1dGetGroupTypeMappingsByTeamIds\x128.personhog.types.v1.GetGroupTypeMappingsByTeamIdsRequest\x1a2.personhog.types.v1.GroupTypeMappingsBatchResponse\x12\x8c\x01\n\x1fGetGroupTypeMappingsByProjectId\x12:.personhog.types.v1.GetGroupTypeMappingsByProjectIdRequest\x1a-.personhog.types.v1.GroupTypeMappingsResponse\x12\x93\x01\n GetGroupTypeMappingsByProjectIds\x12;.personhog.types.v1.GetGroupTypeMappingsByProjectIdsRequest\x1a2.personhog.types.v1.GroupTypeMappingsBatchResponse\x12\x9d\x01\n GetGroupTypeMappingByDashboardId\x12;.personhog.types.v1.GetGroupTypeMappingByDashboardIdRequest\x1a<.personhog.types.v1.GetGroupTypeMappingByDashboardIdResponse\x12\x7f\n\x16CountGroupTypeMappings\x121.personhog.types.v1.CountGroupTypeMappingsRequest\x1a2.personhog.types.v1.CountGroupTypeMappingsResponse\x12^\n\x0bCreateGroup\x12&.personhog.types.v1.CreateGroupRequest\x1a'.personhog.types.v1.CreateGroupResponse\x12^\n\x0bUpdateGroup\x12&.personhog.types.v1.UpdateGroupRequest\x1a'.personhog.types.v1.UpdateGroupResponse\x12\x85\x01\n\x18DeleteGroupsBatchForTeam\x123.personhog.types.v1.DeleteGroupsBatchForTeamRequest\x1a4.personhog.types.v1.DeleteGroupsBatchForTeamResponse\x12\x7f\n\x16UpdateGroupTypeMapping\x121.personhog.types.v1.UpdateGroupTypeMappingRequest\x1a2.personhog.types.v1.UpdateGroupTypeMappingResponse\x12\x7f\n\x16DeleteGroupTypeMapping\x121.personhog.types.v1.DeleteGroupTypeMappingRequest\x1a2.personhog.types.v1.DeleteGroupTypeMappingResponse\x12\xa6\x01\n#DeleteGroupTypeMappingsBatchForTeam\x12>.personhog.types.v1.DeleteGroupTypeMappingsBatchForTeamRequest\x1a?.personhog.types.v1.DeleteGroupTypeMappingsBatchForTeamResponse\x12\x7f\n\x16UpdatePersonProperties\x121.personhog.types.v1.UpdatePersonPropertiesRequest\x1a2.personhog.types.v1.UpdatePersonPropertiesResponse\x12d\n\rDeletePersons\x12(.personhog.types.v1.DeletePersonsRequest\x1a).personhog.types.v1.DeletePersonsResponse\x12\x88\x01\n\x19DeletePersonsBatchForTeam\x124.personhog.types.v1.DeletePersonsBatchForTeamRequest\x1a5.personhog.types.v1.DeletePersonsBatchForTeamResponse\x12^\n\x0bSplitPerson\x12&.personhog.types.v1.SplitPersonRequest\x1a'.personhog.types.v1.SplitPersonResponseb\x06proto3"
+ b"\n\"personhog/service/v1/service.proto\x12\x14personhog.service.v1\x1a\x1fpersonhog/types/v1/person.proto\x1a\x1epersonhog/types/v1/group.proto\x1a\x1fpersonhog/types/v1/cohort.proto\x1a%personhog/types/v1/feature_flag.proto2\xf0%\n\x10PersonHogService\x12X\n\tGetPerson\x12$.personhog.types.v1.GetPersonRequest\x1a%.personhog.types.v1.GetPersonResponse\x12X\n\nGetPersons\x12%.personhog.types.v1.GetPersonsRequest\x1a#.personhog.types.v1.PersonsResponse\x12d\n\x0fGetPersonByUuid\x12*.personhog.types.v1.GetPersonByUuidRequest\x1a%.personhog.types.v1.GetPersonResponse\x12f\n\x11GetPersonsByUuids\x12,.personhog.types.v1.GetPersonsByUuidsRequest\x1a#.personhog.types.v1.PersonsResponse\x12p\n\x15GetPersonByDistinctId\x120.personhog.types.v1.GetPersonByDistinctIdRequest\x1a%.personhog.types.v1.GetPersonResponse\x12\x91\x01\n\x1dGetPersonsByDistinctIdsInTeam\x128.personhog.types.v1.GetPersonsByDistinctIdsInTeamRequest\x1a6.personhog.types.v1.PersonsByDistinctIdsInTeamResponse\x12\x7f\n\x17GetPersonsByDistinctIds\x122.personhog.types.v1.GetPersonsByDistinctIdsRequest\x1a0.personhog.types.v1.PersonsByDistinctIdsResponse\x12\x82\x01\n\x17GetDistinctIdsForPerson\x122.personhog.types.v1.GetDistinctIdsForPersonRequest\x1a3.personhog.types.v1.GetDistinctIdsForPersonResponse\x12\x85\x01\n\x18GetDistinctIdsForPersons\x123.personhog.types.v1.GetDistinctIdsForPersonsRequest\x1a4.personhog.types.v1.GetDistinctIdsForPersonsResponse\x12\x88\x01\n\x19GetHashKeyOverrideContext\x124.personhog.types.v1.GetHashKeyOverrideContextRequest\x1a5.personhog.types.v1.GetHashKeyOverrideContextResponse\x12\x7f\n\x16UpsertHashKeyOverrides\x121.personhog.types.v1.UpsertHashKeyOverridesRequest\x1a2.personhog.types.v1.UpsertHashKeyOverridesResponse\x12\x94\x01\n\x1dDeleteHashKeyOverridesByTeams\x128.personhog.types.v1.DeleteHashKeyOverridesByTeamsRequest\x1a9.personhog.types.v1.DeleteHashKeyOverridesByTeamsResponse\x12w\n\x15CheckCohortMembership\x120.personhog.types.v1.CheckCohortMembershipRequest\x1a,.personhog.types.v1.CohortMembershipResponse\x12s\n\x12CountCohortMembers\x12-.personhog.types.v1.CountCohortMembersRequest\x1a..personhog.types.v1.CountCohortMembersResponse\x12s\n\x12DeleteCohortMember\x12-.personhog.types.v1.DeleteCohortMemberRequest\x1a..personhog.types.v1.DeleteCohortMemberResponse\x12\x82\x01\n\x17DeleteCohortMembersBulk\x122.personhog.types.v1.DeleteCohortMembersBulkRequest\x1a3.personhog.types.v1.DeleteCohortMembersBulkResponse\x12v\n\x13InsertCohortMembers\x12..personhog.types.v1.InsertCohortMembersRequest\x1a/.personhog.types.v1.InsertCohortMembersResponse\x12v\n\x13ListCohortMemberIds\x12..personhog.types.v1.ListCohortMemberIdsRequest\x1a/.personhog.types.v1.ListCohortMemberIdsResponse\x12U\n\x08GetGroup\x12#.personhog.types.v1.GetGroupRequest\x1a$.personhog.types.v1.GetGroupResponse\x12U\n\tGetGroups\x12$.personhog.types.v1.GetGroupsRequest\x1a\".personhog.types.v1.GroupsResponse\x12g\n\x0eGetGroupsBatch\x12).personhog.types.v1.GetGroupsBatchRequest\x1a*.personhog.types.v1.GetGroupsBatchResponse\x12[\n\nListGroups\x12%.personhog.types.v1.ListGroupsRequest\x1a&.personhog.types.v1.ListGroupsResponse\x12\x86\x01\n\x1cGetGroupTypeMappingsByTeamId\x127.personhog.types.v1.GetGroupTypeMappingsByTeamIdRequest\x1a-.personhog.types.v1.GroupTypeMappingsResponse\x12\x8d\x01\n\x1dGetGroupTypeMappingsByTeamIds\x128.personhog.types.v1.GetGroupTypeMappingsByTeamIdsRequest\x1a2.personhog.types.v1.GroupTypeMappingsBatchResponse\x12\x8c\x01\n\x1fGetGroupTypeMappingsByProjectId\x12:.personhog.types.v1.GetGroupTypeMappingsByProjectIdRequest\x1a-.personhog.types.v1.GroupTypeMappingsResponse\x12\x93\x01\n GetGroupTypeMappingsByProjectIds\x12;.personhog.types.v1.GetGroupTypeMappingsByProjectIdsRequest\x1a2.personhog.types.v1.GroupTypeMappingsBatchResponse\x12\x9d\x01\n GetGroupTypeMappingByDashboardId\x12;.personhog.types.v1.GetGroupTypeMappingByDashboardIdRequest\x1a<.personhog.types.v1.GetGroupTypeMappingByDashboardIdResponse\x12\x7f\n\x16CountGroupTypeMappings\x121.personhog.types.v1.CountGroupTypeMappingsRequest\x1a2.personhog.types.v1.CountGroupTypeMappingsResponse\x12^\n\x0bCreateGroup\x12&.personhog.types.v1.CreateGroupRequest\x1a'.personhog.types.v1.CreateGroupResponse\x12^\n\x0bUpdateGroup\x12&.personhog.types.v1.UpdateGroupRequest\x1a'.personhog.types.v1.UpdateGroupResponse\x12\x85\x01\n\x18DeleteGroupsBatchForTeam\x123.personhog.types.v1.DeleteGroupsBatchForTeamRequest\x1a4.personhog.types.v1.DeleteGroupsBatchForTeamResponse\x12\x7f\n\x16UpdateGroupTypeMapping\x121.personhog.types.v1.UpdateGroupTypeMappingRequest\x1a2.personhog.types.v1.UpdateGroupTypeMappingResponse\x12\x7f\n\x16DeleteGroupTypeMapping\x121.personhog.types.v1.DeleteGroupTypeMappingRequest\x1a2.personhog.types.v1.DeleteGroupTypeMappingResponse\x12\xa6\x01\n#DeleteGroupTypeMappingsBatchForTeam\x12>.personhog.types.v1.DeleteGroupTypeMappingsBatchForTeamRequest\x1a?.personhog.types.v1.DeleteGroupTypeMappingsBatchForTeamResponse\x12\x7f\n\x16UpdatePersonProperties\x121.personhog.types.v1.UpdatePersonPropertiesRequest\x1a2.personhog.types.v1.UpdatePersonPropertiesResponse\x12d\n\rDeletePersons\x12(.personhog.types.v1.DeletePersonsRequest\x1a).personhog.types.v1.DeletePersonsResponse\x12\x88\x01\n\x19DeletePersonsBatchForTeam\x124.personhog.types.v1.DeletePersonsBatchForTeamRequest\x1a5.personhog.types.v1.DeletePersonsBatchForTeamResponse\x12\xb2\x01\n'DeletePersonlessDistinctIdsBatchForTeam\x12B.personhog.types.v1.DeletePersonlessDistinctIdsBatchForTeamRequest\x1aC.personhog.types.v1.DeletePersonlessDistinctIdsBatchForTeamResponse\x12^\n\x0bSplitPerson\x12&.personhog.types.v1.SplitPersonRequest\x1a'.personhog.types.v1.SplitPersonResponseb\x06proto3"
)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -28,4 +28,4 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "personhog.service.v1.servic
if not _descriptor._USE_C_DESCRIPTORS:
DESCRIPTOR._loaded_options = None
_globals["_PERSONHOGSERVICE"]._serialized_start = 198
- _globals["_PERSONHOGSERVICE"]._serialized_end = 4865
+ _globals["_PERSONHOGSERVICE"]._serialized_end = 5046
diff --git a/posthog/personhog_client/proto/generated/personhog/service/v1/service_pb2_grpc.py b/posthog/personhog_client/proto/generated/personhog/service/v1/service_pb2_grpc.py
index 6bf84ddf3def..bd301b7e6183 100644
--- a/posthog/personhog_client/proto/generated/personhog/service/v1/service_pb2_grpc.py
+++ b/posthog/personhog_client/proto/generated/personhog/service/v1/service_pb2_grpc.py
@@ -261,6 +261,12 @@ class PersonHogServiceStub:
response_deserializer=personhog_dot_types_dot_v1_dot_person__pb2.DeletePersonsBatchForTeamResponse.FromString,
_registered_method=True,
)
+ self.DeletePersonlessDistinctIdsBatchForTeam = channel.unary_unary(
+ "/personhog.service.v1.PersonHogService/DeletePersonlessDistinctIdsBatchForTeam",
+ request_serializer=personhog_dot_types_dot_v1_dot_person__pb2.DeletePersonlessDistinctIdsBatchForTeamRequest.SerializeToString,
+ response_deserializer=personhog_dot_types_dot_v1_dot_person__pb2.DeletePersonlessDistinctIdsBatchForTeamResponse.FromString,
+ _registered_method=True,
+ )
self.SplitPerson = channel.unary_unary(
"/personhog.service.v1.PersonHogService/SplitPerson",
request_serializer=personhog_dot_types_dot_v1_dot_person__pb2.SplitPersonRequest.SerializeToString,
@@ -501,6 +507,12 @@ class PersonHogServiceServicer:
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
+ def DeletePersonlessDistinctIdsBatchForTeam(self, request, context):
+ """WARNING: Same routing caveat as DeletePersons above."""
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details("Method not implemented!")
+ raise NotImplementedError("Method not implemented!")
+
def SplitPerson(self, request, context):
"""Person split
WARNING: Same routing caveat as DeletePersons above — write operation on person data
@@ -698,6 +710,11 @@ def add_PersonHogServiceServicer_to_server(servicer, server):
request_deserializer=personhog_dot_types_dot_v1_dot_person__pb2.DeletePersonsBatchForTeamRequest.FromString,
response_serializer=personhog_dot_types_dot_v1_dot_person__pb2.DeletePersonsBatchForTeamResponse.SerializeToString,
),
+ "DeletePersonlessDistinctIdsBatchForTeam": grpc.unary_unary_rpc_method_handler(
+ servicer.DeletePersonlessDistinctIdsBatchForTeam,
+ request_deserializer=personhog_dot_types_dot_v1_dot_person__pb2.DeletePersonlessDistinctIdsBatchForTeamRequest.FromString,
+ response_serializer=personhog_dot_types_dot_v1_dot_person__pb2.DeletePersonlessDistinctIdsBatchForTeamResponse.SerializeToString,
+ ),
"SplitPerson": grpc.unary_unary_rpc_method_handler(
servicer.SplitPerson,
request_deserializer=personhog_dot_types_dot_v1_dot_person__pb2.SplitPersonRequest.FromString,
@@ -1824,6 +1841,36 @@ class PersonHogService:
_registered_method=True,
)
+ @staticmethod
+ def DeletePersonlessDistinctIdsBatchForTeam(
+ request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ insecure=False,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None,
+ ):
+ return grpc.experimental.unary_unary(
+ request,
+ target,
+ "/personhog.service.v1.PersonHogService/DeletePersonlessDistinctIdsBatchForTeam",
+ personhog_dot_types_dot_v1_dot_person__pb2.DeletePersonlessDistinctIdsBatchForTeamRequest.SerializeToString,
+ personhog_dot_types_dot_v1_dot_person__pb2.DeletePersonlessDistinctIdsBatchForTeamResponse.FromString,
+ options,
+ channel_credentials,
+ insecure,
+ call_credentials,
+ compression,
+ wait_for_ready,
+ timeout,
+ metadata,
+ _registered_method=True,
+ )
+
@staticmethod
def SplitPerson(
request,
diff --git a/posthog/personhog_client/proto/generated/personhog/types/v1/person_pb2.py b/posthog/personhog_client/proto/generated/personhog/types/v1/person_pb2.py
index bff25aabbae6..9cbbaee5b653 100644
--- a/posthog/personhog_client/proto/generated/personhog/types/v1/person_pb2.py
+++ b/posthog/personhog_client/proto/generated/personhog/types/v1/person_pb2.py
@@ -15,7 +15,7 @@ _sym_db = _symbol_database.Default()
from ....personhog.types.v1 import common_pb2 as personhog_dot_types_dot_v1_dot_common__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
- b'\n\x1fpersonhog/types/v1/person.proto\x12\x12personhog.types.v1\x1a\x1fpersonhog/types/v1/common.proto"\x9e\x02\n\x06Person\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x0c\n\x04uuid\x18\x02 \x01(\t\x12\x0f\n\x07team_id\x18\x03 \x01(\x03\x12\x12\n\nproperties\x18\x04 \x01(\x0c\x12"\n\x1aproperties_last_updated_at\x18\x05 \x01(\x0c\x12!\n\x19properties_last_operation\x18\x06 \x01(\x0c\x12\x12\n\ncreated_at\x18\x07 \x01(\x03\x12\x0f\n\x07version\x18\x08 \x01(\x03\x12\x15\n\ris_identified\x18\t \x01(\x08\x12\x17\n\nis_user_id\x18\n \x01(\x08H\x00\x88\x01\x01\x12\x19\n\x0clast_seen_at\x18\x0b \x01(\x03H\x01\x88\x01\x01B\r\n\x0b_is_user_idB\x0f\n\r_last_seen_at"N\n\x15DistinctIdWithVersion\x12\x13\n\x0bdistinct_id\x18\x01 \x01(\t\x12\x14\n\x07version\x18\x02 \x01(\x03H\x00\x88\x01\x01B\n\n\x08_version"h\n\x15PersonWithDistinctIds\x12\x13\n\x0bdistinct_id\x18\x01 \x01(\t\x12/\n\x06person\x18\x02 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01B\t\n\x07_person"g\n\x11PersonDistinctIds\x12\x11\n\tperson_id\x18\x01 \x01(\x03\x12?\n\x0cdistinct_ids\x18\x02 \x03(\x0b2).personhog.types.v1.DistinctIdWithVersion"\x87\x01\n\x18PersonWithTeamDistinctId\x12/\n\x03key\x18\x01 \x01(\x0b2".personhog.types.v1.TeamDistinctId\x12/\n\x06person\x18\x02 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01B\t\n\x07_person"m\n\x10GetPersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"O\n\x11GetPersonResponse\x12/\n\x06person\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01B\t\n\x07_person"o\n\x11GetPersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x12\n\nperson_ids\x18\x02 \x03(\x03\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"S\n\x0fPersonsResponse\x12+\n\x07persons\x18\x01 \x03(\x0b2\x1a.personhog.types.v1.Person\x12\x13\n\x0bmissing_ids\x18\x02 \x03(\x03"n\n\x16GetPersonByUuidRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x0c\n\x04uuid\x18\x02 \x01(\t\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"q\n\x18GetPersonsByUuidsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\r\n\x05uuids\x18\x02 \x03(\t\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"{\n\x1cGetPersonByDistinctIdRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x13\n\x0bdistinct_id\x18\x02 \x01(\t\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"\x84\x01\n$GetPersonsByDistinctIdsInTeamRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x14\n\x0cdistinct_ids\x18\x02 \x03(\t\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"`\n"PersonsByDistinctIdsInTeamResponse\x12:\n\x07results\x18\x01 \x03(\x0b2).personhog.types.v1.PersonWithDistinctIds"\x96\x01\n\x1eGetPersonsByDistinctIdsRequest\x12=\n\x11team_distinct_ids\x18\x01 \x03(\x0b2".personhog.types.v1.TeamDistinctId\x125\n\x0cread_options\x18\x02 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"]\n\x1cPersonsByDistinctIdsResponse\x12=\n\x07results\x18\x01 \x03(\x0b2,.personhog.types.v1.PersonWithTeamDistinctId"\x99\x01\n\x1eGetDistinctIdsForPersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions\x12\x12\n\x05limit\x18\x04 \x01(\x03H\x00\x88\x01\x01B\x08\n\x06_limit"b\n\x1fGetDistinctIdsForPersonResponse\x12?\n\x0cdistinct_ids\x18\x01 \x03(\x0b2).personhog.types.v1.DistinctIdWithVersion"\xb1\x01\n\x1fGetDistinctIdsForPersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x12\n\nperson_ids\x18\x02 \x03(\x03\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions\x12\x1d\n\x10limit_per_person\x18\x04 \x01(\x03H\x00\x88\x01\x01B\x13\n\x11_limit_per_person"f\n GetDistinctIdsForPersonsResponse\x12B\n\x13person_distinct_ids\x18\x01 \x03(\x0b2%.personhog.types.v1.PersonDistinctIds"\xb9\x01\n\x1dUpdatePersonPropertiesRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x12\n\nevent_name\x18\x03 \x01(\t\x12\x16\n\x0eset_properties\x18\x04 \x01(\x0c\x12\x1b\n\x13set_once_properties\x18\x05 \x01(\x0c\x12\x18\n\x10unset_properties\x18\x06 \x03(\t\x12\x11\n\tpartition\x18\x07 \x01(\r"m\n\x1eUpdatePersonPropertiesResponse\x12/\n\x06person\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01\x12\x0f\n\x07updated\x18\x02 \x01(\x08B\t\n\x07_person"=\n\x14DeletePersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x14\n\x0cperson_uuids\x18\x02 \x03(\t".\n\x15DeletePersonsResponse\x12\x15\n\rdeleted_count\x18\x01 \x01(\x03"G\n DeletePersonsBatchForTeamRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x12\n\nbatch_size\x18\x02 \x01(\x03":\n!DeletePersonsBatchForTeamResponse\x12\x15\n\rdeleted_count\x18\x01 \x01(\x03"W\n\x12SplitPersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x1d\n\x15distinct_ids_to_split\x18\x03 \x03(\t"\x8e\x01\n\x0bSplitResult\x12\x13\n\x0bdistinct_id\x18\x01 \x01(\t\x12\x17\n\x0fnew_person_uuid\x18\x02 \x01(\t\x12\x1a\n\x12new_person_version\x18\x03 \x01(\x03\x12\x13\n\x0bpdi_version\x18\x04 \x01(\x03\x12 \n\x18new_person_created_at_ms\x18\x05 \x01(\x03"F\n\x13SplitPersonResponse\x12/\n\x06splits\x18\x01 \x03(\x0b2\x1f.personhog.types.v1.SplitResultb\x06proto3'
+ b'\n\x1fpersonhog/types/v1/person.proto\x12\x12personhog.types.v1\x1a\x1fpersonhog/types/v1/common.proto"\x9e\x02\n\x06Person\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x0c\n\x04uuid\x18\x02 \x01(\t\x12\x0f\n\x07team_id\x18\x03 \x01(\x03\x12\x12\n\nproperties\x18\x04 \x01(\x0c\x12"\n\x1aproperties_last_updated_at\x18\x05 \x01(\x0c\x12!\n\x19properties_last_operation\x18\x06 \x01(\x0c\x12\x12\n\ncreated_at\x18\x07 \x01(\x03\x12\x0f\n\x07version\x18\x08 \x01(\x03\x12\x15\n\ris_identified\x18\t \x01(\x08\x12\x17\n\nis_user_id\x18\n \x01(\x08H\x00\x88\x01\x01\x12\x19\n\x0clast_seen_at\x18\x0b \x01(\x03H\x01\x88\x01\x01B\r\n\x0b_is_user_idB\x0f\n\r_last_seen_at"N\n\x15DistinctIdWithVersion\x12\x13\n\x0bdistinct_id\x18\x01 \x01(\t\x12\x14\n\x07version\x18\x02 \x01(\x03H\x00\x88\x01\x01B\n\n\x08_version"h\n\x15PersonWithDistinctIds\x12\x13\n\x0bdistinct_id\x18\x01 \x01(\t\x12/\n\x06person\x18\x02 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01B\t\n\x07_person"g\n\x11PersonDistinctIds\x12\x11\n\tperson_id\x18\x01 \x01(\x03\x12?\n\x0cdistinct_ids\x18\x02 \x03(\x0b2).personhog.types.v1.DistinctIdWithVersion"\x87\x01\n\x18PersonWithTeamDistinctId\x12/\n\x03key\x18\x01 \x01(\x0b2".personhog.types.v1.TeamDistinctId\x12/\n\x06person\x18\x02 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01B\t\n\x07_person"m\n\x10GetPersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"O\n\x11GetPersonResponse\x12/\n\x06person\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01B\t\n\x07_person"o\n\x11GetPersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x12\n\nperson_ids\x18\x02 \x03(\x03\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"S\n\x0fPersonsResponse\x12+\n\x07persons\x18\x01 \x03(\x0b2\x1a.personhog.types.v1.Person\x12\x13\n\x0bmissing_ids\x18\x02 \x03(\x03"n\n\x16GetPersonByUuidRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x0c\n\x04uuid\x18\x02 \x01(\t\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"q\n\x18GetPersonsByUuidsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\r\n\x05uuids\x18\x02 \x03(\t\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"{\n\x1cGetPersonByDistinctIdRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x13\n\x0bdistinct_id\x18\x02 \x01(\t\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"\x84\x01\n$GetPersonsByDistinctIdsInTeamRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x14\n\x0cdistinct_ids\x18\x02 \x03(\t\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"`\n"PersonsByDistinctIdsInTeamResponse\x12:\n\x07results\x18\x01 \x03(\x0b2).personhog.types.v1.PersonWithDistinctIds"\x96\x01\n\x1eGetPersonsByDistinctIdsRequest\x12=\n\x11team_distinct_ids\x18\x01 \x03(\x0b2".personhog.types.v1.TeamDistinctId\x125\n\x0cread_options\x18\x02 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"]\n\x1cPersonsByDistinctIdsResponse\x12=\n\x07results\x18\x01 \x03(\x0b2,.personhog.types.v1.PersonWithTeamDistinctId"\x99\x01\n\x1eGetDistinctIdsForPersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions\x12\x12\n\x05limit\x18\x04 \x01(\x03H\x00\x88\x01\x01B\x08\n\x06_limit"b\n\x1fGetDistinctIdsForPersonResponse\x12?\n\x0cdistinct_ids\x18\x01 \x03(\x0b2).personhog.types.v1.DistinctIdWithVersion"\xb1\x01\n\x1fGetDistinctIdsForPersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x12\n\nperson_ids\x18\x02 \x03(\x03\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions\x12\x1d\n\x10limit_per_person\x18\x04 \x01(\x03H\x00\x88\x01\x01B\x13\n\x11_limit_per_person"f\n GetDistinctIdsForPersonsResponse\x12B\n\x13person_distinct_ids\x18\x01 \x03(\x0b2%.personhog.types.v1.PersonDistinctIds"\xb9\x01\n\x1dUpdatePersonPropertiesRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x12\n\nevent_name\x18\x03 \x01(\t\x12\x16\n\x0eset_properties\x18\x04 \x01(\x0c\x12\x1b\n\x13set_once_properties\x18\x05 \x01(\x0c\x12\x18\n\x10unset_properties\x18\x06 \x03(\t\x12\x11\n\tpartition\x18\x07 \x01(\r"m\n\x1eUpdatePersonPropertiesResponse\x12/\n\x06person\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01\x12\x0f\n\x07updated\x18\x02 \x01(\x08B\t\n\x07_person"=\n\x14DeletePersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x14\n\x0cperson_uuids\x18\x02 \x03(\t".\n\x15DeletePersonsResponse\x12\x15\n\rdeleted_count\x18\x01 \x01(\x03"G\n DeletePersonsBatchForTeamRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x12\n\nbatch_size\x18\x02 \x01(\x03":\n!DeletePersonsBatchForTeamResponse\x12\x15\n\rdeleted_count\x18\x01 \x01(\x03"U\n.DeletePersonlessDistinctIdsBatchForTeamRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x12\n\nbatch_size\x18\x02 \x01(\x03"H\n/DeletePersonlessDistinctIdsBatchForTeamResponse\x12\x15\n\rdeleted_count\x18\x01 \x01(\x03"W\n\x12SplitPersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x1d\n\x15distinct_ids_to_split\x18\x03 \x03(\t"\x8e\x01\n\x0bSplitResult\x12\x13\n\x0bdistinct_id\x18\x01 \x01(\t\x12\x17\n\x0fnew_person_uuid\x18\x02 \x01(\t\x12\x1a\n\x12new_person_version\x18\x03 \x01(\x03\x12\x13\n\x0bpdi_version\x18\x04 \x01(\x03\x12 \n\x18new_person_created_at_ms\x18\x05 \x01(\x03"F\n\x13SplitPersonResponse\x12/\n\x06splits\x18\x01 \x03(\x0b2\x1f.personhog.types.v1.SplitResultb\x06proto3'
)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -74,9 +74,13 @@ if not _descriptor._USE_C_DESCRIPTORS:
_globals["_DELETEPERSONSBATCHFORTEAMREQUEST"]._serialized_end = 3050
_globals["_DELETEPERSONSBATCHFORTEAMRESPONSE"]._serialized_start = 3052
_globals["_DELETEPERSONSBATCHFORTEAMRESPONSE"]._serialized_end = 3110
- _globals["_SPLITPERSONREQUEST"]._serialized_start = 3112
- _globals["_SPLITPERSONREQUEST"]._serialized_end = 3199
- _globals["_SPLITRESULT"]._serialized_start = 3202
- _globals["_SPLITRESULT"]._serialized_end = 3344
- _globals["_SPLITPERSONRESPONSE"]._serialized_start = 3346
- _globals["_SPLITPERSONRESPONSE"]._serialized_end = 3416
+ _globals["_DELETEPERSONLESSDISTINCTIDSBATCHFORTEAMREQUEST"]._serialized_start = 3112
+ _globals["_DELETEPERSONLESSDISTINCTIDSBATCHFORTEAMREQUEST"]._serialized_end = 3197
+ _globals["_DELETEPERSONLESSDISTINCTIDSBATCHFORTEAMRESPONSE"]._serialized_start = 3199
+ _globals["_DELETEPERSONLESSDISTINCTIDSBATCHFORTEAMRESPONSE"]._serialized_end = 3271
+ _globals["_SPLITPERSONREQUEST"]._serialized_start = 3273
+ _globals["_SPLITPERSONREQUEST"]._serialized_end = 3360
+ _globals["_SPLITRESULT"]._serialized_start = 3363
+ _globals["_SPLITRESULT"]._serialized_end = 3505
+ _globals["_SPLITPERSONRESPONSE"]._serialized_start = 3507
+ _globals["_SPLITPERSONRESPONSE"]._serialized_end = 3577
diff --git a/posthog/personhog_client/proto/generated/personhog/types/v1/person_pb2.pyi b/posthog/personhog_client/proto/generated/personhog/types/v1/person_pb2.pyi
index c2a716d3a5d2..a8b532382275 100644
--- a/posthog/personhog_client/proto/generated/personhog/types/v1/person_pb2.pyi
+++ b/posthog/personhog_client/proto/generated/personhog/types/v1/person_pb2.pyi
@@ -389,6 +389,22 @@ class DeletePersonsBatchForTeamResponse(_message.Message):
def __init__(self, deleted_count: _Optional[int] = ...) -> None: ...
+class DeletePersonlessDistinctIdsBatchForTeamRequest(_message.Message):
+ __slots__ = ("team_id", "batch_size")
+ TEAM_ID_FIELD_NUMBER: _ClassVar[int]
+ BATCH_SIZE_FIELD_NUMBER: _ClassVar[int]
+ team_id: int
+ batch_size: int
+
+ def __init__(self, team_id: _Optional[int] = ..., batch_size: _Optional[int] = ...) -> None: ...
+
+class DeletePersonlessDistinctIdsBatchForTeamResponse(_message.Message):
+ __slots__ = ("deleted_count",)
+ DELETED_COUNT_FIELD_NUMBER: _ClassVar[int]
+ deleted_count: int
+
+ def __init__(self, deleted_count: _Optional[int] = ...) -> None: ...
+
class SplitPersonRequest(_message.Message):
__slots__ = ("team_id", "person_id", "distinct_ids_to_split")
TEAM_ID_FIELD_NUMBER: _ClassVar[int]
diff --git a/proto/personhog/replica/v1/replica.proto b/proto/personhog/replica/v1/replica.proto
index 6588b20a4bbe..0ff9a3b9091b 100644
--- a/proto/personhog/replica/v1/replica.proto
+++ b/proto/personhog/replica/v1/replica.proto
@@ -64,6 +64,7 @@ service PersonHogReplica {
// Person deletes (temporary: should move to leader once it supports deletes)
rpc DeletePersons(personhog.types.v1.DeletePersonsRequest) returns (personhog.types.v1.DeletePersonsResponse);
rpc DeletePersonsBatchForTeam(personhog.types.v1.DeletePersonsBatchForTeamRequest) returns (personhog.types.v1.DeletePersonsBatchForTeamResponse);
+ rpc DeletePersonlessDistinctIdsBatchForTeam(personhog.types.v1.DeletePersonlessDistinctIdsBatchForTeamRequest) returns (personhog.types.v1.DeletePersonlessDistinctIdsBatchForTeamResponse);
// Person split (temporary: same routing caveat as deletes above)
rpc SplitPerson(personhog.types.v1.SplitPersonRequest) returns (personhog.types.v1.SplitPersonResponse);
diff --git a/proto/personhog/service/v1/service.proto b/proto/personhog/service/v1/service.proto
index 63c88cebaf96..076ecc08e1f6 100644
--- a/proto/personhog/service/v1/service.proto
+++ b/proto/personhog/service/v1/service.proto
@@ -72,6 +72,8 @@ service PersonHogService {
rpc DeletePersons(personhog.types.v1.DeletePersonsRequest) returns (personhog.types.v1.DeletePersonsResponse);
// WARNING: Same routing caveat as DeletePersons above.
rpc DeletePersonsBatchForTeam(personhog.types.v1.DeletePersonsBatchForTeamRequest) returns (personhog.types.v1.DeletePersonsBatchForTeamResponse);
+ // WARNING: Same routing caveat as DeletePersons above.
+ rpc DeletePersonlessDistinctIdsBatchForTeam(personhog.types.v1.DeletePersonlessDistinctIdsBatchForTeamRequest) returns (personhog.types.v1.DeletePersonlessDistinctIdsBatchForTeamResponse);
// Person split
// WARNING: Same routing caveat as DeletePersons above — write operation on person data
diff --git a/proto/personhog/types/v1/person.proto b/proto/personhog/types/v1/person.proto
index 61fd85c86926..6bbb82959493 100644
--- a/proto/personhog/types/v1/person.proto
+++ b/proto/personhog/types/v1/person.proto
@@ -183,6 +183,20 @@ message DeletePersonsBatchForTeamResponse {
int64 deleted_count = 1;
}
+// DeletePersonlessDistinctIdsBatchForTeamRequest deletes up to batch_size
+// posthog_personlessdistinctid rows for a team. These rows have no person FK, so
+// they aren't covered by person deletion. Callers should loop until deleted_count is 0.
+message DeletePersonlessDistinctIdsBatchForTeamRequest {
+ int64 team_id = 1;
+ // Max rows to delete per call. Must be > 0 and <= 50000.
+ int64 batch_size = 2;
+}
+
+message DeletePersonlessDistinctIdsBatchForTeamResponse {
+ // Number of rows deleted. 0 means no more rows to delete.
+ int64 deleted_count = 1;
+}
+
// SplitPersonRequest splits specific distinct_ids off of a person onto new persons.
// Each distinct_id gets a new person with a deterministic UUID (UUIDv5 from team_id:distinct_id).
// The operation is atomic per request: all splits succeed or none do.
diff --git a/rust/personhog-replica/.sqlx/query-fc5037764742e242ed6745972363081ad6f13f95c1631338deb54f30d8b018f0.json b/rust/personhog-replica/.sqlx/query-fc5037764742e242ed6745972363081ad6f13f95c1631338deb54f30d8b018f0.json
new file mode 100644
index 000000000000..c9c66dee552e
--- /dev/null
+++ b/rust/personhog-replica/.sqlx/query-fc5037764742e242ed6745972363081ad6f13f95c1631338deb54f30d8b018f0.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n DELETE FROM posthog_personlessdistinctid\n WHERE id IN (\n SELECT id FROM posthog_personlessdistinctid\n WHERE team_id = $1\n LIMIT $2\n FOR UPDATE SKIP LOCKED\n )\n ",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Int4",
+ "Int8"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "fc5037764742e242ed6745972363081ad6f13f95c1631338deb54f30d8b018f0"
+}
diff --git a/rust/personhog-replica/src/service/mod.rs b/rust/personhog-replica/src/service/mod.rs
index 5dc3820cb5ce..d19be6847073 100644
--- a/rust/personhog-replica/src/service/mod.rs
+++ b/rust/personhog-replica/src/service/mod.rs
@@ -19,15 +19,16 @@ use personhog_proto::personhog::types::v1::{
DeleteGroupTypeMappingsBatchForTeamRequest, DeleteGroupTypeMappingsBatchForTeamResponse,
DeleteGroupsBatchForTeamRequest, DeleteGroupsBatchForTeamResponse,
DeleteHashKeyOverridesByTeamsRequest, DeleteHashKeyOverridesByTeamsResponse,
- DeletePersonsBatchForTeamRequest, DeletePersonsBatchForTeamResponse, DeletePersonsRequest,
- DeletePersonsResponse, DistinctIdWithVersion, GetDistinctIdsForPersonRequest,
- GetDistinctIdsForPersonResponse, GetDistinctIdsForPersonsRequest,
- GetDistinctIdsForPersonsResponse, GetGroupRequest, GetGroupResponse,
- GetGroupTypeMappingByDashboardIdRequest, GetGroupTypeMappingByDashboardIdResponse,
- GetGroupTypeMappingsByProjectIdRequest, GetGroupTypeMappingsByProjectIdsRequest,
- GetGroupTypeMappingsByTeamIdRequest, GetGroupTypeMappingsByTeamIdsRequest,
- GetGroupsBatchRequest, GetGroupsBatchResponse, GetGroupsRequest,
- GetHashKeyOverrideContextRequest, GetHashKeyOverrideContextResponse,
+ DeletePersonlessDistinctIdsBatchForTeamRequest,
+ DeletePersonlessDistinctIdsBatchForTeamResponse, DeletePersonsBatchForTeamRequest,
+ DeletePersonsBatchForTeamResponse, DeletePersonsRequest, DeletePersonsResponse,
+ DistinctIdWithVersion, GetDistinctIdsForPersonRequest, GetDistinctIdsForPersonResponse,
+ GetDistinctIdsForPersonsRequest, GetDistinctIdsForPersonsResponse, GetGroupRequest,
+ GetGroupResponse, GetGroupTypeMappingByDashboardIdRequest,
+ GetGroupTypeMappingByDashboardIdResponse, GetGroupTypeMappingsByProjectIdRequest,
+ GetGroupTypeMappingsByProjectIdsRequest, GetGroupTypeMappingsByTeamIdRequest,
+ GetGroupTypeMappingsByTeamIdsRequest, GetGroupsBatchRequest, GetGroupsBatchResponse,
+ GetGroupsRequest, GetHashKeyOverrideContextRequest, GetHashKeyOverrideContextResponse,
GetPersonByDistinctIdRequest, GetPersonByUuidRequest, GetPersonRequest, GetPersonResponse,
GetPersonsByDistinctIdsInTeamRequest, GetPersonsByDistinctIdsRequest, GetPersonsByUuidsRequest,
GetPersonsRequest, GroupKey, GroupTypeMapping, GroupTypeMappingCount,
@@ -406,6 +407,31 @@ impl PersonHogReplica for PersonHogReplicaService {
Ok(Response::new(DeletePersonsResponse { deleted_count }))
}
+ async fn delete_personless_distinct_ids_batch_for_team(
+ &self,
+ request: Request<DeletePersonlessDistinctIdsBatchForTeamRequest>,
+ ) -> Result<Response<DeletePersonlessDistinctIdsBatchForTeamResponse>, Status> {
+ let req = request.into_inner();
+
+ if req.batch_size <= 0 || req.batch_size > MAX_BATCH_DELETE_SIZE {
+ return Err(Status::invalid_argument(format!(
+ "batch_size must be between 1 and {MAX_BATCH_DELETE_SIZE}"
+ )));
+ }
+
+ let deleted_count = self
+ .storage
+ .delete_personless_distinct_ids_batch_for_team(req.team_id, req.batch_size)
+ .await
+ .map_err(|e| {
+ log_and_convert_error(e, "delete_personless_distinct_ids_batch_for_team")
+ })?;
+
+ Ok(Response::new(
+ DeletePersonlessDistinctIdsBatchForTeamResponse { deleted_count },
+ ))
+ }
+
async fn delete_persons_batch_for_team(
&self,
request: Request<DeletePersonsBatchForTeamRequest>,
diff --git a/rust/personhog-replica/src/service/tests/mocks.rs b/rust/personhog-replica/src/service/tests/mocks.rs
index acd80a445538..54b8cc5cdf1e 100644
--- a/rust/personhog-replica/src/service/tests/mocks.rs
+++ b/rust/personhog-replica/src/service/tests/mocks.rs
@@ -103,6 +103,14 @@ impl storage::PersonLookup for FailingStorage {
Err(self.error.clone())
}
+ async fn delete_personless_distinct_ids_batch_for_team(
+ &self,
+ _team_id: i64,
+ _batch_size: i64,
+ ) -> storage::StorageResult<i64> {
+ Err(self.error.clone())
+ }
+
async fn split_person(
&self,
_team_id: i64,
@@ -458,6 +466,14 @@ impl storage::PersonLookup for SuccessStorage {
Ok(0)
}
+ async fn delete_personless_distinct_ids_batch_for_team(
+ &self,
+ _team_id: i64,
+ _batch_size: i64,
+ ) -> storage::StorageResult<i64> {
+ Ok(0)
+ }
+
async fn split_person(
&self,
_team_id: i64,
@@ -872,6 +888,14 @@ impl storage::PersonLookup for PopulatedStorage {
Ok(0)
}
+ async fn delete_personless_distinct_ids_batch_for_team(
+ &self,
+ _team_id: i64,
+ _batch_size: i64,
+ ) -> storage::StorageResult<i64> {
+ Ok(0)
+ }
+
async fn split_person(
&self,
_team_id: i64,
@@ -1262,6 +1286,14 @@ impl storage::PersonLookup for ConsistencyTrackingStorage {
Ok(0)
}
+ async fn delete_personless_distinct_ids_batch_for_team(
+ &self,
+ _team_id: i64,
+ _batch_size: i64,
+ ) -> storage::StorageResult<i64> {
+ Ok(0)
+ }
+
async fn split_person(
&self,
_team_id: i64,
diff --git a/rust/personhog-replica/src/storage/postgres/person.rs b/rust/personhog-replica/src/storage/postgres/person.rs
index 5ccdb4e15a1a..a9f84776e88f 100644
--- a/rust/personhog-replica/src/storage/postgres/person.rs
+++ b/rust/personhog-replica/src/storage/postgres/person.rs
@@ -472,6 +472,61 @@ impl PersonLookup for PostgresStorage {
Ok(results.iter().sum())
}
+ async fn delete_personless_distinct_ids_batch_for_team(
+ &self,
+ team_id: i64,
+ batch_size: i64,
+ ) -> StorageResult<i64> {
+ if batch_size <= 0 {
+ return Ok(0);
+ }
+
+ let client = current_client_name();
+ let method = current_method_name();
+ let labels = [
+ (
+ "operation".to_string(),
+ "delete_personless_distinct_ids_batch_for_team".to_string(),
+ ),
+ ("pool".to_string(), "bulk_primary".to_string()),
+ ("client".to_string(), client.to_string()),
+ ("method".to_string(), method.to_string()),
+ ];
+ let _timer = common_metrics::timing_guard(DB_QUERY_DURATION, &labels);
+
+ let result = sqlx::query!(
+ r#"
+ DELETE FROM posthog_personlessdistinctid
+ WHERE id IN (
+ SELECT id FROM posthog_personlessdistinctid
+ WHERE team_id = $1
+ LIMIT $2
+ FOR UPDATE SKIP LOCKED
+ )
+ "#,
+ team_id as i32,
+ batch_size
+ )
+ .execute(&self.bulk_primary_pool)
+ .await?;
+
+ common_metrics::histogram(
+ DB_ROWS_RETURNED,
+ &[
+ (
+ "operation".to_string(),
+ "delete_personless_distinct_ids_batch_for_team".to_string(),
+ ),
+ ("pool".to_string(), "bulk_primary".to_string()),
+ ("client".to_string(), client.to_string()),
+ ("method".to_string(), method.to_string()),
+ ],
+ result.rows_affected() as f64,
+ );
+
+ Ok(result.rows_affected() as i64)
+ }
+
async fn delete_persons_batch_for_team(
&self,
team_id: i64,
diff --git a/rust/personhog-replica/src/storage/traits/person.rs b/rust/personhog-replica/src/storage/traits/person.rs
index 99602d6c3d77..30187d1f9511 100644
--- a/rust/personhog-replica/src/storage/traits/person.rs
+++ b/rust/personhog-replica/src/storage/traits/person.rs
@@ -70,6 +70,15 @@ pub trait PersonLookup: Send + Sync {
batch_size: i64,
) -> StorageResult<i64>;
+ /// Delete up to `batch_size` posthog_personlessdistinctid rows for a team.
+ /// These rows have no person FK, so they aren't covered by person deletion.
+ /// Returns the number of deleted rows; 0 means no more rows to delete.
+ async fn delete_personless_distinct_ids_batch_for_team(
+ &self,
+ team_id: i64,
+ batch_size: i64,
+ ) -> StorageResult<i64>;
+
/// Atomically split distinct_ids off a person onto new persons.
///
/// Within a single transaction (constant statement count, set-based):
diff --git a/rust/personhog-replica/tests/common/mod.rs b/rust/personhog-replica/tests/common/mod.rs
index 2841bc404af1..595beeca7cb7 100644
--- a/rust/personhog-replica/tests/common/mod.rs
+++ b/rust/personhog-replica/tests/common/mod.rs
@@ -218,12 +218,35 @@ impl TestContext {
Ok(())
}
+ pub async fn insert_personless_distinct_id(
+ &self,
+ distinct_id: &str,
+ ) -> Result<(), sqlx::Error> {
+ sqlx::query(
+ r#"INSERT INTO posthog_personlessdistinctid
+ (distinct_id, team_id, is_merged, created_at)
+ VALUES ($1, $2, false, NOW())
+ ON CONFLICT DO NOTHING"#,
+ )
+ .bind(distinct_id)
+ .bind(self.team_id)
+ .execute(&self.pool)
+ .await?;
+
+ Ok(())
+ }
+
pub async fn cleanup(&self) -> Result<(), sqlx::Error> {
sqlx::query("DELETE FROM posthog_featureflaghashkeyoverride WHERE team_id = $1")
.bind(self.team_id)
.execute(&self.pool)
.await?;
+ sqlx::query("DELETE FROM posthog_personlessdistinctid WHERE team_id = $1")
+ .bind(self.team_id)
+ .execute(&self.pool)
+ .await?;
+
sqlx::query(
"DELETE FROM posthog_cohortpeople WHERE person_id IN (SELECT id FROM posthog_person WHERE team_id = $1)",
)
diff --git a/rust/personhog-replica/tests/service_tests.rs b/rust/personhog-replica/tests/service_tests.rs
index 2083961c9dcf..6d3b76a0459a 100644
--- a/rust/personhog-replica/tests/service_tests.rs
+++ b/rust/personhog-replica/tests/service_tests.rs
@@ -4,15 +4,15 @@ use common::TestContext;
use personhog_proto::personhog::replica::v1::person_hog_replica_server::PersonHogReplica;
use personhog_proto::personhog::types::v1::{
CheckCohortMembershipRequest, CountGroupTypeMappingsRequest,
- DeleteHashKeyOverridesByTeamsRequest, DeletePersonsBatchForTeamRequest,
- GetDistinctIdsForPersonRequest, GetDistinctIdsForPersonsRequest, GetGroupRequest,
- GetGroupTypeMappingsByProjectIdRequest, GetGroupTypeMappingsByProjectIdsRequest,
- GetGroupTypeMappingsByTeamIdRequest, GetGroupTypeMappingsByTeamIdsRequest,
- GetGroupsBatchRequest, GetGroupsRequest, GetHashKeyOverrideContextRequest,
- GetPersonByDistinctIdRequest, GetPersonByUuidRequest, GetPersonRequest,
- GetPersonsByDistinctIdsInTeamRequest, GetPersonsByDistinctIdsRequest, GetPersonsByUuidsRequest,
- GetPersonsRequest, GroupIdentifier, GroupKey, SplitPersonRequest, TeamDistinctId,
- UpsertHashKeyOverridesRequest,
+ DeleteHashKeyOverridesByTeamsRequest, DeletePersonlessDistinctIdsBatchForTeamRequest,
+ DeletePersonsBatchForTeamRequest, GetDistinctIdsForPersonRequest,
+ GetDistinctIdsForPersonsRequest, GetGroupRequest, GetGroupTypeMappingsByProjectIdRequest,
+ GetGroupTypeMappingsByProjectIdsRequest, GetGroupTypeMappingsByTeamIdRequest,
+ GetGroupTypeMappingsByTeamIdsRequest, GetGroupsBatchRequest, GetGroupsRequest,
+ GetHashKeyOverrideContextRequest, GetPersonByDistinctIdRequest, GetPersonByUuidRequest,
+ GetPersonRequest, GetPersonsByDistinctIdsInTeamRequest, GetPersonsByDistinctIdsRequest,
+ GetPersonsByUuidsRequest, GetPersonsRequest, GroupIdentifier, GroupKey, SplitPersonRequest,
+ TeamDistinctId, UpsertHashKeyOverridesRequest,
};
use personhog_replica::service::PersonHogReplicaService;
use rstest::rstest;
@@ -1261,6 +1261,82 @@ async fn test_delete_persons_batch_for_team_invalid_batch_size(#[case] batch_siz
ctx.cleanup().await.ok();
}
+#[tokio::test]
+async fn test_delete_personless_distinct_ids_batch_for_team() {
+ let ctx = ServiceTestContext::new().await;
+ ctx.insert_personless_distinct_id("svc_personless_1")
+ .await
+ .unwrap();
+ ctx.insert_personless_distinct_id("svc_personless_2")
+ .await
+ .unwrap();
+
+ let response = ctx
+ .service
+ .delete_personless_distinct_ids_batch_for_team(Request::new(
+ DeletePersonlessDistinctIdsBatchForTeamRequest {
+ team_id: ctx.team_id,
+ batch_size: 1,
+ },
+ ))
+ .await
+ .expect("RPC failed");
+ assert_eq!(response.into_inner().deleted_count, 1);
+
+ let response = ctx
+ .service
+ .delete_personless_distinct_ids_batch_for_team(Request::new(
+ DeletePersonlessDistinctIdsBatchForTeamRequest {
+ team_id: ctx.team_id,
+ batch_size: 100,
+ },
+ ))
+ .await
+ .expect("RPC failed");
+ assert_eq!(response.into_inner().deleted_count, 1);
+
+ let response = ctx
+ .service
+ .delete_personless_distinct_ids_batch_for_team(Request::new(
+ DeletePersonlessDistinctIdsBatchForTeamRequest {
+ team_id: ctx.team_id,
+ batch_size: 100,
+ },
+ ))
+ .await
+ .expect("RPC failed");
+ assert_eq!(response.into_inner().deleted_count, 0);
+
+ ctx.cleanup().await.ok();
+}
+
+#[rstest]
+#[case::zero(0)]
+#[case::negative(-1)]
+#[case::exceeds_max(50001)]
+#[tokio::test]
+async fn test_delete_personless_distinct_ids_batch_for_team_invalid_batch_size(
+ #[case] batch_size: i64,
+) {
+ let ctx = ServiceTestContext::new().await;
+
+ let result = ctx
+ .service
+ .delete_personless_distinct_ids_batch_for_team(Request::new(
+ DeletePersonlessDistinctIdsBatchForTeamRequest {
+ team_id: ctx.team_id,
+ batch_size,
+ },
+ ))
+ .await;
+
+ let status = result.unwrap_err();
+ assert_eq!(status.code(), tonic::Code::InvalidArgument);
+ assert!(status.message().contains("batch_size"));
+
+ ctx.cleanup().await.ok();
+}
+
#[rstest]
#[case::exceeds_max((0..251).map(|i| format!("did_{i}")).collect(), "Maximum")]
#[case::duplicates(vec!["[email protected]".to_string(), "[email protected]".to_string()], "Duplicate")]
diff --git a/rust/personhog-replica/tests/storage_tests.rs b/rust/personhog-replica/tests/storage_tests.rs
index cbeaea45ccdb..8ddfe0f62037 100644
--- a/rust/personhog-replica/tests/storage_tests.rs
+++ b/rust/personhog-replica/tests/storage_tests.rs
@@ -1203,6 +1203,130 @@ async fn test_delete_persons_batch_for_team_cross_team_isolation() {
ctx.cleanup().await.ok();
}
+// ============================================================
+// Delete personless distinct IDs batch for team tests
+// ============================================================
+
+#[tokio::test]
+async fn test_delete_personless_distinct_ids_batch_for_team() {
+ let ctx = TestContext::new().await;
+
+ ctx.insert_personless_distinct_id("personless_1")
+ .await
+ .unwrap();
+ ctx.insert_personless_distinct_id("personless_2")
+ .await
+ .unwrap();
+ ctx.insert_personless_distinct_id("personless_3")
+ .await
+ .unwrap();
+
+ // batch_size=2 deletes 2 of the 3 rows.
+ let deleted = ctx
+ .storage
+ .delete_personless_distinct_ids_batch_for_team(ctx.team_id, 2)
+ .await
+ .expect("Failed to delete personless distinct IDs batch");
+ assert_eq!(deleted, 2);
+
+ // The remaining row is deleted next.
+ let deleted = ctx
+ .storage
+ .delete_personless_distinct_ids_batch_for_team(ctx.team_id, 2)
+ .await
+ .expect("Failed to delete personless distinct IDs batch");
+ assert_eq!(deleted, 1);
+
+ // Nothing left.
+ let deleted = ctx
+ .storage
+ .delete_personless_distinct_ids_batch_for_team(ctx.team_id, 2)
+ .await
+ .expect("Failed to delete personless distinct IDs batch");
+ assert_eq!(deleted, 0);
+
+ ctx.cleanup().await.ok();
+}
+
+#[tokio::test]
+async fn test_delete_personless_distinct_ids_batch_for_team_empty() {
+ let ctx = TestContext::new().await;
+
+ let deleted = ctx
+ .storage
+ .delete_personless_distinct_ids_batch_for_team(ctx.team_id, 1000)
+ .await
+ .expect("Failed to delete personless distinct IDs batch");
+ assert_eq!(deleted, 0);
+
+ ctx.cleanup().await.ok();
+}
+
+#[tokio::test]
+async fn test_delete_personless_distinct_ids_batch_for_team_cross_team_isolation() {
+ let ctx = TestContext::new().await;
+
+ ctx.insert_personless_distinct_id("team_a_personless")
+ .await
+ .unwrap();
+
+ // Insert a personless distinct ID for a different team directly.
+ let other_team_id = ctx.team_id + 1;
+ sqlx::query(
+ r#"INSERT INTO posthog_personlessdistinctid
+ (distinct_id, team_id, is_merged, created_at)
+ VALUES ($1, $2, false, NOW())
+ ON CONFLICT DO NOTHING"#,
+ )
+ .bind("team_b_personless")
+ .bind(other_team_id)
+ .execute(&ctx.pool)
+ .await
+ .unwrap();
+
+ let deleted = ctx
+ .storage
+ .delete_personless_distinct_ids_batch_for_team(ctx.team_id, 1000)
+ .await
+ .expect("Failed to delete personless distinct IDs batch");
+ assert_eq!(deleted, 1);
+
+ // The other team's row should remain.
+ let remaining: i64 =
+ sqlx::query_scalar("SELECT COUNT(*) FROM posthog_personlessdistinctid WHERE team_id = $1")
+ .bind(other_team_id)
+ .fetch_one(&ctx.pool)
+ .await
+ .unwrap();
+ assert_eq!(remaining, 1);
+
+ sqlx::query("DELETE FROM posthog_personlessdistinctid WHERE team_id = $1")
+ .bind(other_team_id)
+ .execute(&ctx.pool)
+ .await
+ .ok();
+ ctx.cleanup().await.ok();
+}
+
+#[tokio::test]
+async fn test_delete_personless_distinct_ids_batch_for_team_zero_batch_size() {
+ let ctx = TestContext::new().await;
+
+ ctx.insert_personless_distinct_id("personless_zero")
+ .await
+ .unwrap();
+
+ // A non-positive batch size deletes nothing.
+ let deleted = ctx
+ .storage
+ .delete_personless_distinct_ids_batch_for_team(ctx.team_id, 0)
+ .await
+ .expect("Failed to delete personless distinct IDs batch");
+ assert_eq!(deleted, 0);
+
+ ctx.cleanup().await.ok();
+}
+
#[tokio::test]
async fn test_delete_persons_batch_for_team_rolls_back_on_partial_failure() {
let ctx = TestContext::new().await;
diff --git a/rust/personhog-router/src/backend/mod.rs b/rust/personhog-router/src/backend/mod.rs
index dc0fa7683da5..274caade50ef 100644
--- a/rust/personhog-router/src/backend/mod.rs
+++ b/rust/personhog-router/src/backend/mod.rs
@@ -17,7 +17,8 @@ use personhog_proto::personhog::types::v1::{
DeleteGroupTypeMappingResponse, DeleteGroupTypeMappingsBatchForTeamRequest,
DeleteGroupTypeMappingsBatchForTeamResponse, DeleteGroupsBatchForTeamRequest,
DeleteGroupsBatchForTeamResponse, DeleteHashKeyOverridesByTeamsRequest,
- DeleteHashKeyOverridesByTeamsResponse, DeletePersonsBatchForTeamRequest,
+ DeleteHashKeyOverridesByTeamsResponse, DeletePersonlessDistinctIdsBatchForTeamRequest,
+ DeletePersonlessDistinctIdsBatchForTeamResponse, DeletePersonsBatchForTeamRequest,
DeletePersonsBatchForTeamResponse, DeletePersonsRequest, DeletePersonsResponse,
GetDistinctIdsForPersonRequest, GetDistinctIdsForPersonResponse,
GetDistinctIdsForPersonsRequest, GetDistinctIdsForPersonsResponse, GetGroupRequest,
@@ -112,6 +113,10 @@ pub trait PersonHogBackend: Send + Sync {
&self,
request: DeletePersonsBatchForTeamRequest,
) -> Result<DeletePersonsBatchForTeamResponse, Status>;
+ async fn delete_personless_distinct_ids_batch_for_team(
+ &self,
+ request: DeletePersonlessDistinctIdsBatchForTeamRequest,
+ ) -> Result<DeletePersonlessDistinctIdsBatchForTeamResponse, Status>;
// Person split
async fn split_person(
diff --git a/rust/personhog-router/src/backend/replica.rs b/rust/personhog-router/src/backend/replica.rs
index b8593f1d1871..ea8e4c976d5a 100644
--- a/rust/personhog-router/src/backend/replica.rs
+++ b/rust/personhog-router/src/backend/replica.rs
@@ -10,7 +10,8 @@ use personhog_proto::personhog::types::v1::{
DeleteGroupTypeMappingResponse, DeleteGroupTypeMappingsBatchForTeamRequest,
DeleteGroupTypeMappingsBatchForTeamResponse, DeleteGroupsBatchForTeamRequest,
DeleteGroupsBatchForTeamResponse, DeleteHashKeyOverridesByTeamsRequest,
- DeleteHashKeyOverridesByTeamsResponse, DeletePersonsBatchForTeamRequest,
+ DeleteHashKeyOverridesByTeamsResponse, DeletePersonlessDistinctIdsBatchForTeamRequest,
+ DeletePersonlessDistinctIdsBatchForTeamResponse, DeletePersonsBatchForTeamRequest,
DeletePersonsBatchForTeamResponse, DeletePersonsRequest, DeletePersonsResponse,
GetDistinctIdsForPersonRequest, GetDistinctIdsForPersonResponse,
GetDistinctIdsForPersonsRequest, GetDistinctIdsForPersonsResponse, GetGroupRequest,
@@ -279,6 +280,13 @@ impl PersonHogBackend for ReplicaBackend {
retry_call!(self, delete_persons_batch_for_team, request)
}
+ async fn delete_personless_distinct_ids_batch_for_team(
+ &self,
+ request: DeletePersonlessDistinctIdsBatchForTeamRequest,
+ ) -> Result<DeletePersonlessDistinctIdsBatchForTeamResponse, Status> {
+ retry_call!(self, delete_personless_distinct_ids_batch_for_team, request)
+ }
+
async fn split_person(
&self,
request: SplitPersonRequest,
diff --git a/rust/personhog-router/src/proxy.rs b/rust/personhog-router/src/proxy.rs
index 91c8617247d4..b21f31552b6e 100644
--- a/rust/personhog-router/src/proxy.rs
+++ b/rust/personhog-router/src/proxy.rs
@@ -37,6 +37,7 @@ pub const KNOWN_METHODS: &[&str] = &[
"DeleteGroupTypeMappingsBatchForTeam",
"DeleteGroupsBatchForTeam",
"DeleteHashKeyOverridesByTeams",
+ "DeletePersonlessDistinctIdsBatchForTeam",
"DeletePersons",
"DeletePersonsBatchForTeam",
"GetDistinctIdsForPerson",
diff --git a/rust/personhog-router/src/router/mod.rs b/rust/personhog-router/src/router/mod.rs
index b047a4fd9f9b..4ae84294f6e0 100644
--- a/rust/personhog-router/src/router/mod.rs
+++ b/rust/personhog-router/src/router/mod.rs
@@ -15,7 +15,8 @@ use personhog_proto::personhog::types::v1::{
DeleteGroupTypeMappingResponse, DeleteGroupTypeMappingsBatchForTeamRequest,
DeleteGroupTypeMappingsBatchForTeamResponse, DeleteGroupsBatchForTeamRequest,
DeleteGroupsBatchForTeamResponse, DeleteHashKeyOverridesByTeamsRequest,
- DeleteHashKeyOverridesByTeamsResponse, DeletePersonsBatchForTeamRequest,
+ DeleteHashKeyOverridesByTeamsResponse, DeletePersonlessDistinctIdsBatchForTeamRequest,
+ DeletePersonlessDistinctIdsBatchForTeamResponse, DeletePersonsBatchForTeamRequest,
DeletePersonsBatchForTeamResponse, DeletePersonsRequest, DeletePersonsResponse,
GetDistinctIdsForPersonRequest, GetDistinctIdsForPersonResponse,
GetDistinctIdsForPersonsRequest, GetDistinctIdsForPersonsResponse, GetGroupRequest,
@@ -611,6 +612,21 @@ impl PersonHogRouter {
)
}
+ /// Delete a batch of personless distinct IDs for a team.
+ ///
+ /// WARNING: Same routing caveat as delete_persons above.
+ pub async fn delete_personless_distinct_ids_batch_for_team(
+ &self,
+ request: DeletePersonlessDistinctIdsBatchForTeamRequest,
+ ) -> Result<DeletePersonlessDistinctIdsBatchForTeamResponse, Status> {
+ call_backend!(
+ self,
+ "DeletePersonlessDistinctIdsBatchForTeam",
+ delete_personless_distinct_ids_batch_for_team,
+ request
+ )
+ }
+
/// Split distinct_ids off a person onto new persons.
///
/// WARNING: Same routing caveat as delete_persons above — write operation on
diff --git a/rust/personhog-router/src/service/mod.rs b/rust/personhog-router/src/service/mod.rs
index 5632781ed50d..904318cfedfa 100644
--- a/rust/personhog-router/src/service/mod.rs
+++ b/rust/personhog-router/src/service/mod.rs
@@ -12,7 +12,8 @@ use personhog_proto::personhog::types::v1::{
DeleteGroupTypeMappingResponse, DeleteGroupTypeMappingsBatchForTeamRequest,
DeleteGroupTypeMappingsBatchForTeamResponse, DeleteGroupsBatchForTeamRequest,
DeleteGroupsBatchForTeamResponse, DeleteHashKeyOverridesByTeamsRequest,
- DeleteHashKeyOverridesByTeamsResponse, DeletePersonsBatchForTeamRequest,
+ DeleteHashKeyOverridesByTeamsResponse, DeletePersonlessDistinctIdsBatchForTeamRequest,
+ DeletePersonlessDistinctIdsBatchForTeamResponse, DeletePersonsBatchForTeamRequest,
DeletePersonsBatchForTeamResponse, DeletePersonsRequest, DeletePersonsResponse,
GetDistinctIdsForPersonRequest, GetDistinctIdsForPersonResponse,
GetDistinctIdsForPersonsRequest, GetDistinctIdsForPersonsResponse, GetGroupRequest,
@@ -338,6 +339,13 @@ impl PersonHogService for PersonHogRouterService {
route_request!(self, delete_persons_batch_for_team, request)
}
+ async fn delete_personless_distinct_ids_batch_for_team(
+ &self,
+ request: Request<DeletePersonlessDistinctIdsBatchForTeamRequest>,
+ ) -> Result<Response<DeletePersonlessDistinctIdsBatchForTeamResponse>, Status> {
+ route_request!(self, delete_personless_distinct_ids_batch_for_team, request)
+ }
+
// Person split
async fn split_person(
diff --git a/rust/personhog-router/src/service/tests/mocks.rs b/rust/personhog-router/src/service/tests/mocks.rs
index 2f0efd2e6a34..3b6fe3aef375 100644
--- a/rust/personhog-router/src/service/tests/mocks.rs
+++ b/rust/personhog-router/src/service/tests/mocks.rs
@@ -7,7 +7,8 @@ use personhog_proto::personhog::types::v1::{
DeleteGroupTypeMappingResponse, DeleteGroupTypeMappingsBatchForTeamRequest,
DeleteGroupTypeMappingsBatchForTeamResponse, DeleteGroupsBatchForTeamRequest,
DeleteGroupsBatchForTeamResponse, DeleteHashKeyOverridesByTeamsRequest,
- DeleteHashKeyOverridesByTeamsResponse, DeletePersonsBatchForTeamRequest,
+ DeleteHashKeyOverridesByTeamsResponse, DeletePersonlessDistinctIdsBatchForTeamRequest,
+ DeletePersonlessDistinctIdsBatchForTeamResponse, DeletePersonsBatchForTeamRequest,
DeletePersonsBatchForTeamResponse, DeletePersonsRequest, DeletePersonsResponse,
GetDistinctIdsForPersonRequest, GetDistinctIdsForPersonResponse,
GetDistinctIdsForPersonsRequest, GetDistinctIdsForPersonsResponse, GetGroupRequest,
@@ -185,6 +186,14 @@ impl PersonHogBackend for MockBackend {
Ok(DeletePersonsBatchForTeamResponse { deleted_count: 0 })
}
+ async fn delete_personless_distinct_ids_batch_for_team(
+ &self,
+ _request: DeletePersonlessDistinctIdsBatchForTeamRequest,
+ ) -> Result<DeletePersonlessDistinctIdsBatchForTeamResponse, Status> {
+ self.check_error()?;
+ Ok(DeletePersonlessDistinctIdsBatchForTeamResponse { deleted_count: 0 })
+ }
+
async fn check_cohort_membership(
&self,
_request: CheckCohortMembershipRequest,
diff --git a/rust/personhog-router/tests/common/mod.rs b/rust/personhog-router/tests/common/mod.rs
index c6fee441861b..227b4537cd3c 100644
--- a/rust/personhog-router/tests/common/mod.rs
+++ b/rust/personhog-router/tests/common/mod.rs
@@ -24,7 +24,8 @@ use personhog_proto::personhog::types::v1::{
DeleteGroupTypeMappingResponse, DeleteGroupTypeMappingsBatchForTeamRequest,
DeleteGroupTypeMappingsBatchForTeamResponse, DeleteGroupsBatchForTeamRequest,
DeleteGroupsBatchForTeamResponse, DeleteHashKeyOverridesByTeamsRequest,
- DeleteHashKeyOverridesByTeamsResponse, DeletePersonsBatchForTeamRequest,
+ DeleteHashKeyOverridesByTeamsResponse, DeletePersonlessDistinctIdsBatchForTeamRequest,
+ DeletePersonlessDistinctIdsBatchForTeamResponse, DeletePersonsBatchForTeamRequest,
DeletePersonsBatchForTeamResponse, DeletePersonsRequest, DeletePersonsResponse,
GetDistinctIdsForPersonRequest, GetDistinctIdsForPersonResponse,
GetDistinctIdsForPersonsRequest, GetDistinctIdsForPersonsResponse, GetGroupRequest,
@@ -447,6 +448,15 @@ impl PersonHogReplica for TestReplicaService {
}))
}
+ async fn delete_personless_distinct_ids_batch_for_team(
+ &self,
+ _request: Request<DeletePersonlessDistinctIdsBatchForTeamRequest>,
+ ) -> Result<Response<DeletePersonlessDistinctIdsBatchForTeamResponse>, Status> {
+ Ok(Response::new(
+ DeletePersonlessDistinctIdsBatchForTeamResponse { deleted_count: 0 },
+ ))
+ }
+
async fn split_person(
&self,
_request: Request<SplitPersonRequest>,
diff --git a/rust/property-defs-rs/tests/group_type_resolver.rs b/rust/property-defs-rs/tests/group_type_resolver.rs
index a71a31f52c5c..ca8b52d699c0 100644
--- a/rust/property-defs-rs/tests/group_type_resolver.rs
+++ b/rust/property-defs-rs/tests/group_type_resolver.rs
@@ -275,6 +275,12 @@ impl PersonHogService for MockPersonHogService {
) -> Result<Response<DeletePersonsBatchForTeamResponse>, Status> {
Err(Status::unimplemented(""))
}
+ async fn delete_personless_distinct_ids_batch_for_team(
+ &self,
+ _: Request<DeletePersonlessDistinctIdsBatchForTeamRequest>,
+ ) -> Result<Response<DeletePersonlessDistinctIdsBatchForTeamResponse>, Status> {
+ Err(Status::unimplemented(""))
+ }
async fn get_group_type_mapping_by_dashboard_id(
&self,
_: Request<GetGroupTypeMappingByDashboardIdRequest>,