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): split person rpc (#61950)

Nick Beste9ae6c4801b2
diff --git a/nodejs/src/generated/personhog/personhog/service/v1/service_pb.ts b/nodejs/src/generated/personhog/personhog/service/v1/service_pb.ts
index 4ce801ecea05..d58a4cfedfe9 100644
--- a/nodejs/src/generated/personhog/personhog/service/v1/service_pb.ts
+++ b/nodejs/src/generated/personhog/personhog/service/v1/service_pb.ts
@@ -80,6 +80,8 @@ import type {
PersonsByDistinctIdsInTeamResponseSchema,
PersonsByDistinctIdsResponseSchema,
PersonsResponseSchema,
+ SplitPersonRequestSchema,
+ SplitPersonResponseSchema,
UpdatePersonPropertiesRequestSchema,
UpdatePersonPropertiesResponseSchema,
} from '../../types/v1/person_pb'
@@ -91,7 +93,7 @@ import { file_personhog_types_v1_person } from '../../types/v1/person_pb'
export const file_personhog_service_v1_service: GenFile =
/*@__PURE__*/
fileDesc(
- 'CiJwZXJzb25ob2cvc2VydmljZS92MS9zZXJ2aWNlLnByb3RvEhRwZXJzb25ob2cuc2VydmljZS52MTLbIwoQUGVyc29uSG9nU2VydmljZRJYCglHZXRQZXJzb24SJC5wZXJzb25ob2cudHlwZXMudjEuR2V0UGVyc29uUmVxdWVzdBolLnBlcnNvbmhvZy50eXBlcy52MS5HZXRQZXJzb25SZXNwb25zZRJYCgpHZXRQZXJzb25zEiUucGVyc29uaG9nLnR5cGVzLnYxLkdldFBlcnNvbnNSZXF1ZXN0GiMucGVyc29uaG9nLnR5cGVzLnYxLlBlcnNvbnNSZXNwb25zZRJkCg9HZXRQZXJzb25CeVV1aWQSKi5wZXJzb25ob2cudHlwZXMudjEuR2V0UGVyc29uQnlVdWlkUmVxdWVzdBolLnBlcnNvbmhvZy50eXBlcy52MS5HZXRQZXJzb25SZXNwb25zZRJmChFHZ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QaNS5wZXJzb25ob2cudHlwZXMudjEuRGVsZXRlUGVyc29uc0JhdGNoRm9yVGVhbVJlc3BvbnNlEl4KC1NwbGl0UGVyc29uEiYucGVyc29uaG9nLnR5cGVzLnYxLlNwbGl0UGVyc29uUmVxdWVzdBonLnBlcnNvbmhvZy50eXBlcy52MS5TcGxpdFBlcnNvblJlc3BvbnNlYgZwcm90bzM',
[
file_personhog_types_v1_person,
file_personhog_types_v1_group,
@@ -431,4 +433,16 @@ export const PersonHogService: GenService<{
input: typeof DeletePersonsBatchForTeamRequestSchema
output: typeof DeletePersonsBatchForTeamResponseSchema
}
+ /**
+ * Person split
+ * WARNING: Same routing caveat as DeletePersons above — write operation on person data
+ * routed through replica (primary pool) until leader supports transactional writes.
+ *
+ * @generated from rpc personhog.service.v1.PersonHogService.SplitPerson
+ */
+ splitPerson: {
+ methodKind: 'unary'
+ input: typeof SplitPersonRequestSchema
+ output: typeof SplitPersonResponseSchema
+ }
}> = /*@__PURE__*/ serviceDesc(file_personhog_service_v1_service, 0)
diff --git a/nodejs/src/generated/personhog/personhog/types/v1/person_pb.ts b/nodejs/src/generated/personhog/personhog/types/v1/person_pb.ts
index 836d3de97b75..334360320045 100644
--- a/nodejs/src/generated/personhog/personhog/types/v1/person_pb.ts
+++ b/nodejs/src/generated/personhog/personhog/types/v1/person_pb.ts
@@ -13,7 +13,7 @@ import { file_personhog_types_v1_common } from './common_pb'
export const file_personhog_types_v1_person: GenFile =
/*@__PURE__*/
fileDesc(
- 'Ch9wZXJzb25ob2cvdHlwZXMvdjEvcGVyc29uLnByb3RvEhJwZXJzb25ob2cudHlwZXMudjEingIKBlBlcnNvbhIKCgJpZBgBIAEoAxIMCgR1dWlkGAIgASgJEg8KB3RlYW1faWQYAyABKAMSEgoKcHJvcGVydGllcxgEIAEoDBIiChpwcm9wZXJ0aWVzX2xhc3RfdXBkYXRlZF9hdBgFIAEoDBIhChlwcm9wZXJ0aWVzX2xhc3Rfb3BlcmF0aW9uGAYgASgME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9nLnR5cGVzLnYxLlBlcnNvbkgAiAEBEg8KB3VwZGF0ZWQYAiABKAhCCQoHX3BlcnNvbiI9ChREZWxldGVQZXJzb25zUmVxdWVzdBIPCgd0ZWFtX2lkGAEgASgDEhQKDHBlcnNvbl91dWlkcxgCIAMoCSIuChVEZWxldGVQZXJzb25zUmVzcG9uc2USFQoNZGVsZXRlZF9jb3VudBgBIAEoAyJHCiBEZWxldGVQZXJzb25zQmF0Y2hGb3JUZWFtUmVxdWVzdBIPCgd0ZWFtX2lkGAEgASgDEhIKCmJhdGNoX3NpemUYAiABKAMiOgohRGVsZXRlUGVyc29uc0JhdGNoRm9yVGVhbVJlc3BvbnNlEhUKDWRlbGV0ZWRfY291bnQYASABKAMiVwoSU3BsaXRQZXJzb25SZXF1ZXN0Eg8KB3RlYW1faWQYASABKAMSEQoJcGVyc29uX2lkGAIgASgDEh0KFWRpc3RpbmN0X2lkc190b19zcGxpdBgDIAMoCSKOAQoLU3BsaXRSZXN1bHQSEwoLZGlzdGluY3RfaWQYASABKAkSFwoPbmV3X3BlcnNvbl91dWlkGAIgASgJEhoKEm5ld19wZXJzb25fdmVyc2lvbhgDIAEoAxITCgtwZGlfdmVyc2lvbhgEIAEoAxIgChhuZXdfcGVyc29uX2NyZWF0ZWRfYXRfbXMYBSABKAMiRgoTU3BsaXRQZXJzb25SZXNwb25zZRIvCgZzcGxpdHMYASADKAsyHy5wZXJzb25ob2cudHlwZXMudjEuU3BsaXRSZXN1bHRiBnByb3RvMw',
[file_personhog_types_v1_common]
)
@@ -757,3 +757,103 @@ export type DeletePersonsBatchForTeamResponse = Message<'personhog.types.v1.Dele
export const DeletePersonsBatchForTeamResponseSchema: GenMessage<DeletePersonsBatchForTeamResponse> =
/*@__PURE__*/
messageDesc(file_personhog_types_v1_person, 25)
+
+/**
+ * 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.
+ * Python resolves which distinct IDs to split before calling this RPC.
+ * Limited to 250 distinct_ids per request (server-enforced) to bound row-lock
+ * hold time and message size — callers batch larger splits across requests,
+ * which is safe because the deterministic UUIDs make each request idempotent.
+ *
+ * @generated from message personhog.types.v1.SplitPersonRequest
+ */
+export type SplitPersonRequest = Message<'personhog.types.v1.SplitPersonRequest'> & {
+ /**
+ * @generated from field: int64 team_id = 1;
+ */
+ teamId: bigint
+
+ /**
+ * @generated from field: int64 person_id = 2;
+ */
+ personId: bigint
+
+ /**
+ * Distinct IDs to split off. Must all belong to the specified person; duplicates are rejected.
+ *
+ * @generated from field: repeated string distinct_ids_to_split = 3;
+ */
+ distinctIdsToSplit: string[]
+}
+
+/**
+ * Describes the message personhog.types.v1.SplitPersonRequest.
+ * Use `create(SplitPersonRequestSchema)` to create a new message.
+ */
+export const SplitPersonRequestSchema: GenMessage<SplitPersonRequest> =
+ /*@__PURE__*/
+ messageDesc(file_personhog_types_v1_person, 26)
+
+/**
+ * SplitResult describes a single distinct_id that was split onto a new person.
+ *
+ * @generated from message personhog.types.v1.SplitResult
+ */
+export type SplitResult = Message<'personhog.types.v1.SplitResult'> & {
+ /**
+ * @generated from field: string distinct_id = 1;
+ */
+ distinctId: string
+
+ /**
+ * @generated from field: string new_person_uuid = 2;
+ */
+ newPersonUuid: string
+
+ /**
+ * @generated from field: int64 new_person_version = 3;
+ */
+ newPersonVersion: bigint
+
+ /**
+ * @generated from field: int64 pdi_version = 4;
+ */
+ pdiVersion: bigint
+
+ /**
+ * Epoch millis. For pre-existing persons (idempotent re-split) this is the
+ * original created_at, not the time of this request — callers publish it
+ * downstream (e.g. to ClickHouse) so it must match the Postgres row.
+ *
+ * @generated from field: int64 new_person_created_at_ms = 5;
+ */
+ newPersonCreatedAtMs: bigint
+}
+
+/**
+ * Describes the message personhog.types.v1.SplitResult.
+ * Use `create(SplitResultSchema)` to create a new message.
+ */
+export const SplitResultSchema: GenMessage<SplitResult> = /*@__PURE__*/ messageDesc(file_personhog_types_v1_person, 27)
+
+/**
+ * @generated from message personhog.types.v1.SplitPersonResponse
+ */
+export type SplitPersonResponse = Message<'personhog.types.v1.SplitPersonResponse'> & {
+ /**
+ * Results are in the same order as distinct_ids_to_split in the request.
+ *
+ * @generated from field: repeated personhog.types.v1.SplitResult splits = 1;
+ */
+ splits: SplitResult[]
+}
+
+/**
+ * Describes the message personhog.types.v1.SplitPersonResponse.
+ * Use `create(SplitPersonResponseSchema)` to create a new message.
+ */
+export const SplitPersonResponseSchema: GenMessage<SplitPersonResponse> =
+ /*@__PURE__*/
+ messageDesc(file_personhog_types_v1_person, 28)
diff --git a/nodejs/src/ingestion/personhog/client.test.ts b/nodejs/src/ingestion/personhog/client.test.ts
index f14ec9897782..a7d18cb8198d 100644
--- a/nodejs/src/ingestion/personhog/client.test.ts
+++ b/nodejs/src/ingestion/personhog/client.test.ts
@@ -131,6 +131,7 @@ const SERVICE_DEFAULTS: ServiceImpl<typeof PersonHogService> = {
updatePersonProperties: () => ({}),
deletePersons: () => ({ deletedCount: 0n }),
deletePersonsBatchForTeam: () => ({ deletedCount: 0n }),
+ splitPerson: () => ({ splits: [] }),
}
function createMockClient(overrides: Partial<ServiceImpl<typeof PersonHogService>> = {}): PersonHogClient {
diff --git a/nodejs/src/ingestion/personhog/persons.test.ts b/nodejs/src/ingestion/personhog/persons.test.ts
index 12c91df7df99..768d72717160 100644
--- a/nodejs/src/ingestion/personhog/persons.test.ts
+++ b/nodejs/src/ingestion/personhog/persons.test.ts
@@ -67,6 +67,7 @@ const SERVICE_DEFAULTS: ServiceImpl<typeof PersonHogService> = {
updatePersonProperties: () => ({}),
deletePersons: () => ({ deletedCount: 0n }),
deletePersonsBatchForTeam: () => ({ deletedCount: 0n }),
+ splitPerson: () => ({ splits: [] }),
}
function createOperations(overrides: Partial<ServiceImpl<typeof PersonHogService>> = {}): {
diff --git a/posthog/personhog_client/client.py b/posthog/personhog_client/client.py
index c5c0fae53bd6..cbf11459d2bb 100644
--- a/posthog/personhog_client/client.py
+++ b/posthog/personhog_client/client.py
@@ -73,6 +73,8 @@ from posthog.personhog_client.proto import (
PersonHogServiceStub,
PersonsByDistinctIdsInTeamResponse,
PersonsResponse,
+ SplitPersonRequest,
+ SplitPersonResponse,
UpdateGroupRequest,
UpdateGroupResponse,
UpdateGroupTypeMappingRequest,
@@ -207,6 +209,11 @@ class PersonHogClient:
) -> DeletePersonsBatchForTeamResponse:
return self._stub.DeletePersonsBatchForTeam(request, timeout=timeout or self._timeout)
+ # -- Person split --
+
+ def split_person(self, request: SplitPersonRequest, timeout: float | None = None) -> SplitPersonResponse:
+ return self._stub.SplitPerson(request, timeout=timeout or self._timeout)
+
# -- Person lookups --
def get_person(self, request: GetPersonRequest) -> GetPersonResponse:
diff --git a/posthog/personhog_client/fake_client.py b/posthog/personhog_client/fake_client.py
index c40a4fbf0719..81990d4329ff 100644
--- a/posthog/personhog_client/fake_client.py
+++ b/posthog/personhog_client/fake_client.py
@@ -575,6 +575,14 @@ class FakePersonHogClient:
self.calls.append(_Call("delete_persons_batch_for_team", request, response))
return response
+ # ── Person split ──────────────────────────────────────────────────
+
+ def split_person(
+ self, request: person_pb2.SplitPersonRequest, timeout: float | None = None
+ ) -> person_pb2.SplitPersonResponse:
+ self.calls.append(_Call("split_person", request))
+ return person_pb2.SplitPersonResponse(splits=[])
+
# ── Assertion helpers ────────────────────────────────────────────
def assert_called(self, method: str, *, times: int | None = None) -> list[_Call]:
diff --git a/posthog/personhog_client/proto/__init__.py b/posthog/personhog_client/proto/__init__.py
index aa9bf0ec3124..74bc0c2bc5e6 100644
--- a/posthog/personhog_client/proto/__init__.py
+++ b/posthog/personhog_client/proto/__init__.py
@@ -80,4 +80,7 @@ from posthog.personhog_client.proto.generated.personhog.types.v1.person_pb2 impo
Person,
PersonsByDistinctIdsInTeamResponse,
PersonsResponse,
+ SplitPersonRequest,
+ SplitPersonResponse,
+ SplitResult,
)
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 30905e3da5e3..c2413afcc918 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\xdb#\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.DeletePersonsBatchForTeamResponseb\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\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"
)
_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 = 4769
+ _globals["_PERSONHOGSERVICE"]._serialized_end = 4865
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 1c781769c20b..6bf84ddf3def 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.SplitPerson = channel.unary_unary(
+ "/personhog.service.v1.PersonHogService/SplitPerson",
+ request_serializer=personhog_dot_types_dot_v1_dot_person__pb2.SplitPersonRequest.SerializeToString,
+ response_deserializer=personhog_dot_types_dot_v1_dot_person__pb2.SplitPersonResponse.FromString,
+ _registered_method=True,
+ )
class PersonHogServiceServicer:
@@ -495,6 +501,15 @@ class PersonHogServiceServicer:
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
+ routed through replica (primary pool) until leader supports transactional writes.
+ """
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details("Method not implemented!")
+ raise NotImplementedError("Method not implemented!")
+
def add_PersonHogServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
@@ -683,6 +698,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,
),
+ "SplitPerson": grpc.unary_unary_rpc_method_handler(
+ servicer.SplitPerson,
+ request_deserializer=personhog_dot_types_dot_v1_dot_person__pb2.SplitPersonRequest.FromString,
+ response_serializer=personhog_dot_types_dot_v1_dot_person__pb2.SplitPersonResponse.SerializeToString,
+ ),
}
generic_handler = grpc.method_handlers_generic_handler("personhog.service.v1.PersonHogService", rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
@@ -1803,3 +1823,33 @@ class PersonHogService:
metadata,
_registered_method=True,
)
+
+ @staticmethod
+ def SplitPerson(
+ 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/SplitPerson",
+ personhog_dot_types_dot_v1_dot_person__pb2.SplitPersonRequest.SerializeToString,
+ personhog_dot_types_dot_v1_dot_person__pb2.SplitPersonResponse.FromString,
+ options,
+ channel_credentials,
+ insecure,
+ call_credentials,
+ compression,
+ wait_for_ready,
+ timeout,
+ metadata,
+ _registered_method=True,
+ )
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 0b307e41f6e4..bff25aabbae6 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(\x03b\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"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,3 +74,9 @@ 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
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 8a1f72146690..c2a716d3a5d2 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
@@ -388,3 +388,48 @@ class DeletePersonsBatchForTeamResponse(_message.Message):
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]
+ PERSON_ID_FIELD_NUMBER: _ClassVar[int]
+ DISTINCT_IDS_TO_SPLIT_FIELD_NUMBER: _ClassVar[int]
+ team_id: int
+ person_id: int
+ distinct_ids_to_split: _containers.RepeatedScalarFieldContainer[str]
+
+ def __init__(
+ self,
+ team_id: _Optional[int] = ...,
+ person_id: _Optional[int] = ...,
+ distinct_ids_to_split: _Optional[_Iterable[str]] = ...,
+ ) -> None: ...
+
+class SplitResult(_message.Message):
+ __slots__ = ("distinct_id", "new_person_uuid", "new_person_version", "pdi_version", "new_person_created_at_ms")
+ DISTINCT_ID_FIELD_NUMBER: _ClassVar[int]
+ NEW_PERSON_UUID_FIELD_NUMBER: _ClassVar[int]
+ NEW_PERSON_VERSION_FIELD_NUMBER: _ClassVar[int]
+ PDI_VERSION_FIELD_NUMBER: _ClassVar[int]
+ NEW_PERSON_CREATED_AT_MS_FIELD_NUMBER: _ClassVar[int]
+ distinct_id: str
+ new_person_uuid: str
+ new_person_version: int
+ pdi_version: int
+ new_person_created_at_ms: int
+
+ def __init__(
+ self,
+ distinct_id: _Optional[str] = ...,
+ new_person_uuid: _Optional[str] = ...,
+ new_person_version: _Optional[int] = ...,
+ pdi_version: _Optional[int] = ...,
+ new_person_created_at_ms: _Optional[int] = ...,
+ ) -> None: ...
+
+class SplitPersonResponse(_message.Message):
+ __slots__ = ("splits",)
+ SPLITS_FIELD_NUMBER: _ClassVar[int]
+ splits: _containers.RepeatedCompositeFieldContainer[SplitResult]
+
+ def __init__(self, splits: _Optional[_Iterable[_Union[SplitResult, _Mapping]]] = ...) -> None: ...
diff --git a/proto/personhog/replica/v1/replica.proto b/proto/personhog/replica/v1/replica.proto
index f57fc2ad1cd8..6588b20a4bbe 100644
--- a/proto/personhog/replica/v1/replica.proto
+++ b/proto/personhog/replica/v1/replica.proto
@@ -64,4 +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);
+
+ // 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 07483265d68f..63c88cebaf96 100644
--- a/proto/personhog/service/v1/service.proto
+++ b/proto/personhog/service/v1/service.proto
@@ -72,4 +72,9 @@ 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);
+
+ // Person split
+ // WARNING: Same routing caveat as DeletePersons above — write operation on person data
+ // routed through replica (primary pool) until leader supports transactional writes.
+ rpc SplitPerson(personhog.types.v1.SplitPersonRequest) returns (personhog.types.v1.SplitPersonResponse);
}
diff --git a/proto/personhog/types/v1/person.proto b/proto/personhog/types/v1/person.proto
index 855b8ec9c23e..61fd85c86926 100644
--- a/proto/personhog/types/v1/person.proto
+++ b/proto/personhog/types/v1/person.proto
@@ -182,3 +182,34 @@ message DeletePersonsBatchForTeamResponse {
// Number of persons deleted. 0 means no more persons 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.
+// Python resolves which distinct IDs to split before calling this RPC.
+// Limited to 250 distinct_ids per request (server-enforced) to bound row-lock
+// hold time and message size — callers batch larger splits across requests,
+// which is safe because the deterministic UUIDs make each request idempotent.
+message SplitPersonRequest {
+ int64 team_id = 1;
+ int64 person_id = 2;
+ // Distinct IDs to split off. Must all belong to the specified person; duplicates are rejected.
+ repeated string distinct_ids_to_split = 3;
+}
+
+// SplitResult describes a single distinct_id that was split onto a new person.
+message SplitResult {
+ string distinct_id = 1;
+ string new_person_uuid = 2;
+ int64 new_person_version = 3;
+ int64 pdi_version = 4;
+ // Epoch millis. For pre-existing persons (idempotent re-split) this is the
+ // original created_at, not the time of this request — callers publish it
+ // downstream (e.g. to ClickHouse) so it must match the Postgres row.
+ int64 new_person_created_at_ms = 5;
+}
+
+message SplitPersonResponse {
+ // Results are in the same order as distinct_ids_to_split in the request.
+ repeated SplitResult splits = 1;
+}
diff --git a/rust/personhog-replica/.sqlx/query-141a3c15c67572af8c7779ef6402f5463a8c4c0dd43e291a1e12436e788396c8.json b/rust/personhog-replica/.sqlx/query-141a3c15c67572af8c7779ef6402f5463a8c4c0dd43e291a1e12436e788396c8.json
new file mode 100644
index 000000000000..d9469d010037
--- /dev/null
+++ b/rust/personhog-replica/.sqlx/query-141a3c15c67572af8c7779ef6402f5463a8c4c0dd43e291a1e12436e788396c8.json
@@ -0,0 +1,30 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT distinct_id as \"distinct_id!\", COALESCE(version, 0)::bigint as \"version!\"\n FROM posthog_persondistinctid\n WHERE team_id = $1 AND person_id = $2 AND distinct_id = ANY($3)\n FOR UPDATE\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "distinct_id!",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "version!",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Int4",
+ "Int8",
+ "TextArray"
+ ]
+ },
+ "nullable": [
+ false,
+ null
+ ]
+ },
+ "hash": "141a3c15c67572af8c7779ef6402f5463a8c4c0dd43e291a1e12436e788396c8"
+}
diff --git a/rust/personhog-replica/.sqlx/query-2fa96913eca0fcf773b70e0c7385b1cd0ae5a82d80da976cd49904d9393887a5.json b/rust/personhog-replica/.sqlx/query-2fa96913eca0fcf773b70e0c7385b1cd0ae5a82d80da976cd49904d9393887a5.json
new file mode 100644
index 000000000000..3b8ca6d11b89
--- /dev/null
+++ b/rust/personhog-replica/.sqlx/query-2fa96913eca0fcf773b70e0c7385b1cd0ae5a82d80da976cd49904d9393887a5.json
@@ -0,0 +1,36 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n INSERT INTO posthog_person (uuid, team_id, properties, created_at, version, is_identified)\n SELECT u.uuid, $2, '{}'::jsonb, NOW(), $3, false\n FROM unnest($1::uuid[]) AS u(uuid)\n ON CONFLICT (team_id, uuid) DO UPDATE SET version = $3\n RETURNING id::bigint as \"id!\", uuid as \"uuid!\", created_at as \"created_at!\"\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id!",
+ "type_info": "Int8"
+ },
+ {
+ "ordinal": 1,
+ "name": "uuid!",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 2,
+ "name": "created_at!",
+ "type_info": "Timestamptz"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "UuidArray",
+ "Int4",
+ "Int8"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false
+ ]
+ },
+ "hash": "2fa96913eca0fcf773b70e0c7385b1cd0ae5a82d80da976cd49904d9393887a5"
+}
diff --git a/rust/personhog-replica/.sqlx/query-4f3a1236ae0dbcc9c845e44acbcf4891a6f535045c304035eee5675e706efaa7.json b/rust/personhog-replica/.sqlx/query-4f3a1236ae0dbcc9c845e44acbcf4891a6f535045c304035eee5675e706efaa7.json
new file mode 100644
index 000000000000..9651dbbcf907
--- /dev/null
+++ b/rust/personhog-replica/.sqlx/query-4f3a1236ae0dbcc9c845e44acbcf4891a6f535045c304035eee5675e706efaa7.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT COALESCE(version, 0)::bigint as \"version!\"\n FROM posthog_person\n WHERE team_id = $1 AND id = $2\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "version!",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Int4",
+ "Int8"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "4f3a1236ae0dbcc9c845e44acbcf4891a6f535045c304035eee5675e706efaa7"
+}
diff --git a/rust/personhog-replica/.sqlx/query-eddc81809ba3233a42902ab9f026a3f5cc4a57ba996b637e197d1743f1183597.json b/rust/personhog-replica/.sqlx/query-eddc81809ba3233a42902ab9f026a3f5cc4a57ba996b637e197d1743f1183597.json
new file mode 100644
index 000000000000..82fd21c6e571
--- /dev/null
+++ b/rust/personhog-replica/.sqlx/query-eddc81809ba3233a42902ab9f026a3f5cc4a57ba996b637e197d1743f1183597.json
@@ -0,0 +1,17 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n UPDATE posthog_persondistinctid AS pdi\n SET person_id = m.new_person_id, version = m.new_version\n FROM unnest($2::text[], $3::bigint[], $4::bigint[]) AS m(distinct_id, new_person_id, new_version)\n WHERE pdi.team_id = $1 AND pdi.distinct_id = m.distinct_id\n ",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Int4",
+ "TextArray",
+ "Int8Array",
+ "Int8Array"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "eddc81809ba3233a42902ab9f026a3f5cc4a57ba996b637e197d1743f1183597"
+}
diff --git a/rust/personhog-replica/src/service/error.rs b/rust/personhog-replica/src/service/error.rs
index c20dd12a51cd..eefba56a32c4 100644
--- a/rust/personhog-replica/src/service/error.rs
+++ b/rust/personhog-replica/src/service/error.rs
@@ -48,5 +48,7 @@ pub fn log_and_convert_error(err: storage::StorageError, operation: &str) -> Sta
);
Status::internal(format!("Database error: {msg}"))
}
+ storage::StorageError::NotFound(msg) => Status::not_found(msg.clone()),
+ storage::StorageError::FailedPrecondition(msg) => Status::failed_precondition(msg.clone()),
}
}
diff --git a/rust/personhog-replica/src/service/mod.rs b/rust/personhog-replica/src/service/mod.rs
index 2bc66a11b96c..c40e29246436 100644
--- a/rust/personhog-replica/src/service/mod.rs
+++ b/rust/personhog-replica/src/service/mod.rs
@@ -6,7 +6,7 @@ mod types;
#[cfg(test)]
mod tests;
-use std::collections::HashMap;
+use std::collections::{HashMap, HashSet};
use std::sync::Arc;
use personhog_proto::personhog::replica::v1::person_hog_replica_server::PersonHogReplica;
@@ -37,9 +37,9 @@ use personhog_proto::personhog::types::v1::{
InsertCohortMembersResponse, ListCohortMemberIdsRequest, ListCohortMemberIdsResponse,
ListGroupsRequest, ListGroupsResponse, PersonDistinctIds, PersonWithDistinctIds,
PersonWithTeamDistinctId, PersonsByDistinctIdsInTeamResponse, PersonsByDistinctIdsResponse,
- PersonsResponse, TeamDistinctId, UpdateGroupRequest, UpdateGroupResponse,
- UpdateGroupTypeMappingRequest, UpdateGroupTypeMappingResponse, UpsertHashKeyOverridesRequest,
- UpsertHashKeyOverridesResponse,
+ PersonsResponse, SplitPersonRequest, SplitPersonResponse, SplitResult as ProtoSplitResult,
+ TeamDistinctId, UpdateGroupRequest, UpdateGroupResponse, UpdateGroupTypeMappingRequest,
+ UpdateGroupTypeMappingResponse, UpsertHashKeyOverridesRequest, UpsertHashKeyOverridesResponse,
};
use tonic::{Request, Response, Status};
use uuid::Uuid;
@@ -50,6 +50,9 @@ const MAX_BATCH_LOOKUP_SIZE: usize = 250;
const MAX_BATCH_DELETE_SIZE: i64 = 50_000;
const MAX_LIST_COHORT_MEMBER_IDS_LIMIT: i32 = 10_000;
const MAX_LIST_GROUPS_LIMIT: i32 = 1_000;
+// Splits run in a single all-or-nothing transaction holding row locks, so the
+// cap bounds both lock-hold time and payload size — same order as batch lookups.
+const MAX_SPLIT_BATCH_SIZE: usize = 250;
use consistency::{reject_strong_consistency, to_storage_consistency};
use error::log_and_convert_error;
@@ -1212,4 +1215,61 @@ impl PersonHogReplica for PersonHogReplicaService {
deleted_count,
}))
}
+
+ // ============================================================
+ // Person split
+ // ============================================================
+
+ async fn split_person(
+ &self,
+ request: Request<SplitPersonRequest>,
+ ) -> Result<Response<SplitPersonResponse>, Status> {
+ let req = request.into_inner();
+
+ if req.distinct_ids_to_split.is_empty() {
+ return Ok(Response::new(SplitPersonResponse { splits: vec![] }));
+ }
+
+ if req.distinct_ids_to_split.len() > MAX_SPLIT_BATCH_SIZE {
+ return Err(Status::invalid_argument(format!(
+ "Maximum {MAX_SPLIT_BATCH_SIZE} distinct_ids per split_person request"
+ )));
+ }
+
+ let unique_dids: HashSet<&str> = req
+ .distinct_ids_to_split
+ .iter()
+ .map(|s| s.as_str())
+ .collect();
+ if unique_dids.len() != req.distinct_ids_to_split.len() {
+ return Err(Status::invalid_argument(
+ "Duplicate distinct_ids in split_person request",
+ ));
+ }
+
+ let results = self
+ .storage
+ .split_person(req.team_id, req.person_id, &req.distinct_ids_to_split)
+ .await
+ .map_err(|e| match &e {
+ storage::StorageError::NotFound(msg) => Status::not_found(msg.clone()),
+ storage::StorageError::FailedPrecondition(msg) => {
+ Status::failed_precondition(msg.clone())
+ }
+ _ => log_and_convert_error(e, "split_person"),
+ })?;
+
+ Ok(Response::new(SplitPersonResponse {
+ splits: results
+ .into_iter()
+ .map(|r| ProtoSplitResult {
+ distinct_id: r.distinct_id,
+ new_person_uuid: r.new_person_uuid.to_string(),
+ new_person_version: r.new_person_version,
+ pdi_version: r.pdi_version,
+ new_person_created_at_ms: r.new_person_created_at.timestamp_millis(),
+ })
+ .collect(),
+ }))
+ }
}
diff --git a/rust/personhog-replica/src/service/tests/mocks.rs b/rust/personhog-replica/src/service/tests/mocks.rs
index 0fe942f4b663..4887d93fc795 100644
--- a/rust/personhog-replica/src/service/tests/mocks.rs
+++ b/rust/personhog-replica/src/service/tests/mocks.rs
@@ -102,6 +102,15 @@ impl storage::PersonLookup for FailingStorage {
) -> storage::StorageResult<i64> {
Err(self.error.clone())
}
+
+ async fn split_person(
+ &self,
+ _team_id: i64,
+ _person_id: i64,
+ _distinct_ids_to_split: &[String],
+ ) -> storage::StorageResult<Vec<storage::SplitResult>> {
+ Err(self.error.clone())
+ }
}
#[async_trait]
@@ -447,6 +456,15 @@ impl storage::PersonLookup for SuccessStorage {
) -> storage::StorageResult<i64> {
Ok(0)
}
+
+ async fn split_person(
+ &self,
+ _team_id: i64,
+ _person_id: i64,
+ _distinct_ids_to_split: &[String],
+ ) -> storage::StorageResult<Vec<storage::SplitResult>> {
+ Ok(vec![])
+ }
}
#[async_trait]
@@ -851,6 +869,15 @@ impl storage::PersonLookup for PopulatedStorage {
) -> storage::StorageResult<i64> {
Ok(0)
}
+
+ async fn split_person(
+ &self,
+ _team_id: i64,
+ _person_id: i64,
+ _distinct_ids_to_split: &[String],
+ ) -> storage::StorageResult<Vec<storage::SplitResult>> {
+ Ok(vec![])
+ }
}
#[async_trait]
@@ -1231,6 +1258,15 @@ impl storage::PersonLookup for ConsistencyTrackingStorage {
) -> storage::StorageResult<i64> {
Ok(0)
}
+
+ async fn split_person(
+ &self,
+ _team_id: i64,
+ _person_id: i64,
+ _distinct_ids_to_split: &[String],
+ ) -> storage::StorageResult<Vec<storage::SplitResult>> {
+ Ok(vec![])
+ }
}
#[async_trait]
diff --git a/rust/personhog-replica/src/storage/error.rs b/rust/personhog-replica/src/storage/error.rs
index d053e5f67117..4522b6cf0e19 100644
--- a/rust/personhog-replica/src/storage/error.rs
+++ b/rust/personhog-replica/src/storage/error.rs
@@ -13,6 +13,14 @@ pub enum StorageError {
/// Connection pool exhausted or closed
#[error("Database pool exhausted")]
PoolExhausted,
+
+ /// Resource not found (e.g. person, distinct_id)
+ #[error("Not found: {0}")]
+ NotFound(String),
+
+ /// Operation precondition violated (e.g. concurrent modification)
+ #[error("Failed precondition: {0}")]
+ FailedPrecondition(String),
}
impl Clone for StorageError {
@@ -21,6 +29,8 @@ impl Clone for StorageError {
Self::Connection(msg) => Self::Connection(msg.clone()),
Self::Query(msg) => Self::Query(msg.clone()),
Self::PoolExhausted => Self::PoolExhausted,
+ Self::NotFound(msg) => Self::NotFound(msg.clone()),
+ Self::FailedPrecondition(msg) => Self::FailedPrecondition(msg.clone()),
}
}
}
diff --git a/rust/personhog-replica/src/storage/mod.rs b/rust/personhog-replica/src/storage/mod.rs
index 452451903072..d90b62df5308 100644
--- a/rust/personhog-replica/src/storage/mod.rs
+++ b/rust/personhog-replica/src/storage/mod.rs
@@ -7,7 +7,7 @@ pub use error::{StorageError, StorageResult};
pub use types::{
CohortMembership, DistinctIdMapping, DistinctIdWithVersion, Group, GroupIdentifier, GroupKey,
- GroupTypeMapping, HashKeyOverride, HashKeyOverrideContext, Person,
+ GroupTypeMapping, HashKeyOverride, HashKeyOverrideContext, Person, SplitResult,
};
pub use traits::{CohortStorage, DistinctIdLookup, FeatureFlagStorage, GroupStorage, PersonLookup};
diff --git a/rust/personhog-replica/src/storage/postgres/person.rs b/rust/personhog-replica/src/storage/postgres/person.rs
index 325e1b685856..fb830eaee78e 100644
--- a/rust/personhog-replica/src/storage/postgres/person.rs
+++ b/rust/personhog-replica/src/storage/postgres/person.rs
@@ -1,6 +1,7 @@
use std::collections::{HashMap, HashSet};
use async_trait::async_trait;
+use chrono::{DateTime, Utc};
use futures::stream::{self, StreamExt, TryStreamExt};
use sqlx::postgres::PgPool;
use uuid::Uuid;
@@ -10,7 +11,14 @@ use personhog_common::grpc::{current_client_name, current_method_name};
use super::{PostgresStorage, DB_BULK_CHUNKS, DB_QUERY_DURATION, DB_ROWS_RETURNED};
use crate::storage::error::{StorageError, StorageResult};
use crate::storage::traits::PersonLookup;
-use crate::storage::types::Person;
+use crate::storage::types::{Person, SplitResult};
+
+const PERSON_UUIDV5_NAMESPACE: Uuid = Uuid::from_bytes([
+ 0x93, 0x29, 0x79, 0xb4, 0x65, 0xc3, 0x44, 0x24, 0x84, 0x67, 0x0b, 0x66, 0xec, 0x27, 0xbc, 0x22,
+]);
+
+/// Version offset for split person/PDI rows — mirrors the Django convention.
+const SPLIT_VERSION_OFFSET: i64 = 101;
const POOL_LABEL: &str = "replica";
const BULK_POOL_LABEL: &str = "bulk_replica";
@@ -621,6 +629,193 @@ impl PersonLookup for PostgresStorage {
})
.collect())
}
+
+ async fn split_person(
+ &self,
+ team_id: i64,
+ person_id: i64,
+ distinct_ids_to_split: &[String],
+ ) -> StorageResult<Vec<SplitResult>> {
+ if distinct_ids_to_split.is_empty() {
+ return Ok(vec![]);
+ }
+
+ let client = current_client_name();
+ let method = current_method_name();
+ let labels = [
+ ("operation".to_string(), "split_person".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);
+
+ // All-or-nothing transaction on the bulk primary pool. The statement count
+ // is constant (not per-distinct_id), so the lock window stays short; the
+ // service-layer cap bounds the number of rows locked.
+ let mut tx = self.bulk_primary_pool.begin().await?;
+
+ // No FOR UPDATE on the source person: deletes lock PDI rows before person
+ // rows, so locking the person first here would invert that order and risk
+ // deadlock. The PDI locks below are what guard the reassignment.
+ let person_version: i64 = sqlx::query_scalar!(
+ r#"
+ SELECT COALESCE(version, 0)::bigint as "version!"
+ FROM posthog_person
+ WHERE team_id = $1 AND id = $2
+ "#,
+ team_id as i32,
+ person_id
+ )
+ .fetch_optional(&mut *tx)
+ .await?
+ .ok_or_else(|| {
+ StorageError::NotFound(format!("person_id={person_id} (team_id={team_id})"))
+ })?;
+
+ // Lock the PDI rows and validate ownership under the lock: any requested
+ // distinct_id that didn't lock either doesn't exist or belongs to another
+ // person, and the whole request is rejected.
+ let locked_pdis = sqlx::query!(
+ r#"
+ SELECT distinct_id as "distinct_id!", COALESCE(version, 0)::bigint as "version!"
+ FROM posthog_persondistinctid
+ WHERE team_id = $1 AND person_id = $2 AND distinct_id = ANY($3)
+ FOR UPDATE
+ "#,
+ team_id as i32,
+ person_id,
+ distinct_ids_to_split
+ )
+ .fetch_all(&mut *tx)
+ .await?;
+
+ if locked_pdis.len() != distinct_ids_to_split.len() {
+ let owned_set: HashSet<&str> = locked_pdis
+ .iter()
+ .map(|pdi| pdi.distinct_id.as_str())
+ .collect();
+ let unknown: Vec<&str> = distinct_ids_to_split
+ .iter()
+ .filter(|did| !owned_set.contains(did.as_str()))
+ .map(|s| s.as_str())
+ .collect();
+ return Err(StorageError::NotFound(format!(
+ "distinct_ids {unknown:?} do not belong to person_id={person_id} (team_id={team_id})"
+ )));
+ }
+
+ let new_person_version = person_version + SPLIT_VERSION_OFFSET;
+ // Build all arrays in request order so the response order matches the
+ // input order (part of the RPC contract).
+ let pdi_version_by_did: HashMap<&str, i64> = locked_pdis
+ .iter()
+ .map(|pdi| (pdi.distinct_id.as_str(), pdi.version))
+ .collect();
+ let dids: Vec<String> = distinct_ids_to_split.to_vec();
+ let new_uuids: Vec<Uuid> = dids
+ .iter()
+ .map(|did| {
+ Uuid::new_v5(
+ &PERSON_UUIDV5_NAMESPACE,
+ format!("{team_id}:{did}").as_bytes(),
+ )
+ })
+ .collect();
+ let pdi_versions: Vec<i64> = dids
+ .iter()
+ .map(|did| pdi_version_by_did[did.as_str()] + SPLIT_VERSION_OFFSET)
+ .collect();
+
+ // Upsert all new persons in one statement (deterministic UUIDs, idempotent).
+ // RETURNING covers both freshly inserted and conflict-updated rows; for
+ // conflicts, created_at is the pre-existing row's original value.
+ let new_persons = sqlx::query!(
+ r#"
+ INSERT INTO posthog_person (uuid, team_id, properties, created_at, version, is_identified)
+ SELECT u.uuid, $2, '{}'::jsonb, NOW(), $3, false
+ FROM unnest($1::uuid[]) AS u(uuid)
+ ON CONFLICT (team_id, uuid) DO UPDATE SET version = $3
+ RETURNING id::bigint as "id!", uuid as "uuid!", created_at as "created_at!"
+ "#,
+ &new_uuids,
+ team_id as i32,
+ new_person_version
+ )
+ .fetch_all(&mut *tx)
+ .await?;
+
+ let person_by_uuid: HashMap<Uuid, (i64, DateTime<Utc>)> = new_persons
+ .into_iter()
+ .map(|r| (r.uuid, (r.id, r.created_at)))
+ .collect();
+ let new_person_rows: Vec<(i64, DateTime<Utc>)> = new_uuids
+ .iter()
+ .map(|u| {
+ person_by_uuid.get(u).copied().ok_or_else(|| {
+ StorageError::Query(format!("person upsert did not return a row for uuid {u}"))
+ })
+ })
+ .collect::<StorageResult<_>>()?;
+ let new_person_ids: Vec<i64> = new_person_rows.iter().map(|(id, _)| *id).collect();
+
+ // Reassign all PDIs to their new persons in one statement.
+ let update_result = sqlx::query!(
+ r#"
+ UPDATE posthog_persondistinctid AS pdi
+ SET person_id = m.new_person_id, version = m.new_version
+ FROM unnest($2::text[], $3::bigint[], $4::bigint[]) AS m(distinct_id, new_person_id, new_version)
+ WHERE pdi.team_id = $1 AND pdi.distinct_id = m.distinct_id
+ "#,
+ team_id as i32,
+ &dids,
+ &new_person_ids,
+ &pdi_versions
+ )
+ .execute(&mut *tx)
+ .await?;
+
+ if update_result.rows_affected() != dids.len() as u64 {
+ return Err(StorageError::Query(format!(
+ "expected to reassign {} PDIs but updated {} (team_id={team_id}, person_id={person_id})",
+ dids.len(),
+ update_result.rows_affected()
+ )));
+ }
+
+ tx.commit().await?;
+
+ let results: Vec<SplitResult> = dids
+ .into_iter()
+ .zip(new_uuids)
+ .zip(pdi_versions)
+ .zip(new_person_rows)
+ .map(
+ |(((distinct_id, new_person_uuid), pdi_version), (_, new_person_created_at))| {
+ SplitResult {
+ distinct_id,
+ new_person_uuid,
+ new_person_version,
+ pdi_version,
+ new_person_created_at,
+ }
+ },
+ )
+ .collect();
+
+ common_metrics::histogram(
+ DB_ROWS_RETURNED,
+ &[
+ ("operation".to_string(), "split_person".to_string()),
+ ("pool".to_string(), "bulk_primary".to_string()),
+ ("client".to_string(), client.to_string()),
+ ("method".to_string(), method.to_string()),
+ ],
+ results.len() as f64,
+ );
+
+ Ok(results)
+ }
}
/// Delete a chunk of persons by integer ID in a single transaction:
diff --git a/rust/personhog-replica/src/storage/traits/person.rs b/rust/personhog-replica/src/storage/traits/person.rs
index 17f40c4e3f85..99602d6c3d77 100644
--- a/rust/personhog-replica/src/storage/traits/person.rs
+++ b/rust/personhog-replica/src/storage/traits/person.rs
@@ -2,7 +2,7 @@ use async_trait::async_trait;
use uuid::Uuid;
use crate::storage::error::StorageResult;
-use crate::storage::types::Person;
+use crate::storage::types::{Person, SplitResult};
/// Person lookup operations by ID, UUID, and distinct ID
#[async_trait]
@@ -69,4 +69,23 @@ pub trait PersonLookup: Send + Sync {
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):
+ /// 1. Locks the specified PersonDistinctId rows with SELECT FOR UPDATE and
+ /// validates ownership under the lock
+ /// 2. Creates new persons via one bulk upsert (deterministic UUIDv5,
+ /// version = original person version + 101)
+ /// 3. Reassigns PDIs to new persons in one bulk update
+ /// (version = original PDI version + 101)
+ ///
+ /// Returns StorageError::NotFound if the person doesn't exist or any
+ /// distinct_id doesn't belong to it.
+ async fn split_person(
+ &self,
+ team_id: i64,
+ person_id: i64,
+ distinct_ids_to_split: &[String],
+ ) -> StorageResult<Vec<SplitResult>>;
}
diff --git a/rust/personhog-replica/src/storage/types/person.rs b/rust/personhog-replica/src/storage/types/person.rs
index b320f95b410f..ae1e6e8229c9 100644
--- a/rust/personhog-replica/src/storage/types/person.rs
+++ b/rust/personhog-replica/src/storage/types/person.rs
@@ -27,3 +27,14 @@ pub struct DistinctIdWithVersion {
pub distinct_id: String,
pub version: Option<i64>,
}
+
+#[derive(Debug, Clone)]
+pub struct SplitResult {
+ pub distinct_id: String,
+ pub new_person_uuid: Uuid,
+ pub new_person_version: i64,
+ pub pdi_version: i64,
+ /// For pre-existing persons (idempotent re-split) this is the original
+ /// created_at, preserved by the upsert — not the time of this request.
+ pub new_person_created_at: chrono::DateTime<chrono::Utc>,
+}
diff --git a/rust/personhog-replica/tests/service_tests.rs b/rust/personhog-replica/tests/service_tests.rs
index 6d47bb21ea42..2c5598f16b3d 100644
--- a/rust/personhog-replica/tests/service_tests.rs
+++ b/rust/personhog-replica/tests/service_tests.rs
@@ -11,7 +11,8 @@ use personhog_proto::personhog::types::v1::{
GetGroupsBatchRequest, GetGroupsRequest, GetHashKeyOverrideContextRequest,
GetPersonByDistinctIdRequest, GetPersonByUuidRequest, GetPersonRequest,
GetPersonsByDistinctIdsInTeamRequest, GetPersonsByDistinctIdsRequest, GetPersonsByUuidsRequest,
- GetPersonsRequest, GroupIdentifier, GroupKey, TeamDistinctId, UpsertHashKeyOverridesRequest,
+ GetPersonsRequest, GroupIdentifier, GroupKey, SplitPersonRequest, TeamDistinctId,
+ UpsertHashKeyOverridesRequest,
};
use personhog_replica::service::PersonHogReplicaService;
use rstest::rstest;
@@ -1234,3 +1235,33 @@ async fn test_delete_persons_batch_for_team_invalid_batch_size(#[case] batch_siz
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")]
+#[tokio::test]
+async fn test_split_person_invalid_request(
+ #[case] distinct_ids_to_split: Vec<String>,
+ #[case] expected_message: &str,
+) {
+ let ctx = ServiceTestContext::new().await;
+
+ let result = ctx
+ .service
+ .split_person(Request::new(SplitPersonRequest {
+ team_id: ctx.team_id,
+ person_id: 1,
+ distinct_ids_to_split,
+ }))
+ .await;
+
+ let status = result.unwrap_err();
+ assert_eq!(status.code(), tonic::Code::InvalidArgument);
+ assert!(
+ status.message().contains(expected_message),
+ "Expected message containing {expected_message:?}, got: {}",
+ status.message()
+ );
+
+ ctx.cleanup().await.ok();
+}
diff --git a/rust/personhog-replica/tests/storage_tests.rs b/rust/personhog-replica/tests/storage_tests.rs
index a0bf61ae9ea1..44c0c8ecb7ed 100644
--- a/rust/personhog-replica/tests/storage_tests.rs
+++ b/rust/personhog-replica/tests/storage_tests.rs
@@ -2014,3 +2014,567 @@ async fn test_list_groups_without_properties() {
ctx.cleanup().await.ok();
}
+
+// ============================================================
+// split_person storage tests
+// ============================================================
+
+#[tokio::test]
+async fn test_split_person_empty_distinct_ids() {
+ let ctx = TestContext::new().await;
+ let person = ctx
+ .insert_person("[email protected]", None)
+ .await
+ .unwrap();
+
+ let results = ctx
+ .storage
+ .split_person(ctx.team_id, person.id, &[])
+ .await
+ .expect("Empty split should succeed");
+
+ assert!(results.is_empty());
+ ctx.cleanup().await.ok();
+}
+
+#[rstest]
+#[case::single_split(1)]
+#[case::two_splits(2)]
+#[case::five_splits(5)]
+#[tokio::test]
+async fn test_split_person_creates_new_persons(#[case] num_splits: usize) {
+ let ctx = TestContext::new().await;
+ let person = ctx.insert_person("[email protected]", None).await.unwrap();
+
+ let mut split_dids = Vec::new();
+ for i in 0..num_splits {
+ let did = format!("split_{i}@example.com");
+ ctx.add_distinct_id_to_person(person.id, &did)
+ .await
+ .unwrap();
+ split_dids.push(did);
+ }
+
+ let results = ctx
+ .storage
+ .split_person(ctx.team_id, person.id, &split_dids)
+ .await
+ .expect("Split should succeed");
+
+ assert_eq!(results.len(), num_splits);
+
+ for (i, result) in results.iter().enumerate() {
+ // Results come back in request order
+ assert_eq!(result.distinct_id, split_dids[i]);
+ assert_eq!(result.new_person_version, 101); // original version 0 + 101
+ assert_eq!(result.pdi_version, 101); // original PDI version 0 + 101
+
+ // New person should exist in DB
+ let new_person = ctx
+ .storage
+ .get_person_by_uuid(ctx.team_id, result.new_person_uuid)
+ .await
+ .expect("Lookup should succeed")
+ .expect("New person should exist");
+ assert_eq!(new_person.version, Some(101));
+ assert_eq!(new_person.created_at, result.new_person_created_at);
+
+ // PDI should now point to the new person
+ let looked_up = ctx
+ .storage
+ .get_person_by_distinct_id(ctx.team_id, &result.distinct_id)
+ .await
+ .expect("Lookup should succeed")
+ .expect("Person for distinct_id should exist");
+ assert_eq!(looked_up.uuid, result.new_person_uuid);
+ }
+
+ // Original person still exists with its keeper distinct_id
+ let original = ctx
+ .storage
+ .get_person_by_id(ctx.team_id, person.id)
+ .await
+ .expect("Lookup should succeed")
+ .expect("Original person should still exist");
+ assert_eq!(original.uuid, person.uuid);
+
+ let original_by_did = ctx
+ .storage
+ .get_person_by_distinct_id(ctx.team_id, "[email protected]")
+ .await
+ .expect("Lookup should succeed")
+ .expect("Keeper DID should still resolve to original");
+ assert_eq!(original_by_did.id, person.id);
+
+ ctx.cleanup().await.ok();
+}
+
+#[tokio::test]
+async fn test_split_person_version_arithmetic() {
+ let ctx = TestContext::new().await;
+
+ // Insert a person with a non-zero version
+ let person_id = rand::thread_rng().gen_range(1_000_000i64..100_000_000);
+ let person_uuid = Uuid::now_v7();
+ let person_version: i64 = 42;
+
+ sqlx::query(
+ r#"INSERT INTO posthog_person
+ (id, uuid, team_id, properties, properties_last_updated_at,
+ properties_last_operation, created_at, version, is_identified, is_user_id)
+ VALUES ($1, $2, $3, '{}'::jsonb, '{}', '{}', NOW(), $4, false, NULL)"#,
+ )
+ .bind(person_id)
+ .bind(person_uuid)
+ .bind(ctx.team_id)
+ .bind(person_version)
+ .execute(&ctx.pool)
+ .await
+ .unwrap();
+
+ // Insert PDIs with non-zero versions
+ let pdi_version: i64 = 7;
+ for did in &["v_did_a", "v_did_b"] {
+ sqlx::query(
+ r#"INSERT INTO posthog_persondistinctid
+ (distinct_id, person_id, team_id, version) VALUES ($1, $2, $3, $4)"#,
+ )
+ .bind(*did)
+ .bind(person_id)
+ .bind(ctx.team_id)
+ .bind(pdi_version)
+ .execute(&ctx.pool)
+ .await
+ .unwrap();
+ }
+
+ let results = ctx
+ .storage
+ .split_person(
+ ctx.team_id,
+ person_id,
+ &["v_did_a".to_string(), "v_did_b".to_string()],
+ )
+ .await
+ .expect("Split should succeed");
+
+ for result in &results {
+ assert_eq!(
+ result.new_person_version,
+ person_version + 101,
+ "New person version should be original + 101"
+ );
+ assert_eq!(
+ result.pdi_version,
+ pdi_version + 101,
+ "PDI version should be original + 101"
+ );
+ }
+
+ ctx.cleanup().await.ok();
+}
+
+#[tokio::test]
+async fn test_split_person_deterministic_uuids() {
+ let ctx = TestContext::new().await;
+ let person = ctx
+ .insert_person("[email protected]", None)
+ .await
+ .unwrap();
+ ctx.add_distinct_id_to_person(person.id, "[email protected]")
+ .await
+ .unwrap();
+
+ let results = ctx
+ .storage
+ .split_person(
+ ctx.team_id,
+ person.id,
+ &["[email protected]".to_string()],
+ )
+ .await
+ .expect("Split should succeed");
+
+ // Compute expected UUID the same way the implementation does
+ let namespace = Uuid::from_bytes([
+ 0x93, 0x29, 0x79, 0xb4, 0x65, 0xc3, 0x44, 0x24, 0x84, 0x67, 0x0b, 0x66, 0xec, 0x27, 0xbc,
+ 0x22,
+ ]);
+ let expected_uuid = Uuid::new_v5(
+ &namespace,
+ format!("{}:[email protected]", ctx.team_id).as_bytes(),
+ );
+
+ assert_eq!(results[0].new_person_uuid, expected_uuid);
+
+ ctx.cleanup().await.ok();
+}
+
+#[tokio::test]
+async fn test_split_person_idempotent() {
+ let ctx = TestContext::new().await;
+ let person = ctx
+ .insert_person("[email protected]", None)
+ .await
+ .unwrap();
+ ctx.add_distinct_id_to_person(person.id, "[email protected]")
+ .await
+ .unwrap();
+
+ let results1 = ctx
+ .storage
+ .split_person(
+ ctx.team_id,
+ person.id,
+ &["[email protected]".to_string()],
+ )
+ .await
+ .expect("First split should succeed");
+
+ // After the first split, the PDI is reassigned to the new person.
+ // A second call with the same person_id should get NOT_FOUND because
+ // the distinct_id no longer belongs to that person.
+ let err = ctx
+ .storage
+ .split_person(
+ ctx.team_id,
+ person.id,
+ &["[email protected]".to_string()],
+ )
+ .await
+ .expect_err("Second split should fail because DID moved");
+
+ let msg = err.to_string();
+ assert!(
+ msg.contains("Not found"),
+ "Expected NotFound error, got: {msg}"
+ );
+
+ // The new person should still exist with the correct UUID
+ let new_person = ctx
+ .storage
+ .get_person_by_uuid(ctx.team_id, results1[0].new_person_uuid)
+ .await
+ .expect("Lookup should succeed")
+ .expect("New person should still exist");
+ assert_eq!(new_person.version, Some(results1[0].new_person_version));
+
+ ctx.cleanup().await.ok();
+}
+
+#[tokio::test]
+async fn test_split_person_preserves_created_at_of_existing_person() {
+ let ctx = TestContext::new().await;
+ let person = ctx
+ .insert_person("[email protected]", None)
+ .await
+ .unwrap();
+ ctx.add_distinct_id_to_person(person.id, "[email protected]")
+ .await
+ .unwrap();
+
+ // Pre-create the person the split will upsert into (same deterministic
+ // UUIDv5), with a created_at in the past.
+ let namespace = Uuid::from_bytes([
+ 0x93, 0x29, 0x79, 0xb4, 0x65, 0xc3, 0x44, 0x24, 0x84, 0x67, 0x0b, 0x66, 0xec, 0x27, 0xbc,
+ 0x22,
+ ]);
+ let split_uuid = Uuid::new_v5(
+ &namespace,
+ format!("{}:[email protected]", ctx.team_id).as_bytes(),
+ );
+ let old_created_at = chrono::DateTime::parse_from_rfc3339("2020-01-02T03:04:05Z")
+ .unwrap()
+ .with_timezone(&chrono::Utc);
+ let existing_id = rand::thread_rng().gen_range(1_000_000i64..100_000_000);
+ sqlx::query(
+ r#"INSERT INTO posthog_person
+ (id, uuid, team_id, properties, properties_last_updated_at,
+ properties_last_operation, created_at, version, is_identified, is_user_id)
+ VALUES ($1, $2, $3, '{}'::jsonb, '{}', '{}', $4, 3, false, NULL)"#,
+ )
+ .bind(existing_id)
+ .bind(split_uuid)
+ .bind(ctx.team_id)
+ .bind(old_created_at)
+ .execute(&ctx.pool)
+ .await
+ .unwrap();
+
+ let results = ctx
+ .storage
+ .split_person(
+ ctx.team_id,
+ person.id,
+ &["[email protected]".to_string()],
+ )
+ .await
+ .expect("Split should succeed");
+
+ // The upsert keeps the existing person's created_at; the response must
+ // report it so callers publish the value that matches Postgres.
+ assert_eq!(results[0].new_person_uuid, split_uuid);
+ assert_eq!(results[0].new_person_created_at, old_created_at);
+ assert_eq!(results[0].new_person_version, 101); // source person version 0 + 101
+
+ let upserted = ctx
+ .storage
+ .get_person_by_uuid(ctx.team_id, split_uuid)
+ .await
+ .expect("Lookup should succeed")
+ .expect("Upserted person should exist");
+ assert_eq!(upserted.created_at, old_created_at);
+ assert_eq!(upserted.version, Some(101));
+
+ ctx.cleanup().await.ok();
+}
+
+#[tokio::test]
+async fn test_split_person_not_found_unknown_distinct_id() {
+ let ctx = TestContext::new().await;
+ let person = ctx
+ .insert_person("[email protected]", None)
+ .await
+ .unwrap();
+
+ let err = ctx
+ .storage
+ .split_person(
+ ctx.team_id,
+ person.id,
+ &["[email protected]".to_string()],
+ )
+ .await
+ .expect_err("Should fail with NOT_FOUND");
+
+ let msg = err.to_string();
+ assert!(
+ msg.contains("Not found"),
+ "Expected NotFound error, got: {msg}"
+ );
+
+ ctx.cleanup().await.ok();
+}
+
+#[tokio::test]
+async fn test_split_person_not_found_wrong_person() {
+ let ctx = TestContext::new().await;
+ let person_a = ctx.insert_person("[email protected]", None).await.unwrap();
+ let _person_b = ctx.insert_person("[email protected]", None).await.unwrap();
+
+ // Try to split person_b's distinct_id from person_a
+ let err = ctx
+ .storage
+ .split_person(ctx.team_id, person_a.id, &["[email protected]".to_string()])
+ .await
+ .expect_err("Should fail with NOT_FOUND");
+
+ let msg = err.to_string();
+ assert!(
+ msg.contains("Not found"),
+ "Expected NotFound error, got: {msg}"
+ );
+
+ ctx.cleanup().await.ok();
+}
+
+#[tokio::test]
+async fn test_split_person_not_found_nonexistent_person() {
+ let ctx = TestContext::new().await;
+
+ let err = ctx
+ .storage
+ .split_person(
+ ctx.team_id,
+ 999999999,
+ &["[email protected]".to_string()],
+ )
+ .await
+ .expect_err("Should fail for nonexistent person");
+
+ let msg = err.to_string();
+ assert!(
+ msg.contains("Not found"),
+ "Expected NotFound error, got: {msg}"
+ );
+
+ ctx.cleanup().await.ok();
+}
+
+#[tokio::test]
+async fn test_split_person_cross_team_isolation() {
+ let ctx = TestContext::new().await;
+ let person = ctx
+ .insert_person("[email protected]", None)
+ .await
+ .unwrap();
+ ctx.add_distinct_id_to_person(person.id, "[email protected]")
+ .await
+ .unwrap();
+
+ let other_team_id = ctx.team_id + 1;
+
+ // Splitting with wrong team_id should fail
+ let err = ctx
+ .storage
+ .split_person(
+ other_team_id,
+ person.id,
+ &["[email protected]".to_string()],
+ )
+ .await
+ .expect_err("Should fail with wrong team_id");
+
+ let msg = err.to_string();
+ assert!(
+ msg.contains("Not found"),
+ "Expected NotFound error, got: {msg}"
+ );
+
+ // Original should be untouched
+ let original = ctx
+ .storage
+ .get_person_by_distinct_id(ctx.team_id, "[email protected]")
+ .await
+ .expect("Lookup should succeed")
+ .expect("Original DID should still resolve");
+ assert_eq!(original.id, person.id);
+
+ ctx.cleanup().await.ok();
+}
+
+#[tokio::test]
+async fn test_split_person_transaction_rollback_on_partial_failure() {
+ let ctx = TestContext::new().await;
+ let person = ctx
+ .insert_person("[email protected]", None)
+ .await
+ .unwrap();
+ ctx.add_distinct_id_to_person(person.id, "[email protected]")
+ .await
+ .unwrap();
+
+ // Request includes one valid and one invalid distinct_id.
+ // Ownership validation under the lock should reject the whole request.
+ let err = ctx
+ .storage
+ .split_person(
+ ctx.team_id,
+ person.id,
+ &[
+ "[email protected]".to_string(),
+ "[email protected]".to_string(),
+ ],
+ )
+ .await
+ .expect_err("Should fail due to unknown distinct_id");
+
+ let msg = err.to_string();
+ assert!(
+ msg.contains("Not found"),
+ "Expected NotFound error, got: {msg}"
+ );
+
+ // Valid distinct_id should NOT have been reassigned (no partial commit)
+ let still_original = ctx
+ .storage
+ .get_person_by_distinct_id(ctx.team_id, "[email protected]")
+ .await
+ .expect("Lookup should succeed")
+ .expect("DID should still resolve to original");
+ assert_eq!(
+ still_original.id, person.id,
+ "tx_split_a should still belong to original person after failed split"
+ );
+
+ ctx.cleanup().await.ok();
+}
+
+#[tokio::test]
+async fn test_split_person_new_persons_have_empty_properties() {
+ let ctx = TestContext::new().await;
+ let props = serde_json::json!({"email": "[email protected]", "plan": "enterprise"});
+ let person = ctx
+ .insert_person("[email protected]", Some(props))
+ .await
+ .unwrap();
+ ctx.add_distinct_id_to_person(person.id, "[email protected]")
+ .await
+ .unwrap();
+
+ let results = ctx
+ .storage
+ .split_person(
+ ctx.team_id,
+ person.id,
+ &["[email protected]".to_string()],
+ )
+ .await
+ .expect("Split should succeed");
+
+ let new_person = ctx
+ .storage
+ .get_person_by_uuid(ctx.team_id, results[0].new_person_uuid)
+ .await
+ .expect("Lookup should succeed")
+ .expect("New person should exist");
+
+ // New persons from split get empty properties, not the original's
+ let props_str = new_person.properties.expect("properties should be set");
+ let props_val: serde_json::Value =
+ serde_json::from_str(&props_str).expect("properties should be valid JSON");
+ assert_eq!(props_val, serde_json::json!({}));
+
+ ctx.cleanup().await.ok();
+}
+
+#[tokio::test]
+async fn test_split_person_each_did_gets_unique_person() {
+ let ctx = TestContext::new().await;
+ let person = ctx
+ .insert_person("[email protected]", None)
+ .await
+ .unwrap();
+ ctx.add_distinct_id_to_person(person.id, "[email protected]")
+ .await
+ .unwrap();
+ ctx.add_distinct_id_to_person(person.id, "[email protected]")
+ .await
+ .unwrap();
+ ctx.add_distinct_id_to_person(person.id, "[email protected]")
+ .await
+ .unwrap();
+
+ let results = ctx
+ .storage
+ .split_person(
+ ctx.team_id,
+ person.id,
+ &[
+ "[email protected]".to_string(),
+ "[email protected]".to_string(),
+ "[email protected]".to_string(),
+ ],
+ )
+ .await
+ .expect("Split should succeed");
+
+ // Each split distinct_id should get a different new person UUID
+ let uuids: std::collections::HashSet<Uuid> =
+ results.iter().map(|r| r.new_person_uuid).collect();
+ assert_eq!(
+ uuids.len(),
+ 3,
+ "Each split DID should produce a unique person"
+ );
+
+ // None of them should be the original person
+ for uuid in &uuids {
+ assert_ne!(
+ *uuid, person.uuid,
+ "New person UUID must differ from original"
+ );
+ }
+
+ ctx.cleanup().await.ok();
+}
diff --git a/rust/personhog-router/src/backend/mod.rs b/rust/personhog-router/src/backend/mod.rs
index 47568c35ea4a..dc0fa7683da5 100644
--- a/rust/personhog-router/src/backend/mod.rs
+++ b/rust/personhog-router/src/backend/mod.rs
@@ -32,9 +32,9 @@ use personhog_proto::personhog::types::v1::{
InsertCohortMembersRequest, InsertCohortMembersResponse, ListCohortMemberIdsRequest,
ListCohortMemberIdsResponse, ListGroupsRequest, ListGroupsResponse,
PersonsByDistinctIdsInTeamResponse, PersonsByDistinctIdsResponse, PersonsResponse,
- UpdateGroupRequest, UpdateGroupResponse, UpdateGroupTypeMappingRequest,
- UpdateGroupTypeMappingResponse, UpdatePersonPropertiesRequest, UpdatePersonPropertiesResponse,
- UpsertHashKeyOverridesRequest, UpsertHashKeyOverridesResponse,
+ SplitPersonRequest, SplitPersonResponse, UpdateGroupRequest, UpdateGroupResponse,
+ UpdateGroupTypeMappingRequest, UpdateGroupTypeMappingResponse, UpdatePersonPropertiesRequest,
+ UpdatePersonPropertiesResponse, UpsertHashKeyOverridesRequest, UpsertHashKeyOverridesResponse,
};
use tonic::Status;
@@ -113,6 +113,12 @@ pub trait PersonHogBackend: Send + Sync {
request: DeletePersonsBatchForTeamRequest,
) -> Result<DeletePersonsBatchForTeamResponse, Status>;
+ // Person split
+ async fn split_person(
+ &self,
+ request: SplitPersonRequest,
+ ) -> Result<SplitPersonResponse, Status>;
+
// Cohort membership
async fn check_cohort_membership(
&self,
diff --git a/rust/personhog-router/src/backend/replica.rs b/rust/personhog-router/src/backend/replica.rs
index 7d94f1afa6f6..b8593f1d1871 100644
--- a/rust/personhog-router/src/backend/replica.rs
+++ b/rust/personhog-router/src/backend/replica.rs
@@ -25,8 +25,9 @@ use personhog_proto::personhog::types::v1::{
InsertCohortMembersRequest, InsertCohortMembersResponse, ListCohortMemberIdsRequest,
ListCohortMemberIdsResponse, ListGroupsRequest, ListGroupsResponse,
PersonsByDistinctIdsInTeamResponse, PersonsByDistinctIdsResponse, PersonsResponse,
- UpdateGroupRequest, UpdateGroupResponse, UpdateGroupTypeMappingRequest,
- UpdateGroupTypeMappingResponse, UpsertHashKeyOverridesRequest, UpsertHashKeyOverridesResponse,
+ SplitPersonRequest, SplitPersonResponse, UpdateGroupRequest, UpdateGroupResponse,
+ UpdateGroupTypeMappingRequest, UpdateGroupTypeMappingResponse, UpsertHashKeyOverridesRequest,
+ UpsertHashKeyOverridesResponse,
};
use std::time::Duration;
use tonic::codec::CompressionEncoding;
@@ -278,6 +279,13 @@ impl PersonHogBackend for ReplicaBackend {
retry_call!(self, delete_persons_batch_for_team, request)
}
+ async fn split_person(
+ &self,
+ request: SplitPersonRequest,
+ ) -> Result<SplitPersonResponse, Status> {
+ retry_call!(self, split_person, request)
+ }
+
async fn check_cohort_membership(
&self,
request: CheckCohortMembershipRequest,
diff --git a/rust/personhog-router/src/proxy.rs b/rust/personhog-router/src/proxy.rs
index 7717617ff176..91c8617247d4 100644
--- a/rust/personhog-router/src/proxy.rs
+++ b/rust/personhog-router/src/proxy.rs
@@ -60,6 +60,7 @@ pub const KNOWN_METHODS: &[&str] = &[
"InsertCohortMembers",
"ListCohortMemberIds",
"ListGroups",
+ "SplitPerson",
"UpdateGroup",
"UpdateGroupTypeMapping",
"UpdatePersonProperties",
diff --git a/rust/personhog-router/src/router/mod.rs b/rust/personhog-router/src/router/mod.rs
index 4d8bd78a6f76..b047a4fd9f9b 100644
--- a/rust/personhog-router/src/router/mod.rs
+++ b/rust/personhog-router/src/router/mod.rs
@@ -30,9 +30,9 @@ use personhog_proto::personhog::types::v1::{
InsertCohortMembersRequest, InsertCohortMembersResponse, ListCohortMemberIdsRequest,
ListCohortMemberIdsResponse, ListGroupsRequest, ListGroupsResponse,
PersonsByDistinctIdsInTeamResponse, PersonsByDistinctIdsResponse, PersonsResponse,
- UpdateGroupRequest, UpdateGroupResponse, UpdateGroupTypeMappingRequest,
- UpdateGroupTypeMappingResponse, UpdatePersonPropertiesRequest, UpdatePersonPropertiesResponse,
- UpsertHashKeyOverridesRequest, UpsertHashKeyOverridesResponse,
+ SplitPersonRequest, SplitPersonResponse, UpdateGroupRequest, UpdateGroupResponse,
+ UpdateGroupTypeMappingRequest, UpdateGroupTypeMappingResponse, UpdatePersonPropertiesRequest,
+ UpdatePersonPropertiesResponse, UpsertHashKeyOverridesRequest, UpsertHashKeyOverridesResponse,
};
use tonic::metadata::MetadataMap;
use tonic::Status;
@@ -611,6 +611,18 @@ impl PersonHogRouter {
)
}
+ /// Split distinct_ids off a person onto new persons.
+ ///
+ /// WARNING: Same routing caveat as delete_persons above — write operation on
+ /// person data routed through replica (primary pool) until leader supports
+ /// transactional writes.
+ pub async fn split_person(
+ &self,
+ request: SplitPersonRequest,
+ ) -> Result<SplitPersonResponse, Status> {
+ call_backend!(self, "SplitPerson", split_person, request)
+ }
+
// ============================================================
// Person property updates - Person data, write operations
// ============================================================
diff --git a/rust/personhog-router/src/service/mod.rs b/rust/personhog-router/src/service/mod.rs
index c2815950ccb4..5632781ed50d 100644
--- a/rust/personhog-router/src/service/mod.rs
+++ b/rust/personhog-router/src/service/mod.rs
@@ -27,9 +27,9 @@ use personhog_proto::personhog::types::v1::{
InsertCohortMembersRequest, InsertCohortMembersResponse, ListCohortMemberIdsRequest,
ListCohortMemberIdsResponse, ListGroupsRequest, ListGroupsResponse,
PersonsByDistinctIdsInTeamResponse, PersonsByDistinctIdsResponse, PersonsResponse,
- UpdateGroupRequest, UpdateGroupResponse, UpdateGroupTypeMappingRequest,
- UpdateGroupTypeMappingResponse, UpdatePersonPropertiesRequest, UpdatePersonPropertiesResponse,
- UpsertHashKeyOverridesRequest, UpsertHashKeyOverridesResponse,
+ SplitPersonRequest, SplitPersonResponse, UpdateGroupRequest, UpdateGroupResponse,
+ UpdateGroupTypeMappingRequest, UpdateGroupTypeMappingResponse, UpdatePersonPropertiesRequest,
+ UpdatePersonPropertiesResponse, UpsertHashKeyOverridesRequest, UpsertHashKeyOverridesResponse,
};
use tonic::{Request, Response, Status};
@@ -338,6 +338,15 @@ impl PersonHogService for PersonHogRouterService {
route_request!(self, delete_persons_batch_for_team, request)
}
+ // Person split
+
+ async fn split_person(
+ &self,
+ request: Request<SplitPersonRequest>,
+ ) -> Result<Response<SplitPersonResponse>, Status> {
+ route_request!(self, split_person, request)
+ }
+
// Person property updates (routed to leader)
async fn update_person_properties(
diff --git a/rust/personhog-router/src/service/tests/mocks.rs b/rust/personhog-router/src/service/tests/mocks.rs
index 52864c96a103..2f0efd2e6a34 100644
--- a/rust/personhog-router/src/service/tests/mocks.rs
+++ b/rust/personhog-router/src/service/tests/mocks.rs
@@ -22,8 +22,9 @@ use personhog_proto::personhog::types::v1::{
InsertCohortMembersRequest, InsertCohortMembersResponse, ListCohortMemberIdsRequest,
ListCohortMemberIdsResponse, ListGroupsRequest, ListGroupsResponse, Person,
PersonsByDistinctIdsInTeamResponse, PersonsByDistinctIdsResponse, PersonsResponse,
- UpdateGroupRequest, UpdateGroupResponse, UpdateGroupTypeMappingRequest,
- UpdateGroupTypeMappingResponse, UpsertHashKeyOverridesRequest, UpsertHashKeyOverridesResponse,
+ SplitPersonRequest, SplitPersonResponse, UpdateGroupRequest, UpdateGroupResponse,
+ UpdateGroupTypeMappingRequest, UpdateGroupTypeMappingResponse, UpsertHashKeyOverridesRequest,
+ UpsertHashKeyOverridesResponse,
};
use std::sync::Mutex;
use tonic::Status;
@@ -364,4 +365,12 @@ impl PersonHogBackend for MockBackend {
self.check_error()?;
Ok(DeleteGroupTypeMappingsBatchForTeamResponse { deleted_count: 0 })
}
+
+ async fn split_person(
+ &self,
+ _request: SplitPersonRequest,
+ ) -> Result<SplitPersonResponse, Status> {
+ self.check_error()?;
+ Ok(SplitPersonResponse { splits: vec![] })
+ }
}
diff --git a/rust/personhog-router/tests/common/mod.rs b/rust/personhog-router/tests/common/mod.rs
index a53e8e92c0de..c6fee441861b 100644
--- a/rust/personhog-router/tests/common/mod.rs
+++ b/rust/personhog-router/tests/common/mod.rs
@@ -39,9 +39,9 @@ use personhog_proto::personhog::types::v1::{
InsertCohortMembersRequest, InsertCohortMembersResponse, ListCohortMemberIdsRequest,
ListCohortMemberIdsResponse, ListGroupsRequest, ListGroupsResponse, Person,
PersonsByDistinctIdsInTeamResponse, PersonsByDistinctIdsResponse, PersonsResponse,
- UpdateGroupRequest, UpdateGroupResponse, UpdateGroupTypeMappingRequest,
- UpdateGroupTypeMappingResponse, UpdatePersonPropertiesRequest, UpdatePersonPropertiesResponse,
- UpsertHashKeyOverridesRequest, UpsertHashKeyOverridesResponse,
+ SplitPersonRequest, SplitPersonResponse, UpdateGroupRequest, UpdateGroupResponse,
+ UpdateGroupTypeMappingRequest, UpdateGroupTypeMappingResponse, UpdatePersonPropertiesRequest,
+ UpdatePersonPropertiesResponse, UpsertHashKeyOverridesRequest, UpsertHashKeyOverridesResponse,
};
use personhog_router::backend::{
LeaderBackend, LeaderBackendConfig, ReplicaBackend, ReplicaDnsConfig, StashTable,
@@ -446,6 +446,13 @@ impl PersonHogReplica for TestReplicaService {
deleted_count: 0,
}))
}
+
+ async fn split_person(
+ &self,
+ _request: Request<SplitPersonRequest>,
+ ) -> Result<Response<SplitPersonResponse>, Status> {
+ Ok(Response::new(SplitPersonResponse { splits: vec![] }))
+ }
}
/// Start a test replica server on a random port and return its address
diff --git a/rust/property-defs-rs/tests/group_type_resolver.rs b/rust/property-defs-rs/tests/group_type_resolver.rs
index 7d5c78b0debf..a71a31f52c5c 100644
--- a/rust/property-defs-rs/tests/group_type_resolver.rs
+++ b/rust/property-defs-rs/tests/group_type_resolver.rs
@@ -323,6 +323,12 @@ impl PersonHogService for MockPersonHogService {
) -> Result<Response<DeleteGroupTypeMappingsBatchForTeamResponse>, Status> {
Err(Status::unimplemented(""))
}
+ async fn split_person(
+ &self,
+ _: Request<SplitPersonRequest>,
+ ) -> Result<Response<SplitPersonResponse>, Status> {
+ Err(Status::unimplemented(""))
+ }
}
// -- helpers ------------------------------------------------------------