Repository navigation
feat: add Heroku preboot context to strong_migrations destructive-operation messages - #3057
Open
costajohnt wants to merge 1 commit into
Open
costajohnt wants to merge 1 commit into
costajohnt wants to merge 1 commit into
Conversation
…ration messages Closes codebar#2963
This branch has not been deployed
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 #2963
With preboot, the release phase runs before old web dynos stop, so old code serves against the new schema for about 3 minutes after each deploy. strong_migrations' destructive-operation messages don't say that, so the preboot guidance in AGENTS.md ("Migrations and Heroku preboot") is invisible at the moment someone hits the error.
This appends a short preboot note to the nine messages listed in the issue, through
StrongMigrations.error_messages(the gem's documented custom-messages API). The gem's own text is unchanged and comes first; the note goes after it. It usesfetch, so if a future gem version drops one of these keys, boot fails loudly instead of the note silently landing onnil.I left
remove_column,change_column_null_postgresql(whatchange_column_nullwithout a default raises on Postgres 16) andadd_column_defaultout, since the issue scoped the list. AGENTS.md mentionsremove_columnand adding a column with a default as preboot hazards too, so I'm happy to add them here if you'd like.Testing
spec/config/strong_migrations_config_spec.rb: therename_columnmessage still starts with the gem's text and ends with the note, all nine messages carry the note exactly once, and an unrelated message (add_index) is unchanged. Two of the three examples fail without the initializer change.rename_columnmigration run withbin/rails db:migratein development prints the gem's message followed by the note. Of the 35 messages, 9 carry the note and the other 26 are unchanged.bundle exec rspec(1748 examples, 0 failures) andbundle exec rubocopon the changed files.