Sanitize reused PostgreSQL connections at checkout - #1752
Draft
Zetazzz wants to merge 2 commits into
Draft
Conversation
Zetazzz
force-pushed
the
feat/complete-graphile-request-context
branch
from
September 6, 2026 02:22
9c8214b to
4e166ca
Compare
Zetazzz
force-pushed
the
agent/pg-checkout-sanitation
branch
from
September 6, 2026 02:24
b96752d to
3ed4803
Compare
Zetazzz
force-pushed
the
feat/complete-graphile-request-context
branch
from
September 9, 2026 01:46
4e166ca to
581262c
Compare
Zetazzz
force-pushed
the
agent/pg-checkout-sanitation
branch
from
September 9, 2026 04:27
3ed4803 to
aa8ee79
Compare
This was referenced Sep 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Default PostgreSQL pool checkouts now run
DISCARD ALL, clear node-postgres/Graphile prepared-statement bookkeeping, and destroy clients when reset fails. Promise, callback, andpool.query()checkout paths retain their API behavior. Custom factories keep their own checkout contract.Rebased onto the current #1744 head (
10574e19f6df223edbdfc0f795cdba373c828901), which applies canonical transaction-local request settings after checkout sanitation. #1754 identity/lease remains stacked above this PR.Performance is measured before making a deployment claim. The committed benchmark and raw JSON cover three alternating rounds of 1,000 operations per arm/workload against PostgreSQL 18.6, Node 24.20.0, localhost TCP, one client, and the application login. On this shared host, prepared SELECT throughput fell about 64%, and complete request-context transaction throughput fell about 7%. The sanitized checkout retained no prepared statement versus one in the baseline. These are local microbenchmarks under unrelated CPU load; repeat against the actual query mix/network before setting a production budget. The README explains why these results do not justify replacing the reset with
RESET ALLor introducing an unsafe bypass.Validation: pg-cache 24 tests and pg-query-context 13 tests passed, including real same-backend reset, prepared SQL reuse, transaction context, and fail-closed replacement. Eleven affected/reset owner builds, frozen install, and supply-chain policy passed. The integration fixture now uses the existing pool owner and guarantees teardown. Full CI passed all 17 jobs on
aa8ee794c01da4e3f4cf93d4967ea8ee0f0f4be2.Refs constructive-io/constructive-planning#1693 (F10).