Derive the /accounts empty state from the declared connections

JA
6d ago
+49-9

Summary

Provider kit Track A, A9 (the last derived list): the /accounts empty state is decided by AccountsController#accounts_index_empty?, from the declared connections, instead of a hand-kept chain of 29 .empty? checks in accounts/index.html.erb.

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

What changed

  • accounts_index_empty? (private, exposed with helper_method): no manual accounts, no Apple Wallet accounts, and no visible connections for any INDEX_CONNECTIONS provider. The view calls it; the logic leaves the ERB.
  • The provider:family generator no longer gsubs the new provider into the old chain. Its pattern (@coinstats_items.empty? %>) had already stopped matching, so generated providers were missing from the empty check; they are now counted through their declaration. The generator still adds the provider's section.
  • Diff: non-test +11 / −9.

No visible change.

Demo data

No demo data needed.

Migration notes

No migration.

Verification

  • Old vs new (Rails runner evaluating the removed ERB condition against the new method): 30 cases (everything empty; each of the 29 lists non-empty alone), 0 differences, the same 29 lists on both sides.
  • Fail-first: "the index is empty only when no account or connection is listed" failed before the change (no predicate). "index shows the empty state for a family with nothing to list, and not once it has a connection" clears the empty fixture family's IBKR, Indexa Capital and SnapTrade connections first, then adds one Brex connection.
  • Mutations, each caught: drop the Apple Wallet check; drop the manual-accounts check; any? instead of all?; ignore connections; negate the view condition.
  • bin/rails test (full): 15,885 runs, 0 failures; 8 errors in ReleaseNotesWorkflowTest from node missing in the test image.
  • bin/rubocop and erb_lint on changed files: no offenses. bin/brakeman: no warnings.

Blast radius

  • Only AccountsController#index renders accounts/index, after setting every variable the method reads; the item controllers' turbo streams render accounts/index/manual_accounts, which does not use the condition.
  • The generator's "already has" check now matches only the provider's section, which is what it should detect.
  • Track A's derived lists are complete with this slice; the Family includes and the /accounts index sections stay hand-kept until Track B.

Screenshots

Fixture family empty with every connection and account removed, so /accounts shows its empty state. Base is we-promise/sure#5085's head; both render the same empty state, as expected for a change that only moves the condition out of the view.

LightDark
Before (we-promise/sure#5085 head)before-lightbefore-dark
After (this PR)after-lightafter-dark