fix(onchain): let Track selected assets submit on self-hosted installs

Merged
LY
2mo ago
+135-88

Problem

On a self-hosted instance with no crypto price provider enabled, an admin linking an on-chain wallet reaches the token review screen, ticks assets, clicks Track selected assets, and nothing happens. No request reaches the server.

The token screen renders the price-provider warning, which for self-hosted admins includes the one-click Enable crypto prices button. That button is a DS::Button with href: + method: :post, so it renders a button_to form, and the warning was rendered inside the token review form. HTML does not allow nested forms: the parser ignores the inner <form> start tag, and the inner </form> closes the outer form. Everything after the warning (the asset checkboxes and the submit button) ends up outside any form, so the submit button has nothing to submit.

The same nesting also handed the Enable button to the outer form, so clicking it posted to link_wallet and did not enable prices. The Manage → Review tokens screen renders the same partial and broke the same way.

The existing system test runs in managed mode, where the one-click button is not rendered, which is why this was not caught.

Fix

Render the price-provider warning above the token review form, not inside it, in onchain_wallet_items/_token_review_form.html.erb. No visual change: the wrapper keeps the same space-y-4 spacing.

Validation

  • New controller test: on a self-hosted instance, the asset checkboxes and the submit button are inside the link_wallet form, and the enable-prices form still renders.
  • The existing linking system test now runs in both modes. The self-hosted variant goes through the full flow and asserts that both accounts are created.
  • Both new tests fail on main without the view change and pass with it.
  • bin/rails test: 10452 runs, 1 error in RecurringTransaction::PipelineTest, which fails identically on main in the devcontainer (it reads config[:username], while database.yml uses user:). bin/rails test:system, rubocop, erb_lint, Biome and Brakeman are clean.

šŸ¤– Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • In self-hosted wallet imports, the price-provider warning and token review form now appear separately. This keeps token selection and submission available alongside price setup.
    • The wallet-linking flow continues to select priceable assets, exclude unpriceable assets, and create accounts for the selected tokens.