Skip to content

ci(pg19): one-command smoke harness — live verification of every Phase 3 tool#143

Merged
devopam merged 2 commits into
mainfrom
claude/pg19-smoke-harness
Jun 21, 2026
Merged

ci(pg19): one-command smoke harness — live verification of every Phase 3 tool#143
devopam merged 2 commits into
mainfrom
claude/pg19-smoke-harness

Conversation

@devopam

@devopam devopam commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Summary

User direction: "can we install postgresql 19 beta1 for live testing our functionality?" — Docker daemon isn't available in the Claude Code sandbox, so this PR lands a one-command harness operators can run locally to spin up PG 19, exercise every Phase 3 tool against the live server, and tear down.

What lands

File Purpose
scripts/smoke_test_pg19.sh Bash launcher. Builds .github/ci-postgres-pg19.Dockerfile, starts a container on port 5443 (no clash with PG 14-18), runs the Python driver, tears down. Supports --keep (leave container running) and --down (cleanup only). Idempotent — re-run anytime.
scripts/smoke_test_pg19.py Python driver. Walks every Phase 3 tool: 6 status probes (printed as a capability matrix), 5 read-only advisors / readers, 2 representative writes (enable_logical_replication_on_demand, enable_data_checksums), all gated on the corresponding status probe so the smoke completes cleanly on Beta builds that haven't shipped every feature yet.
docs/plans/pg19-readiness.md "Local testing" section restructured to feature the harness as the recommended path.

Usage

scripts/smoke_test_pg19.sh           # build + run + tear down
scripts/smoke_test_pg19.sh --keep    # leave the container running afterwards
scripts/smoke_test_pg19.sh --down    # tear down a leftover container

What it prints

A capability matrix first:

=== Capability matrix ===
  get_pgq_status                    available
  get_repack_status                 available
  get_aio_status                    available
  get_pg19_stats_status             unavailable
  get_data_checksums_status         available
  get_logical_replication_status    available

Then per-tool JSON output for every probe + advisor + safe write.

Why this is the right shape

  • No production code changes. Snapshots, contracts, and existing tests untouched.
  • No production runtime impact. Lives in scripts/; never imported by mcpg.*.
  • Bridges the GA-day-0 verification milestone I committed to in docs/plans/pg19-readiness.md — "run this script and read the output" becomes the canonical verification flow once PG 19 hits GA.
  • Sandbox-aware. I would have run it here, but Docker daemon isn't available; the script self-checks that requirement and bails cleanly if Docker isn't running.

Test plan

  • ruff check scripts/smoke_test_pg19.py — clean.
  • python -c "import scripts.smoke_test_pg19" — imports cleanly.
  • Manual: run scripts/smoke_test_pg19.sh on a workstation with Docker. (Can't be automated from CI without a Docker-in-Docker setup; the launcher itself stays a local-dev / GA-verification tool.)

🤖 Generated with Claude Code

https://claude.ai/code/session_0122yLZLJ8t4W43sdN6BmTZc


Generated by Claude Code

@sourcery-ai sourcery-ai 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.

Sorry @devopam, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@gemini-code-assist-2 gemini-code-assist-2 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a local smoke test harness for PostgreSQL 19 readiness, consisting of documentation updates, a Python script (smoke_test_pg19.py) to run probes and writes, and a bash launcher (smoke_test_pg19.sh) to manage the test container. Key feedback includes handling potential ImportError exceptions for the unimplemented pg19_runtime module, moving the database connection call inside the try block to guarantee proper resource cleanup on failure, and adding a pre-flight Docker check along with an EXIT trap in the bash script to ensure reliable container teardown.

Comment thread scripts/smoke_test_pg19.py
Comment thread scripts/smoke_test_pg19.py
Comment thread scripts/smoke_test_pg19.py
Comment thread scripts/smoke_test_pg19.sh
Comment thread scripts/smoke_test_pg19.sh
claude added 2 commits June 21, 2026 03:23
…e 3 tool

User direction: "can we install postgresql 19 beta1 for live testing
our functionality?" — Docker daemon isn't available in the Claude
Code sandbox, so this lands a one-command harness operators can run
locally instead.

What lands:

  scripts/smoke_test_pg19.sh — bash launcher that:
    - Builds the existing .github/ci-postgres-pg19.Dockerfile
    - Starts mcpg-pg19-smoke on port 5443 (no clash with PG 14-18)
    - Runs the Python smoke driver
    - Tears down the container (unless --keep)
    - Supports --down for cleanup only

  scripts/smoke_test_pg19.py — Python driver that exercises every
  Phase 3 tool against the live server:
    - All 6 status probes (PGQ / REPACK / AIO / pg19_stats /
      checksums / logical replication) — printed as a capability
      matrix
    - 4 read-only advisors / readers (recommend_io_method,
      analyze_lock_hotspots, read_pg_stat_lock, read_pg_stat_recovery,
      list_property_graphs)
    - 2 representative writes (enable_logical_replication_on_demand,
      enable_data_checksums) — gated on the corresponding status
      probe so the smoke completes cleanly on Beta builds that
      haven't shipped every feature yet

  docs/plans/pg19-readiness.md — "Local testing" section restructured
  to feature the harness as the recommended path.

Pure tooling — no production code changes; no impact on existing
tests, snapshots, or contracts. Operators run this manually whenever
they want to verify a Phase 3 tool against an actual PG 19 server,
and the GA-day-0 verification milestone (documented earlier in
docs/plans/pg19-readiness.md) becomes "run this script and read the
output".
… reviews)

Three independent critical reviews on PR #143:

  1. scripts/smoke_test_pg19.py: database.connect() lived outside the
     try/finally, so a connection failure (slow container start, auth
     mismatch, etc.) raised an unhandled exception and skipped the
     close() cleanup. Moved inside the try block.

  2. scripts/smoke_test_pg19.sh: no preflight check for the Docker
     daemon. With `set -e` active, calling `docker rm` on a missing
     daemon blew up inside the `down()` helper with a cryptic error.
     Added an explicit `docker info` probe that bails with a friendly
     message before doing anything else.

  3. scripts/smoke_test_pg19.sh: if the Python smoke run crashed,
     the explicit `down` at the bottom never fired and left the
     container running on port 5443. Switched to an EXIT trap that
     respects $KEEP — single-entry cleanup path that fires regardless
     of how the script exits (success / failure / interrupt). Removed
     the redundant trailing `down` call.

Two earlier gemini comments (the `pg19_runtime` import guards) are
moot now that PR #142 (the runtime-toggles module) has landed —
the imports succeed on the rebased branch.
@devopam devopam force-pushed the claude/pg19-smoke-harness branch from a24f3f1 to 3cc7d90 Compare June 21, 2026 03:24
@devopam devopam merged commit 89fb372 into main Jun 21, 2026
15 of 17 checks passed
@devopam devopam deleted the claude/pg19-smoke-harness branch June 22, 2026 02:35
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