Skip to content

ci(staging): report data migrations that have not been applied - #858

Merged
jirhiker merged 1 commit into
stagingfrom
ci/report-pending-data-migrations
Aug 19, 2026
Merged

ci(staging): report data migrations that have not been applied#858
jirhiker merged 1 commit into
stagingfrom
ci/report-pending-data-migrations

Conversation

@jirhiker

Copy link
Copy Markdown
Member

Closes the visibility gap around data migrations without moving the decision
about applying them.

Deploys run alembic upgrade head and nothing else, deliberately — a data
migration changes content rather than structure, is often irreversible (a
deletion has no downgrade), and may be slow enough to hold a deploy hostage.
data_migrations.yml is where applying one is decided.

The cost of that is a merged migration sitting unnoticed. This step reports
after the alembic step and never applies anything.

It does not fail the deploy

Pending migrations produce a ::warning annotation and a job-summary table, and
the step exits zero.

The deploy succeeded. Turning it red because a separate, deliberate action has
not been taken yet trains people to ignore a red pipeline — which costs more
than the thing being reported. A database it cannot reach is also a warning
rather than a failure, for the same reason.

Verified against a real database

::warning::Data migration not applied: 20260205_0001_move_nma_location_notes ...

## Data migrations
1 applied, **1 pending**.
| id | name |
| `20260205_0001_move_nma_location_notes` | Move NMA location notes to Notes table |

Exit 0. Also exits 0 with the database unreachable.

Worth noting it found a genuinely pending migration on the first run —
move_nma_location_notes, registered and never applied. That is the gap this
exists to surface.

Not included

production in the Data Migrations workflow dropdown should probably require a
GitHub environment approval, so applying to production is two people rather than
one dispatch. That is a repo settings change rather than a code one, so it is
not in this PR.

🤖 Generated with Claude Code

Deploys run alembic and nothing else, deliberately: a data migration changes
content rather than structure, is often irreversible -- a deletion has no
downgrade -- and may be slow enough to hold a deploy hostage. Applying one is a
decision, and data_migrations.yml is where it is made.

The cost of that choice is that a merged migration can sit unnoticed. This
closes the gap without moving the decision: the step reports and never applies.

It exits zero even with migrations pending. The deploy succeeded, and a
pipeline that goes red for something else is one people learn to ignore, so the
finding surfaces as a warning annotation and in the job summary instead. A
database it cannot reach is also a warning rather than a failure, for the same
reason.

Verified against a real database: it found one pending migration of two
registered, wrote the annotation and summary, and exited zero -- and exits zero
when the database is unreachable.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Coverage

78.08% total — gate is 75%.

No measured coverage for the Python files changed here.

@jirhiker
jirhiker merged commit fdc59a3 into staging Aug 19, 2026
9 checks passed
@jirhiker
jirhiker deleted the ci/report-pending-data-migrations branch August 19, 2026 18:28
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