Skip to content

Surface SimpleFIN connection warnings that need re-auth - #13

Merged
dfrysinger merged 1 commit into
mainfrom
surface-connection-reauth-warnings
Jul 11, 2026
Merged

dfrysinger merged 1 commit into
mainfrom
surface-connection-reauth-warnings

Conversation

@dfrysinger

Copy link
Copy Markdown
Owner

Summary

Surfaces SimpleFIN connection problems (a bank that stopped updating and needs
re-authorization, e.g. a stale Apple Card connection) in the web UI. These were
fetched from the SimpleFIN Bridge but never shown to the user, so a connection
could silently stop updating with no warning. The SimpleFIN developer guide
explicitly requires always showing these errors to the end user.

What changed

  • Always-visible amber banner (#connBanner) + an Accounts-tab badge,
    bootstrapped by a /api/accounts fetch on load, so the warning is loud from
    whatever tab is restored, not only the Accounts view.
  • Accounts view now renders connection problems as up to three distinct
    notices based on the remediation the user actually needs:
    • reconnect — connection-level (con.*) and legacy code-less errors: a
      specific bank must be reconnected in the SimpleFIN Bridge.
    • reauth — gen.auth: finance-mcp's own SimpleFIN access URL is no longer
      authorized; re-add the app / claim a new setup token (not a per-bank
      reconnect).
    • transient — account-level (act.*), developer (gen.api), and other
      codes that clear on the next sync.
  • connErrors normalizes the SimpleFIN error model: prefers the structured
    errlist (v2) over the deprecated errors strings (v1) so one problem is not
    counted twice, reads the required msg display field, and dedupes on the full
    identity (code, conn_id, account_id, msg).
  • connErrorKind classifies by error-code prefix, honoring the spec's
    unknown-subcode-falls-back-to-prefix rule.
  • Root-cause dedup in sync.py: a long sync spans multiple ~90-day windows
    and a persistent per-connection error was accumulated once per window. Added
    _dedupe_errors() (applied before caching and in the returned summary) keyed
    on the same identity as the UI, plus _hashable() so a malformed upstream
    entry can't crash the whole sync.
  • All error text is HTML-escaped before rendering.

Tests

  • Extended INV-WEBUI-011 guard (test_connection_errors_surface_from_any_tab)
    to pin prefer-errlist, the msg field, the full-identity dedup key, and the
    three-way connErrorKind classification.
  • Added test_dedupe_errors_drops_repeats_preserving_order,
    test_sync_dedupes_persistent_error_across_windows, and
    test_dedupe_errors_handles_unhashable_fields.
  • Full suite: 781 passing.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

A bank connection can lapse (e.g. Apple Card, which updates monthly) and
SimpleFIN then returns a per-connection warning in the accounts response.
Those warnings were fetched and stored but never shown, so a stale account
could silently stop updating.

Surface them the way the SimpleFIN developer guide requires ("always show
those errors to your end users"): an always-visible amber banner and an
Accounts-tab badge reflect the combined errors/errlist count and are
bootstrapped on load, so the warning is loud from any tab. The Accounts view
lists each affected connection with instructions to reconnect it in the
SimpleFIN Bridge, since this read-only app cannot re-authorize a bank itself.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dfrysinger
dfrysinger merged commit 350f0e7 into main Jul 11, 2026
2 checks passed
@dfrysinger
dfrysinger deleted the surface-connection-reauth-warnings branch July 11, 2026 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant