Derive provider_summary from the declared family panels

JA
6d ago
+68-131

Summary

Provider kit Track A, A5: SettingsHelper#provider_summary is derived from the declared family panels instead of carrying one when branch per provider.

Part of jaysbeekay/sure#670. Stacked on jaysbeekay/sure#689 (A4); built on the fork first and sent upstream as part of Track A's native stack on top of we-promise/sure#5005.

Upstream: we-promise/sure#5082 (same commits), in Track A's native stack we-promise/sure#5087.

What changed

  • A provider whose adapter declares panel: (so it is in FAMILY_PANEL_KEYS) is summarised from its @<key>_items: :off without items, otherwise sync_based_summary. Only the providers whose summary really differs keep a branch: Plaid and Plaid EU (configuration form), SnapTrade (OAuth-configured items only), Enable Banking, TrueLayer and Trade Republic (custom summaries).
  • The provider:family generator no longer patches provider_summary: append_provider_summary_case and its two tests are deleted. A generated provider with panel: true gets its summary from the declaration; the generator guide says so.
  • Diff: +68 / −131 (non-test +22 / −112).

No visible change.

Demo data

No demo data needed.

Migration notes

No migration.

Verification

  • Old vs new (Rails runner, old helper loaded as a separate module): 256 cases over 32 keys (28 declared, plaid_eu, PLAID, Brex, an unknown key) × no items / own items / every provider's items / every other provider's items × Plaid configured or not: 0 differences, none raising.
  • Fail-first: "summarises a newly declared panel provider from its items" (old: :off) and "is off for a provider whose panel is not declared" (old: :ok) both failed for that reason before the change.
  • Mutations, each caught: drop the panel guard; drop the SnapTrade filter; drop each of the Enable Banking, TrueLayer and Trade Republic branches; skip the Plaid branch; drop plaid_eu; items instead of items&.any?; no downcase; ignore the configuration key (&.first).
  • eager_load! clean.
  • bin/rails test (full): 15,874 runs, 0 failures; 8 errors in ReleaseNotesWorkflowTest from node missing in the test image.
  • bin/rubocop on changed files: no offenses. bin/brakeman: no warnings.

Blast radius

  • Callers: Settings::ProvidersController#build_provider_entries passes every configuration key (filtered to exclude panel keys, so those stay :off apart from Plaid/Plaid EU, as before) and every FAMILY_PANELS key. The @<key>_items it reads are set by load_provider_items for all 26 panel keys, in both branches. instance_variable_get runs only after the FAMILY_PANEL_KEYS guard.
  • Siblings left for later slices: family_panel_items (A6) and load_provider_items (A7) read the same variables.