Declare provider metadata and display name on the adapter
JA
6d ago+166+166+012345678901234567890123456789-76-76-01234567890123456789
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 jaysbeekay/sure#670. Stacked on jaysbeekay/sure#688 (A3); 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#5081 (same commits), in Track A's native stack we-promise/sure#5087.
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.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.