Render Mercury's views through the provider kit components
Summary
Provider kit Track B, B8d: Mercury's remaining views render through the provider kit's components: the Settings > Providers panel (PanelComponent), the selection dialogs (AccountSelectionComponent), the two error dialogs (ApiErrorComponent, SetupRequiredComponent) and the setup page (AccountSetupComponent). A pure move, proven against snapshots recorded from the old views. The HTML changes only where the DS commits on jaysbeekay/sure#723 and jaysbeekay/sure#724 restyled the shared components (Cancel link, alerts, empty state); eight snapshots were re-recorded in 8c8a9ea77. This completes moving Mercury's views onto the kit.
One slice rather than Lunch Flow's three (#750, #751, #752): Mercury reuses the hooks those slices added, so its non-test diff is +134 / -445, inside the ~300-line limit.
Part of jaysbeekay/sure#670 (Track B, step 8: the Mercury conversion, views; option (c), kit variants and hooks that reproduce each provider's HTML). Stacked on the Lunch Flow setup-page slice (jaysbeekay/sure#752) in fork stack #687.
Upstream draft PR: https://github.com/we-promise/sure/pull/5261 (same branch, same commit), in native stack we-promise/sure#5268 on refactor/provider-kit.
Before / after
| Before (Mercury's own views) | After | |
|---|---|---|
| Panel | its own partial: a list of connections like Brex's | PanelComponent with the setup-steps slot and variant: :classic |
| Disconnect button | no aria-label | the same: :classic omits it (Brex keeps its label) |
| Credential fields | inline, twice | mercury_items/_credential_fields (token with value: nil; base URL; sandbox note on the add form) |
| Selection dialogs | two 60-line templates, as Lunch Flow's | AccountSelectionComponent with variant: :classic |
| Row content | nickname, name or legal business name; "Mercury • USD • status • Type" | the same, from mercury_account_options |
| API error / setup required | icon notice, Mercury's own keys; API error always links to provider settings | the components' icon notice with heading:, issues:/steps: and link_text:; return_path: nil |
| Setup page | 105-line view plus _subtype_select | AccountSetupComponent with defaults: and variant: :classic; the partial goes; the hard-coded page title stays in the view |
| Subtype prompts | hard-coded English "Select subtype" / "Select type" | mercury_items.subtype_select.placeholder.* in en.yml, the same words |
| Rendered HTML | unchanged (snapshots), except the blocks restyled with DS primitives on jaysbeekay/sure#723 and jaysbeekay/sure#724 |
What changed
ProviderItem::PanelComponent:variant:(:kitby default,:classic);disconnect_ariareturns no label for:classic.MercuryItemsHelper(new):mercury_account_options,mercury_account_setup_defaultsandmercury_depository_subtype, the logic the views computed inline.- Mercury's seven views keep their names, ivars and locals and render the components;
mercury_items/_subtype_selectis deleted (the setup page was its only caller). config/locales/views/mercury_items/en.yml: the two subtype prompts the component looks up. The app hasconfig.i18n.fallbacks = true, so the other fifteen Mercury locales fall back to these English words, which is what every locale showed before.
Screenshots
The move changes nothing else visible. The DS commits on jaysbeekay/sure#723 (8fb320136) and jaysbeekay/sure#724 (16badcc9e) restyle these blocks: the Cancel link (secondary DS::Link), the API error and setup-required notices (DS::Alert in place of the icon notice), and the setup page's hint, fetch error and all-linked state (DS::Alert and DS::EmptyState). The Settings > Providers panel is unchanged (its snapshots match) and is not shown. Before is the base branch up/lunchflow-kit-setup-page (09b89ee5b); after is this head (5b9e1345d). Desktop 1280px; phone at Chrome's 500px minimum window width.
| Before | After | |
|---|---|---|
| Select accounts, desktop | ![]() | ![]() |
| Select accounts, phone | ![]() | ![]() |
| API error, desktop | ![]() | ![]() |
| API error, phone | ![]() | ![]() |
| Setup required, desktop | ![]() | ![]() |
| Setup required, phone | ![]() | ![]() |
| Setup page (hint), desktop | ![]() | ![]() |
| Setup page (hint), phone | ![]() | ![]() |
| Setup page, fetch error, desktop | ![]() | ![]() |
| Setup page, fetch error, phone | ![]() | ![]() |
| Setup page, all linked, desktop | ![]() | ![]() |
| Setup page, all linked, phone | ![]() | ![]() |
Demo data
No demo data needed.
Migration notes
No migration.
Verification
-
Snapshots recorded first: eleven renders of the old views were written (
PROVIDER_ITEM_SNAPSHOTS=write) before anything changed, using the same cases as Brex's and Lunch Flow's:- panel: no connections, one connection, a syncing connection with an error;
- select accounts (nickname, name with
&, legal business name only, no name), select accounts with no nameable account, select an existing account, the API error, setup required; - setup page: the fixture's "Mercury Checking" plus "Mercury Savings", "Treasury MM" and "Operating" (each subtype rule and the no-match case), an API error, every account linked.
The three "renders through" tests failed then (
expected exactly once/at least once, invoked neverfor each component), and pass after. Brex's and Lunch Flow's snapshots still match. -
Snapshot provenance (checked 2026-11-17): this slice's eleven snapshot tests were run against the old Mercury views on
up/lunchflow-kit-setup-page(5b7bec6d7), before this slice.- With the snapshots as first recorded (57677753d): 11 runs, 0 failures. So the recordings are the old views' output.
- With the current snapshots: the three panel snapshots still match. The other 8 differ only in the DS blocks: the Cancel link (3 selection snapshots), the
api_errorandsetup_requireddialogs (nowDS::Alerts), and the setup page's hint, fetch error and all-linked state (3 setup snapshots). That is the deliberate DS change re-recorded in 8c8a9ea77.
-
Existing tests unedited:
MercuryItemsControllerTest,Settings::ProvidersControllerTest,I18nTestand the Brex and Lunch Flow tests pass. -
Mutations, each caught (17): the classic panel keeping the aria-label; Brex's panel losing it; Mercury's panel not classic; a setup step dropped; the edit form given the add form's token placeholder; the sandbox note on the edit form; the row name ignoring the nickname; ignoring the legal business name; the type not titleized; the selection not classic; the API error losing an issue; the API error or setup-required notice as an alert; the setup defaulting to Depository; an unmatched name defaulting to checking; the subtype prompt reworded in
en.yml; the setup page not classic. -
bin/rails test(full, at this commit): 16,523 runs, 0 failures; the same 8ReleaseNotesWorkflowTesterrors (nonodein the test image). -
bin/rubocop,erb_linton the changed files: no offenses.bin/brakeman: no warnings.i18n-tasks normalizeleavesen.ymlunchanged. -
Size (
git diff -C): non-test +134 / -445. -
Checked against upstream AGENTS.md (blob 1a5dbebd, 2026-11-17): no deviations.
Blast radius
Who else hits these lines, and what do they pass?
render_provider_panel("mercury", …)and the Bank sync page rendersettings/providers/mercury_panelwith the same locals and the samemercury-providers-panelTurbo target;ProviderItemsControllerrenders Mercury's selection, error and setup views with the same ivars and locals.PanelComponentis also rendered by Brex's panel (novariant:) and Lunch Flow's (single shape, no disconnect button); their snapshots pin their output.- Siblings: the other providers keep their own views. Still untranslated in Mercury's views, unchanged here: the setup page title ("Set Up Mercury Accounts") and "Mercury • USD" in the account rows.























