Skip to content

fix(clickhouse): skip migration 0270 outside cloud - #70278

Merged
rorylshanks merged 3 commits into
masterfrom
agent/fix-self-hosted-property-values-migration
Jul 13, 2026
Merged

fix(clickhouse): skip migration 0270 outside cloud#70278
rorylshanks merged 3 commits into
masterfrom
agent/fix-self-hosted-property-values-migration

Conversation

@rorylshanks

@rorylshanks rorylshanks commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Problem

Migration 0257 intentionally leaves self-hosted deployments on the original kafka_property_values schema. Migration 0270 ignored that boundary, dropped property_values_mv, and then tried to recreate it with the cloud-only schema.

Addresses #64148.

Changes

Make migration 0270 a no-op outside US, EU, and DEV, matching migrations 0257 and 0268.

Note

This prevents 0270 from damaging self-hosted installations. It intentionally does not add recovery work for a view already dropped by an earlier failed run.

How did you test this code?

  • uv run ruff check posthog/clickhouse/migrations/0270_property_values_drop_mv_length_filter.py
  • uv run ruff format --check posthog/clickhouse/migrations/0270_property_values_drop_mv_length_filter.py
  • Focused Python check confirming 0270 produces zero operations with CLOUD_DEPLOYMENT unset and two operations for US, EU, and DEV
  • uv run hogli ci:preflight --fix

The full migration test module could not run from the sparse checkout because the Django settings package was not present.

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Docs update

No docs update needed.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Codex used the repository's /clickhouse-migrations skill and Ponytail. Investigation showed that the property-count schema change was deliberately cloud-only, so rebuilding the self-hosted Kafka table was unnecessary. The final change only gates 0270 to the same deployments as 0257 and 0268.

@rorylshanks
rorylshanks marked this pull request as ready for review July 12, 2026 08:16
@rorylshanks
rorylshanks requested a review from a team as a code owner July 12, 2026 08:16
@greptile-apps

greptile-apps Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix self-hosted property values migratio..." | Re-trigger Greptile

Comment thread posthog/clickhouse/migrations/0270_property_values_drop_mv_length_filter.py Outdated
@github-actions

github-actions Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

🤖 CI report

Playwright — all passed

All tests passed.

View test results →

ℹ️ ClickHouse migration SQL — 1 migration(s)

ClickHouse migration SQL per cloud environment

  • unset
    • 0270_property_values_drop_mv_length_filter — operations list is empty under this environment
  • US, EU
    • aux
      DROP TABLE IF EXISTS property_values_mv
      CREATE MATERIALIZED VIEW IF NOT EXISTS property_values_mv
      TO property_values
      AS SELECT
          team_id,
          property_type,
          property_key,
          property_value,
          property_count,
          coalesce(_timestamp, now()) as last_seen
      FROM posthog_test.kafka_property_values
  • DEV
    • data
      DROP TABLE IF EXISTS property_values_mv
      CREATE MATERIALIZED VIEW IF NOT EXISTS property_values_mv
      TO property_values
      AS SELECT
          team_id,
          property_type,
          property_key,
          property_value,
          property_count,
          coalesce(_timestamp, now()) as last_seen
      FROM posthog_test.kafka_property_values

@trunk-io

trunk-io Bot commented Jul 12, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@rorylshanks
rorylshanks marked this pull request as draft July 12, 2026 08:31
@rorylshanks
rorylshanks marked this pull request as ready for review July 12, 2026 09:34
@greptile-apps

greptile-apps Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Reviews (2): Last reviewed commit: "fix self-hosted migration node role" | Re-trigger Greptile

@rorylshanks rorylshanks changed the title fix self-hosted property values migration fix(clickhouse): skip migration 0270 outside cloud Jul 13, 2026
@rorylshanks rorylshanks added the stamphog Request AI approval (no full review) label Jul 13, 2026
@stamphog

stamphog Bot commented Jul 13, 2026

Copy link
Copy Markdown

Note

🤖 stamphog reviewed ec9101a4efb68762d3898848530fc1e1a88c5134 — verdict: REFUSED

Gates denied: this is a ClickHouse migration change, which is deny-listed and classified as never-automatable (T2-never) regardless of size — migrations require human review even though a follow-up commit appears to address Greptile's node-role concern.

  • 👍 on the PR from greptile-apps[bot], hex-security-app[bot].
  • Touches a ClickHouse migration file (deny-listed, T2-never tier) — always requires human sign-off
  • Greptile raised a P1 concern about self-hosted multi-node AUX/DATA role handling; a follow-up commit claims to fix it but needs human confirmation on a live ClickHouse migration
Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list matches: migrations
size 12L, 1F substantive — within ceiling
tier classified as T2-never: T2-never (12L, 1F, single-area, fix)
stamphog 2.0.0b3 .stamphog/policy.yml @ 2c72238 · reviewed head ec9101a

@stamphog stamphog Bot removed the stamphog Request AI approval (no full review) label Jul 13, 2026
@rorylshanks
rorylshanks enabled auto-merge (squash) July 13, 2026 08:47
@rorylshanks
rorylshanks merged commit 641dd5a into master Jul 13, 2026
402 of 404 checks passed
@rorylshanks
rorylshanks deleted the agent/fix-self-hosted-property-values-migration branch July 13, 2026 08:54
@deployment-status-posthog

deployment-status-posthog Bot commented Jul 13, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-07-13 09:18 UTC Run
prod-us ✅ Deployed 2026-07-13 09:33 UTC Run
prod-eu ✅ Deployed 2026-07-13 09:34 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