Skip to content

Abort solidus:install on migration/seed rake failures - #6553

Open
wakqasahmed wants to merge 1 commit into
solidusio:mainfrom
wakqasahmed:fix/issue-6035-silent-install-failure
Open

Abort solidus:install on migration/seed rake failures#6553
wakqasahmed wants to merge 1 commit into
solidusio:mainfrom
wakqasahmed:fix/issue-6035-silent-install-failure

Conversation

@wakqasahmed

Copy link
Copy Markdown

Fixes #6035

Problem

solidus:install runs several rake tasks (railties:install:migrations, db:create, db:migrate, active_storage:install, db:seed, spree_sample:load) via the generator's rake helper without passing abort_on_failure: true.

Even though Solidus::InstallGenerator.exit_on_failure? returns true, Thor's run only falls back to that class-level default when the :abort_on_failure key is absent from the options hash (config.fetch(:abort_on_failure, self.class.exit_on_failure?)). Rails' execute_command always includes the key explicitly (as nil when not set), so the fallback never kicks in and a failing rake task is silently ignored. The generator then proceeds through the rest of its steps and prints Solidus has been installed successfully. Enjoy! even though migrations or seeding actually failed - exactly what was reported in #6035 (a db:migrate failure due to a pre-existing table went unnoticed, seeding then failed too, and the install was reported as successful).

Fix

Pass abort_on_failure: true explicitly on each of these rake calls in core/lib/generators/solidus/install/install_generator.rb, so a real failure aborts the generator (a clean Thor::Error, since exit_on_failure? is already true) instead of continuing silently.

Test plan

  • Added specs in core/spec/lib/generators/solidus/install/install_generator_spec.rb asserting abort_on_failure: true is passed for the migrations, database creation, active storage, seed, and sample-data rake calls, and that a raised failure from db:migrate propagates out of run_migrations instead of being swallowed.
  • Could not execute the suite locally (no Ruby/Bundler available in this environment) - verified the fix against Rails' Rails::Generators::Actions#rake/#execute_command and Thor's Actions#run source to confirm the exact fallback behavior described above.

The install generator's rake calls for installing migrations,
creating the database, running migrations, installing Active
Storage, seeding data, and loading sample data did not pass
abort_on_failure, so Thor's default abort_on_failure fallback to
the generator's exit_on_failure? was bypassed (execute_command
always sets the key explicitly, even to nil). Any failure in
these steps was silently swallowed and the generator went on to
print 'Solidus has been installed successfully.'

Pass abort_on_failure: true explicitly to each of these rake
calls so a real failure aborts the generator instead of being
ignored.
@wakqasahmed
wakqasahmed requested a review from a team as a code owner August 22, 2026 14:52
@github-actions github-actions Bot added the changelog:solidus_core Changes to the solidus_core gem label Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:solidus_core Changes to the solidus_core gem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

generate solidus:install may fail silently despite errors or conflicts

1 participant