Skip to content

chore(deps): PostgreSQL 18 kit v4: refuse the older 18 after a rollback to 17 - #153

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, the Matrix stack no longer starts the older 18 cluster on the way back. Postgres stays stopped and postgres-17-dump names two choices.

What changed

  • scripts/postgres-17-to-18.sh is now kit v4, byte for byte (sha256 195ae868…, mode 755). It replaces v2, which chore(deps): PostgreSQL 18 with an automatic, non-destructive upgrade from 17 #152 shipped.
  • v2 accepted a re-upgrade after a rollback. 18 then started silently without what 17 wrote meanwhile. v4 stores 17's checkpoint in 18/moved-from-17.checkpoint and refuses when it has changed.
  • The operator then chooses one of two paths, and neither deletes anything:
    • move 17 again: rename 18/ and upgrade-from-17/ with a suffix;
    • keep 18: delete the checkpoint file.
  • Removing upgrade-from-17/ on its own stays safe: later starts work, and a rollback is still caught. Kit v3 broke this case; this PR moves from v2 straight to v4.
  • docs/CHAT-SETUP.md "PostgreSQL 18":
    • a new "Going forward again" section, with the exact commands for both choices;
    • the clean-up split into its two independent steps;
    • a note that passwords rotated on 18 revert when you move 17 again.
  • CI job names are unchanged.

Review this

  • docs/CHAT-SETUP.md "Going forward again". Operators will paste these commands. The test runs them verbatim, so a typo would fail CI.
  • scripts/test-postgres-17-to-18.sh steps 5 to 6d (rollback, forward_refused). They are the proof of the refusal.
  • Safe to skip: scripts/postgres-17-to-18.sh. It is the shared kit, and check-compose-matrix.sh pins its checksum.

Checked (on Major, under kslot)

  • scripts/test-postgres-17-to-18.sh with v4 at the final test text: PASS.
  • Each new case fails on an older kit, at the step it targets:
    • v2 (29926441): FAIL 18 started after 17 ran since the move (first rollback);
    • v3 (65632931): FAIL 18 after removing the dump;
    • v4 with the checkpoint re-taken whenever the dump directory is gone (mut4b, ecd2e113): FAIL 18 started after 17 ran since the move (rollback after removing the dump).
  • The guard check: check-compose-matrix.sh with the old v2 checksum against the v4 file fails with "differs from the kit".
  • Compose guards (proxy, matrix, podman), shellcheck over every script, check-no-binaries.sh, and mdbook build with check-links.py: all pass.
  • go vet passes. go test -race passes on SQLite, and against a throwaway postgres:18.7-alpine3.24@… container. On SQLite, TestInstallerLiveActivationRolesAndSignedRevocation failed once on the long TMPDIR (107-byte socket limit); it passes with a short TMPDIR.

Not checked: the Matrix acceptance legs, the browser jobs and the Docker image are left to CI. This PR changes no Go, web or image code.

Decided for you

  • The test now runs the documented commands verbatim, through docker compose run --no-deps --entrypoint …, instead of a raw volume mount. Operators get a tested command.
  • After "move 17 again", the test applies role-passwords.sql again, because the step-3 rotation was made on 18 only. The docs tell operators to do the same.

You need to: nothing.

Detail

Upgrade test, new flow after step 4 (rerun):

Step What happens What it asserts
5 Roll back to the previous Compose files and write on17 on 17. up fails, the dump log says has run on, and postgres is not running.
5b Run the documented "move again" rename. 18 restores; on17 is present, on18 is gone, and 18.replaced/ and upgrade-from-17.replaced/ are kept.
6 Bad dump (unchanged). No cluster is produced.
6b rm -r upgrade-from-17 (17 kept), then start, then roll back again with on17b. The start says already done; going forward is refused again.
6c The documented "keep 18" (rm 18/moved-from-17.checkpoint). up succeeds, on17b is absent, and a forced rerun still says already done.
6d rm -r pgdata. Later starts say already done.

Files:

  • scripts/postgres-17-to-18.sh: kit v4.
  • scripts/check-compose-matrix.sh: the new checksum.
  • scripts/test-postgres-17-to-18.sh: the steps above.
  • docs/CHAT-SETUP.md, AGENTS.md, CHANGELOG.md: the docs.

🤖 Generated with Claude Code

…an 17

Kit v4 (sha256 195ae868...) records 17's checkpoint at the move in
18/moved-from-17.checkpoint. If 17 ran since (a rollback), the dump
one-shot refuses, so the older 18 never starts silently; the operator
moves 17 again or keeps 18. Removing upgrade-from-17/ no longer
matters to later starts.

The repo upgrade test now drives both choices with the documented
commands, and a rollback after the dump's clean-up. Docs describe the
way back to 18 and split the clean-up into its two independent steps.

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-kymessage-server-153, 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 439babc into master Nov 26, 2026
21 checks passed
@Yoshiofthewire
Yoshiofthewire deleted the chore/postgres-18-kit-v4 branch November 26, 2026 00:43
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