Derive family_panel_items from the declared family panels
JA
6d ago+41+41+01234567890123456789-117-117-012345678901234567890123456789
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 withpanel: truegets 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:familygenerator no longer patchesfamily_panel_items:append_family_panel_itemis deleted, withappend_hash_entry,append_last_entryandadd_bank_sync_entry, which had no other users, and their two tests.add_bank_sync_entriesnow only warns when the adapter lacks itspanel: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_connectionsand@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
gocardlesspanel was missing from the hand-kept hash). - Mutations, each caught: read
@<key>_item; key by every connection declaration instead of the panels; returnnilitems; 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 inReleaseNotesWorkflowTestfromnodemissing in the test image.bin/rubocopon changed files: no offenses.bin/brakeman: no warnings.
Blast radius
- Caller:
compute_provider_sync_healthonly, which readsitems_map[key]for thePANEL_SYNCABLE_TYPESkeys (the same declared panels), so hash order is not relied on. - Sibling left for A7:
load_provider_itemsandprepare_show_contextset these variables from their own hand-kept lists.