Skip to content

fix(docker): ship the newest supported PostgreSQL client, not the bundled major - #1432

Merged
MBombeck merged 2 commits into
MBombeck:mainfrom
aw23edfr4:fix/postgres-client-major-ceiling
Nov 22, 2026
Merged

MBombeck merged 2 commits into
MBombeck:mainfrom
aw23edfr4:fix/postgres-client-major-ceiling

Conversation

@aw23edfr4

@aw23edfr4 aw23edfr4 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Follows #1431, the client half of it. It changes one pin, one test and one
doc section; the bundled database, db-upgrade and every volume stay exactly as they are,
so this moves nothing on disk for anybody.

Why

pg_dump and pg_restore read servers of their own major and older and refuse a newer
one. The pgclient pin is therefore not only "which client ships", it is the ceiling on
the server major an install may run — including installs that bring their own database,
which docs/ops/postgres-major-upgrade.md explicitly invites ("HealthLog runs on 16 and
18 alike, and the move there is yours to schedule").

With the client at the bundled major, such an install breaks in two stages once its
server moves to 19:

  1. the nightly dump, the db-restore check and every manual db-dump fail at once, which
    nothing surfaces to the operator;
  2. the next release that carries a migration does not boot at all: the pre-migration dump
    aborts with server version mismatch, the entrypoint correctly refuses to migrate
    without a dump, and the container crashloops.

The gap between the two is what makes it hard to read: here the server moved at 22:00 and
the app only fell over at 01:02 the next day, with a release that had nothing to do with it.

What it does

  • pgclient comes from postgres:19.0-trixie (digest-pinned, same multi-arch image), and
    the install path, loader config, PATH and the two --version build checks move with
    it.
  • src/__tests__/runtime-package-pins.test.ts holds the order rather than the equality:
    the client may lead the bundled database, never trail it. It also derives the expected
    COPY path and the Dockerfile's own --version grep from whatever major the pin names,
    so the next move keeps them honest.
  • docs/ops/postgres-major-upgrade.md states the ceiling for a bring-your-own server, and
    gives a one-liner that reads the client major off any release.

One client on 19 serves a server on 16, 18 and 19 alike, so the matrix the docs promise
holds for the first time.

The tradeoff, stated plainly

The rule this replaces was deliberate, and it bought one thing this does not: the
disaster-recovery path (db-restore, docs/ops/disaster-recovery.md) now runs a
pg_restore 19 against the bundled 18 server. Dumping an 18 server with a 19 client is
fully supported; restoring into an older server is the direction PostgreSQL only says
"should work", with the caveat that the archive was produced from that same 18 server, so
nothing in it is newer than the target. If you would rather not take that, the alternative
is the bundled-database bump discussed in the issue, and this PR should wait for it.

Verification

Run on this branch, against a clean install of the lockfile (pnpm 11.15.1):

  • tsc --noEmit — clean.
  • prettier --check . — clean.
  • eslint — 0 errors (3 warnings, all pre-existing and none in the changed files).
  • runtime-package-pins.test.ts and database-pin-is-watched.test.ts — 7 tests, all
    passing, including the rewritten rule and the two derived assertions.

Left to CI, because there is no Docker on this machine: the image build itself, the e2e
suites, and with them the one thing I cannot prove from the outside — that the pg_dump 19
in the built image dumps a live 18 server. That is the documented client contract rather
than a guess, and the build check holds the version the binaries report.

One aside from running the checks, unrelated to this change: on Windows pnpm test collects
nothing, because the per-file project classification in tests/unit-projects.ts hands
include backslash paths that the glob matcher never matches ("No test files found", all
three Node projects). Hence the two suites above were run directly. Happy to open a separate
issue if that is worth having.

Drafted with Claude Code; the reasoning, the checks above and this description were reviewed by me before sending.

aw23edfr4 and others added 2 commits November 22, 2026 13:18
…dled major

A client reads servers of its own major and older and refuses a newer one, so
the `pgclient` pin is the ceiling on the server an install may run — the
installs that bring their own database included, which
docs/ops/postgres-major-upgrade.md invites: "HealthLog runs on 16 and 18
alike, and the move there is yours to schedule". With the client pinned to
the bundled major, such an install stops dumping the moment its server moves
to 19, and then fails to boot at the next release that carries a migration,
with pg_dump's version-mismatch line inside the entrypoint's "not migrating
without the dump". The nightly dumps go first and quietly; the boot goes
hours or days later, which is what makes the cause hard to find.

Take the client from postgres:19.0-trixie and let it lead the bundled
database rather than match it: one pg_dump serves a server on 16, 18 and 19
alike. The bundled database is not touched, so nothing moves on disk for
anybody, and db-upgrade stays as it is.

runtime-package-pins.test.ts holds the order now instead of the equality, and
ties the install path and the image's own --version check to whatever major
the pin names. postgres-major-upgrade.md states the ceiling for a
bring-your-own server and how to read it off the release you run.

Co-Authored-By: Claude Opus 5 <[email protected]>
The pgclient stage may lead the bundled database now, so the stage list in the canvas hoist guard matches the major as a number rather than 18.
@MBombeck
MBombeck merged commit 4855afe into MBombeck:main Nov 22, 2026
33 checks passed
MBombeck pushed a commit that referenced this pull request Nov 22, 2026
#1432 moved the `pgclient` pin to major 19 and changed what the pin test
holds, and left this note describing the rule it replaced: it still names
major 18 for the runner's paths and version checks, says the client's minor
moves with the bundled database's, and says runtime-package-pins.test.ts
fails while the two differ. That test now fails only if the client falls
below the bundled database.

The ignore rule itself is unchanged. A client major stays a decision rather
than an update PR — now a decision about the newest server major the project
supports rather than about the bundled database's major.
@MBombeck MBombeck mentioned this pull request Nov 23, 2026
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