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): folded person updates carry identity and last-seen (#79166)

Zach Brown3fb39740d6b3
diff --git a/nodejs/src/common/generated/personhog/personhog/types/v1/person_pb.ts b/nodejs/src/common/generated/personhog/personhog/types/v1/person_pb.ts
index 564964890b66..76adaaa2205a 100644
--- a/nodejs/src/common/generated/personhog/personhog/types/v1/person_pb.ts
+++ b/nodejs/src/common/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(
- 'Ch9wZXJzb25ob2cvdHlwZXMvdjEvcGVyc29uLnByb3RvEhJwZXJzb25ob2cudHlwZXMudjEingIKBlBlcnNvbhIKCgJpZBgBIAEoAxIMCgR1dWlkGAIgASgJEg8KB3RlYW1faWQYAyABKAMSEgoKcHJvcGVydGllcxgEIAEoDBIiChpwcm9wZXJ0aWVzX2xhc3RfdXBkYXRlZF9hdBgFIAEoDBIhChlwcm9wZXJ0aWVzX2xhc3Rfb3BlcmF0aW9uGAYgASgMEhIKCmNyZWF0ZWRfYXQYByABKAMSDwoHdmVyc2lvbhgIIAEoAxIVCg1pc19pZGVudGlmaWVkGAkgASgIEhcKCmlzX3VzZXJfaWQYCiABKAhIAIgBARIZCgxsYXN0X3NlZW5fYXQYCyABKANIAYgBAUINCgtfaXNfdXNlcl9pZEIPCg1fbGFzdF9zZWVuX2F0Ik4KFURpc3RpbmN0SWRXaXRoVmVyc2lvbhITCgtkaXN0aW5jdF9pZBgBIAEoCRIUCgd2ZXJzaW9uGAIgASgDSACIAQFCCgoIX3ZlcnNpb24iaAoVUGVyc29uV2l0aERpc3RpbmN0SWRzEhMKC2Rpc3RpbmN0X2lkGAEgASgJEi8KBnBlcn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pb24YAyABKAMiMAodU2V0UGVyc29uVmVyc2lvbkZsb29yUmVzcG9uc2USDwoHdXBkYXRlZBgBIAEoCGIGcHJvdG8z',
[file_personhog_types_v1_common]
)
@@ -592,8 +592,11 @@ export type UpdatePersonPropertiesRequest = Message<'personhog.types.v1.UpdatePe
personId: bigint
/**
- * The event name that triggered this update (e.g. "$set", "$identify", "$pageview").
- * Used to determine filtering behavior (person events bypass property filtering).
+ * The event name that triggered this update (e.g. "$set", "$identify",
+ * "$pageview"). The leader checks it against a small denylist of events
+ * that must never write person properties and otherwise ignores it.
+ * Callers folding many events into one request filter denylisted
+ * events' ops at fold time and send a representative name.
*
* @generated from field: string event_name = 3;
*/
@@ -608,6 +611,11 @@ export type UpdatePersonPropertiesRequest = Message<'personhog.types.v1.UpdatePe
/**
* JSON-encoded map of properties to set only if not already present.
+ * Resolved by the leader against authoritative state under the
+ * per-person lock — callers must not pre-resolve set_once against a
+ * fetched snapshot, or a concurrent writer's earlier value gets
+ * clobbered. When the same key appears here and in set_properties,
+ * set wins.
*
* @generated from field: bytes set_once_properties = 5;
*/
@@ -619,6 +627,29 @@ export type UpdatePersonPropertiesRequest = Message<'personhog.types.v1.UpdatePe
* @generated from field: repeated string unset_properties = 6;
*/
unsetProperties: string[]
+
+ /**
+ * OR-merged: true marks the person identified; false and absent are
+ * no-ops (identification never reverts through this RPC). The
+ * false→true transition counts as a change and produces a changelog
+ * record on its own.
+ *
+ * @generated from field: optional bool is_identified = 7;
+ */
+ isIdentified?: boolean
+
+ /**
+ * Epoch milliseconds (matching Person.last_seen_at). The leader floors
+ * the value to the hour (ingestion's own granularity) and max-merges,
+ * so the stored value only ever advances. An advance is a change that
+ * produces a changelog record on its own — matching ingestion's direct
+ * write path, which persists a last-seen-only advance — and the
+ * flooring bounds record volume at one per person-hour regardless of
+ * the caller's precision.
+ *
+ * @generated from field: optional int64 last_seen_at = 8;
+ */
+ lastSeenAt?: bigint
}
/**
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 38bcc2007c08..660a84068472 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"\xa6\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"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.SplitResult"c\n&SetPersonDistinctIdVersionFloorRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x13\n\x0bdistinct_id\x18\x02 \x01(\t\x12\x13\n\x0bmin_version\x18\x03 \x01(\x03"e\n\'SetPersonDistinctIdVersionFloorResponse\x12/\n\x06person\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01B\t\n\x07_person"W\n\x1cSetPersonVersionFloorRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x13\n\x0bmin_version\x18\x03 \x01(\x03"0\n\x1dSetPersonVersionFloorResponse\x12\x0f\n\x07updated\x18\x01 \x01(\x08b\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"\x80\x02\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\x1a\n\ris_identified\x18\x07 \x01(\x08H\x00\x88\x01\x01\x12\x19\n\x0clast_seen_at\x18\x08 \x01(\x03H\x01\x88\x01\x01B\x10\n\x0e_is_identifiedB\x0f\n\r_last_seen_at"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.SplitResult"c\n&SetPersonDistinctIdVersionFloorRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x13\n\x0bdistinct_id\x18\x02 \x01(\t\x12\x13\n\x0bmin_version\x18\x03 \x01(\x03"e\n\'SetPersonDistinctIdVersionFloorResponse\x12/\n\x06person\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01B\t\n\x07_person"W\n\x1cSetPersonVersionFloorRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x13\n\x0bmin_version\x18\x03 \x01(\x03"0\n\x1dSetPersonVersionFloorResponse\x12\x0f\n\x07updated\x18\x01 \x01(\x08b\x06proto3'
)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -63,32 +63,32 @@ if not _descriptor._USE_C_DESCRIPTORS:
_globals["_GETDISTINCTIDSFORPERSONSRESPONSE"]._serialized_start = 2465
_globals["_GETDISTINCTIDSFORPERSONSRESPONSE"]._serialized_end = 2567
_globals["_UPDATEPERSONPROPERTIESREQUEST"]._serialized_start = 2570
- _globals["_UPDATEPERSONPROPERTIESREQUEST"]._serialized_end = 2736
- _globals["_UPDATEPERSONPROPERTIESRESPONSE"]._serialized_start = 2738
- _globals["_UPDATEPERSONPROPERTIESRESPONSE"]._serialized_end = 2847
- _globals["_DELETEPERSONSREQUEST"]._serialized_start = 2849
- _globals["_DELETEPERSONSREQUEST"]._serialized_end = 2910
- _globals["_DELETEPERSONSRESPONSE"]._serialized_start = 2912
- _globals["_DELETEPERSONSRESPONSE"]._serialized_end = 2958
- _globals["_DELETEPERSONSBATCHFORTEAMREQUEST"]._serialized_start = 2960
- _globals["_DELETEPERSONSBATCHFORTEAMREQUEST"]._serialized_end = 3031
- _globals["_DELETEPERSONSBATCHFORTEAMRESPONSE"]._serialized_start = 3033
- _globals["_DELETEPERSONSBATCHFORTEAMRESPONSE"]._serialized_end = 3091
- _globals["_DELETEPERSONLESSDISTINCTIDSBATCHFORTEAMREQUEST"]._serialized_start = 3093
- _globals["_DELETEPERSONLESSDISTINCTIDSBATCHFORTEAMREQUEST"]._serialized_end = 3178
- _globals["_DELETEPERSONLESSDISTINCTIDSBATCHFORTEAMRESPONSE"]._serialized_start = 3180
- _globals["_DELETEPERSONLESSDISTINCTIDSBATCHFORTEAMRESPONSE"]._serialized_end = 3252
- _globals["_SPLITPERSONREQUEST"]._serialized_start = 3254
- _globals["_SPLITPERSONREQUEST"]._serialized_end = 3341
- _globals["_SPLITRESULT"]._serialized_start = 3344
- _globals["_SPLITRESULT"]._serialized_end = 3486
- _globals["_SPLITPERSONRESPONSE"]._serialized_start = 3488
- _globals["_SPLITPERSONRESPONSE"]._serialized_end = 3558
- _globals["_SETPERSONDISTINCTIDVERSIONFLOORREQUEST"]._serialized_start = 3560
- _globals["_SETPERSONDISTINCTIDVERSIONFLOORREQUEST"]._serialized_end = 3659
- _globals["_SETPERSONDISTINCTIDVERSIONFLOORRESPONSE"]._serialized_start = 3661
- _globals["_SETPERSONDISTINCTIDVERSIONFLOORRESPONSE"]._serialized_end = 3762
- _globals["_SETPERSONVERSIONFLOORREQUEST"]._serialized_start = 3764
- _globals["_SETPERSONVERSIONFLOORREQUEST"]._serialized_end = 3851
- _globals["_SETPERSONVERSIONFLOORRESPONSE"]._serialized_start = 3853
- _globals["_SETPERSONVERSIONFLOORRESPONSE"]._serialized_end = 3901
+ _globals["_UPDATEPERSONPROPERTIESREQUEST"]._serialized_end = 2826
+ _globals["_UPDATEPERSONPROPERTIESRESPONSE"]._serialized_start = 2828
+ _globals["_UPDATEPERSONPROPERTIESRESPONSE"]._serialized_end = 2937
+ _globals["_DELETEPERSONSREQUEST"]._serialized_start = 2939
+ _globals["_DELETEPERSONSREQUEST"]._serialized_end = 3000
+ _globals["_DELETEPERSONSRESPONSE"]._serialized_start = 3002
+ _globals["_DELETEPERSONSRESPONSE"]._serialized_end = 3048
+ _globals["_DELETEPERSONSBATCHFORTEAMREQUEST"]._serialized_start = 3050
+ _globals["_DELETEPERSONSBATCHFORTEAMREQUEST"]._serialized_end = 3121
+ _globals["_DELETEPERSONSBATCHFORTEAMRESPONSE"]._serialized_start = 3123
+ _globals["_DELETEPERSONSBATCHFORTEAMRESPONSE"]._serialized_end = 3181
+ _globals["_DELETEPERSONLESSDISTINCTIDSBATCHFORTEAMREQUEST"]._serialized_start = 3183
+ _globals["_DELETEPERSONLESSDISTINCTIDSBATCHFORTEAMREQUEST"]._serialized_end = 3268
+ _globals["_DELETEPERSONLESSDISTINCTIDSBATCHFORTEAMRESPONSE"]._serialized_start = 3270
+ _globals["_DELETEPERSONLESSDISTINCTIDSBATCHFORTEAMRESPONSE"]._serialized_end = 3342
+ _globals["_SPLITPERSONREQUEST"]._serialized_start = 3344
+ _globals["_SPLITPERSONREQUEST"]._serialized_end = 3431
+ _globals["_SPLITRESULT"]._serialized_start = 3434
+ _globals["_SPLITRESULT"]._serialized_end = 3576
+ _globals["_SPLITPERSONRESPONSE"]._serialized_start = 3578
+ _globals["_SPLITPERSONRESPONSE"]._serialized_end = 3648
+ _globals["_SETPERSONDISTINCTIDVERSIONFLOORREQUEST"]._serialized_start = 3650
+ _globals["_SETPERSONDISTINCTIDVERSIONFLOORREQUEST"]._serialized_end = 3749
+ _globals["_SETPERSONDISTINCTIDVERSIONFLOORRESPONSE"]._serialized_start = 3751
+ _globals["_SETPERSONDISTINCTIDVERSIONFLOORRESPONSE"]._serialized_end = 3852
+ _globals["_SETPERSONVERSIONFLOORREQUEST"]._serialized_start = 3854
+ _globals["_SETPERSONVERSIONFLOORREQUEST"]._serialized_end = 3941
+ _globals["_SETPERSONVERSIONFLOORRESPONSE"]._serialized_start = 3943
+ _globals["_SETPERSONVERSIONFLOORRESPONSE"]._serialized_end = 3991
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 138934f54a9d..80a41648fd9d 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
@@ -313,19 +313,32 @@ class GetDistinctIdsForPersonsResponse(_message.Message):
) -> None: ...
class UpdatePersonPropertiesRequest(_message.Message):
- __slots__ = ("team_id", "person_id", "event_name", "set_properties", "set_once_properties", "unset_properties")
+ __slots__ = (
+ "team_id",
+ "person_id",
+ "event_name",
+ "set_properties",
+ "set_once_properties",
+ "unset_properties",
+ "is_identified",
+ "last_seen_at",
+ )
TEAM_ID_FIELD_NUMBER: _ClassVar[int]
PERSON_ID_FIELD_NUMBER: _ClassVar[int]
EVENT_NAME_FIELD_NUMBER: _ClassVar[int]
SET_PROPERTIES_FIELD_NUMBER: _ClassVar[int]
SET_ONCE_PROPERTIES_FIELD_NUMBER: _ClassVar[int]
UNSET_PROPERTIES_FIELD_NUMBER: _ClassVar[int]
+ IS_IDENTIFIED_FIELD_NUMBER: _ClassVar[int]
+ LAST_SEEN_AT_FIELD_NUMBER: _ClassVar[int]
team_id: int
person_id: int
event_name: str
set_properties: bytes
set_once_properties: bytes
unset_properties: _containers.RepeatedScalarFieldContainer[str]
+ is_identified: bool
+ last_seen_at: int
def __init__(
self,
@@ -335,6 +348,8 @@ class UpdatePersonPropertiesRequest(_message.Message):
set_properties: _Optional[bytes] = ...,
set_once_properties: _Optional[bytes] = ...,
unset_properties: _Optional[_Iterable[str]] = ...,
+ is_identified: bool = ...,
+ last_seen_at: _Optional[int] = ...,
) -> None: ...
class UpdatePersonPropertiesResponse(_message.Message):
diff --git a/proto/personhog/types/v1/person.proto b/proto/personhog/types/v1/person.proto
index 987bea24c750..6c061e9df6cc 100644
--- a/proto/personhog/types/v1/person.proto
+++ b/proto/personhog/types/v1/person.proto
@@ -135,15 +135,36 @@ message GetDistinctIdsForPersonsResponse {
message UpdatePersonPropertiesRequest {
int64 team_id = 1;
int64 person_id = 2;
- // The event name that triggered this update (e.g. "$set", "$identify", "$pageview").
- // Used to determine filtering behavior (person events bypass property filtering).
+ // The event name that triggered this update (e.g. "$set", "$identify",
+ // "$pageview"). The leader checks it against a small denylist of events
+ // that must never write person properties and otherwise ignores it.
+ // Callers folding many events into one request filter denylisted
+ // events' ops at fold time and send a representative name.
string event_name = 3;
// JSON-encoded map of properties to set (overwrites existing values).
bytes set_properties = 4;
// JSON-encoded map of properties to set only if not already present.
+ // Resolved by the leader against authoritative state under the
+ // per-person lock — callers must not pre-resolve set_once against a
+ // fetched snapshot, or a concurrent writer's earlier value gets
+ // clobbered. When the same key appears here and in set_properties,
+ // set wins.
bytes set_once_properties = 5;
// Property keys to remove from the person.
repeated string unset_properties = 6;
+ // OR-merged: true marks the person identified; false and absent are
+ // no-ops (identification never reverts through this RPC). The
+ // false→true transition counts as a change and produces a changelog
+ // record on its own.
+ optional bool is_identified = 7;
+ // Epoch milliseconds (matching Person.last_seen_at). The leader floors
+ // the value to the hour (ingestion's own granularity) and max-merges,
+ // so the stored value only ever advances. An advance is a change that
+ // produces a changelog record on its own — matching ingestion's direct
+ // write path, which persists a last-seen-only advance — and the
+ // flooring bounds record volume at one per person-hour regardless of
+ // the caller's precision.
+ optional int64 last_seen_at = 8;
}
message UpdatePersonPropertiesResponse {
diff --git a/rust/personhog-identity/src/service/get_or_create.rs b/rust/personhog-identity/src/service/get_or_create.rs
index 278fbcb98520..b1694e963d6f 100644
--- a/rust/personhog-identity/src/service/get_or_create.rs
+++ b/rust/personhog-identity/src/service/get_or_create.rs
@@ -216,6 +216,8 @@ impl PersonHogIdentityService {
set_properties: entry.set_properties.clone(),
set_once_properties: entry.set_once_properties.clone(),
unset_properties: Vec::new(),
+ is_identified: None,
+ last_seen_at: None,
};
match self
diff --git a/rust/personhog-leader/src/cache/partitioned.rs b/rust/personhog-leader/src/cache/partitioned.rs
index 1c519cfe6bfe..0873e293a6fa 100644
--- a/rust/personhog-leader/src/cache/partitioned.rs
+++ b/rust/personhog-leader/src/cache/partitioned.rs
@@ -124,6 +124,7 @@ mod tests {
created_at: 1700000000,
version: 1,
is_identified: false,
+ last_seen_at: None,
approx_bytes: approx_person_bytes(64),
}
}
diff --git a/rust/personhog-leader/src/cache/persons.rs b/rust/personhog-leader/src/cache/persons.rs
index 5288e0d0ddda..3b9b2c4362d0 100644
--- a/rust/personhog-leader/src/cache/persons.rs
+++ b/rust/personhog-leader/src/cache/persons.rs
@@ -36,6 +36,10 @@ pub struct CachedPerson {
pub created_at: i64,
pub version: i64,
pub is_identified: bool,
+ /// Epoch milliseconds of the person's last observed activity, when
+ /// known (matching `created_at`'s unit). Max-merged on update — the
+ /// value only ever advances — and deliberately not a change by itself.
+ pub last_seen_at: Option<i64>,
/// Byte weight charged against the cache capacity; see
/// [`approx_person_bytes`].
pub approx_bytes: usize,
@@ -58,6 +62,7 @@ impl TryFrom<Person> for CachedPerson {
created_at: person.created_at,
version: person.version,
is_identified: person.is_identified,
+ last_seen_at: person.last_seen_at,
approx_bytes,
})
}
@@ -154,6 +159,7 @@ mod tests {
created_at: 1700000000,
version: 1,
is_identified: false,
+ last_seen_at: None,
approx_bytes: approx_person_bytes(64),
}
}
diff --git a/rust/personhog-leader/src/person_update.rs b/rust/personhog-leader/src/person_update.rs
index 7158baee95f1..0c53d36f5d64 100644
--- a/rust/personhog-leader/src/person_update.rs
+++ b/rust/personhog-leader/src/person_update.rs
@@ -215,6 +215,23 @@ mod tests {
assert_eq!(result.to_unset, vec!["old_prop"]);
}
+ #[test]
+ fn set_wins_over_set_once_for_the_same_key() {
+ let result = compute_event_property_updates(
+ "$set",
+ &json!({"plan": "pro"}),
+ &json!({"plan": "free"}),
+ &[],
+ &json!({}),
+ );
+ assert!(result.has_changes);
+ assert_eq!(
+ result.to_set["plan"],
+ json!("pro"),
+ "the request contract: when a key appears in both set and set_once, set wins"
+ );
+ }
+
#[test]
fn apply_updates_sets_properties() {
let updates = PropertyUpdates {
diff --git a/rust/personhog-leader/src/pg.rs b/rust/personhog-leader/src/pg.rs
index 5a6b9d282be3..bbe8feb7da07 100644
--- a/rust/personhog-leader/src/pg.rs
+++ b/rust/personhog-leader/src/pg.rs
@@ -46,7 +46,7 @@ pub async fn load_person_from_pg(
// is the truthful answer for a deleted person.
let row = sqlx::query(&format!(
"SELECT id, team_id, uuid::text, properties::text AS properties, created_at, version, \
- is_identified
+ is_identified, last_seen_at
FROM {table}
WHERE team_id = $1 AND id = $2 AND is_deleted = false",
))
@@ -73,6 +73,7 @@ pub async fn load_person_from_pg(
let created_at: chrono::DateTime<chrono::Utc> = row.get("created_at");
let version: Option<i64> = row.get("version");
let is_identified: bool = row.get("is_identified");
+ let last_seen_at: Option<chrono::DateTime<chrono::Utc>> = row.get("last_seen_at");
let properties = match serde_json::from_str(properties_text) {
Ok(value) => value,
@@ -112,5 +113,6 @@ pub async fn load_person_from_pg(
created_at: created_at.timestamp_millis(),
version: version.unwrap_or(0),
is_identified,
+ last_seen_at: last_seen_at.map(|t| t.timestamp_millis()),
}))
}
diff --git a/rust/personhog-leader/src/service.rs b/rust/personhog-leader/src/service.rs
index 70d580b60098..e7982cfafe31 100644
--- a/rust/personhog-leader/src/service.rs
+++ b/rust/personhog-leader/src/service.rs
@@ -402,21 +402,26 @@ impl PersonHogLeaderService {
}
}
+/// Upper bound on the epoch-millisecond timestamps the leader will put in
+/// a changelog record: the last instant of year 9999. Comfortably inside
+/// both chrono's representable range and Postgres's `timestamptz` range,
+/// so any value under this bound is bindable by the writer.
+const MAX_EPOCH_MS_YEAR_9999: i64 = 253_402_300_799_999;
+
+/// The granularity `last_seen_at` is stored at. Matches ingestion's own
+/// hourly truncation so both write paths produce identical stored values.
+const MS_PER_HOUR: i64 = 3_600_000;
+
/// The changelog contract: every produced record must be applyable by the
/// writer's upsert verbatim. Properties are guaranteed by admission
/// (NUL sanitization plus the exact size measure); this checks the
-/// identity fields against the writer's bind conversions — uuid must
-/// parse, team_id must fit the column's `integer`, and created_at — epoch
-/// milliseconds, like every timestamp in the proto — must sit inside a
-/// sanity range ([1970, 9999]) any legitimately created person satisfies.
-///
-/// These three are the only fields that need checking because they are
-/// the only writer-bound fields representable in `CachedPerson`: the
-/// legacy jsonb columns and `last_seen_at` have no cache field and are
-/// unconditionally empty in `cached_person_to_proto`, so a leader-produced
+/// remaining writer-bound fields against the writer's bind conversions —
+/// uuid must parse, team_id must fit the column's `integer`, and the
+/// timestamps must sit inside a sanity range ([1970, 9999]) any
+/// legitimate value satisfies. The legacy jsonb columns have no cache
+/// field and are unconditionally empty in `cached_person_to_proto`, so a
/// record structurally cannot carry values the writer would refuse there.
fn assert_writeable(p: &CachedPerson) -> Result<(), String> {
- const MAX_EPOCH_MS_YEAR_9999: i64 = 253_402_300_799_999;
if Uuid::parse_str(&p.uuid).is_err() {
return Err("uuid does not parse as a UUID".to_string());
}
@@ -432,6 +437,11 @@ fn assert_writeable(p: &CachedPerson) -> Result<(), String> {
p.created_at
));
}
+ if let Some(t) = p.last_seen_at {
+ if !(0..=MAX_EPOCH_MS_YEAR_9999).contains(&t) {
+ return Err(format!("last_seen_at epoch {t} is outside sane bounds"));
+ }
+ }
Ok(())
}
@@ -448,7 +458,7 @@ fn cached_person_to_proto(p: &CachedPerson) -> Person {
version: p.version,
is_identified: p.is_identified,
is_user_id: None,
- last_seen_at: None,
+ last_seen_at: p.last_seen_at,
}
}
@@ -631,8 +641,35 @@ impl PersonHogLeader for PersonHogLeaderService {
&person.properties,
);
+ // OR-merge: identification never reverts through this RPC, so
+ // only a true that finds false is a change. It counts as one on
+ // its own — an $identify with no property diffs must still
+ // produce a record.
+ let identified_now = person.is_identified || req.is_identified == Some(true);
+ let identity_changed = identified_now != person.is_identified;
+
+ // last_seen_at is request-borne and best-effort: an out-of-range
+ // value is discarded rather than failing the update, so the
+ // acked ⇒ writeable invariant never hinges on it. In-range values
+ // are floored to the hour — Node's startOf('hour') on its
+ // UTC-normalized timestamps, expressed in epoch terms — so record
+ // volume is bounded at one per person-hour by construction, not
+ // by trusting callers to coarsen.
+ let requested_last_seen = req
+ .last_seen_at
+ .filter(|t| (0..=MAX_EPOCH_MS_YEAR_9999).contains(t));
+ if requested_last_seen != req.last_seen_at {
+ counter!("personhog_leader_last_seen_discarded_total").increment(1);
+ }
+ let requested_last_seen = requested_last_seen.map(|t| t - t % MS_PER_HOUR);
+ // Max-merge: the stored value only ever advances, and an advance
+ // is a change in its own right — ingestion's direct write path
+ // persists a last-seen-only advance, so this path must too.
+ let merged_last_seen = person.last_seen_at.max(requested_last_seen);
+ let last_seen_changed = merged_last_seen != person.last_seen_at;
+
// Fast path: no diffs detected, skip the clone in apply_property_updates
- if !updates.has_changes {
+ if !updates.has_changes && !identity_changed && !last_seen_changed {
counter!("personhog_leader_updates_total", "outcome" => "no_change").increment(1);
return Ok(Response::new(UpdatePersonPropertiesResponse {
person: Some(cached_person_to_proto(&person)),
@@ -645,7 +682,7 @@ impl PersonHogLeader for PersonHogLeaderService {
let (new_properties, actually_updated) =
apply_property_updates(&updates, &person.properties);
- if !actually_updated {
+ if !actually_updated && !identity_changed && !last_seen_changed {
counter!("personhog_leader_updates_total", "outcome" => "no_change").increment(1);
return Ok(Response::new(UpdatePersonPropertiesResponse {
person: Some(cached_person_to_proto(&person)),
@@ -767,7 +804,8 @@ impl PersonHogLeader for PersonHogLeaderService {
properties: new_properties,
created_at: person.created_at,
version: base_version + 1,
- is_identified: person.is_identified,
+ is_identified: identified_now,
+ last_seen_at: merged_last_seen,
approx_bytes,
};
@@ -1153,6 +1191,7 @@ mod tests {
created_at: 0,
version: 1,
is_identified: false,
+ last_seen_at: None,
approx_bytes: 64,
},
);
@@ -1217,6 +1256,7 @@ mod tests {
created_at: 0,
version: 1,
is_identified: false,
+ last_seen_at: None,
approx_bytes: 64,
},
);
@@ -1229,6 +1269,8 @@ mod tests {
set_properties: serde_json::to_vec(&serde_json::json!({"a": 1})).unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
});
request
.metadata_mut()
@@ -1315,6 +1357,7 @@ mod tests {
created_at: 0,
version: 1,
is_identified: false,
+ last_seen_at: None,
approx_bytes: 64,
},
);
@@ -1359,6 +1402,7 @@ mod tests {
created_at: 0,
version: 1,
is_identified: false,
+ last_seen_at: None,
approx_bytes: 64,
},
);
@@ -1380,6 +1424,8 @@ mod tests {
set_properties: serde_json::to_vec(&serde_json::json!({"a": 1})).unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
});
request
.metadata_mut()
@@ -1461,6 +1507,8 @@ mod tests {
set_properties: serde_json::to_vec(&serde_json::json!({"a": 1})).unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
});
write
.metadata_mut()
diff --git a/rust/personhog-leader/tests/common/mod.rs b/rust/personhog-leader/tests/common/mod.rs
index c15b898b7748..93fac3acf6b2 100644
--- a/rust/personhog-leader/tests/common/mod.rs
+++ b/rust/personhog-leader/tests/common/mod.rs
@@ -547,6 +547,7 @@ pub fn test_cached_person() -> CachedPerson {
created_at: 1700000000,
version: 1,
is_identified: false,
+ last_seen_at: None,
approx_bytes: approx_person_bytes(64),
}
}
diff --git a/rust/personhog-leader/tests/integration.rs b/rust/personhog-leader/tests/integration.rs
index 3a06bea074cb..cc596700e5d0 100644
--- a/rust/personhog-leader/tests/integration.rs
+++ b/rust/personhog-leader/tests/integration.rs
@@ -138,6 +138,8 @@ async fn service_accepts_requests_after_coordination_warmup() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
0,
))
@@ -225,6 +227,8 @@ async fn unowned_partition_returns_failed_precondition() {
set_properties: vec![],
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
0,
))
@@ -315,6 +319,8 @@ async fn missing_partition_metadata_returns_invalid_argument() {
set_properties: vec![],
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
})
.await;
let status = result.expect_err("write without x-partition must fail closed");
@@ -398,6 +404,8 @@ async fn mismatched_partition_metadata_returns_invalid_argument() {
set_properties: vec![],
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
wrong_partition,
))
@@ -495,6 +503,8 @@ async fn writes_fenced_after_drain_reads_still_served() {
set_properties: serde_json::to_vec(&serde_json::json!({ "email": email })).unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
0,
)
@@ -635,6 +645,8 @@ async fn drain_fences_before_waiting_on_inflight() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
0,
))
@@ -929,6 +941,8 @@ async fn update_produces_person_state_to_kafka() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
routing_partition,
))
@@ -1043,6 +1057,8 @@ async fn kafka_produce_failure_leaves_cache_unchanged() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
0,
))
@@ -1076,6 +1092,8 @@ async fn kafka_produce_failure_leaves_cache_unchanged() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
0,
))
@@ -1162,6 +1180,8 @@ async fn e2e_update_produces_to_local_kafka() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
0,
))
@@ -1405,6 +1425,8 @@ async fn update_triggers_pg_fallback_then_applies_changes() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
partition,
))
@@ -1496,6 +1518,8 @@ async fn evicted_dirty_person_recovers_from_changelog() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
routing_partition,
))
@@ -1596,6 +1620,8 @@ async fn dirty_person_with_failed_recovery_is_unavailable_not_stale() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
routing_partition,
))
@@ -1711,6 +1737,8 @@ async fn writes_shed_when_dirty_index_is_full() {
set_properties: serde_json::to_vec(&serde_json::json!({ "k": value })).unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
};
// First person fills the index.
@@ -1801,6 +1829,8 @@ async fn recovery_fails_when_record_version_disagrees_with_the_mark() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
routing_partition,
))
@@ -1911,6 +1941,8 @@ async fn recovery_reuses_the_partition_consumer_across_fetches() {
set_properties: serde_json::to_vec(&serde_json::json!({ "who": value })).unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
};
// A's record lands at offset 0, B's at offset 1.
for (person_id, value) in [(person_a, "a"), (person_b, "b")] {
@@ -2135,6 +2167,8 @@ async fn oversize_updates_are_rejected_and_oversized_rows_remediated() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
routing_partition,
))
@@ -2173,6 +2207,8 @@ async fn oversize_updates_are_rejected_and_oversized_rows_remediated() {
set_properties: serde_json::to_vec(&serde_json::json!({"name": "after"})).unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
routing_partition,
))
@@ -2214,6 +2250,8 @@ async fn oversize_updates_are_rejected_and_oversized_rows_remediated() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
oversized_partition,
))
@@ -2282,6 +2320,8 @@ async fn oversize_updates_are_rejected_and_oversized_rows_remediated() {
set_properties: serde_json::to_vec(&serde_json::json!({"name": "x"})).unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
unremediable_partition,
))
@@ -2378,6 +2418,8 @@ async fn oversize_updates_are_rejected_and_oversized_rows_remediated() {
set_properties: oversized_update.clone(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
routing_partition,
))
@@ -2393,6 +2435,8 @@ async fn oversize_updates_are_rejected_and_oversized_rows_remediated() {
set_properties: oversized_update,
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
team2_partition,
))
@@ -2428,6 +2472,8 @@ async fn oversize_updates_are_rejected_and_oversized_rows_remediated() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
routing_partition,
))
@@ -2474,6 +2520,8 @@ async fn oversize_updates_are_rejected_and_oversized_rows_remediated() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
routing_partition,
))
@@ -2556,6 +2604,8 @@ async fn an_unresolved_version_is_never_reused() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
},
0,
))
@@ -2624,6 +2674,8 @@ async fn a_fenced_write_that_bounces_does_not_hand_its_version_back() {
set_properties: serde_json::to_vec(&serde_json::json!({"n": n})).unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
});
request
.metadata_mut()
@@ -2743,6 +2795,8 @@ async fn an_unknown_outcome_keeps_its_version(
set_properties: serde_json::to_vec(&serde_json::json!({"n": n})).unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
});
request
.metadata_mut()
@@ -2781,3 +2835,181 @@ async fn an_unknown_outcome_keeps_its_version(
"the entry must survive, or a pruned mark leaves the person unreadable"
);
}
+
+/// The scalar fields carry merge semantics, not assignment: identification
+/// only ever ORs true (and counts as a change on its own — an $identify
+/// with no property diffs must still produce a record), while last-seen
+/// only ever advances and never earns a record by itself.
+#[tokio::test]
+async fn scalar_fields_merge_rather_than_assign() {
+ const HOUR_MS: i64 = 3_600_000;
+ let topic = format!("scalar_merge_{}", uuid::Uuid::new_v4().simple());
+ let cache = Arc::new(PartitionedCache::new(1 << 20));
+ let (_mock_cluster, kafka_producer) = create_test_kafka().await;
+ let emitted_versions = Arc::new(personhog_leader::emitted::EmittedVersions::new(1_000_000));
+
+ let service = PersonHogLeaderService::new(
+ Arc::clone(&cache),
+ kafka_producer.clone(),
+ topic.clone(),
+ None,
+ Arc::new(DashMap::new()),
+ Arc::new(InflightTracker::new()),
+ NUM_PARTITIONS,
+ Arc::new(DirtyIndex::new(1_000_000)),
+ test_recovery(KAFKA_BOOTSTRAP),
+ PropertySizeLimits::new(655360, 524288),
+ WarningsProducer::new(kafka_producer, "clickhouse_ingestion_warnings".to_string()),
+ None,
+ None,
+ Arc::clone(&emitted_versions),
+ );
+
+ cache.create_partition(0);
+ seed_person(&cache, 0, test_cached_person());
+
+ let update = |set: serde_json::Value, identified: Option<bool>, seen: Option<i64>| {
+ let mut request = Request::new(UpdatePersonPropertiesRequest {
+ team_id: 1,
+ person_id: 42,
+ event_name: "$identify".to_string(),
+ set_properties: if set.is_null() {
+ vec![]
+ } else {
+ serde_json::to_vec(&set).unwrap()
+ },
+ set_once_properties: vec![],
+ unset_properties: vec![],
+ is_identified: identified,
+ last_seen_at: seen,
+ });
+ request
+ .metadata_mut()
+ .insert("x-partition", "0".parse().unwrap());
+ request
+ };
+
+ // A last-seen-only advance is a change of its own: ingestion's
+ // direct write path persists it, so this path must too. The leader
+ // floors to the hour, so a raw mid-hour timestamp stores the hour.
+ let result = service
+ .update_person_properties(update(serde_json::Value::Null, None, Some(HOUR_MS + 1_234)))
+ .await
+ .expect("last-seen-only must be accepted")
+ .into_inner();
+ assert!(result.updated, "a last-seen-only advance earns a record");
+ let person = result.person.unwrap();
+ assert_eq!(person.version, 2);
+ assert_eq!(
+ person.last_seen_at,
+ Some(HOUR_MS),
+ "stored at hour granularity"
+ );
+
+ // A second event inside the stored hour is a no-op: the flooring
+ // bounds record volume at one per person-hour regardless of the
+ // caller's precision.
+ let result = service
+ .update_person_properties(update(
+ serde_json::Value::Null,
+ None,
+ Some(HOUR_MS + 900_000),
+ ))
+ .await
+ .expect("a same-hour timestamp must be accepted")
+ .into_inner();
+ assert!(
+ !result.updated,
+ "a raw timestamp inside the stored hour must not produce a record"
+ );
+
+ // Identification is a change, and the newer last-seen merges in.
+ let result = service
+ .update_person_properties(update(
+ serde_json::Value::Null,
+ Some(true),
+ Some(5 * HOUR_MS),
+ ))
+ .await
+ .expect("identification must apply")
+ .into_inner();
+ assert!(result.updated, "the false→true transition earns a record");
+ let person = result.person.unwrap();
+ assert_eq!(person.version, 3);
+ assert!(person.is_identified);
+ assert_eq!(person.last_seen_at, Some(5 * HOUR_MS));
+
+ // OR semantics: false does not revert, and re-asserting true is not a
+ // change.
+ let result = service
+ .update_person_properties(update(serde_json::Value::Null, Some(false), None))
+ .await
+ .expect("a false is a no-op, not an error")
+ .into_inner();
+ assert!(
+ !result.updated,
+ "identification never reverts through this RPC"
+ );
+ assert!(result.person.unwrap().is_identified);
+ let result = service
+ .update_person_properties(update(serde_json::Value::Null, Some(true), None))
+ .await
+ .expect("re-asserting true is accepted")
+ .into_inner();
+ assert!(
+ !result.updated,
+ "an already-identified person has nothing to change"
+ );
+
+ // A non-advancing last-seen is not a change: only forward movement
+ // of the stored value earns a record.
+ let result = service
+ .update_person_properties(update(serde_json::Value::Null, None, Some(3 * HOUR_MS)))
+ .await
+ .expect("a stale last-seen is a no-op, not an error")
+ .into_inner();
+ assert!(
+ !result.updated,
+ "a last-seen at or below the stored value must not produce a record"
+ );
+
+ // Max-merge: an older last-seen cannot lower the stored one, and a
+ // property change carries the newest value forward.
+ let result = service
+ .update_person_properties(update(
+ serde_json::json!({"plan": "pro"}),
+ None,
+ Some(3 * HOUR_MS),
+ ))
+ .await
+ .expect("a property change with a stale last-seen must apply")
+ .into_inner();
+ assert!(result.updated);
+ let person = result.person.unwrap();
+ assert_eq!(person.version, 4);
+ assert_eq!(
+ person.last_seen_at,
+ Some(5 * HOUR_MS),
+ "a stale last-seen must not lower the stored value"
+ );
+
+ // A last-seen outside the writer's bindable range is discarded, not
+ // fatal: the update it rides on still lands.
+ let result = service
+ .update_person_properties(update(
+ serde_json::json!({"plan": "max"}),
+ None,
+ Some(i64::MAX),
+ ))
+ .await
+ .expect("an absurd last-seen must not fail the update it rides on")
+ .into_inner();
+ assert!(result.updated);
+ let person = result.person.unwrap();
+ assert_eq!(person.version, 5);
+ assert_eq!(
+ person.last_seen_at,
+ Some(5 * HOUR_MS),
+ "an out-of-range last-seen must be discarded, not stored"
+ );
+}
diff --git a/rust/personhog-router/tests/raw_proxy_integration.rs b/rust/personhog-router/tests/raw_proxy_integration.rs
index 121ba5084d3a..063f5c061470 100644
--- a/rust/personhog-router/tests/raw_proxy_integration.rs
+++ b/rust/personhog-router/tests/raw_proxy_integration.rs
@@ -258,6 +258,8 @@ async fn raw_proxy_update_person_properties_routes_to_leader() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
}),
1,
42,
@@ -294,6 +296,8 @@ async fn raw_proxy_write_then_strong_read_roundtrip() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
}),
1,
42,
@@ -346,6 +350,8 @@ async fn raw_proxy_leader_requests_without_key_headers_rejected() {
set_properties: vec![],
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
})
.await;
let status = update_result.expect_err("write without key headers must be rejected");
@@ -412,6 +418,8 @@ async fn raw_proxy_update_person_properties_no_leader_returns_unimplemented() {
set_properties: vec![],
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
})
.await;
@@ -449,6 +457,8 @@ async fn raw_proxy_compressed_leader_requests_transit_untouched() {
.unwrap(),
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
}),
1,
42,
@@ -527,6 +537,8 @@ async fn raw_proxy_rejects_oversized_leader_request() {
set_properties: oversized_props,
set_once_properties: vec![],
unset_properties: vec![],
+ is_identified: None,
+ last_seen_at: None,
}),
1,
42,
diff --git a/rust/personhog-router/tests/stash_integration.rs b/rust/personhog-router/tests/stash_integration.rs
index 3ed81c9890e1..d9ec353a6723 100644
--- a/rust/personhog-router/tests/stash_integration.rs
+++ b/rust/personhog-router/tests/stash_integration.rs
@@ -78,6 +78,8 @@ fn mk_request(team_id: i64, person_id: i64, set_email: &str) -> UpdatePersonProp
set_properties: serde_json::to_vec(&serde_json::json!({ "email": set_email })).unwrap(),
set_once_properties: Vec::new(),
unset_properties: Vec::new(),
+ is_identified: None,
+ last_seen_at: None,
}
}
diff --git a/rust/personhog-test-harness/src/client.rs b/rust/personhog-test-harness/src/client.rs
index 07ee00546da7..61c887cb52dd 100644
--- a/rust/personhog-test-harness/src/client.rs
+++ b/rust/personhog-test-harness/src/client.rs
@@ -57,6 +57,8 @@ impl HarnessClient {
set_properties: serde_json::to_vec(&set_properties)?,
set_once_properties: serde_json::to_vec(&set_once_properties)?,
unset_properties,
+ is_identified: None,
+ last_seen_at: None,
})
.await
.context("UpdatePersonProperties failed")
diff --git a/rust/personhog-writer/src/pg.rs b/rust/personhog-writer/src/pg.rs
index 012ea281f74f..24c17a7a3e76 100644
--- a/rust/personhog-writer/src/pg.rs
+++ b/rust/personhog-writer/src/pg.rs
@@ -43,6 +43,14 @@ impl PgStore {
ALLOWED_TABLES
);
+ // Most columns take the record's value outright — the record is the
+ // leader's authoritative snapshot and the version guard orders
+ // records — but three merge against the existing row instead. The
+ // meta columns coalesce because changelog records carry no meta
+ // (the leader does not maintain those columns; ingestion's direct
+ // writer does), so assignment would erase real values. last_seen_at
+ // takes GREATEST — which ignores NULL — because records may predate
+ // the field, and the column's invariant is that it only advances.
let upsert_sql = format!(
"INSERT INTO {table} (
id, team_id, uuid, properties, properties_last_updated_at,
@@ -61,12 +69,14 @@ impl PgStore {
ON CONFLICT (team_id, id) DO UPDATE SET
uuid = EXCLUDED.uuid,
properties = EXCLUDED.properties,
- properties_last_updated_at = EXCLUDED.properties_last_updated_at,
- properties_last_operation = EXCLUDED.properties_last_operation,
+ properties_last_updated_at =
+ COALESCE(EXCLUDED.properties_last_updated_at, {table}.properties_last_updated_at),
+ properties_last_operation =
+ COALESCE(EXCLUDED.properties_last_operation, {table}.properties_last_operation),
created_at = EXCLUDED.created_at,
version = EXCLUDED.version,
is_identified = EXCLUDED.is_identified,
- last_seen_at = EXCLUDED.last_seen_at
+ last_seen_at = GREATEST(EXCLUDED.last_seen_at, {table}.last_seen_at)
WHERE EXCLUDED.version > COALESCE({table}.version, -1)",
table = table_name
);
diff --git a/rust/personhog-writer/tests/integration.rs b/rust/personhog-writer/tests/integration.rs
index dcddc4b4f638..7f7a19ecb8d5 100644
--- a/rust/personhog-writer/tests/integration.rs
+++ b/rust/personhog-writer/tests/integration.rs
@@ -4,6 +4,7 @@ use std::collections::HashMap;
use std::sync::Arc;
use std::time::Duration;
+use chrono::{DateTime, Utc};
use common::{
cleanup_team, create_local_kafka_producer, create_mock_kafka, create_test_pool, make_person,
KAFKA_BOOTSTRAP, TARGET_TABLE, TOPIC,
@@ -98,6 +99,97 @@ async fn writer_version_guard_skips_stale_updates() {
cleanup_team(&pool, team_id).await;
}
+#[tokio::test]
+async fn writer_merges_meta_and_last_seen_instead_of_assigning() {
+ let pool = create_test_pool().await;
+ let team_id: i32 = 99_006;
+ cleanup_team(&pool, team_id).await;
+
+ let writer = PersonWriteStore::new(
+ PgStore::new(pool.clone(), TARGET_TABLE.to_string()),
+ common::test_store_config(),
+ );
+
+ let fetch = |pool: sqlx::PgPool| async move {
+ let row: (i64, Option<String>, Option<DateTime<Utc>>) = sqlx::query_as(
+ "SELECT version, properties_last_updated_at::text, last_seen_at
+ FROM personhog_person_tmp WHERE team_id = $1 AND id = $2",
+ )
+ .bind(team_id)
+ .bind(1_i64)
+ .fetch_one(&pool)
+ .await
+ .unwrap();
+ (row.0, row.1, row.2.map(|t| t.timestamp_millis()))
+ };
+
+ // Seed a row carrying meta and a last-seen value, as ingestion's direct
+ // writer produces today.
+ let mut person = make_person(team_id as i64, 1, 1);
+ person.properties_last_updated_at =
+ serde_json::to_vec(&serde_json::json!({"email": "2026-01-01T00:00:00Z"})).unwrap();
+ person.last_seen_at = Some(5000);
+ assert!(matches!(
+ writer.upsert_batch(vec![person]).await,
+ BatchOutcome::Success
+ ));
+ let (version, meta, last_seen) = fetch(pool.clone()).await;
+ assert_eq!((version, last_seen), (1, Some(5000)));
+ let seeded_meta = meta.expect("insert must land the seeded meta");
+
+ // A leader-shaped record: newer version, no meta, older last-seen. The
+ // version guard admits it, but it must not erase the meta or lower the
+ // last-seen value.
+ let mut leader_record = make_person(team_id as i64, 1, 2);
+ leader_record.last_seen_at = Some(3000);
+ assert!(matches!(
+ writer.upsert_batch(vec![leader_record]).await,
+ BatchOutcome::Success
+ ));
+ let (version, meta, last_seen) = fetch(pool.clone()).await;
+ assert_eq!(version, 2, "the version guard must admit the newer record");
+ assert_eq!(
+ meta.as_deref(),
+ Some(seeded_meta.as_str()),
+ "a record without meta must leave the stored meta in place"
+ );
+ assert_eq!(
+ last_seen,
+ Some(5000),
+ "a record with an older last-seen must not lower the stored value"
+ );
+
+ // A record with no last-seen at all (predating the field) must also
+ // leave the stored value in place.
+ let no_last_seen = make_person(team_id as i64, 1, 3);
+ assert!(matches!(
+ writer.upsert_batch(vec![no_last_seen]).await,
+ BatchOutcome::Success
+ ));
+ let (version, _, last_seen) = fetch(pool.clone()).await;
+ assert_eq!((version, last_seen), (3, Some(5000)));
+
+ // A record that does carry meta and a newer last-seen replaces both —
+ // merging must not freeze the columns at their first values.
+ let mut advancing = make_person(team_id as i64, 1, 4);
+ advancing.properties_last_updated_at =
+ serde_json::to_vec(&serde_json::json!({"email": "2026-02-01T00:00:00Z"})).unwrap();
+ advancing.last_seen_at = Some(6000);
+ assert!(matches!(
+ writer.upsert_batch(vec![advancing]).await,
+ BatchOutcome::Success
+ ));
+ let (version, meta, last_seen) = fetch(pool.clone()).await;
+ assert_eq!((version, last_seen), (4, Some(6000)));
+ assert_ne!(
+ meta.as_deref(),
+ Some(seeded_meta.as_str()),
+ "a record carrying meta must replace the stored meta"
+ );
+
+ cleanup_team(&pool, team_id).await;
+}
+
#[tokio::test]
async fn writer_upsert_batch_multiple_persons() {
let pool = create_test_pool().await;