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(flags): use the shared cookieless sentinel in personhog-replica (#113594)

Phil Haack4fb044df33ea
diff --git a/rust/personhog-common/src/persons.rs b/rust/personhog-common/src/persons.rs
index c0c817e761e6..81915379aa15 100644
--- a/rust/personhog-common/src/persons.rs
+++ b/rust/personhog-common/src/persons.rs
@@ -20,8 +20,10 @@ pub fn person_uuid(team_id: i64, distinct_id: &str) -> Uuid {
)
}
-/// Every cookieless visitor shares this distinct id. Mirrors the constant in
-/// `common-cookieless`, which the personhog services do not depend on.
+/// Every cookieless visitor shares this distinct id. A hash key override that
+/// stores it counts as no override. Mirrors the constant in
+/// `common-cookieless`. The personhog services do not depend on that crate
+/// because it pulls in redis and moka.
pub const COOKIELESS_SENTINEL_VALUE: &str = "$posthog_cookieless";
/// Validate a configured table identifier before it is interpolated into
diff --git a/rust/personhog-replica/src/service/mod.rs b/rust/personhog-replica/src/service/mod.rs
index c44f6293f62f..d97090f4161d 100644
--- a/rust/personhog-replica/src/service/mod.rs
+++ b/rust/personhog-replica/src/service/mod.rs
@@ -9,6 +9,7 @@ mod tests;
use std::collections::{HashMap, HashSet};
use std::sync::Arc;
+use personhog_common::persons::COOKIELESS_SENTINEL_VALUE;
use personhog_proto::personhog::replica::v1::person_hog_replica_server::PersonHogReplica;
use personhog_proto::personhog::types::v1::{
AckPersonTombstonesRequest, AckPersonTombstonesResponse, CheckCohortMembershipRequest,
@@ -53,7 +54,6 @@ use personhog_proto::personhog::types::v1::{
use tonic::{Request, Response, Status};
use uuid::Uuid;
-use crate::storage::types::COOKIELESS_SENTINEL_VALUE;
use crate::storage::{self, FullStorage};
const MAX_BATCH_LOOKUP_SIZE: usize = 250;
diff --git a/rust/personhog-replica/src/storage/postgres/feature_flag.rs b/rust/personhog-replica/src/storage/postgres/feature_flag.rs
index d01644d62130..8b58bab07668 100644
--- a/rust/personhog-replica/src/storage/postgres/feature_flag.rs
+++ b/rust/personhog-replica/src/storage/postgres/feature_flag.rs
@@ -4,11 +4,12 @@ use async_trait::async_trait;
use sqlx::FromRow;
use personhog_common::grpc::{current_client_name, current_method_name};
+use personhog_common::persons::COOKIELESS_SENTINEL_VALUE;
use super::{ConsistencyLevel, PostgresStorage, DB_QUERY_DURATION, DB_ROWS_RETURNED};
use crate::storage::error::StorageResult;
use crate::storage::traits::FeatureFlagStorage;
-use crate::storage::types::{HashKeyOverride, HashKeyOverrideContext, COOKIELESS_SENTINEL_VALUE};
+use crate::storage::types::{HashKeyOverride, HashKeyOverrideContext};
// Kept as an intermediate struct because the rows are aggregated into
// HashKeyOverrideContext via HashMap grouping logic. All field types already
diff --git a/rust/personhog-replica/src/storage/types/feature_flag.rs b/rust/personhog-replica/src/storage/types/feature_flag.rs
index 54253d1f35f2..ab2f76b0dd55 100644
--- a/rust/personhog-replica/src/storage/types/feature_flag.rs
+++ b/rust/personhog-replica/src/storage/types/feature_flag.rs
@@ -1,7 +1,3 @@
-/// Every cookieless visitor shares this hash key, so a stored override with it is no override.
-/// Mirrors `COOKIELESS_SENTINEL_VALUE` in `common-cookieless`, which pulls in redis and moka.
-pub const COOKIELESS_SENTINEL_VALUE: &str = "$posthog_cookieless";
-
#[derive(Debug, Clone)]
pub struct HashKeyOverride {
pub feature_flag_key: String,