Render Lunch Flow's selection dialogs through shared components
Summary
Provider kit Track B, B7e: Lunch Flow's account-selection dialogs and its two error dialogs render through the shared components Brex has used since B5a: select_accounts and select_existing_account through ProviderItem::AccountSelectionComponent, _api_error through ProviderItem::ApiErrorComponent, _setup_required through ProviderItem::SetupRequiredComponent. A pure move, proven against snapshots recorded from the old views. The one HTML change is the Cancel link, which is now the secondary DS::Link from the DS commit on jaysbeekay/sure#723 (8fb320136); the three affected snapshots were re-recorded in 02a249d78.
Part of jaysbeekay/sure#670 (Track B, step 7: the Lunch Flow conversion, views; option (c), kit variants and hooks that reproduce each provider's HTML). Stacked on the Lunch Flow panel slice (jaysbeekay/sure#750) in fork stack #687.
Upstream draft PR: https://github.com/we-promise/sure/pull/5259 (same branch, same commit), in native stack we-promise/sure#5268 on refactor/provider-kit.
Before / after
| Before (Lunch Flow's own views) | After | |
|---|---|---|
| Selection dialogs | two 60-line templates, near copies | AccountSelectionComponent with variant: :classic |
| Form tag | hand-written <form> plus its own authenticity_token field | the same, from the :classic variant (Brex keeps form_with) |
| Row without a name | border-error bg-error/5, text-error | the same, from :classic (Brex keeps destructive) |
| Cancel link | data-action="DS--dialog#close" | the same, from :classic |
| Submit with nothing selectable | enabled | enabled, from :classic (Brex's is disabled) |
| Row content | inline in each template | lunchflow_account_options helper: name; IBAN's last four, institution, currency, status |
| API error dialog | DS::Alert heading, four "Label:" issues, always links to provider settings | ApiErrorComponent with notice: :alert, heading:, issues:, link_text:, and return_path: nil |
| Setup-required dialog | DS::Alert warning, own step keys | SetupRequiredComponent with notice: :alert, heading:, description:, steps_title:, steps:, link_text: |
| Rendered HTML | unchanged (snapshots), except the Cancel link's classes (DS secondary link, from jaysbeekay/sure#723) |
What changed
ProviderItem::AccountSelectionComponent:variant:(:kitby default,:classic), read byclassic?,cancel_data,submit_disabled?,blank_name_border_classesandblank_name_text_class. The form's contents are captured once and wrapped either inform_withor in the hand-written tag.ProviderItem::ApiErrorComponent:notice:(:iconby default,:alert), and optionalheading:,issues:(label and description pairs) andlink_text:. With none given it reads Brex's keys exactly as before.ProviderItem::SetupRequiredComponent: the same, withdescription:,steps_title:andsteps:.LunchflowItemsHelper#lunchflow_account_options(new): the row content the two templates computed inline.- The four Lunch Flow views keep their names, ivars and locals; the controller is unchanged. No locale file changes: Lunch Flow's own keys are passed in.
Screenshots
The move changes nothing else visible. The Cancel link is now the secondary DS::Link from jaysbeekay/sure#723's DS commit (8fb320136): a slightly darker grey fill. Lunch Flow's API error and setup-required dialogs render the same before and after (snapshots match), so they are not shown. Before is the base branch up/lunchflow-kit-panel (0b0c28ba8); after is this head (eb5d5d6c1). Desktop 1280px; phone at Chrome's 500px minimum window width.
| Before | After | |
|---|---|---|
| Select accounts, desktop | ![]() | ![]() |
| Select accounts, phone | ![]() | ![]() |
Demo data
No demo data needed.
Migration notes
No migration.
Verification
-
Snapshots recorded first: five renders of the old views were written (
PROVIDER_ITEM_SNAPSHOTS=write) before anything changed:- select accounts: an account with an IBAN, one without, and one with no name (an institution name with
&, to cover escaping); - select accounts where nothing has a name, with no
return_to; - select an existing account;
- the API error, given a return path (which Lunch Flow's dialog ignores);
- setup required.
"The Lunch Flow selection pages and dialogs render through the shared components" failed then (
expected at least once, invoked neverfor all three components), and passes after. Lunch Flow's form writes its own token field, whose attributes put anidbetween the name and the value, so the test normalises that token itself. Brex's five snapshots still match. - select accounts: an account with an IBAN, one without, and one with no name (an institution name with
-
Snapshot provenance (checked 2026-11-17): this slice's five snapshot tests were run against the old Lunch Flow views on
up/lunchflow-kit-panel(a02536c10), before this slice.- With the snapshots as first recorded (5eea4afe6): 5 runs, 0 failures. So the recordings are the old views' output.
- With the current snapshots: 3 failures (
select_accounts,select_accounts_without_names,select_existing_account). Each differs only in the Cancel link's classes: the old views' hand-styledbutton-bg-secondaryanchor against the secondaryDS::Link. That is the deliberate DS change re-recorded in 02a249d78.api_errorandsetup_requiredstill match.
-
Existing tests unedited:
LunchflowItemsControllerTest, the Brex selection tests and the helper tests pass. -
Mutations, each caught (15): the classic form built with
form_with; the classic Cancel not closing the dialog; the classic submit disabled with nothing selectable; Brex's submit never disabled; the classic rows' border or text indestructive; the IBAN suffix dropped; currency and status swapped; Lunch Flow's API error following the return path; its notice beside an icon; a label's colon dropped; the setup-required notice beside an icon; Brex's API error losing an issue; Brex's setup steps reordered; the provider's link text ignored. -
bin/rails test(full, at this commit): 16,505 runs, 0 failures; the same 8ReleaseNotesWorkflowTesterrors (nonodein the test image). -
bin/rubocop,erb_linton the changed files: no offenses.bin/brakeman: no warnings. -
Size (
git diff -C): non-test +188 / -226. -
Checked against upstream AGENTS.md (blob 1a5dbebd, 2026-11-17): no deviations.
Blast radius
Who else hits these lines, and what do they pass?
ProviderItemsControllerrenderslunchflow_items/select_accounts,select_existing_account,setup_requiredandapi_errorwith the same ivars and locals as before.- The three components are also rendered by Brex's views, which pass none of the new arguments; Brex's snapshots pin that their output is unchanged.
- Siblings: Mercury's selection and error dialogs move in their own slice (its notice is the icon form, with its own keys); the other providers keep their templates.



