Skip to content

test: align PostgreSQL tests with the shared I/O pool lifecycle - #183683

Closed
steipete wants to merge 2 commits into
mainfrom
pgprep/partial-index-pool-root
Closed

steipete wants to merge 2 commits into
mainfrom
pgprep/partial-index-pool-root

Conversation

@steipete

@steipete steipete commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Two PostgreSQL tests assume the pre-pool worker lifecycle. The partial-index conformance fixture creates an undeclared pool root, and the idle-backend test checks PostgreSQL immediately after closing a pool port, before asynchronous client shutdown can finish.

User Impact

Test-only repairs for PostgreSQL readiness preparation. Runtime behavior, schemas, dependencies, pool guards, and SQLite behavior are unchanged.

Why This Change Was Made

Declare the partial-index test's own eval worker through the existing declarePostgresTestRoot fixture contract. For idle expiry, poll pg_stat_activity for at most ten seconds at 50 ms intervals. The strict assertion still requires the expired PID to disappear, so a leaked backend fails. Burst reuse and checked-out connection assertions remain unchanged.

These are the smallest fixes at the test owners: two added declaration lines and one bounded replacement for an immediate asynchronous-cleanup assertion. No production change or new test scaffolding.

Evidence

  • The undeclared-root failure reproduced on main 3f199f0208d0233a14fc3c3d51b89f6ead25c419: 10 passing assertions, then the same undeclared-worker error and exit 1. The declaration yields 10/10 passing with no unhandled error.

  • The idle-expiry race failed in CI 40209105323, PG shard 3, at the immediate empty-result assertion. Six interleaved standalone main/candidate runs passed; they did not reproduce the load-dependent failure. Source inspection shows port close triggers asynchronous client.end(), which explains why an immediate catalog observation is not a valid completion boundary.

  • Coordinator review approves both test-only lifecycle repairs. Current local and exact-head CI results are recorded below.

  • Updated local PG17/Node24/CI=1 proof: reuse test file 5/5 passes, 55 assertions. Wrapper wall times: 216.58, 249.12, 206.22, 57.26, 63.22 seconds (includes worker compilation and cleanup).

  • Partial-index conformance: 10/10 pass, no unhandled errors; 96.21 seconds wrapper / 84.60 seconds Vitest.

  • Commands: node --import ./scripts/tsx.mjs scripts/test-database-conformance.mjs --engine postgres --connection <local-pg17-dsn> -- <test-file> --maxWorkers=1 with each of the two changed test files. The corresponding pnpm test <file> --maxWorkers=1 route uses the same test runner; PG proof adds the conformance setup.

  • Full local core typecheck: node scripts/run-tsgo.mjs -p tsconfig.core.json --noEmit, passed in 3.33 seconds. Focused lint, formatting, and git diff --check passed.

  • pr-simplify complete. Independent Codex P0–P2 reviews cover both the fixture declaration and the complete polling delta; no actionable findings.

  • Final-head three-shard PostgreSQL CI pending the new push. No manual CI dispatch.

@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 25, 2026 15:53
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T16:58:36.134439Z 5215361 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 25, 2026
@clawsweeper

clawsweeper Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR declares the partial-index conformance fixture’s worker as an intentional PostgreSQL pool root.

Example: Run the partial-index ordering conformance file against PostgreSQL 17 with CI=1.

  • Before: All 10 assertions pass, but an undeclared pool-root error makes the process exit 1.
  • After: The PR reports 10 passing tests, no unhandled errors, and exit 0.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-supported fixture repair with reported before-and-after validation; PostgreSQL CI remains pending.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored, test-only repair is outside the ordinary shipped-entry-point proof gate; its body records a real PostgreSQL conformance run before and after the change.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: PostgreSQL conformance reports passing assertions but fails the overall process on the fixture’s undeclared pool root.
Reason: The maintainer-authored direction uses an established fixture contract and restores useful conformance validation without production changes.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR provides a focused repair for a current conformance failure, with no actionable defect found in the introduced change.

Priority: P2
Reviewed head: 593d81e9b58d292f6d589d37e42c456068d755a5

Before merge

None.

Findings

None.

Agent review details

How this fits together

The conformance suite opens populated stores and exercises production query owners inside a fixture worker; a shared test registry distinguishes intentional PostgreSQL roots from accidental worker pools.

flowchart TD
  A[Conformance suite] --> B[Fixture worker]
  A --> C[Test root registry]
  B --> D[Production database owners]
  D --> E[PostgreSQL pool]
  E --> F[Root diagnostic guard]
  C --> F
Loading

Technical review

Best possible solution:

Use the existing root-declaration helper for this explicitly independent fixture and retain all ordering assertions and guard enforcement.

Do we have a high-confidence way to reproduce the issue?

The undeclared worker-root path is visible in fetched main and matches the reported PostgreSQL failure; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The two-line repair is the smallest complete implementation of the maintainer’s stated independent-fixture design and reuses the existing registry owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 475a6d98baa5.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit b378654 adds test/helpers/postgres-pool-roots.ts:25 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b378654d5e8d; files: test/helpers/postgres-pool-roots.ts)

PR surface

Tests +2. Total +2 across 1 file. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 2 0 +2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 2 0 +2

Labels

Label changes:

  • add P2: Repairs a reproducible PostgreSQL conformance infrastructure failure without changing runtime behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Repairs a reproducible PostgreSQL conformance infrastructure failure without changing runtime behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 25, 2026, 12:09 PM ET / 16:09 UTC.

@steipete steipete changed the title test: declare PostgreSQL pool root in partial-index ordering conformance test: align PostgreSQL tests with the shared I/O pool lifecycle Oct 25, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Superseded by #183675 and #183695, which make the plan/conformance workers inherit the shared PostgreSQL pool instead of declaring a self-root. The independent asynchronous idle-expiry test fix will move to a separate PR based on current main.

@steipete

Copy link
Copy Markdown
Contributor Author

Current-main follow-up for this fixture: squash c31e465 (#183695) landed over a parent that already contained the pool-endpoint wiring. The resulting readJournalPlans now contains both an outer and an inner const postgresPool = createPostgresPoolEndpoints(), and two shorthand postgresPool properties in workerData (lines 136/140 and 210/212 at that commit).

The inner declaration shadows the endpoints whose catch path performs cleanup, and the duplicate object property is a TypeScript error. The minimal correction is to retain the outer declaration, its existing comment, one workerData.postgresPool, and the current transfer list; remove the inner declaration/comment and the repeated property. All assertions and cases can stay intact. This is source-confirmed, not a claim of a PostgreSQL runtime replay.

I found this while attributing historical CI for an unrelated fixture-consolidation PR. Reporting here because this open PR owns the same conformance fixture; no schema, detector, or production changes are needed.

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

Labels

P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant