Render the Brex panel through ProviderItem::PanelComponent
Summary
Provider kit Track B, B4b: Brex's Settings > Providers panel (settings/providers/_brex_panel) renders through a shared ProviderItem::PanelComponent. The panel's HTML is unchanged, checked against snapshots of the partial taken before the change.
Part of jaysbeekay/sure#670 (Track B, item 4, second of two slices: B4a card, B4b panel). Stacked on B4a (jaysbeekay/sure#721) in fork stack #687.
Upstream draft PR: https://github.com/we-promise/sure/pull/5233 (same branch, same commit), in native stack we-promise/sure#5268 on refactor/provider-kit.
What changed
ProviderItem::PanelComponent(new): the panel's template, moved from the Brex partial. It covers the error alert, each connection with its sync, disconnect and edit form, and the add-connection form. Messages come from the provider's existing<key>_items.provider_panel.*keys (no locale changes); the panel id comes from the panel declaration'sturbo_id.- Provider-specific parts:
- setup steps: a
setup_stepsslot, which the Brex partial fills with its four steps; - credential fields: a partial hook,
<key>_items/_credential_fieldswithform:,item:andediting:, rendered inside each form. This departs from the "slots" default in #670's plan, because a slot is filled before the component renders and cannot receive the per-form builder.brex_items/_credential_fieldsholds Brex's token and base URL fields, plus the sandbox note on the add form.
- setup steps: a
settings/providers/_brex_panelkeeps itsbrex_items:/error_message:locals and fallbacks and renders the component.
Screenshots
Rendering unchanged: this PR moves the Brex panel onto a shared component, and the snapshot tests show the HTML matches the partial's. After only, at this PR's head: Settings > Providers, the Brex connection from the test fixtures (brex_items(:one)).
| Light | Dark | |
|---|---|---|
| After | ![]() | ![]() |
Demo data
No demo data needed: no new records.
Migration notes
No migration.
Verification
-
Snapshots: three renders of the original Brex panel, recorded before the change, in
test/components/provider_item/snapshots/, with the same normalisation as B4a:- no connections;
- one connection;
- a syncing connection with an error.
ProviderItem::PanelComponentTestasserts the panel still renders each one, and that it renders throughProviderItem::PanelComponent; the latter fails without the change (uninitialized constant ProviderItem::PanelComponent). -
Snapshot provenance (re-checked 2026-11-17): the three partial snapshot tests were run against the old
_brex_panelonup/provider-kit-card, before this slice: 3 runs, 0 failures. -
Review fix (2026-11-17): the component reads its turbo id from
Provider::Factory.panel_declarationsinstead ofSettings::ProvidersController::FAMILY_PANELS_BY_KEY. -
Existing tests unchanged:
Settings::ProvidersControllerTestandBrexItemsControllerTest(which renders the panel after create and update) pass unedited. -
Mutations, each caught: no setup steps; the edit form given the add form's fields; the add form given the edit form's fields; the wrong panel id; no error alert; sync enabled while syncing; the add-connection heading shown with no connections.
-
bin/rails test(full, at the B4b commit): 16,294 runs, 0 failures; the same 8ReleaseNotesWorkflowTesterrors (nonodein the test image). -
bin/rubocop,erb_linton the changed templates andbin/brakeman: no offenses or warnings. -
Diff with copy detection (
git diff -Cagainst B4a): non-test +184 / -124. -
Checked against upstream AGENTS.md (blob 1a5dbebd, 2026-11-17): no deviations.
Blast radius
render_provider_panel("brex", …)and the Settings > Providers page rendersettings/providers/brex_panelwith the same locals and the samebrex-providers-panelTurbo target.- Siblings: the other providers' panels keep their own partials for now.

