From d044e93bdbbaeb80d3fb798cccb6058d1ad52ee5 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sun, 30 Aug 2026 14:47:29 -0400 Subject: [PATCH] ci: repair autogenerate's missing pgvector import before applying (#3275) mode: models applies the raw autogenerated candidate, and it cannot run: sa.Column('weights', pgvector.sqlalchemy.vector.VECTOR(dim=1152), ...) NameError: name 'pgvector' is not defined Alembic emits the qualified reference without emitting the import. Observed on run 4988, which turns this from a thing I predicted by reading the candidate into a thing demonstrated by executing it. Repaired in the workflow rather than counted as a schema difference: the comparison asks whether the MODELS describe the schema, and this is a defect in the generator. The same fixup has to be applied by hand to any baseline generated this way, which is why it is item 4 on the collapsed baseline's hand-written list. --- .forgejo/workflows/baseline.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.forgejo/workflows/baseline.yml b/.forgejo/workflows/baseline.yml index 14643f8..7d36ac4 100644 --- a/.forgejo/workflows/baseline.yml +++ b/.forgejo/workflows/baseline.yml @@ -208,6 +208,15 @@ jobs: mkdir -p /tmp/held mv alembic/versions/*.py /tmp/held/ cp /tmp/candidate/*.py alembic/versions/ + # Autogenerate EMITS pgvector.sqlalchemy.vector.VECTOR(...) without + # importing it, so the file it writes cannot run: + # NameError: name 'pgvector' is not defined + # Observed on run 4988, which is the proof rather than the theory. + # This is a defect in the GENERATOR, not in the models, so it is + # repaired here rather than counted as a schema difference — the + # comparison is about whether the models describe the schema. + sed -i '0,/^import sqlalchemy as sa$/s//import sqlalchemy as sa\nimport pgvector.sqlalchemy.vector/' alembic/versions/*.py + grep -n 'import pgvector' alembic/versions/*.py ls alembic/versions/*.py DB_NAME=fc_base alembic upgrade head rm -f alembic/versions/*.py