Skip to content

test(migrations): prepare for freezing migrations 1-12 in v0.1.15 - #1068

Merged
LeeroyHannigan merged 3 commits into
mainfrom
test/migrations-ready-for-release
Nov 17, 2026
Merged

LeeroyHannigan merged 3 commits into
mainfrom
test/migrations-ready-for-release

Conversation

@robinnsc

@robinnsc robinnsc commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

What

Prepares main for the v0.1.15 release PR, #1069, which freezes catalog migrations 1 to 12. Merge this one first; #1069 is stacked on it.

Background. Each catalog store keeps a migration ledger: one row per applied migration, with the checksum of the code that ran. RELEASED_THROUGH in crates/storage/src/migrations/registry.rs marks which migrations have shipped. Those are frozen: their checksums are pinned, and extenddb migrate --forget <id>, which deletes a ledger row so the migration runs again, refuses them. #1069 raises RELEASED_THROUGH from 0 to 12, which breaks the tests and text below.

1. Tests that forget a frozen migration

Ten tests and two devtools scripts called forget on an id from 1 to 12 and expected it to succeed.

  • Where forget only made a migration pending again, the test now deletes the ledger row with the backend's own client.
  • Where the test is about forget itself, it uses a runner with a test-only bound of 0 (Runner::with_released_through, now exposed under the existing test-util feature). Release builds don't enable test-util, and nothing at runtime can change the bound.
  • Two extenddb-storage unit tests that assumed nothing was released now hold at either bound.
  • New guard: the_default_runner_refuses_every_id_this_binary_released and a step in devtools/check-postgres-catalog-lock check that the shipped binary refuses --forget for every frozen id.

2. Text that says the ledger arrives in 1.0

About 55 files said the ledger arrives "in v1.0" or called older releases "0.1.x" or "before 1.0". They now say 0.1.15 and later, or 0.1.14 and earlier. Statements about 1.0 as a product milestone are unchanged.

Printed messages that change wording:

  • "a release before 1.0" becomes "a release before 0.1.15" in migrate status, advice and --reconverge help.
  • backup migrate-legacy refuses "the 13-digit shape that 0.1.14 and earlier releases issued".

Other documents:

  • docs/versioning.md: the patch-release rules now apply from 1.0. 0.x releases, 0.1.15 included, can add configuration keys and breaking migrations. Crates are published from 0.1.15.
  • Upgrade manual: a new entry for fix(auth): bind LeadingKeys for a refused Query's partition operand #511, and six 0.1.15 entries get the v0.1.15: label.
  • CONTRIBUTING.md: adds Cassandra's checksum test command.

3. Release-path fixes

  • docker/dockerhub-overview-cassandra.md described KMS-key signing, but the release workflow signs keyless. The page now matches the PostgreSQL and MongoDB pages.
  • devtools/release-dry-run: the SHA-256 step failed when CARGO_TARGET_DIR was set.

No product behavior changes apart from the reworded messages.

Testing done

Each check ran with RELEASED_THROUGH at 0 (this PR) and at 12 (#1069's freeze applied, then reverted).

  • cargo fmt --check and cargo +1.97.0 clippy --workspace --all-targets -- -D warnings, with and without the storage test hooks: clean.
  • cargo test -p extenddb-storage --lib: 265 passed at both bounds.
  • The changed tests on SQLite, PostgreSQL, MongoDB and Cassandra, and the Python wire test: pass at both bounds.
  • check-postgres-catalog-lock (direct and through PgBouncer) and check-cassandra-catalog-lock: pass at both bounds.
  • With Runner::new hard-coded to a bound of 0 and the release bound at 12, the new unit test and the lock-script step both fail.
  • The older-binary checks against the 0.1.14 images pass for PostgreSQL, SQLite and MongoDB. They ran on the previous base, 95425f5; main has not changed those crates since. Cassandra's was not run locally.

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace): not run in full; the affected suites above pass at both bounds, and CI runs the workspace
  • Code is formatted (cargo fmt --check)
  • Clippy is clean (cargo clippy -- -W clippy::pedantic): checked as CI runs it, cargo +1.97.0 clippy --workspace --all-targets -- -D warnings
  • I have added or updated tests for new functionality: the default runner's refusal test and the lock-script step
  • I have updated documentation if behavior changed
  • Breaking changes are noted below (if any)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, or public CLI surface, an RFC has been accepted or is linked
    below. Otherwise, an ADR captures the decision (link below).

