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(ingestion): drop the personless table from the nodejs test schema (#84432)

José Sequeira87ff0cf9bd66
diff --git a/nodejs/sql/create_persons_tables.sql b/nodejs/sql/create_persons_tables.sql
index 8ef95b506da6..cb17155f5f4f 100644
--- a/nodejs/sql/create_persons_tables.sql
+++ b/nodejs/sql/create_persons_tables.sql
@@ -68,15 +68,6 @@ END $$;
CREATE INDEX IF NOT EXISTS posthog_persondistinctid_person_id_5d655bba
ON posthog_persondistinctid (person_id);
--- Personless distinct IDs (merge queue helpers)
-CREATE TABLE IF NOT EXISTS posthog_personlessdistinctid (
- team_id INTEGER NOT NULL,
- distinct_id TEXT NOT NULL,
- is_merged BOOLEAN NOT NULL DEFAULT false,
- created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
- PRIMARY KEY (team_id, distinct_id)
-);
-
-- Cohort membership by person (only person_id is touched by repo)
CREATE TABLE IF NOT EXISTS posthog_cohortpeople (
id BIGSERIAL PRIMARY KEY,
diff --git a/nodejs/src/ingestion/common/persons/flag-called-personless.ts b/nodejs/src/ingestion/common/persons/flag-called-personless.ts
index 9761fb10be06..e73ef32f2da2 100644
--- a/nodejs/src/ingestion/common/persons/flag-called-personless.ts
+++ b/nodejs/src/ingestion/common/persons/flag-called-personless.ts
@@ -31,9 +31,7 @@ export function eventHasGroups(properties: PluginEvent['properties']): boolean {
/**
* Whether a $feature_flag_called event should default to personless so server-side flag
- * evaluation does not create orphan person profiles (see #60581). Shared by the per-event
- * step that makes the final decision and the batch step that pre-inserts the
- * posthog_personlessdistinctid rows.
+ * evaluation does not create orphan person profiles (see #60581).
*
* `processPersonExplicitlyTrue` must be supplied by the caller because the per-event step
* runs after normalizeProcessPerson has stripped $process_person_profile, while the batch
diff --git a/nodejs/tests/helpers/sql.ts b/nodejs/tests/helpers/sql.ts
index 6da9f804b54e..24adfad28f56 100644
--- a/nodejs/tests/helpers/sql.ts
+++ b/nodejs/tests/helpers/sql.ts
@@ -46,7 +46,6 @@ BEGIN
'posthog_featureflaghashkeyoverride',
'posthog_cohortpeople',
'posthog_persondistinctid',
- 'posthog_personlessdistinctid',
'posthog_person',
'posthog_personoverridemapping',
'posthog_personoverride',
@@ -76,7 +75,6 @@ BEGIN
DELETE FROM posthog_personoverride CASCADE;
DELETE FROM posthog_personoverridemapping CASCADE;
DELETE FROM posthog_persondistinctid CASCADE;
- DELETE FROM posthog_personlessdistinctid CASCADE;
DELETE FROM posthog_person CASCADE;
-- Handle any other tables that might exist in the persons database
@@ -94,7 +92,6 @@ BEGIN
'posthog_personoverride',
'posthog_personoverridemapping',
'posthog_persondistinctid',
- 'posthog_personlessdistinctid',
'posthog_person'
)
) LOOP
@@ -146,7 +143,7 @@ function getPostgresUseForTable(table: string): PostgresUse {
// Persons-related tables
const personsTablesRegex =
- /^posthog_(person|persondistinctid|personlessdistinctid|personoverridemapping|personoverride|pendingpersonoverride|flatpersonoverride|featureflaghashkeyoverride|cohortpeople|group|grouptypemapping)$/
+ /^posthog_(person|persondistinctid|personoverridemapping|personoverride|pendingpersonoverride|flatpersonoverride|featureflaghashkeyoverride|cohortpeople|group|grouptypemapping)$/
if (personsTablesRegex.test(table)) {
return PostgresUse.PERSONS_WRITE
}
diff --git a/nodejs/tests/ingestion/common/steps/event-processing/process-persons-step.integration.test.ts b/nodejs/tests/ingestion/common/steps/event-processing/process-persons-step.integration.test.ts
index 35ce3db1d7c3..df59af0e8c16 100644
--- a/nodejs/tests/ingestion/common/steps/event-processing/process-persons-step.integration.test.ts
+++ b/nodejs/tests/ingestion/common/steps/event-processing/process-persons-step.integration.test.ts
@@ -448,19 +448,12 @@ describe('createProcessPersonsStep', () => {
return Number(result.rows[0].version ?? 0)
}
- it('writes version 1 for a merge-added distinct id and no personless bookkeeping row', async () => {
+ it('writes version 1 for a merge-added distinct id', async () => {
await createPersonWithDistinctIds('user-1')
await runIdentify(identify('anon-1', 'user-1'))
expect(await versionOf('anon-1')).toBe(1)
- const personlessRows = await infra.postgres.query(
- PostgresUse.PERSONS_WRITE,
- 'SELECT 1 FROM posthog_personlessdistinctid WHERE team_id = $1 AND distinct_id = $2',
- [teamId, 'anon-1'],
- 'fetchPersonlessRow'
- )
- expect(personlessRows.rows).toHaveLength(0)
})
it('gives the non-primary distinct id version 1 when neither points at a person', async () => {