fix(migrations): 0035's revision id fits alembic_version (32 chars) (#5374)
CI / lint (push) Successful in 3s
CI / integration (push) Successful in 1m17s
CI / unit (push) Successful in 1m35s
CI / publish (push) Successful in 1m25s

"0035_drop_plugin_catalog_settings" is 33 characters, and
alembic_version.version_num is VARCHAR(32), so the upgrade failed with
"value too long" (CI run 8800, integration). Renamed to
0035_drop_plugin_catalog. tests/test_migration_ids.py now checks every core
and plugin revision id fits, in the unit lane, which never migrates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 13:20:11 -04:00
co-authored by Claude Opus 5.5
parent f035a3b14a
commit 263560cc94
2 changed files with 31 additions and 2 deletions
@@ -5,7 +5,7 @@ image and a third-party plugin is a folder the operator mounts, so nothing reads
`plugins.index_url` or `plugins.repositories` any more. The removed feature
takes its rows with it, as 0025 did for the http plugin.
Revision ID: 0035_drop_plugin_catalog_settings
Revision ID: 0035_drop_plugin_catalog
Revises: 0034_user_time_zone
Create Date: 2026-10-08
"""
@@ -13,7 +13,7 @@ from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
revision: str = "0035_drop_plugin_catalog_settings"
revision: str = "0035_drop_plugin_catalog"
down_revision: Union[str, None] = "0034_user_time_zone"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
+29
View File
@@ -0,0 +1,29 @@
"""Every Alembic revision id fits alembic_version.version_num, a VARCHAR(32).
A longer id passes every unit test and fails only when the upgrade writes it:
"value too long for type character varying(32)", and the app does not boot
(0035, #5374). The unit lane never migrates, so this reads the files.
"""
import pathlib
import re
REPO = pathlib.Path(__file__).resolve().parents[1]
_REVISION = re.compile(r'^revision(?::[^=]*)?=\s*["\']([^"\']+)["\']', re.M)
def revision_ids() -> dict[str, str]:
files = [*(REPO / "steward/migrations/versions").glob("*.py"),
*(REPO / "plugins").glob("*/migrations/versions/*.py")]
found = {}
for path in files:
m = _REVISION.search(path.read_text())
if m:
found[str(path.relative_to(REPO))] = m.group(1)
return found
def test_every_revision_id_fits_version_num():
ids = revision_ids()
assert len(ids) >= 30, ids # core and plugin migrations were found, so the check is real
too_long = {path: rev for path, rev in ids.items() if len(rev) > 32}
assert not too_long, f"alembic_version.version_num is VARCHAR(32): {too_long}"