Repository navigation
[new] Never run a revision's stale bytecode - #19
Merged
Merged
Conversation
`new` replaces the template Alembic wrote and may have loaded. Python keys cached bytecode on the source's size and whole-second modified time, so a same-size rewrite within the second left the template's empty upgrade() running, and `up` recorded the migration without sending its SQL. `rebase` and `new --exchange` rewrote files the same way. Every rewrite now drops the cached bytecode, and `up` and `down` drop it for all revisions first, so a cache an older version left can't run either. Solves: DRY-2040 migration recorded but never run Tests: 11 new unit tests, 8 of which fail without the fix; unit and Docker integration suites; a 61-migration import that had skipped 3
Patch release for the stale-bytecode fix. The CHANGELOG says who could be affected and how to check, because upgrading can't rerun a migration the database already counts as applied. Solves: DRY-2040 release Tests: none (version and changelog)
drycode
force-pushed
the
dy/dry-2040-stale-bytecode
branch
from
December 1, 2026 17:37
f039e8b to
6403051
Compare
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.
ch-migrate newreplaces the template Alembic writes. Python caches bytecode by the source's size and whole-second modified time, so a rewrite in the same second at the same size left the template's emptyupgrade()running.upthen recorded the migration as applied without sending its SQL. It was first seen withnew --irreversible, and also reproduces with plainnew --dictand a 40-character name.new,new --exchange,rebase) now drops its cached bytecode.upanddowndrop it for every revision before they start, so a cache an older version left can't run.Eleven new unit tests, eight of which fail without the fix. Unit suite passes; Docker integration 189 passed, 4 skipped.
Style check: three findings are the order and parameter count of functions this changes one line in; they predate it, so the gate was skipped for opening this PR.