Declare provider metadata and display name on the adapter
Summary
Provider kit Track A, A4: each account provider declares its display name and Provider::Metadata attributes on its adapter, and Provider::Metadata::REGISTRY is derived from those declarations.
Part of #5003
Stacked on #5080 (A3), in Track A's native stack on #5005.
Fork pre-flight: jaysbeekay/sure#689 (same commits, against a mirror of upstream main; its CI, Gatekeeper and review history live there).
What changed
declares_connection(key:, name:, ..., panel:, metadata:):name:is required and is the one display name, used as the panel title and as the metadataname.metadata:carries region, kinds, maturity, logo text/colour/icon, domain and tier.panel:is nowtrueor a hash ofturbo_id:/auto_open:overrides. Anameorkeyinsidemetadata:raisesArgumentError.Provider::Factory.metadata_declarations;REGISTRY= the 28 declared account providers +Provider::Metadata::UNDECLARED(Plaid EU, which shares Plaid's connection, and the three property valuation providers).- Generator template emits
name:,panel: trueand placeholdermetadata:(region "Global", kinds from--type, maturity:alpha, a two-letterlogo_text, with a TODO to set them), so a generated provider passes the completeness test; its missing-declaration warning, the generator guide (including its sample adapter, which lacked the declaration since A1) and the provider-logo guide use the new form.
No visible change. The 23 account providers that had no metadata name gain one; nothing visible reads it (panel rows use the panel title; the configuration path's name || key.titleize gives "Plaid" either way; FinanceKit's "Apple Wallet" is unchanged).
Review fixes (2026-11-15)
- The generated adapter now declares placeholder
metadata:, and the generator's missing-declaration warning shows it, so a generated provider passes "every declared account provider has metadata from its declaration". - That test now asserts each field (
region,kinds,maturity,logo_text).slice(...).all?dropped a missing key, so Brex with noregionpassed; it now fails, naming the field.
Demo data
No demo data needed.
Migration notes
No migration.
Verification
- Old vs new (Rails runner against the removed literal): same 32 keys; every value unchanged except 23 added
name:keys; no other difference. - Fail-first: "each account provider's display name is both its panel title and its metadata name" failed before (Akahu's metadata name was nil); "metadata from its declaration" failed on the missing
metadata_declarations. - Mutations, each caught: drop the
UNDECLAREDmerge; metadata withoutname; panel title not fromname; Brex without metadata; the template withoutname:; no guard on a name insidemetadata:. eager_load!thenREGISTRY.size= 32.bin/rails test(full): 15,872 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
Provider::Metadatareaders:ProviderLogoandlogo_url(logo fields, domain),_drawer_header(maturity),settings/providers/show(region, kinds, tier, maturity),Settings::ProvidersController(nameonly on the configuration path and FinanceKit;maturityfor panels). No adapter, concern or initializer reads it at load, so buildingREGISTRYfrom the adapters creates no cycle.FAMILY_PANELS(A3) titles now come fromname:; the A3 tests pinning Brex, Fio, Trade Republic and SnapTrade still pass unchanged.
Summary by cubic
Account providers now declare their display name and Provider::Metadata attributes on their adapter in declares_connection instead of a literal registry hash, and Provider::Metadata::REGISTRY is derived from those declarations. declares_connection requires name:, which backs both the panel title and the metadata name, while panel: becomes true or a hash of turbo_id/auto_open overrides.
Changes
declares_connectionraises ifname:orkey:appear insidemetadata:.Provider::Metadata::REGISTRYis built from the 28 account providers' declarations plus hand-writtenUNDECLAREDentries for providers without their own connection (Plaid EU, property valuation providers).- The 23 account providers without a metadata name gain one; nothing visible reads these names yet.
- The generator now writes placeholder metadata (
region,kinds,maturity,logo_text) with a TODO, and its missing-declaration warning and the provider guides use the newname:/panel: trueform. - The completeness test checks each required metadata field individually, so a missing key no longer slips through a
slicecall.
Summary by CodeRabbit
-
New Features
- Provider connections now include consistent display names and details such as supported regions, account types, availability, and branding.
- Provider panels now use a consistent setup across supported connections.
-
Documentation
- Updated provider setup guides and generator instructions to reflect current connection and branding options.