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.

chore(personhog): delete the stale writer TODO and fix doc drift (#97538)

Zach Brownd756c3c1fe25
diff --git a/rust/personhog-identity/README.md b/rust/personhog-identity/README.md
index 47f3b4a6676f..38eb0d33b7fe 100644
--- a/rust/personhog-identity/README.md
+++ b/rust/personhog-identity/README.md
@@ -7,7 +7,7 @@ Person state spans two planes:
- the sync plane (Postgres primary), which owns existence, identity topology, and lifecycle scalars
- the async plane (leader + changelog), which owns person property content
-`GetOrCreatePersonByDistinctId` / `GetOrCreatePersonsByDistinctIds` orchestrate both planes so a single ack covers both: `created = true` means the person stub is committed in Postgres AND the initial `$set`/`$set_once` are durable in the leader's changelog. The identity service never runs a saga; person-destroying operations (two-person merges, deletes) belong to the lifecycle manager.
+`GetOrCreatePersonByDistinctId` / `GetOrCreatePersonsByDistinctIds` orchestrate both planes so a single ack covers both: `created = true` means the person stub is committed in Postgres AND the initial `$set`/`$set_once` are durable in the leader's changelog. Person-destroying operations (two-person merges, deletes) run as lifecycle sagas hosted in this service (`src/lifecycle/`).
## How get-or-create works
@@ -22,6 +22,7 @@ Races resolve per key, never failing the rest of a batch: a concurrent create co
- `src/service/` — gRPC surface; `mod.rs` is dispatch-only, each RPC family has its own module (`get_or_create.rs`)
- `src/storage/` — `IdentityStorage` trait + Postgres implementation (primary pool only; identity reads must never be stale)
- `src/leader.rs` — `PropertyWriter` trait + router-backed implementation
+- `src/lifecycle/` — the lifecycle engine: merge and delete sagas, sweeper, GC
- Shared person primitives (row type, storage errors, uuidv5 scheme) live in `personhog-common::persons`
## Running locally
diff --git a/rust/personhog-proto/README.md b/rust/personhog-proto/README.md
index 6cb2b4a67594..1be86bb306d4 100644
--- a/rust/personhog-proto/README.md
+++ b/rust/personhog-proto/README.md
@@ -11,7 +11,9 @@ Proto definitions live in the top-level [`/proto/personhog`](/proto/personhog) d
├── types/v1/ # Shared message types
├── service/v1/ # Public API (router)
├── replica/v1/ # Internal read API
-└── leader/v1/ # Internal write API [future]
+├── leader/v1/ # Internal write API
+├── identity/v1/ # Identity service API
+└── lifecycle/v1/ # Lifecycle saga records
```
Each component is versioned independently, allowing breaking changes to internal APIs without affecting the public API.
diff --git a/rust/personhog-writer/TODO.md b/rust/personhog-writer/TODO.md
deleted file mode 100644
index 95c60219c361..000000000000
--- a/rust/personhog-writer/TODO.md
+++ /dev/null
@@ -1,45 +0,0 @@
-# personhog-writer follow-ups
-
-## Per-partition parallel writes
-
-The writer is currently serial: one batch at a time, commit offsets, then
-next batch. Under PG latency spikes this backpressures the consumer quickly.
-
-The natural evolution is per-partition writer tasks:
-
-- Use rdkafka rebalance callbacks (`on_assign` / `on_revoke`) to spawn/drain
- a writer task per assigned partition.
-- Each partition's batches are processed serially (preserving offset order),
- but different partitions write in parallel.
-- Offset commits stay safe because each partition's offsets are managed
- independently.
-- Cooperative-sticky assignment minimizes churn during deploys.
-
-No coordinator integration needed — Kafka's consumer group protocol handles
-partition assignment. The coordinator would only matter if we wanted writer
-and leader co-located on the same partitions.
-
-## Flush channel capacity
-
-Default `flush_channel_capacity` is 8. Tune down if memory is a concern,
-or up if PG latency causes frequent backpressure under production load.
-
-## Leader-side validation
-
-Add input validation/sanitization in personhog-leader before producing to
-`personhog_updates`:
-
-- Validate UUID format
-- Validate properties are well-formed JSON
-- Enforce size limits before publishing
-
-This shifts failure detection earlier and keeps the writer's error paths
-rare.
-
-## Production cutover
-
-Once validation confirms parity with the Node pipeline:
-
-1. Switch `PG_TARGET_TABLE` from `personhog_person_tmp` to `posthog_person`
-2. Drop `personhog_person_tmp` table
-3. Remove `personhog_person_tmp` from the table allowlist