Skip to content

chore(deps): PostgreSQL 18 upgrade kit v4, refusing a stale 18 after a rollback - #100

Merged
Yoshiofthewire merged 1 commit into
masterfrom
chore/postgres-18-kit-v4
Nov 26, 2026
Merged

Yoshiofthewire merged 1 commit into
masterfrom
chore/postgres-18-kit-v4

Conversation

@Yoshiofthewire

Copy link
Copy Markdown
Member

In one line: After a rollback to PostgreSQL 17 that ran 17 again, the next up refuses to start the older 18 cluster and tells the operator how to move again or keep 18. Before this, it started 18 silently without what 17 wrote.

What changed

  • scripts/postgres-17-to-18.sh is re-vendored byte-identical from the shared kit v4 (sha256 195ae868…; it was v2, 29926441…). After the dump stops 17 cleanly, the script records 17's checkpoint in 18/moved-from-17.checkpoint. On a later start where 17's checkpoint has changed, the postgres-17-dump one-shot exits 1, and postgres (service_completed_successfully) does not start.
  • The marker sits beside the 18 cluster, so the documented clean-up (removing upgrade-from-17) keeps later starts working and keeps the check.
  • The compose upgrade test now covers: a rollback that writes on 17; the refusal on the way back; the documented "move 17 again" and "keep 18" commands, run as written in the docs; and the documented clean-up followed by a later rollback, which is still refused.
  • The Go guard now pins the v4 checksum.
  • docs/CONFIGURATION.md "Back to 18 after a rollback" describes the refusal and the two choices. The clean-up text says removing the dump is safe and removing pgdata is a separate choice. There is a CHANGELOG line.
  • No compose, CI or job-name changes.

Review this

  • docs/CONFIGURATION.md: the operator commands for "move again" and "keep 18". A wrong command here strands data. The test runs both verbatim.
  • scripts/test-postgres-17-to-18.sh: steps 3–4c. Safe to skip: scripts/postgres-17-to-18.sh, which is the kit byte for byte (sha256sum = 195ae8684e34dd515158a88b1f76b918cf6e3f3c854ce83fe4fb190a5178cf06).

Checked, on Major at this head:

  • the compose upgrade test PASS;
  • each new case fails with the old scripts (5 mutation runs, below);
  • the guard fails on the v2 script;
  • Go race suites on PostgreSQL 18.7 and SQLite, normal and fips (22/22 packages each);
  • gofmt, go vet, shellcheck, check-no-binaries, smoke test.

Not checked: the frontend and browser jobs (no web change; CI runs them). A v2 install that was rolled back before this lands can't be detected (the kit takes the current checkpoint as the moved state).

You need to: nothing. Do not merge until CI, the security reviewer and the Reviewer Guide are clean.

Detail

Upgrade test, new steps (driving the real docker-compose.yml)

  • 3 Rollback with the previous compose file (dd87863): 17 holds 20000 rows. A row is written on 17.
  • 3b Back to the new file: up fails, the dump logs "has run on", and postgres is not running.
  • 3c The documented rename (18 → 18.replaced, upgrade-from-17 → .replaced), then up: 18 has 20001 rows and 18.replaced/docker is kept.
  • 4 The rerun is a no-op (unchanged).
  • 4b Roll back again, then a refusal. The documented rm …/18/moved-from-17.checkpoint lets 18 start, and the next start says "already done".
  • 4c The documented rm -r /var/lib/postgresql/upgrade-from-17 (with a copy kept for step 5): 18 starts. Then a rollback writes on 17, and the way back is refused again.

Mutations (each a copy of this tree with an older script; earlier new assertions neutralised so later ones are reached)

script test result
v2 29926441 as is FAIL: after a rollback: the 18 stack started
v2 3b off FAIL: keep-18 check: the 18 stack started
v2 3b, 4b off FAIL: after the clean-up: the 18 stack started
v3 65632931 as is FAIL: the documented keep-18 command failed (marker in the wrong place)
v3 keep-18 via v3's marker FAIL: a start after the documented clean-up failed
v4 195ae868 as is PASS (7m18s on Major, including the slot wait)

Guard: TestComposePostgres18UpgradesFrom17 with the v2 script fails with "differs from the shared kit (sha256 2992644…)".

Go suites (local, go1.27.4, -race -count=1 -p 2, TMPDIR=~/.k)

  • PostgreSQL 18.7 (postgres:18.7-alpine3.24@sha256:0115267a…, own container): normal 22 ok, fips 22 ok.
  • SQLite: normal 22 ok, fips 22 ok.
  • A first run with a long TMPDIR failed internal/api installer tests ("setup socket path exceeds the 107-byte Unix limit") and cmd/server. That is environmental; with a short TMPDIR, cmd/server -v and the full suites pass.

Health of the one-shot

Nothing in this repo checks stack health across services: CI's container check inspects kypulse_ci only. So the exited-0 postgres-17-dump needs no change here.

🤖 Generated with Claude Code

…a rollback

Re-vendor scripts/postgres-17-to-18.sh from the shared kit v4 (sha256
195ae868...). After the dump stops 17 it records 17's checkpoint in
18/moved-from-17.checkpoint; once 17 has run again (a rollback) the dump
refuses, so the older 18 never starts silently. The marker sits beside the
18 cluster, so removing upgrade-from-17 keeps both later starts and the check.

The compose upgrade test now rolls back and writes on 17, then proves the
18 stack refuses, the documented "move again" and "keep 18" commands work,
and the documented clean-up keeps starts going and still catches a later
rollback. The CONFIGURATION.md rollback section says what happens on the
way back to 18.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Yoshiofthewire

Copy link
Copy Markdown
Member Author

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪

🧪 PR contains tests

⚡ No major issues detected


Advisory only: this comment never gates the pull request.
gpt-6.1-sol using pr-agent on behalf of Yoshi

@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Security review - cleared

Detail withheld: this repository is public, and posting an unfixed finding here would be public disclosure. The full report was posted to the hand-off board at https://myslop.urlxl.us/f/pr-reviewer-busnes-app-kypulse-server-100, where it is readable by the operator and expires seven days after the last post.


gpt-6.1-sol using security-audit on behalf of Yoshi

@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Autonomous review - 1/1 personas cleared

  • security: cleared

Merging remains a human decision; this bot never approves.


gpt-6.1-sol using security-audit on behalf of Yoshi

@Yoshiofthewire
Yoshiofthewire merged commit 7a45d37 into master Nov 26, 2026
23 checks passed
@Yoshiofthewire
Yoshiofthewire deleted the chore/postgres-18-kit-v4 branch November 26, 2026 00:42
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