Render the Lunch Flow panel through ProviderItem::PanelComponent

Merged
JA
1d ago
+262-70

Summary

Provider kit Track B, B7d: Lunch Flow's Settings > Providers panel (settings/providers/_lunchflow_panel) renders through ProviderItem::PanelComponent, as Brex's does since B4b. A pure move: the panel's HTML is unchanged, proven against snapshots recorded from the old partial.

Lunch Flow's panel is a single connection form, not a list of connections, so the kit gains the single-connection panel shape that jaysbeekay/sure#670 lists among the declaration fields.

Part of #5003 (Track B, step 7: the Lunch Flow conversion, views; option (c), kit variants that reproduce each provider's HTML).

Stacked on #5257. Fork pre-flight: jaysbeekay/sure#750 (same branch, same commit; its CI, Gatekeeper review and screenshot history live there).

Before / after

BeforeAfter
Lunch Flow panelits own 50-line partial: setup steps, error alert, one form for first_or_initializeProviderItem::PanelComponent with the setup steps slot, item: and i18n_scope:
Lunch Flow's declarationpanel: truepanel: { shape: :single }
PanelComponentlist of connections plus an add formalso a single-connection shape: one form that posts a new connection or patches the existing one, no name field, "Save and connect" / "Update connection"
Lunch Flow credential fieldsinline in the panellunchflow_items/_credential_fields (API key with value: nil, base URL, import start date), the partial hook B4b introduced
Rendered HTMLunchanged (snapshots)

What changed

  • Provider::Base.declares_connection: a panel Hash may set shape:; the panel declaration carries it (omitted when unset, so every other provider's declaration is unchanged, including Brex's exact-hash test).
  • ProviderItem::PanelComponent:
    • item: for the single shape; items: defaults to [] and new_item: to nil.
    • The bottom form now reads form_item / form_url / form_method / form_submit_label. For a list (Brex) these are the new connection, the collection path, POST and add_connection, exactly as before; for a single connection, the given connection, POST or PATCH by whether it is saved, and save_and_connect / update_connection. The name field is list-only, and editing: is whether the form's connection is saved.
    • i18n_scope: (default <key>_items.provider_panel), because Lunch Flow's panel messages live under settings.providers.lunchflow_panel.*. No locale file changes.
  • settings/providers/_lunchflow_panel: keeps error_message: / @error_message and still picks Current.family.lunchflow_items.first_or_initialize(...), then renders the component.

Screenshots

Rendering unchanged: this PR moves the Lunch Flow 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 Lunch Flow connection from the test fixtures (lunchflow_items(:one)).

LightDark
Afterafter-lightafter-dark

Demo data

No demo data needed.

Migration notes

No migration.

Verification

  • Snapshots recorded first: lunchflow_panel_without_connection, _with_connection (saved base URL and import start date) and _with_error were written from the old partial (PROVIDER_ITEM_SNAPSHOTS=write) before anything changed. "The Lunch Flow panel renders through ProviderItem::PanelComponent" failed then (expected exactly once, invoked never), and passes after. Brex's three panel snapshots still match.
  • Snapshot provenance (checked 2026-11-17): this slice's three panel snapshot tests were run against the old settings/providers/_lunchflow_panel on up/lunchflow-secret-field (d980e8ceb), before this slice: 3 runs, 0 failures. So the snapshots are the old partial's output, not the component's.
  • Existing tests unedited: LunchflowItemsControllerTest (including jaysbeekay/sure#749's tests that the re-rendered panel and the drawer do not echo the key), Settings::ProvidersControllerTest and the Brex panel tests pass.
  • Mutations, each caught (11): the name field shown on the single form; editing: always false; the form always POSTing; the form always posting to the collection; the two submit labels swapped; i18n_scope ignored; Lunch Flow declared without shape:; declares_connection dropping shape:; the API key echoed (caught by jaysbeekay/sure#749's controller tests and the snapshots); the import start date's value dropped; Brex's add form handed an existing connection.
  • bin/rails test (full, at this commit): 16,499 runs, 0 failures; the same 8 ReleaseNotesWorkflowTest errors (no node in the test image). Six further errors in that run were ActiveStorage variant tests failing for want of libvips in a fresh container; after installing it they pass (76 runs, 0 failures) and the slices after this one ran with it.
  • bin/rubocop, erb_lint on the changed files: no offenses. bin/brakeman: no warnings.
  • Size (git diff -C): non-test +86 / -70.
  • Checked against upstream AGENTS.md (blob 1a5dbebd, 2026-11-17): no deviations.

Blast radius

Who else hits these lines, and what do they pass?

  • PanelComponent is rendered by Brex's panel (items:, new_item:, no shape) and now Lunch Flow's (item:, shape: :single). Brex's snapshots pin that its path is unchanged.
  • The panel declaration is read through FAMILY_PANELS by build_provider_entries (reads key, title, turbo_id, partial, auto_open only), render_provider_panel and PANEL_SYNCABLE_TYPES; none reads shape, and only Lunch Flow sets it.
  • render_provider_panel("lunchflow", …) and the Bank sync page render the partial with the same locals and the same lunchflow-providers-panel Turbo target.
  • Siblings: Mercury's panel moves in its own slice; the other providers keep their partials.

Summary by cubic

Renders Lunch Flow's Settings > Providers panel through ProviderItem::PanelComponent instead of its own partial, with the HTML unchanged and pinned by snapshots recorded from the old partial.

What changed

  • PanelComponent gains a single-connection shape (panel: { shape: :single }): one form creates or updates the given connection, submits "Save and connect" or "Update connection", and hides the name field that list panels like Brex's show.
  • Lunch Flow's credential fields (API key, base URL, import start date) move to lunchflow_items/_credential_fields; the component accepts i18n_scope: because Lunch Flow's messages live under settings.providers.lunchflow_panel.
  • Brex's list panel path and snapshots are unchanged, and other providers' declarations stay the same since shape: is omitted when unset.