Skip to content

ci: fix broken pg_isready readiness probe on the WarehousePG CI lane - #323

Merged
devopam merged 3 commits into
mainfrom
fix/warehousepg-ci-readiness-probe
Aug 25, 2026
Merged

ci: fix broken pg_isready readiness probe on the WarehousePG CI lane#323
devopam merged 3 commits into
mainfrom
fix/warehousepg-ci-readiness-probe

Conversation

@devopam

@devopam devopam commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the warehousepg-latest CI matrix lane (Tests (PG warehousepg-latest))
taking ~9-10 minutes per run vs. ~3.5-4.5 minutes for every other PG version.

Diagnosis (via gh run view step timings on two recent runs): the gap
traced entirely to the "Start PostgreSQL (pgvector + PostGIS)" step
(~6-6.5 min there vs. ~20-30s elsewhere) — the pytest step itself was
already the same duration as any other lane. Raw logs showed the
readiness-poll loop's docker exec mcpg-db pg_isready -U gpadmin failing
identically on every single one of its 90 attempts:

OCI runtime exec failed: exec failed: unable to start container process:
exec: "pg_isready": executable file not found in $PATH

woblerr/warehousepg:7.4.1-WHPG doesn't ship pg_isready on PATH (not
documented upstream either), so the loop could never observe success and
always burned its full 90 × 4s = 360s budget as dead time, regardless of
how fast the database actually came up underneath.

Fix: probe with psql instead, connecting through the published port
the same way pytest itself does — the runner's default client already
works here (the "Install PostgreSQL client tools" step deliberately skips
a custom client for this lane). It's also a strictly stronger check than
pg_isready: it only succeeds once the target database actually accepts
queries. The 90-attempt/4s ceiling stays as a safety net; every other
matrix lane's pg_isready-based probe is untouched.

Also includes a small prerequisite fix: bumped a transitive pip
dependency (26.1.2 → 26.2.1, PYSEC-2026-3721, pulled in via pip-audit's
own pip_api dep) that was blocking the local pre-commit hook's
dependency audit on an unrelated commit — kept as its own commit rather
than folded into the CI fix.

Caveat: no local docker/CI access to time the fixed probe directly —
the ~9-10 min → ~4 min improvement is inferred from the log evidence
(pg_isready failing on literally every attempt), not re-measured. Worth
confirming on this PR's own CI run.

Roadmap linkage

N/A — CI/infra fix, no roadmap row.

Checklist

  • Tests added/updated first (TDD); suite passes locally — n/a, no
    application code changed; full local unit suite (2909 passed, 3
    skipped) run via the pre-commit hook on every commit
  • ruff, ruff format, and mypy src/mcpg pass
  • CHANGELOG.md updated under [Unreleased]
  • Roadmap row cited above (N/A)
  • No hand-edits to src/mcpg/_vendor/

🤖 Generated with Claude Code

Summary by Sourcery

Restore timely WarehousePG CI startup by replacing its unavailable readiness utility with a working database connectivity check.

Bug Fixes:

  • Fix the warehousepg-latest CI lane readiness check so it detects database availability instead of exhausting its full polling timeout.
  • Upgrade the transitive pip dependency to address PYSEC-2026-3721.

CI:

  • Use a database query through the published port for WarehousePG readiness while preserving existing probes for other PostgreSQL CI lanes.

devopam and others added 3 commits August 25, 2026 13:05
pip-audit>=2.7 (a direct dev dependency, used by the CI security job
and the local pre-commit hook) pulls in pip_api -> pip 26.1.2, which
has a known vulnerability (PYSEC-2026-3721, fixed in 26.2). Discovered
because it was blocking the local pre-commit hook's own dependency
audit step on an unrelated commit. `uv lock --upgrade-package pip`
bumps just the one pinned entry; `uv run pip-audit --strict` (the
exact invocation the CI security job uses) now reports no known
vulnerabilities.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DMBaAe32ggci6ukABssDKj
The `warehousepg-latest` matrix entry (Tests (PG warehousepg-latest))
was taking ~9-10 minutes per run vs. ~3.5-4.5 minutes for every other
PG version — confirmed via `gh run view` step timings on two recent
runs. The gap traced entirely to the "Start PostgreSQL (pgvector +
PostGIS)" step (~6-6.5 min there vs. ~20-30s elsewhere); the pytest
step itself was essentially identical in duration to every other lane.

Root cause, from raw run logs: the readiness-poll loop does
`docker exec mcpg-db pg_isready -U gpadmin`, up to 90 times, 4s apart.
Every single attempt across both inspected runs failed identically:

    OCI runtime exec failed: exec failed: unable to start container
    process: exec: "pg_isready": executable file not found in $PATH

`woblerr/warehousepg:7.4.1-WHPG` doesn't ship `pg_isready` on PATH
(not documented upstream either). The loop could never observe
success, so it always burned its full 90 * 4s = 360s budget as dead
time on every run, regardless of how fast the database actually came
up underneath.

Fix: probe with `psql` instead, connecting through the published port
the same way pytest itself does (the runner's default client already
works here — see the "Install PostgreSQL client tools" step, which
deliberately skips a custom client for this lane). This is also a
strictly stronger check than `pg_isready`: it only succeeds once the
target database accepts queries, not just once the postmaster process
is up. The 90-attempt/4s ceiling stays as a safety net for a
genuinely slow single-node Greenplum-family init, but the loop now
breaks as soon as it's actually ready instead of always waiting out
the full ceiling. Every other matrix lane's pg_isready-based probe is
untouched.

Expected effect: the warehousepg-latest lane should drop from ~9-10
min to something close to the other lanes' ~4 min, unless the
underlying Greenplum-family init genuinely needs more than a few tens
of seconds (unverified — no local docker/CI access to time it
directly; validate on the next actual CI run).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DMBaAe32ggci6ukABssDKj
Adds [Unreleased] entries for the two preceding commits, per this
repo's PR template checklist.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DMBaAe32ggci6ukABssDKj

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@devopam
devopam merged commit d6389ce into main Aug 25, 2026
17 checks passed
@devopam
devopam deleted the fix/warehousepg-ci-readiness-probe branch August 25, 2026 12:08
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.

1 participant