Derive family_panel_items from the declared family panels

JA
6d ago
+41-117

Summary

Provider kit Track A, A6: Settings::ProvidersController#family_panel_items is derived from the declared family panels instead of listing each provider's @<key>_items by hand.

Part of jaysbeekay/sure#670. Stacked on jaysbeekay/sure#690 (A5); 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#5083 (same commits), in Track A's native stack we-promise/sure#5087.

What changed

  • family_panel_items = FAMILY_PANEL_KEYS.index_with { |key| instance_variable_get(:"@#{key}_items") }. A provider declared with panel: true gets a sync status on its connection row without an entry of its own. The keys come from the frozen constant, never from a param.
  • The provider:family generator no longer patches family_panel_items: append_family_panel_item is deleted, with append_hash_entry, append_last_entry and add_bank_sync_entry, which had no other users, and their two tests. add_bank_sync_entries now only warns when the adapter lacks its panel: declaration.
  • Diff: +41 / −117 (non-test +10 / −88).

No visible change.

Demo data

No demo data needed.

Migration notes

No migration.

Verification

  • Old vs new (Rails runner, old method loaded on its own): 32 scenarios (no items, every provider's items, each declared provider's items alone, plus @financekit_connections and @plaid_eu_items): 0 differences, 26 keys on both sides.
  • Fail-first: "family_panel_items hands each declared panel its own loaded items" failed before the change (a declared gocardless panel was missing from the hand-kept hash).
  • Mutations, each caught: read @<key>_item; key by every connection declaration instead of the panels; return nil items; drop the generator's warning; drop its early return for an adapter that declares its panel (both covered by the new generator test, added after review).
  • 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

  • Caller: compute_provider_sync_health only, which reads items_map[key] for the PANEL_SYNCABLE_TYPES keys (the same declared panels), so hash order is not relied on.
  • Sibling left for A7: load_provider_items and prepare_show_context set these variables from their own hand-kept lists.