Skip to content

fix(data-warehouse): use org id as distinct_id for dwh-postgres-cdc flag#59938

Merged
danielcarletti merged 1 commit into
masterfrom
feat/dwh-postgres-cdc-org-eval
May 27, 2026
Merged

fix(data-warehouse): use org id as distinct_id for dwh-postgres-cdc flag#59938
danielcarletti merged 1 commit into
masterfrom
feat/dwh-postgres-cdc-org-eval

Conversation

@danielcarletti
Copy link
Copy Markdown
Contributor

Problem

The dwh-postgres-cdc feature flag is evaluated server-side in is_cdc_enabled_for_team and on the frontend (via posthog-js with the org auto-bound as a group in userLogic.ts). The flag's intent is org-level rollout, but the backend passed team.uuid as the distinct_id while supplying the organization in groups / group_properties. That works, but it's inconsistent with how the rest of the codebase evaluates org-aggregated flags (e.g. warehouse-api in products/data_warehouse/backend/api/table.py) and makes the evaluation semantics ambiguous before we widen the rollout.

Changes

  • Pass str(team.organization_id) as the distinct_id in is_cdc_enabled_for_team, matching the existing convention used by other org-aggregated flag checks in the repo.
  • No frontend changes — userLogic.ts already calls posthog.group('organization', user.organization.id, …), so org-aggregated evaluation works as-is for the featureFlags[FEATURE_FLAGS.DWH_POSTGRES_CDC] read in SourceForm.tsx.

How did you test this code?

I'm an agent. No automated or manual tests were run for this one-line distinct_id swap; the change is type-preserving and the call site contract is unchanged. Pre-commit ruff / ty checks passed via lint-staged.

Publish to changelog?

no

🤖 Agent context

  • Tool: Claude Code (Opus 4.7).
  • Decisions:
    • Considered leaving team.uuid as the distinct_id; rejected because the flag will be flipped to org-aggregated with a kill-list condition for safe 100% rollout, and inconsistent identifiers across call sites make the kill switch behavior harder to reason about.
    • Considered moving the frontend read to an explicit posthog.isFeatureEnabled call with manually-provided groups; rejected because posthog-js already has the org bound and the existing kea selector pattern is the standard.

Match PostHog convention for org-aggregated feature flags. Previously
passed team.uuid as distinct_id while also passing the org as the
groups/group_properties context, which is inconsistent with how
similar flags are evaluated elsewhere (e.g. table.py warehouse-api).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@assign-reviewers-posthog assign-reviewers-posthog Bot requested review from a team May 25, 2026 18:05
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 25, 2026

Reviews (1): Last reviewed commit: "fix(data-warehouse): use org id as disti..." | Re-trigger Greptile

@github-actions
Copy link
Copy Markdown
Contributor

ClickHouse migration SQL per cloud environment

No ClickHouse migrations changed in this PR.

@danielcarletti danielcarletti merged commit 3ebd0dc into master May 27, 2026
216 checks passed
@danielcarletti danielcarletti deleted the feat/dwh-postgres-cdc-org-eval branch May 27, 2026 17:43
@deployment-status-posthog
Copy link
Copy Markdown

deployment-status-posthog Bot commented May 27, 2026

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-05-27 18:24 UTC Run
prod-us ✅ Deployed 2026-05-27 18:45 UTC Run
prod-eu ✅ Deployed 2026-05-27 18:47 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants