Manage Lunch Flow connections the way the provider kit does
Summary
Lunch Flow controller convergence, C1g: managing connections. Lunch Flow's create, update, destroy and sync now behave as ProviderItemsController's do, which is the last difference left between Lunch Flow's controller and the kit's. The controller can then move onto the kit as a pure move (B7b).
Part of jaysbeekay/sure#670 (Track B, controller-layer convergence, option (b), owner 2026-11-16). Stacked on C1f (jaysbeekay/sure#735) in fork stack #687.
Upstream draft PR: https://github.com/we-promise/sure/pull/5247 (same branch, same commit), in native stack we-promise/sure#5268 on refactor/provider-kit.
Behaviour delta (Lunch Flow)
| Before | After | |
|---|---|---|
Creating a connection with a blank name ("") | the blank name was kept, so the save failed ("Name can't be blank") | the default name, "Lunch Flow Connection", from a new lunchflow_items.default_connection_name translation |
| Creating a connection with no name | "Lunch Flow Connection" (a literal) | unchanged, now from the translation; the panel's initialised record and Family#create_lunchflow_item! read it too |
| Updating a connection | the cache dropped on an API key or base URL change | unchanged, now through LunchflowItem::AccountFlow.update_item_with_cache_expiration; the panel is also given lunchflow_items (which Lunch Flow's single-connection panel doesn't read) |
Deleting when an error escapes unlink_all! | logged, then the connection was scheduled for deletion anyway | the error surfaces and nothing is scheduled. ProviderItem::Unlinking already rescues each account's failure, so only an error listing the accounts (a database failure) reaches here |
A sync posted from the panel (source=panel) | redirect (406 for a Turbo request) | the panel re-renders with "sync in progress". Lunch Flow's card doesn't send source=panel, so nothing reachable from its UI changes |
What changed
LunchflowItemsController#create,#update,#destroy,#sync: as the kit's; the private cache-key helper goes.config/locales/views/lunchflow_items/en.yml:default_connection_name._lunchflow_panel.html.erbandFamily::LunchflowConnectableuse it instead of the literal.
Screenshots
Settings > Bank sync, Lunch Flow's panel, captured headlessly in Chrome at 1100 px from the fixture family: before at the base head (b575b994), after at this PR's head (960475e3). The panel looks the same: the default name now comes from a translation, but the form has no name field, and nothing in Lunch Flow's UI posts a blank name or source=panel.
No connection yet (the "Save and connect" form for the record the panel initialises with the default name):
| Before | After |
|---|---|
![]() | ![]() |
An existing connection ("Update connection"):
| Before | After |
|---|---|
![]() | ![]() |
Demo data
No demo data needed.
Migration notes
No migration.
Verification
- Tests (fail-first): new
LunchflowItemsConnectionTest(5 tests): blank name; no name (a guard, passes before and after); sync from the panel; sync from the card (a guard); destroy with an error escapingunlink_all!. On the old code the blank-name, panel-sync and destroy tests fail. - Mutations, each caught: update without the cache expiration (the existing API-key and base-URL cache tests); the blank name kept; the panel sync not rendered.
- Existing tests unedited:
LunchflowItemsControllerTest, the cache tests and the settings controller tests pass. bin/rails test(full, at the C1g commit): 16,386 runs, 0 failures; the same 8ReleaseNotesWorkflowTesterrors (nonodein the test image).bin/rubocop,erb_lint: no offenses.bin/brakeman: no warnings.- Size: non-test +10 / -22.
- Checked against upstream AGENTS.md (blob 1a5dbebd, 2026-11-17): no deviations.
Blast radius
Family#create_lunchflow_item!has no caller in app or tests; its default now reads the translation.- The panel's
first_or_initialize(name:)only sets the unsaved record's name; the form posts no name field.
Review notes
A code review of the diff before commit raised nine points. Taken: the default name's two other literals now read the translation. Noted, not changed:
- the reviewer worried that the panel's blank password field would erase the API key on update. It doesn't: the field is a
text_fieldwithtype: :password, which renders the stored value, so the key is resubmitted. That means the Lunch Flow API key is in the provider settings page's HTML: a probe test confirmedresponse.bodycontains the fixture key. This predates this stack and is not changed here. Brex's credential fields (B4b) omit the stored token, and Lunch Flow's panel moves onto that shape in its view slices; worth fixing on its own sooner. - because the key is resubmitted, every panel update counts as a credential change and drops the accounts cache, as before (C1c) and as on the kit;
- the
lunchflow_itemspanel local is unused by Lunch Flow's panel; it is passed so the controller move is pure; - the four actions now duplicate the kit's until B7b swaps the controller for a subclass.



