Skip to content

CI doesn't exercise the Alembic migration chain — broken migration 004 shipped undetected #9

Description

@Svaag

Context

Tests use aiosqlite + SQLAlchemy create_all — there is no Postgres and no Alembic in ci.yml. The migration chain (001006) is never run end-to-end in CI.

This let a real defect ship: migration 004_intent_engine was written non-self-contained (it assumed a pre-existing toy crypto_intents table + crypto_intent_status enum and only did add_column / ALTER TYPE). It was unappliable on any clean DB and would have failed every fresh deploy. CI was green throughout because prod sat at alembic 001 and the test suite builds its schema via create_all, never via the migrations. The break was only caught during the manual production deploy and fixed in PR #8 (004 rewritten self-contained, verified by diffing the migrated schema against create_all).

A CI gate that actually runs the migrations would have caught it on the PR.

Action items

  1. Add a Postgres service container to .github/workflows/ci.yml (the self-hosted runner has Docker) with a throwaway hyrule DB.
  2. Add a step that runs the chain as a roundtrip on every PR: alembic upgrade head then alembic downgrade base against that Postgres.
  3. (Optional, strong) Assert the migrated head schema matches Base.metadata.create_all — the exact parity check used to validate the 004 fix — so future model/migration drift fails CI.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingloop:knowledge-gapKnowledge context is missing, stale, or contradictory

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions