ci(staging): report data migrations that have not been applied - #858
Merged
Conversation
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>
Contributor
Coverage✅ 78.08% total — gate is 75%. No measured coverage for the Python files changed here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the visibility gap around data migrations without moving the decision
about applying them.
Deploys run
alembic upgrade headand nothing else, deliberately — a datamigration 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.ymlis 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
::warningannotation and a job-summary table, andthe 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
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 thisexists to surface.
Not included
productionin the Data Migrations workflow dropdown should probably require aGitHub 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