ADR / RFC: ADR-0023 (catalog migrations).

Breaking changes

None. The printed messages change wording only; exit codes are unchanged.


By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.

The release that freezes catalog migrations 1 to 12 raises
RELEASED_THROUGH from 0 to 12, and Runner::forget then refuses every id
from 1 to 12. Ten tests and two devtools scripts forget one of those ids
and expect success, and two extenddb-storage unit tests assume no id is
released. Each now passes with the bound at 0 and at 12.

Where forget only made a migration pending again, the test deletes the
migration's ledger row with the backend's own client (the version row
is left as it was; the next run rewrites it):
- migration 6's backfill tests on SQLite, PostgreSQL and Cassandra;
- the PostgreSQL re-registration on a changed status;
- the Cassandra check that the status before the lock reads no policy;
- the backup commands' exit 3 on a catalog behind the binary
  (tests/test_backup_store_config.py).

Where the test is about forget, it keeps its purpose with a runner given
a released bound of 0: PostgreSQL's forget-and-reapply test, MongoDB's,
SQLite's in changed_ahead_and_forgotten_ledgers, SQLite's
one-transaction test, and the "nothing to forget" case of
forget_refuses_an_id_it_cannot_forget. Runner::with_released_through is
exposed under the existing test-util feature for this, and SQLite's
forget takes the runner through a new forget_with. Release builds do
not enable test-util, and nothing a release binary reads can change the
bound. each_refusal_names_its_command checks the Changed advice on both
sides of the bound: --forget for RELEASED_THROUGH + 1, and "run the
ExtendDB release that recorded it" for RELEASED_THROUGH.

The PostgreSQL and Cassandra catalog lock scripts ran
`migrate --forget <id>` and expected exit 0. They now check that
`--forget` of an id the binary does not carry exits 1 and leaves the
lock free, delete the migration's ledger row themselves, and check that
`migrate --yes` applies it again, as before.

Since every forget test sets its own bound, none checked the bound a
release binary uses: Runner::new could set 0 and every test would pass.
the_default_runner_refuses_every_id_this_binary_released checks that
Runner::new refuses each id from 1 to RELEASED_THROUGH with "has been
released" and forgets the first id above the bound, so it holds at any
bound. devtools/check-postgres-catalog-lock reads the bound from
registry.rs and, when it is above 0, checks that the binary's
`migrate --forget 1` exits 1 with that message and leaves both ledgers
unchanged.

Signed-off-by: Scott Robinson <robinnsc@amazon.com>
The docs, the messages the binary prints and the comments beside them
were written for the migration ledger arriving in 1.0. It arrives in
0.1.15, which is itself a 0.1.x release and a release before 1.0, so
"a release before 1.0", "a 0.1.x release" and "the v1.0 schema" would
include the release that brings the ledger.

Statements about which releases predate the ledger, the frozen
migrations or the 14-digit backup ids now name 0.1.14 and earlier, or
0.1.15 and later. Migration 1's schema is called that instead of the
v1.0 schema. The printed messages that change:
- "a release before 1.0" becomes "a release before 0.1.15" in the
  status, the migrate advice and preview, and --reconverge's help;
- migrate-legacy's refusal and its --help name "the 13-digit shape
  that 0.1.14 and earlier releases issued";
- PostgreSQL's and Cassandra's check after migration 1 compare with
  migration 1's schema;
- migration 1's description in migrate --list drops "v1.0".
The tests and devtools scripts that match these messages change with
them. The CI steps that run the 0.1.14 images are named for 0.1.14.
README.md and docs/cassandra-setup.md say the Cassandra image is
published from 0.1.15.

docs/versioning.md stated its rules for every release: a patch release
adds no configuration key and no breaking catalog migration, and rolls
back with the earlier binary. 0.1.15 does both, and rolling it back
needs the backup taken before the upgrade. The page now says the rules
apply from 1.0 and what a 0.x release can change, and that the crates
are published to crates.io from 0.1.15.

