Migrate PostgresStore from pgx v4 to v5 - #26
Merged
Merged
Conversation
Closes the last two open Dependabot alerts (pgproto3/v2 DoS, pgx SQL injection), neither of which has a fix in the v4 line -- only pgx v5.9.2+. pgx/v4 was only imported in postgres.go, and the only real API change needed was pgxpool.ConnectConfig -> pgxpool.NewWithConfig; everything else (QueryRow/Exec/Query/Scan, pgx.ErrNoRows, the RETURNING (xmax = 0) trick from the created/updated fix) is unchanged between v4 and v5. go mod tidy also drops pgconn, pgtype, pgproto3/v2, chunkreader, pgio, and puddle v1 (pgx/v5 bundles its own updated pgproto3 and pulls in puddle/v2 instead), and drops golang.org/x/crypto entirely -- pgx v5's SCRAM implementation no longer depends on it. PostgresStore previously had zero committed test coverage -- the created/updated fix was only ever verified with a throwaway scratch test. Added pkg/links/postgres_test.go (skips without DATABASE_URL) to close that gap and catch exactly this kind of driver-behavior regression going forward. Wired DATABASE_URL-backed `go test ./...` into docker_test.sh and reordered test.yml so schema creation happens before the Test step (previously ran after, so a Postgres-backed Go test would have failed in CI). Verified: gofmt clean, go vet clean, go test ./... -count=1, and a forced uncached `go test -run TestPostgres -v -count=1` against a real local Postgres confirming all four new tests actually execute (not skipped/cached) and pass under pgx v5, plus a full ./docker_test.sh run covering the bash-level integration suite too. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
Closes the last two open Dependabot alerts (
pgproto3/v2DoS,pgxSQL injection) -- neither has a fix in thepgxv4 line, only v5.9.2+.pgx/v4was only imported inpkg/links/postgres.go. The only real API change waspgxpool.ConnectConfig→pgxpool.NewWithConfig; everything else (QueryRow/Exec/Query/Scan,pgx.ErrNoRows, theRETURNING (xmax = 0)trick from Fix Postgres created/updated status, key normalization, reserved key, and frontend CSRF #23) is unchanged between v4 and v5. Verified the v5 API directly viago docin a scratch module before writing any code.go mod tidydropspgconn,pgtype,pgproto3/v2,chunkreader,pgio, andpuddlev1 (v5 bundles its own updatedpgproto3and pulls inpuddle/v2instead), and dropsgolang.org/x/cryptoentirely -- v5's SCRAM implementation no longer needs it.PostgresStorehad zero committed test coverage before this -- the created/updated fix from Fix Postgres created/updated status, key normalization, reserved key, and frontend CSRF #23 was only ever checked with a throwaway scratch test. Addedpkg/links/postgres_test.go(skips cleanly withoutDATABASE_URL) to close that gap for good.DATABASE_URL-backedgo test ./...intodocker_test.sh, and reordered.github/workflows/test.ymlso table creation happens before the Test step (it previously ran after, which would have made a Postgres-backed Go test fail in CI).Test plan
gofmt -l .,go build ./...,go vet ./...go test ./... -count=1go test -run TestPostgres -v -count=1against a real local Postgres -- all four new tests actually execute (not skipped/cached) and pass underpgx v5, including the created-vs-updated regression check./docker_test.shrun, covering the bash-level integration suite toogo list -m allconfirmspgx/v4and the oldpgproto3/v2are fully gone from the module graph🤖 Generated with Claude Code