fix(data-warehouse): suggest incremental sync when postgres CDC lacks replication permission - #70232
Conversation
… replication permission When a Postgres source can't create a logical replication slot because the connecting role lacks replication privilege, the error now points at the simplest fix - switch the affected tables to Incremental sync, which needs only SELECT - instead of only echoing the raw permission error or listing GRANT statements. Covers both the pre-creation prerequisite check and the runtime slot-setup failure path. Generated-By: PostHog Code Task-Id: b44cb9d7-c007-4dae-b6fc-ca4063b92643
|
Hey @Gilbert09! 👋 It looks like your git author email on this PR isn't your
You can fix it for this repo with: git config user.email "you@posthog.com"Or set it globally with |
Generated-By: PostHog Code Task-Id: b44cb9d7-c007-4dae-b6fc-ca4063b92643
|
Reviews (1): Last reviewed commit: "chore(data-warehouse): drop em dashes fr..." | Re-trigger Greptile |
There was a problem hiding this comment.
Copy-only fix improving CDC failure error messages to suggest the Incremental sync workaround; no behavior/schema change, covered by new unit tests, author is on the owning team, diff matches description.
- Author wrote 25% of the modified lines and has 7 merged PRs in these paths (familiarity MODERATE).
- 👍 on the PR from greptile-apps[bot], hex-security-app[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 30L, 2F substantive, 52L/3F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1b-small (52L, 3F, single-area, fix) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ f221814 · reviewed head e34ab19 |
Problem
Session recordings of the data-warehouse new-source flow show users hitting the same wall when connecting a Postgres source with CDC (Change Data Capture): slot creation fails because the connecting role can't create a logical replication slot. The error only echoed the raw permission failure (or listed GRANT statements), so users had to discover on their own that switching the tables to Incremental sync clears the blocker. Multiple users independently found that workaround the hard way.
Changes
When the CDC slot/publication setup fails for lack of replication privilege, the message now names the simplest fix: switch the affected tables to Incremental sync, which needs only SELECT permission. This covers both places the friction surfaces:
_check_replication_role), which already explained how to grant replication, now adds the Incremental fallback.Failed to create replication slot: <raw error>, now appends the actionable hint when the underlying error is a permission problem. Non-permission failures keep the raw message unchanged.No sync behaviour or schema changes - copy only.
How did you test this code?
Added unit tests for the new message helper (permission error surfaces the Incremental hint, superuser-role error surfaces it, generic error keeps the raw message only). Ran the CDC adapter and prerequisite-validator test suites locally - 15 passed. I (Claude) did not manually exercise the live Postgres onboarding flow.
🤖 Agent context
Autonomy: Fully autonomous
Authored by Claude Code while synthesising friction themes from Replay Vision scans of the new-source onboarding flow. The recurring, high-confidence theme was the CDC replication-permission blocker with a known safe workaround (Incremental sync), so this PR surfaces that workaround in the error copy. Other themes seen in the scans (connectors only available as "coming soon", already-thorough Google Search Console and Stripe error messages) were left as recommendations rather than changes, since they need product decisions or are already handled.
Created with PostHog Code