Skip to content

fix(data-warehouse): suggest incremental sync when postgres CDC lacks replication permission - #70232

Merged
Gilbert09 merged 2 commits into
masterfrom
posthog-code/cdc-permission-incremental-hint
Jul 13, 2026
Merged

fix(data-warehouse): suggest incremental sync when postgres CDC lacks replication permission#70232
Gilbert09 merged 2 commits into
masterfrom
posthog-code/cdc-permission-incremental-hint

Conversation

@Gilbert09

Copy link
Copy Markdown
Member

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:

  • The pre-creation prerequisite check (_check_replication_role), which already explained how to grant replication, now adds the Incremental fallback.
  • The runtime slot-setup failure path, which previously returned only 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

… 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
@github-actions

Copy link
Copy Markdown
Contributor

Hey @Gilbert09! 👋

It looks like your git author email on this PR isn't your @posthog.com address (owerstom@gmail.com). Since you're on the PostHog team, it's worth pointing your local git author email at your @posthog.com address. Why it matters:

  • Consistent work identity in git history — internal tooling that attributes commits to team members keys off your @posthog.com address.
  • Keeps team contributions easy to tell apart from external community ones when scanning history.

You can fix it for this repo with:

git config user.email "you@posthog.com"

Or set it globally with git config --global user.email "you@posthog.com". No need to redo this PR — just a nudge for next time. 🙂

@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team July 11, 2026 13:57
Generated-By: PostHog Code
Task-Id: b44cb9d7-c007-4dae-b6fc-ca4063b92643
@greptile-apps

greptile-apps Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "chore(data-warehouse): drop em dashes fr..." | Re-trigger Greptile

@Gilbert09 Gilbert09 added the stamphog Request AI approval (no full review) label Jul 11, 2026 — with PostHog

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@trunk-io

trunk-io Bot commented Jul 11, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@Gilbert09
Gilbert09 merged commit a581191 into master Jul 13, 2026
257 checks passed
@Gilbert09
Gilbert09 deleted the posthog-code/cdc-permission-incremental-hint branch July 13, 2026 10:03
@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 11:21 UTC Run
prod-us ✅ Deployed 2026-07-13 11:34 UTC Run
prod-eu ✅ Deployed 2026-07-13 11:36 UTC Run

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

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant