Repository navigation
[solidus_admin] Add force_legacy_admin_proc preference to route individual requests to the legacy admin - #6601
Merged
AlistairNorman merged 1 commit intoNov 4, 2026
Conversation
Noah-Silvera
force-pushed
the
preference-for-forcing-legacy-ui
branch
2 times, most recently
from
October 14, 2026 17:46
110cbc6 to
da6672e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6601 +/- ##
==========================================
+ Coverage 92.48% 92.58% +0.10%
==========================================
Files 1065 1065
Lines 21544 21546 +2
==========================================
+ Hits 19924 19948 +24
+ Misses 1620 1598 -22 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Noah-Silvera
force-pushed
the
preference-for-forcing-legacy-ui
branch
from
October 14, 2026 18:37
da6672e to
84fe77d
Compare
Noah-Silvera
force-pushed
the
preference-for-forcing-legacy-ui
branch
3 times, most recently
from
October 14, 2026 19:06
9db9505 to
3aca0ef
Compare
Noah-Silvera
marked this pull request as ready for review
October 14, 2026 21:00
jarednorman
force-pushed
the
preference-for-forcing-legacy-ui
branch
from
October 15, 2026 19:57
3aca0ef to
d6669a4
Compare
jarednorman
approved these changes
Oct 15, 2026
jarednorman
force-pushed
the
preference-for-forcing-legacy-ui
branch
from
October 15, 2026 19:57
3aca0ef to
d6669a4
Compare
Noah-Silvera
force-pushed
the
preference-for-forcing-legacy-ui
branch
from
November 2, 2026 14:46
d6669a4 to
78e69c5
Compare
Noah-Silvera
force-pushed
the
preference-for-forcing-legacy-ui
branch
from
November 2, 2026 15:15
78e69c5 to
c7b8eb0
Compare
Stores with heavily customized legacy admin pages can't move to the new admin today, because the only switch is the all-or-nothing cookie/param. This adds a `force_legacy_admin_proc` preference that gets the Rack request, so an app can send just the pages it hasn't ported back to the legacy admin. By default it never forces it, so nothing changes unless an app opts in. The route constraint lives in the install generator's template, so only new installs pick it up. Rerunning the generator adds a second mount rather than replacing the old one, so existing apps have to add the clause to their mount by hand. The PR description spells that out. The default is a lambda returning the proc, like `storefront_product_path_proc`, because Solidus calls a Proc default to build the value. Co-authored-by: GitHub Copilot <copilot@github.com>
Noah-Silvera
force-pushed
the
preference-for-forcing-legacy-ui
branch
from
November 2, 2026 15:18
c7b8eb0 to
daf65d7
Compare
Contributor
Author
|
Just pushed to see if I could get the tests to pass |
Contributor
Author
|
Checks passed and Jared approves: @AlistairNorman could we merge this one? |
AlistairNorman
approved these changes
Nov 4, 2026
Contributor
|
Nice work, I think this will really help with adoption |
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.
What this adds
A new
SolidusAdmin::Config.force_legacy_admin_procpreference. It receives the Rack request and returns whether that request should be served by the legacy admin (solidus_backend) instead ofSolidusAdmin.Until now the only switch was all-or-nothing: the
solidus_admin=falsecookie or query param. Stores that have heavily customized some legacy admin pages couldn't adopt the new admin at all. With this, you can send just the pages you haven't ported back to the legacy admin and use the new admin everywhere else.It defaults to never forcing the legacy admin, so nothing changes unless you opt in.
Upgrading
New installs (
solidus_admin:install) get everything automatically.Existing apps need a one-time edit, because rerunning the generator adds a second
SolidusAdminmount instead of replacing the existing one. Apply this change to theSolidusAdmin::Enginemount inconfig/routes.rb(line numbers will differ in your app):If you already customized the constraint, add
!SolidusAdmin::Config.force_legacy_admin_proc.call(req)to your own logic. Until you do, setting the preference has no effect.Using it
The cookie and query param still work and take precedence.
Testing locally
This walks through both an existing app that upgrades without touching its routes, and a fresh install. It uses the Docker setup from the root README (
docker-compose up -dfirst). Restartbin/devafter any change toconfig/routes.rborconfig/initializers/, since neither is reloaded.Throughout, "the two basic tests" are:
admin@example.com/test123), open/admin/productsand rundocument.body.classNamein DevTools. This is the new admin, so the result is'bg-gray-15 font-sans text-sm'./admin/products?solidus_admin=false. This is the legacy admin, so the result is'admin '.Baseline on
main. Check outmain, then build and start the sandbox:Run tests A and B.
Switch to this branch. The sandbox is gitignored and loads the admin gem from
../admin, so it keeps working. Check out this branch, restartbin/dev, and run tests A and B again. Nothing should change.Upgrade without touching the routes. The sandbox's mount is now the old one, without the new clause, like an existing app. Add this inside the
configureblock ofsandbox/config/initializers/solidus_admin.rb, restart, and run tests A and B again:Both results are unchanged:
/admin/productsis still the new admin. The preference is set but nothing calls it, because the old mount doesn't consult it.Edit the routes. Add
&& !SolidusAdmin::Config.force_legacy_admin_proc.call(req)to the constraint of theSolidusAdmin::Enginemount insandbox/config/routes.rb, as described in "Upgrading" above, and restart./admin/productsnow serves the legacy admin ('admin ') without any param, while/admin/storesstill serves the new admin.Fresh install on this branch. Rebuild the sandbox with
docker-compose exec app bin/sandbox, startbin/dev, and confirm the generatedsandbox/config/routes.rbalready has!SolidusAdmin::Config.force_legacy_admin_proc.call(req)in the mount's constraint. Run tests A and B.Use the proc on the fresh install. Add the
force_legacy_admin_procline from step 3 to the new sandbox's initializer and restart./admin/productsnow serves the legacy admin, and no routes edit was needed.🤖 Generated with Claude Code