Skip to content

chore(deps): PostgreSQL 18 upgrade kit v4: refuse 18 after a rollback to 17 - #128

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 wrote data, switching back to the 18 compose files no longer silently starts the older 18; the stack stops and tells the operator their two choices.

What changed

  • scripts/postgres-17-to-18.sh is now shared kit v4, byte for byte (sha256 195ae868…cf06, was v2 29926441…). After the dump stops 17 cleanly, the kit records 17's checkpoint in 18/moved-from-17.checkpoint. If 17 runs again later, postgres-17-dump exits 1 and PostgreSQL does not start.
  • The operator then picks one, and nothing is deleted either way: move again (rename 18/ and upgrade-from-17/, and the next up dumps 17 afresh) or keep 18 (delete the marker file).
  • The documented clean-up (rm -r upgrade-from-17) keeps 18 starting, and the rollback check stays armed. This is kit v3's outage, fixed in v4.
  • scripts/test-postgres-17-to-18.sh (CI job PostgreSQL 17 to 18 upgrade (Compose), name unchanged) runs all of this on the repo's real compose files, base and replicas. The cases are the refused re-upgrade, move again (the row written on 17 reaches 18 and the replaced 18 is kept), keep 18, and clean-up followed by a refused later rollback.
  • check-replicas-compose.py pins the v4 checksum. The rollback docs, AGENTS.md and the CHANGELOG are updated. The previous Current source is archived under eceb24e.

Review this

  • docs/REPLICAS.md, "Back to 18 after a rollback": operators will paste these commands. "Keep 18" drops whatever 17 wrote during the rollback, and the docs say so.
  • scripts/test-postgres-17-to-18.sh refused(): a refusal counts only when three things hold: up fails, the dump log carries the kit's rollback message, and no postgres container is running.
  • Safe to skip: scripts/postgres-17-to-18.sh is the vendored kit, identical to the shared copy. Diff it against the kit, don't review it here.

Checked (on Major, at c9fef68)

  • Upgrade test with v4: base PASS (55 s) and replicas PASS.
  • Mutations, base mode, each failing at the step it targets:
    • kit v2: FAIL: 18 started without the row written on 17 during the rollback (3b);
    • kit v2 with 3b removed: FAIL: 18 started after a rollback (keep-18 check) (4b);
    • kit v2 with 3b and 4b removed: FAIL: after the clean-up, 18 started without what 17 wrote since (4c);
    • kit v3: FAIL: 18 did not start after the documented clean-up (4c).
  • The guard fails with the v2 script ("differs from the upgrade kit") and passes with v4.
  • make notes-check tidy-check lint test-web audit-web smoke passes (Node 26.13.1), and shellcheck scripts/*.sh is clean.
  • go vet and go test -race on SQLite: kjob exit 0. Every K host was busy, so it ran on Major.
  • go test -race and the FIPS profile against a local postgres:18.7-alpine3.24@sha256:0115… both pass.

Not checked

  • A rollback that wrote on 17 before this release lands cannot be detected: a v2 install takes 17's current checkpoint as the moved state. The CHANGELOG says so.
  • The replica e2e (Compose replicas and failover) was not run locally; CI runs it. No Go or compose file changed.

You need to: nothing. Merge when CI and both reviewers are clean.

Detail
  • New test steps:
    • 3: roll back with the fed0fb3 compose files and write a row on 17.
    • 3b: up with the current files is refused.
    • 3c: move again: 50001 rows on 18, and 18.replaced/docker is kept.
    • 4: the rerun is a no-op.
    • 4b: start 17, which is refused, then delete the marker, and 18 starts with 50001 rows.
    • 4c: move the dump aside; 18 still starts; start 17 again, which is refused; restore the dump for step 5.
  • The mutation copies changed only the kit script, plus, for the v2 runs, the earlier refusal lines that would otherwise stop the run before the targeted step. They ran from a scratch directory with GIT_DIR pointing at the repo.
  • Health: no product code or test here checks every service's health, so the one-shot's exit-0 rule needs no change.
  • Kit test (~/.cache/ky-workers/pg18/kit/test-postgres-17-to-18.sh) is the model; this repo's test drives Compose instead of docker run.

🤖 Generated with Claude Code

… to 17

Re-vendor scripts/postgres-17-to-18.sh from the shared kit v4 (sha256
195ae868...). After the dump stops 17 it records 17's latest checkpoint in
18/moved-from-17.checkpoint; when 17 has run since (a rollback), the one-shot
refuses, so 18 never starts silently without what 17 wrote. The operator
moves 17 again (rename 18/ and upgrade-from-17/) or keeps 18 (delete the
marker). The marker sits beside the 18 cluster, so the documented clean-up
of upgrade-from-17/ keeps 18 starting and the check armed.

The upgrade test drives the repo's compose files through the refused
re-upgrade, "move again", "keep 18" and the clean-up. The guard pins the
new checksum; docs and release notes describe 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-ky-server-base-128, 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 538a34d into master Nov 26, 2026
17 checks passed
@Yoshiofthewire
Yoshiofthewire deleted the chore/postgres-18-kit-v4 branch November 26, 2026 00:48
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