Report Lunch Flow sync status and errors like the provider kit
Summary
Lunch Flow convergence, C1a: Lunch Flow's syncer now reports status, errors and failures the way the provider kit's shared syncer does (Brex today). This is a reviewed behaviour change of its own, so the later conversion (B7) can move Lunch Flow onto the shared syncer as a pure move.
Part of jaysbeekay/sure#670 (Track B, Lunch Flow convergence, decided 2026-11-16). Stacked on K1 (jaysbeekay/sure#725) in fork stack #687.
Upstream draft PR: https://github.com/we-promise/sure/pull/5237 (same branch, same commit), in native stack we-promise/sure#5268 on refactor/provider-kit.
Behaviour delta (Lunch Flow)
| Before | After | |
|---|---|---|
| Status text | hard-coded English strings | lunchflow_items.syncer.* translations, with the same English wording. "1 accounts need setup..." becomes "1 account needs setup..." (pluralised). |
| Import failure categories | lunchflow_import | account_import_error, transaction_import_error, import_error |
| Import failure messages | provider_warnings.lunchflow_* | lunchflow_items.syncer.accounts_failed / transactions_failed / import_failed_with_error (same wording; the 10 existing translations moved with them). A failure with no counts and no error text now reports "Lunch Flow import failed." where it reported nothing. |
| A linked account that fails to process, or whose balance sync can't be scheduled | not reported | reported as account_processing_error / account_sync_error |
| An exception during sync | the raw message stored on the sync and its stats, and the exception re-raised | a safe translated message stored and raised as LunchflowItem::Syncer::SafeSyncError (credentials_invalid for an :unauthorized / :access_forbidden API error, otherwise failed). The raw error is logged with its backtrace and sent to Sentry, tagged lunchflow_item_id. |
| A rejected API key | sync error "Invalid API key" | "Invalid Lunch Flow API key or account permissions". The connection is still flagged requires_update. |
Unchanged: the setup counts (total_accounts, linked_accounts, unlinked_accounts), pending_account_setup, the investment data-quality warning, the transaction stats, and the import call (the sync window is C1b).
What changed
LunchflowItem::Syncer: rewritten in the shared syncer's shape. Lunch Flow keeps its holdings wording ("Processing transactions and holdings...") and its investment warning.config/locales/models/provider_warnings/*.yml(10 locales): the threelunchflow_*keys removed.config/locales/views/lunchflow_items/*.yml: the same translations added undersyncer, plus the new English keys. Other locales fall back to English for the new keys.
Demo data
No demo data needed.
Migration notes
No migration. Existing sync records keep their stored messages and categories; only new syncs use the new ones.
Verification
-
Tests (fail-first):
LunchflowItem::SyncerTest's expectations change with the delta above. Eight of its nine tests fail on the old syncer, each on the delta it names:- the categories;
- the safe message and
SafeSyncError; - the provider's error text;
- process and schedule failures being reported;
- the status text coming from translations;
- the rejected-key message.
The healthy-import test passes before and after.
-
Mutations, each caught: process failures not collected; schedule failures not collected; credential errors not recognised; a hard-coded status; the original exception re-raised; the provider's error text ignored; the old
lunchflow_importcategory. -
Lunch Flow model, controller and i18n tests: 86 runs, 0 failures.
-
bin/rails test(full, at the C1a commit): 16,309 runs, 0 failures; the same 8ReleaseNotesWorkflowTesterrors (nonodein the test image). -
bin/rubocopon changed files: no offenses.bin/brakeman: no warnings. All changed locale files parse. -
Size: non-test +218 / -136, of which the syncer is +108 / -52 and the rest is locale moves.
-
Checked against upstream AGENTS.md (blob 1a5dbebd, 2026-11-17): no deviations.
Blast radius
LunchflowItem::Synceris reached only throughSyncable#syncerfromSync#perform.- The moved translation keys had no other reader.
- Siblings: Mercury's syncer has the same shape; it converges in its own slice.