Derive provider_summary from the declared family panels
Merged
JA
2d ago+68+68+01234567890123456789-131-131-012345678901234567890123456789
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 #5003
Stacked on #5081 (A4), in Track A's native stack on #5005.
Fork pre-flight: jaysbeekay/sure#690 (same commits, against a mirror of upstream main; its CI, Gatekeeper and review history live there).
What changed
- A provider whose adapter declares
panel:(so it is inFAMILY_PANEL_KEYS) is summarised from its@<key>_items::offwithout items, otherwisesync_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:familygenerator no longer patchesprovider_summary:append_provider_summary_caseand its two tests are deleted. A generated provider withpanel: truegets 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;itemsinstead ofitems&.any?; nodowncase; ignore the configuration key (&.first). eager_load!clean.bin/rails test(full): 15,874 runs, 0 failures; 8 errors inReleaseNotesWorkflowTestfromnodemissing in the test image. After rebasing the stack onto upstreammain(dbeebf14c), the full suite at the top of the stack (A9): 16,246 runs, 0 failures, the same 8 environment errors.bin/rubocopon changed files: no offenses.bin/brakeman: no warnings.
Blast radius
- Callers:
Settings::ProvidersController#build_provider_entriespasses every configuration key (filtered to exclude panel keys, so those stay:offapart from Plaid/Plaid EU, as before) and everyFAMILY_PANELSkey. The@<key>_itemsit reads are set byload_provider_itemsfor all 26 panel keys, in both branches.instance_variable_getruns only after theFAMILY_PANEL_KEYSguard. - Siblings left for later slices:
family_panel_items(A6) andload_provider_items(A7) read the same variables.
Summary by cubic
Derives SettingsHelper#provider_summary from the declared family panels instead of one when branch per provider. A provider with a declared panel: gets its summary from its @<key>_items — :off without items, otherwise sync_based_summary. Behavior is unchanged.
Refactors
- Only providers whose summary really differs keep a branch: Plaid and Plaid EU (configuration form), SnapTrade (OAuth-configured items only), Enable Banking, TrueLayer (re-consent warning), and Trade Republic (custom summaries).
- The
provider:familygenerator no longer patchesprovider_summary;append_provider_summary_caseand its tests are deleted, so a newly declared panel provider gets its summary without editing the helper. - A summary returns
:offfor a provider whose panel is not declared, even when items exist.
Summary by CodeRabbit
- Bug Fixes
- Provider connection summaries now reflect eligible connections, including showing an update warning when a TrueLayer connection needs re-consent.
- Providers without a declared settings panel are shown as off, even if connection items exist.
- SnapTrade summaries now include only connections with OAuth configured, preventing ineligible connections from appearing as active.
- Documentation
- Updated the provider setup guide to explain that connected providers appear in settings based on their panel declaration, without requiring a separate settings-helper update.