Skip to content

fix(data-warehouse): make duckgres table_suffix read-only in admin#65616

Merged
EDsCODE merged 1 commit into
masterfrom
eric/duckgres-admin-suffix-readonly
Jun 23, 2026
Merged

fix(data-warehouse): make duckgres table_suffix read-only in admin#65616
EDsCODE merged 1 commit into
masterfrom
eric/duckgres-admin-suffix-readonly

Conversation

@EDsCODE

@EDsCODE EDsCODE commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Problem

DuckLakeBackfill.table_suffix names a team's warehouse tables (events_<suffix> / persons_<suffix>) and — since #65323 — the v3 data-import sink schema (posthog_data_imports_<suffix>). It's a write-once value: changing it after data is written moves the target and silently orphans the already-written tables/schema, splitting a team's warehouse data.

The product enable flow (enable_team_backfill) already enforces this — it raises if you try to change an existing suffix. But the Django admin left table_suffix editable, so a staff user could change it directly on the change form and bypass the guard. That was the one remaining unguarded mutation path.

This is the interim safety stopgap called out by #65331 (the full fix — drift detection + automatic re-prime — depends on the backfill state machine in #63144, which isn't merged yet).

Changes

  • Add table_suffix to readonly_fields on DuckLakeBackfillAdmin. The field still displays on the change form; it just can't be edited. The suffix is only ever set through the validated enable flow.
  • Add a regression test asserting the field is read-only in admin.

How did you test this code?

I'm an agent (Claude Code). Automated test only — no manual testing:

  • Added posthog/admin/test_ducklake_backfill_admin.py::TestDuckLakeBackfillAdmin::test_table_suffix_is_readonly, which catches the regression of someone reopening the admin edit hole. Ran it locally: passes. ruff + ty clean.

Automatic notifications

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

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Eric asked me to assess the relevance of #65331 (whether table_suffix is even mutable and the effects), then to ship the one-line stopgap. A verification pass against origin/master established: the suffix-based resolver (#65323) is merged and live, so the orphan-on-change hazard is real today; the full re-prime fix depends on #63144 (backfill state machine), which lives on an unmerged branch. The only realistic accidental-change vector on master is the Django admin, where the field was editable — this PR closes that without depending on #63144.

Tools: Claude Code (Opus 4.8). Skills consulted: writing-tests (gated the regression test as worth adding). No migration involved (admin-config change only).

table_suffix names a team's warehouse tables and data-import schema, so
changing it after data is written moves the target and silently orphans
the old tables. The product enable flow is already write-once, but the
Django admin left the field editable. Make it read-only so the suffix is
only ever set through the validated enable flow.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@EDsCODE EDsCODE self-assigned this Jun 23, 2026
@greptile-apps

greptile-apps Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(data-warehouse): make duckgres table..." | Re-trigger Greptile

@EDsCODE EDsCODE enabled auto-merge (squash) June 23, 2026 21:20
@github-actions

Copy link
Copy Markdown
Contributor

🎭 Playwright report · View test results →

⚠️ 1 flaky test:

  • Preflight can have errors too (chromium)

These issues are not necessarily caused by your changes.
Annoyed by this comment? Help fix flakies and failures and it'll disappear!

@EDsCODE EDsCODE merged commit 532e0b1 into master Jun 23, 2026
228 checks passed
@EDsCODE EDsCODE deleted the eric/duckgres-admin-suffix-readonly branch June 23, 2026 21:41
@deployment-status-posthog

deployment-status-posthog Bot commented Jun 23, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-06-23 22:08 UTC Run
prod-us ✅ Deployed 2026-06-23 22:45 UTC Run
prod-eu ✅ Deployed 2026-06-23 22:48 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