Serve Lunch Flow from ProviderItemsController

JA
5d ago
+32-260

Summary

Provider kit Track B, B7b: Lunch Flow's controller moves onto the provider kit. LunchflowItemsController becomes a thin ProviderItemsController subclass that names its permitted params, and its routes use the provider_items concern. A pure move: the Lunch Flow controller convergence slices (C1d–C1g) made every action behave as the kit's, so nothing changes, and every existing Lunch Flow test passes unedited.

Part of jaysbeekay/sure#670 (Track B, step 7: the Lunch Flow conversion, controller and routes, as B3a/B3b did for Brex). Stacked on C1g (jaysbeekay/sure#736) in fork stack #687.

Upstream draft PR: https://github.com/we-promise/sure/pull/5248 (same branch, same commit), in native stack we-promise/sure#5268 on refactor/provider-kit.

What changed

  • app/controllers/lunchflow_items_controller.rb: 7 lines (from 250): < ProviderItemsController with item_params.
  • config/routes.rb: resources :lunchflow_items, …, concerns: :provider_items replaces the hand-written collection and member block. bin/rails routes -g lunchflow_items prints the same 16 routes before and after (diffed).
  • Contract: Lunch Flow's lifecycle test now includes the whole ProviderItemLifecycleTests (selection, caching, linking, setup), and a new LunchflowItemsProviderKitTest includes ProviderItemsControllerTests (route helpers and paths, non-admin rejection, sync, removal).
  • test/views/provider_item_cards_test.rb: the render-site floor goes from 12 to 11, since Lunch Flow's card render now is the kit controller's single shared one.

Demo data

No demo data needed.

Migration notes

No migration.

Verification

  • Existing tests unedited: no existing Lunch Flow test changes. The Lunch Flow controller, cache, selection, setup, connection and return-path tests and its model tests, with Brex's, pass (199 runs, 0 failures).
  • Contract (fail-first): on the old controller, the two controller-contract tests that pin the move fail: "the shared controller serves the connection's routes at their usual paths" (LunchflowItemsController is not a ProviderItemsController) and the non-admin rejection (@controller is not a ProviderItemsController). The flow tests already passed, because the flow converged in C1e/C1f.
  • Mutations, each caught: base_url not permitted (cache test); sync_start_date not permitted (the two start-date update tests).
  • bin/rails test (full, at the B7b commit): 16,402 runs, 0 failures; the same 8 ReleaseNotesWorkflowTest errors (no node in the test image).
  • bin/rubocop on changed files: no offenses. bin/brakeman: no warnings.
  • Size: non-test +3 / -256.
  • Checked against upstream AGENTS.md (blob 1a5dbebd, 2026-11-17): no deviations.

Blast radius

  • Routes and helper names are unchanged (diffed above), and nothing outside the controller called its private methods.
  • ProviderItemsController is unchanged; it now also serves lunchflow_items.

Review notes

A code review of the diff before commit found no regressions. Noted, not changed:

  • lunchflow_items still routes index, show, new and edit, which have no Lunch Flow templates. This predates the stack (Brex has the same) and is carried over unchanged.
  • The setup view filters the skip option itself instead of reading @displayable_account_type_options. That goes when the setup page moves onto the kit's component.
  • Lowering the render-site floor by hand will repeat with each provider move.
  • The contract's account payload is minimal; Lunch Flow's own mapping is covered by its controller and model tests.