Skip to content

Add gtc doctor preflight command - #13

Merged
emoss08 merged 1 commit into
mainfrom
claude/gtc-doctor
Aug 12, 2026
Merged

emoss08 merged 1 commit into
mainfrom
claude/gtc-doctor

Conversation

@emoss08

@emoss08 emoss08 commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Stacked PR 1 of 3 — base main. Followed by #(DDL) and #(sinks), which build on this branch.

What does this PR do?

Adds gtc doctor: one command that diagnoses a deployment before the first run, instead of making the operator decode startup logs.

PostgreSQL — server version (warns below 14, the pgoutput v2 floor), wal_level, SUPERUSER/REPLICATION privileges, free replication slots and WAL senders, slot/publication existence weighed against auto-create permissions (CREATE PUBLICATION ... FOR ALL TABLES needs superuser, so it fails with the exact statement to run manually), tables lacking a primary key or replica identity (whose UPDATE/DELETEs PostgreSQL would reject once published), and — the authoritative check — a real IDENTIFY_SYSTEM replication handshake.

Sinks — Redis PING, RedisJSON module probe, Meilisearch health, transform compilation with the same options startup uses, plus config-consistency checks (DLQ enabled without REDIS_URL, outbox without REDIS_URL, no sinks at all).

Pipeline — warns when sink-count × CDC_PROCESS_TIMEOUT could exceed wal_sender_timeout, which would drop the replication connection mid-event.

Exit 0 when ready (warnings allowed), 1 on failures, with a concrete fix hint per finding:

PostgreSQL
  ✓ connection             PostgreSQL 16.13
  ✗ wal_level              "replica" — logical replication needs wal_level=logical
                           (ALTER SYSTEM SET wal_level = 'logical'; then restart PostgreSQL)
  ✓ privileges             user "postgres" is superuser
  ✓ replication protocol   IDENTIFY_SYSTEM ok (timeline 1, 0/15ED390)

Type of change

  • New feature / sink

Checklist

  • go test ./... passes (including -race)
  • gofmt / go vet are clean
  • Tests added or updated for changed behavior (URL rewriting, report/exit-code accounting; the integration test runs doctor as a preflight — passing against the provisioned environment, failing with an unreachable sink)
  • README.md / CLAUDE.md updated (new "Preflight" section, build/run commands)
  • If this touches delivery semantics: not touched — doctor only reads, and exits before the pipeline starts

Notes for the reviewer

  • Verified against a real PostgreSQL 16 + Redis, including the failure and warning paths (unreachable Redis, a table with no primary key, no sinks configured).
  • The webhook endpoint deliberately isn't probed in later PRs' checks either — probing would deliver traffic a receiver never asked for.

🤖 Generated with Claude Code

https://claude.ai/code/session_019dEj24Ta2o9QxzW9ZrSPtb


Generated by Claude Code

One command that diagnoses a deployment before the first run, instead of
the operator decoding startup logs:

- PostgreSQL: server version (14+ for pgoutput v2), wal_level=logical,
  SUPERUSER/REPLICATION privileges, free replication slots and WAL
  senders, slot/publication existence vs. auto-create permissions
  (CREATE PUBLICATION FOR ALL TABLES needs superuser), tables without a
  primary key or replica identity (UPDATE/DELETE on them fails once
  published), and a real replication-protocol handshake
  (IDENTIFY_SYSTEM) as the authoritative access check.
- Sinks: Redis PING, RedisJSON module presence (JSON.TYPE probe),
  Meilisearch health, plus config consistency — transforms compile with
  the same options as startup, DLQ enabled without REDIS_URL warns,
  outbox without REDIS_URL fails, zero sinks warns.
- Pipeline: warns when sink-count x CDC_PROCESS_TIMEOUT can exceed
  wal_sender_timeout (which would get the replication connection
  dropped mid-event).

Exit 0 when ready (warnings allowed), 1 on failures, with a concrete
fix hint per finding. The integration test now runs doctor as a
preflight (pass against the provisioned environment, fail with an
unreachable sink) before exercising the pipeline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dEj24Ta2o9QxzW9ZrSPtb
@emoss08
emoss08 merged commit 119a652 into main Aug 12, 2026
7 checks passed
@emoss08
emoss08 deleted the claude/gtc-doctor branch August 12, 2026 01:42
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