The upgrade manual gains a 0.1.15 entry for #511: a Query whose
partition key condition is not an equality now gets
AccessDeniedException where a LeadingKeys fence does not cover its
operand, where 0.1.14 answered ValidationException. The six 0.1.15
entries whose headings named no release (#515, #384, #471, #692, #581,
note says one server per catalog "in this release", as README.md does.
CONTRIBUTING step 7 lists Cassandra's checksum test, and
differences-from-dynamodb.md no longer says "this branch".

Statements about 1.0 as a milestone (scope, support policy) are
unchanged. So are the migration bodies, whose checksums the release
freezes, the ADRs, which are not edited after acceptance, the design
document's revision log, and the RELEASED_THROUGH and RELEASED comments
that the release commit rewrites.

Signed-off-by: Scott Robinson <robinnsc@amazon.com>
The Cassandra image's Docker Hub overview said every image is signed
with the KMS release key and showed `cosign verify --key`.
release-image.yml signs every backend's image keyless through
.github/actions/sign-image, and the first Cassandra image is published
after the keyless migration, so no Cassandra image carries a key
signature. The overview now gives the keyless verify command and signer
identities that the PostgreSQL and MongoDB overviews give.

devtools/release-dry-run's SHA-256 record step ran `cd target/package`,
which fails when CARGO_TARGET_DIR (or a cargo config) moves the target
directory, as `cargo package` then writes elsewhere. The step now reads
target_directory from `cargo metadata`, as devtools/check-crate-packages
does. release-crates.yml runs with the default target directory and is
not affected.

Signed-off-by: Scott Robinson <robinnsc@amazon.com>
@robinnsc robinnsc changed the title test(migrations): make the tree ready for releasing migrations 1 to 12 in 0.1.15 test(migrations): prepare for freezing migrations 1-12 in v0.1.15 Nov 17, 2026

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing here blocks the release. Points outside the diff:

  • The migration 1 bodies still say "v1.0" and "releases before 1.0": crates/storage-sqlite/migrations/0001_baseline.sql:4,129,435, crates/storage-postgres/migrations/0001_baseline.sql:6,93,398,399, crates/storage-postgres/data_migrations/0001_baseline.sql:6,116, crates/storage-cassandra/migrations/catalog/0001_baseline.cql:6,24,347,348, crates/storage-cassandra/migrations/account/0001_baseline.cql:6,17, crates/storage-mongodb/src/migrations/m0001_baseline.rs:4,15,17,119 and crates/storage-sqlite/src/migrations/m0001_baseline.rs:4. The two .rs modules can be reworded before #1069 at no cost, since a ledger records their fingerprint. The SQL and CQL files record their own checksum: a reword before #1069 makes catalogs built from main report Changed for migration 1, and a reword after #1069 needs a rebless entry. If they stay as written, a line in the description would record that.
  • Four entries under "Behavior Changes by Release" shipped in v0.1.14 and carry no label: lines 833, 947, 964 and 994, from #419 and #420 (git tag --contains gives v0.1.14 for both). Next to the v0.1.15: labels they read as unreleased. v0.1.14: on the four headings fixes that.
  • docs/design/15-backup-restore.md:620 still says "the 13-digit shape every 0.1.x backup has".

Comment thread docs/versioning.md

## What a release can change

These rules apply from 1.0. A 0.x release, 0.1.15 among them, can add configuration keys, CLI flags and backup format versions, can carry breaking catalog migrations, and can raise the minimum Rust version, whatever part of its number changes. 0.1.15 adds configuration keys and breaking catalog migrations, so a rollback from it to 0.1.14 needs the backup taken before the upgrade, not only the 0.1.14 binary (see the [Rollback Procedure](manuals/07-upgrade-manual.md#rollback-procedure)).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 40 still says "Every migration in 1.0 is breaking." With this paragraph, migrations 1 to 12 ship in 0.1.15, and #1069 freezes several of them as additive or not applicable on some backends (see the comment on line 77 of the upgrade manual). Suggest for line 40: "Migration 1 is breaking on every backend. extenddb migrate --list prints the kind of each migration on the configured backend."

ADR-0023 says 1.0 for the release that brings the ledger on lines 14, 155, 159, 202, 275, 290, 340 and 369 to 389. It is a record, so a dated note at its top that the ledger shipped in 0.1.15 would cover them.

`verify` also checks the connection to the data database. When that check fails, `verify` exits 1 on a Behind catalog instead of 3, because `migrate --yes` cannot apply the pending migrations while the data database cannot be reached. It still exits 4 or 5 for the statuses that need a person.

A migration is additive when the previous release serves the catalog correctly with it applied, and breaking otherwise. Migrations 1 to 7 and 9 to 12 are breaking. Migration 8 creates a table in the PostgreSQL data database that the previous release never reads; on PostgreSQL it is declared breaking only because the job that proves an additive declaration against the old binary does not yet exist (CONTRIBUTING, step 4 of adding a migration), and on SQLite, MongoDB and Cassandra it does not apply (`migrate --list` prints it as not applicable, and `migrate` counts it as additive). Do not run a 0.1.x server against a migrated catalog. A 0.1.x binary that writes to a migrated catalog (its `migrate --yes`, or a SQLite dev server) leaves it WrittenByOlderRelease. `migrate --yes --reconverge` repairs it by running the convergent migrations again. Migration 2, which rewrites stored policies, is not convergent: the repair skips it and prints a line that says so (see the v0.1.14 notes below).
A migration is additive when the previous release serves the catalog correctly with it applied, and breaking otherwise. Migrations 1 to 7 and 9 to 12 are breaking. Migration 8 creates a table in the PostgreSQL data database that the previous release never reads; on PostgreSQL it is declared breaking only because the job that proves an additive declaration against the old binary does not yet exist (CONTRIBUTING, step 4 of adding a migration), and on SQLite, MongoDB and Cassandra it does not apply (`migrate --list` prints it as not applicable, and `migrate` counts it as additive). Do not run a server of 0.1.14 or an earlier release against a migrated catalog. A binary of those releases that writes to a migrated catalog (its `migrate --yes`, or a SQLite dev server) leaves it WrittenByOlderRelease. `migrate --yes --reconverge` repairs it by running the convergent migrations again. Migration 2, which rewrites stored policies, is not convergent: the repair skips it and prints a line that says so (see the v0.1.14 notes below).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence and line 215 ("every migration in this release is breaking") disagree with the kinds #1069 freezes. Migration 12 is not applicable on PostgreSQL, SQLite and Cassandra, and migrate records it as additive. A release build of #1069 prints it in migrate --list on PostgreSQL as not applicable: access_key_id is the primary key of access_keys, so an ID can be stored once. The RELEASED tables also declare SQLite 7, 8 and 11, MongoDB 3, 4, 7, 8, 9 and 11, and Cassandra 3, 4, 7, 8 and 11 additive.

The rollback steps stay right because migration 1 is breaking on every backend. Both lines can say that and point at migrate --list for the kind of each migration.

/// `forget` deletes the ledger row and writes the version row in one
/// transaction: when the version row cannot be written, the ledger row is
/// still there.
/// still there. The command's path is followed under the lock, with a

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test now calls forget_with on its own SqliteMigrations, so SqliteCatalogMigrations::forget (commands.rs:127) does not run, and "the command's path is followed" no longer holds. This test and storage-cassandra/tests/migrations.rs:517 were the two Rust tests that called a backend's CatalogMigrations::forget, and with this PR none does. The SQLite and MongoDB lock scripts never run --forget, so those two entry points run in no test at the release bound.

Suggest also calling SqliteCatalogMigrations.forget(&lock, 1) under the lock, and asserting the has been released refusal and an unchanged ledger. Otherwise the comment can drop the command path.

return False


def released_through() -> int:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

released_through() repeats the parser of devtools/check-released-through: the same regex on the same file. This script already imports catalog_checks, so the function could live there for both.

The step at line 201 also puts the bound in the expected text, so it passes only when the checkout's bound equals the binary's. Run from a tree at bound 13 against this 0.1.15 binary, it fails a correct binary. Matching only migrations above \d+ can be forgotten checks the refusal whatever bound the checkout has.

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@LeeroyHannigan
LeeroyHannigan added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 81e3ebe Nov 17, 2026
60 checks passed
@LeeroyHannigan
LeeroyHannigan deleted the test/migrations-ready-for-release branch November 17, 2026 18:34
LeeroyHannigan added a commit that referenced this pull request Nov 17, 2026
…icy text

Main renamed the release that brings the migration ledger from 1.0 to 0.1.15 in its messages and docs (#1068). The text that this branch adds still used the old names.

The progress line that serve prints for a catalog with no ledger now says "a release before 0.1.15", as the status and migrate messages do. The upgrade manual's section on migrations at startup now names 0.1.15, or 0.1.14 and earlier releases, instead of 1.0 and 0.1.x. The Helm note in the deployment guide and a Cassandra test comment change in the same way. The note about one server per catalog says "this release", as the other notes on main do.
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