Skip to content

fix: don't infer renames or skip dev migration check in codegen --check - #881

Merged
zachdaniel merged 1 commit into
ash-project:mainfrom
Straffern:fix/codegen-check-renames-841
Oct 5, 2026
Merged

zachdaniel merged 1 commit into
ash-project:mainfrom
Straffern:fix/codegen-check-renames-841

Conversation

@Straffern

Copy link
Copy Markdown
Contributor

Closes #841

Description below is LLM-generated (per the AI Policy); code reviewed and vetted by me.

Implements the fix agreed in #841:

  1. --check reports remaining _dev migrations before snapshot merging / rename inference, instead of only after operations are computed.
  2. yes?/2 returns false in --check mode, so check never confirms an interactive rename (attribute, table, or schema move). Ambiguous changes surface as add/remove and raise PendingCodegen.

Regression tests in test/migration_generator_test.exs (--check option):

  • 4 removed + 2 added attributes with a --dev migration remaining → exits with the dev-migration message (previously Could not get matching name after 3 attempts.).
  • 2 removed + 2 added attributes, no dev migrations → PendingCodegen, no rename in the diff (previously the same crash).

Behavior change: --check now fails whenever _dev migrations remain, even if the diff against the last production snapshot is empty.

Contributor checklist

Leave anything that you believe does not apply unchecked.

  • I accept the AI Policy, or AI was not used in the creation of this PR.
  • Bug fixes include regression tests
  • Chores
  • Documentation changes
  • Features include unit/acceptance tests
  • Refactoring
  • Update dependencies

In --check mode, yes?/2 answered true to rename prompts while prompt/2
returned a placeholder, so multiple removed + added attributes raised
"Could not get matching name after 3 attempts." before the remaining
_dev migration check could run.

- check for remaining _dev migrations before rename inference
- never confirm interactive questions in --check mode

Fixes ash-project#841
@zachdaniel
zachdaniel merged commit a43d0bc into ash-project:main Oct 5, 2026
@zachdaniel

Copy link
Copy Markdown
Contributor

🚀 Thank you for your contribution! 🚀

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.

mix ash.codegen --check, fails

2 participants