Skip to content

Open-source personal finance manager. Self-hosted, privacy-first.

fix(accounts): show a warning instead of a success toast when a manual sync is rate-limited (#1214)

Tássio Noronhaa94b16a554ef
diff --git a/backend/app/api/connections.py b/backend/app/api/connections.py
index 7afe9906..7a9faec8 100644
--- a/backend/app/api/connections.py
+++ b/backend/app/api/connections.py
@@ -170,7 +170,7 @@ async def sync_connection(
# Manual sync is user-initiated, so ask the provider to pull fresh
# data from the bank before we read. Scheduled syncs (Celery) keep
# the default behaviour: read whatever the provider already has.
- connection, merged_count = await connection_service.sync_connection(
+ connection, merged_count, sync_outcome = await connection_service.sync_connection(
session,
connection_id,
ctx.workspace.id,
@@ -178,7 +178,11 @@ async def sync_connection(
trigger_provider_refresh=True,
)
result = BankConnectionRead.model_validate(connection)
- return {**result.model_dump(mode="json"), "merged_count": merged_count}
+ return {
+ **result.model_dump(mode="json"),
+ "merged_count": merged_count,
+ "sync_outcome": sync_outcome,
+ }
except ValueError as e:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=str(e))
except ProviderUserActionRequired as e:
diff --git a/backend/app/services/connection_service.py b/backend/app/services/connection_service.py
index 6e7737be..1b4d54b2 100644
--- a/backend/app/services/connection_service.py
+++ b/backend/app/services/connection_service.py
@@ -4,7 +4,7 @@ import re
import uuid
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, InvalidOperation
-from typing import Optional
+from typing import Literal, Optional
from sqlalchemy import delete, exists, func, or_, select, update
from sqlalchemy.exc import IntegrityError
@@ -1966,13 +1966,24 @@ async def _sync_credit_card_bills(
return by_external_id
+# Outcome of a sync that completed without raising, reported to the caller
+# so the UI can tell "data read" from "the provider throttled us and nothing
+# was pulled" (issue #736). "refreshed" covers the normal path (the data may
+# be the provider's cached copy; whether a fresh pull happened is the
+# provider's own semantics). "rate_limited" means the provider returned a
+# 429: nothing was pulled and last_sync_at was left untouched so the next
+# sync retries the same window. Errors (expired session, user action
+# required, generic failure) still propagate as exceptions.
+SyncOutcome = Literal["refreshed", "rate_limited"]
+
+
async def sync_connection(
session: AsyncSession,
connection_id: uuid.UUID,
workspace_id: uuid.UUID,
requesting_user_id: uuid.UUID,
trigger_provider_refresh: bool = False,
-) -> tuple[BankConnection, int]:
+) -> tuple[BankConnection, int, SyncOutcome]:
connection = await get_connection(
session, connection_id, workspace_id, for_update=True
)
@@ -2551,7 +2562,7 @@ async def sync_connection(
connection.status = "active"
await session.commit()
await session.refresh(connection)
- return connection, merged_count
+ return connection, merged_count, "refreshed"
except SessionExpiredError:
# Provider consent expired — distinct from a generic error so the UI
@@ -2587,7 +2598,9 @@ async def sync_connection(
# to the one we already hold rather than raising: re-raising here would
# escape as a 500, which is exactly what this handler exists to avoid.
refreshed = await session.get(BankConnection, connection_id)
- return refreshed or connection, 0
+ # Report "rate_limited" so the caller (manual sync endpoint, UI) knows
+ # no fresh data was pulled and can say so instead of a success toast.
+ return refreshed or connection, 0, "rate_limited"
except Exception:
# Mark connection as errored so UI shows reconnect banner
await session.rollback()
diff --git a/backend/tests/test_connection_service.py b/backend/tests/test_connection_service.py
index 3bcb3f70..7ef811d6 100644
--- a/backend/tests/test_connection_service.py
+++ b/backend/tests/test_connection_service.py
@@ -22,6 +22,7 @@ from app.providers.base import (
ConnectionData,
ConnectTokenData,
HoldingData,
+ ProviderRateLimited,
ProviderUserActionRequired,
TransactionData,
)
@@ -851,10 +852,11 @@ async def test_sync_connection_new_transactions(session: AsyncSession, test_user
patch("app.services.connection_service.detect_transfer_pairs", new_callable=AsyncMock), \
patch("app.services.connection_service.stamp_primary_amount", new_callable=AsyncMock), \
patch("app.services.connection_service.apply_rules_to_transaction", new_callable=AsyncMock):
- result_conn, merged = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
+ result_conn, merged, outcome = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
assert result_conn.status == "active"
assert merged == 0
+ assert outcome == "refreshed"
transaction = await session.scalar(
select(Transaction).where(Transaction.external_id == "sync-tx-1")
)
@@ -862,6 +864,37 @@ async def test_sync_connection_new_transactions(session: AsyncSession, test_user
assert transaction.original_description == "GROCERY"
+async def test_sync_connection_rate_limited_reports_outcome_and_keeps_last_sync(
+ session: AsyncSession, test_user, test_workspace,
+):
+ """A provider 429 must not look like a successful sync (issue #736).
+
+ The connection stays active, nothing is merged, last_sync_at is left
+ untouched so the next sync retries the same window, and the caller gets
+ an explicit "rate_limited" outcome to show instead of a success toast.
+ """
+ conn = await _make_connection(session, test_user.id, "Limited Bank")
+ stale_sync_at = conn.last_sync_at
+ assert stale_sync_at is not None
+
+ mock_provider = AsyncMock()
+ mock_provider.refresh_credentials = AsyncMock(return_value={"token": "fake"})
+ mock_provider.get_accounts = AsyncMock(
+ side_effect=ProviderRateLimited("Daily request limit reached")
+ )
+
+ with patch("app.services.connection_service.get_provider", return_value=mock_provider):
+ result_conn, merged, outcome = await sync_connection(
+ session, conn.id, test_workspace.id, test_user.id
+ )
+
+ assert outcome == "rate_limited"
+ assert merged == 0
+ assert result_conn.status == "active"
+ assert result_conn.last_sync_at == stale_sync_at
+
+
@pytest.mark.asyncio
async def test_sync_connection_partial_user_action_warning_marks_connection_error(
session: AsyncSession, test_user, test_workspace,
@@ -889,7 +922,7 @@ async def test_sync_connection_partial_user_action_warning_marks_connection_erro
patch("app.services.connection_service.detect_transfer_pairs", new_callable=AsyncMock), \
patch("app.services.connection_service.stamp_primary_amount", new_callable=AsyncMock), \
patch("app.services.connection_service.apply_rules_to_transaction", new_callable=AsyncMock):
- result_conn, merged = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
+ result_conn, merged, _ = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
assert result_conn.status == "error"
assert merged == 0
@@ -967,7 +1000,7 @@ async def test_sync_connection_simplefin_rekey_does_not_duplicate_account_or_tx(
patch("app.services.connection_service.detect_transfer_pairs", new_callable=AsyncMock), \
patch("app.services.connection_service.stamp_primary_amount", new_callable=AsyncMock), \
patch("app.services.connection_service.apply_rules_to_transaction", new_callable=AsyncMock):
- result_conn, merged = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
+ result_conn, merged, _ = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
assert result_conn.status == "active"
assert merged == 0
@@ -2027,7 +2060,7 @@ async def test_sync_connection_tolerates_duplicate_transaction_rows(
patch("app.services.connection_service.stamp_primary_amount", new_callable=AsyncMock), \
patch("app.services.connection_service._cleanup_phantom_duplicates", new_callable=AsyncMock), \
patch("app.services.connection_service.apply_rules_to_transaction", new_callable=AsyncMock):
- result_conn, _ = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
+ result_conn, _, _ = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
assert result_conn.status == "active"
# Sync reconciled onto an existing row instead of inserting a third, and did
@@ -2096,7 +2129,7 @@ async def test_sync_connection_with_category_mapping(session: AsyncSession, test
with patch("app.services.connection_service.get_provider", return_value=mock_provider), \
patch("app.services.connection_service.detect_transfer_pairs", new_callable=AsyncMock), \
patch("app.services.connection_service.stamp_primary_amount", new_callable=AsyncMock):
- result_conn, _ = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
+ result_conn, _, _ = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
assert result_conn.status == "active"
@@ -2552,7 +2585,7 @@ async def test_sync_connection_skips_pending(session: AsyncSession, test_user, t
patch("app.services.connection_service.detect_transfer_pairs", new_callable=AsyncMock), \
patch("app.services.connection_service.stamp_primary_amount", new_callable=AsyncMock), \
patch("app.services.connection_service.apply_rules_to_transaction", new_callable=AsyncMock):
- result_conn, _ = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
+ result_conn, _, _ = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
assert result_conn.status == "active"
@@ -2587,7 +2620,7 @@ async def test_sync_connection_skips_holdings_when_asset_sync_disabled(
patch("app.services.connection_service.detect_transfer_pairs", new_callable=AsyncMock), \
patch("app.services.connection_service.stamp_primary_amount", new_callable=AsyncMock), \
patch("app.services.connection_service.apply_rules_to_transaction", new_callable=AsyncMock):
- result_conn, _ = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
+ result_conn, _, _ = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
assert result_conn.status == "active"
mock_provider.get_holdings.assert_not_awaited()
@@ -2622,7 +2655,7 @@ async def test_sync_connection_imports_holdings_by_default(
patch("app.services.connection_service.detect_transfer_pairs", new_callable=AsyncMock), \
patch("app.services.connection_service.stamp_primary_amount", new_callable=AsyncMock), \
patch("app.services.connection_service.apply_rules_to_transaction", new_callable=AsyncMock):
- result_conn, _ = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
+ result_conn, _, _ = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
assert result_conn.status == "active"
mock_provider.get_holdings.assert_awaited_once()
@@ -3095,7 +3128,7 @@ async def test_sync_swallows_get_bills_error(
p1, p2, p3 = _patch_sync_helpers()
with patch("app.services.connection_service.get_provider", return_value=mock_provider), \
p1, p2, p3:
- result, _ = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
+ result, _, _ = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
assert result.status == "active"
tx_row = (await session.execute(
diff --git a/backend/tests/test_connection_service_coverage.py b/backend/tests/test_connection_service_coverage.py
index e3e68a7b..e73f37e4 100644
--- a/backend/tests/test_connection_service_coverage.py
+++ b/backend/tests/test_connection_service_coverage.py
@@ -517,7 +517,7 @@ async def test_sync_trigger_refresh_refreshed_then_reads(session: AsyncSession,
p1, p2, p3 = _patch_helpers()
with patch("app.services.connection_service.get_provider", return_value=mock_provider), \
p1, p2, p3:
- result, _ = await sync_connection(
+ result, _, _ = await sync_connection(
session, conn.id, test_workspace.id, test_user.id,
trigger_provider_refresh=True,
)
@@ -570,7 +570,7 @@ async def test_sync_fuzzy_matches_manual_transaction(session: AsyncSession, test
p1, p2, p3 = _patch_helpers()
with patch("app.services.connection_service.get_provider", return_value=mock_provider), \
p1, p2, p3:
- result, merged = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
+ result, merged, _ = await sync_connection(session, conn.id, test_workspace.id, test_user.id)
assert result.status == "active"
assert merged == 1
diff --git a/backend/tests/test_connections_api.py b/backend/tests/test_connections_api.py
index d1465f07..fa969d65 100644
--- a/backend/tests/test_connections_api.py
+++ b/backend/tests/test_connections_api.py
@@ -8,7 +8,11 @@ from sqlalchemy.ext.asyncio import AsyncSession
from app.models.bank_connection import BankConnection
from app.models.user import User
-from app.providers.base import ProviderUserActionRequired, SessionExpiredError
+from app.providers.base import (
+ ProviderRateLimited,
+ ProviderUserActionRequired,
+ SessionExpiredError,
+)
@pytest.mark.asyncio
@@ -277,6 +281,57 @@ async def test_sync_connection_session_expired_returns_gone(
assert resp.json()["detail"] == "SimpleFIN access URL is missing"
+async def test_sync_connection_success_reports_refreshed_outcome(
+ client: AsyncClient, auth_headers, test_connection: BankConnection
+):
+ """A completed sync reports sync_outcome='refreshed' (issue #736)."""
+ mock_provider = AsyncMock()
+ mock_provider.refresh_credentials = AsyncMock(return_value={"token": "fake"})
+ mock_provider.get_accounts = AsyncMock(return_value=[])
+ with patch("app.services.connection_service.get_provider", return_value=mock_provider), \
+ patch("app.services.connection_service.detect_transfer_pairs", new_callable=AsyncMock), \
+ patch("app.services.connection_service.stamp_primary_amount", new_callable=AsyncMock), \
+ patch("app.services.connection_service.apply_rules_to_transaction", new_callable=AsyncMock):
+ resp = await client.post(
+ f"/api/connections/{test_connection.id}/sync", headers=auth_headers,
+ )
+
+ assert resp.status_code == 200
+ body = resp.json()
+ assert body["sync_outcome"] == "refreshed"
+ assert body["merged_count"] == 0
+ assert body["status"] == "active"
+
+
+async def test_sync_connection_rate_limited_reports_outcome(
+ client: AsyncClient, auth_headers, test_connection: BankConnection
+):
+ """A provider 429 returns 200 with sync_outcome='rate_limited' so the UI
+ does not show a success toast (issue #736)."""
+ stale_sync_at = test_connection.last_sync_at
+ mock_provider = AsyncMock()
+ mock_provider.refresh_credentials = AsyncMock(return_value={"token": "fake"})
+ mock_provider.get_accounts = AsyncMock(
+ side_effect=ProviderRateLimited("Daily request limit reached")
+ )
+ with patch("app.services.connection_service.get_provider", return_value=mock_provider):
+ resp = await client.post(
+ f"/api/connections/{test_connection.id}/sync", headers=auth_headers,
+ )
+
+ assert resp.status_code == 200
+ body = resp.json()
+ assert body["sync_outcome"] == "rate_limited"
+ assert body["merged_count"] == 0
+ assert body["status"] == "active"
+ # No fresh data was pulled, so the last sync timestamp is untouched.
+ assert datetime.fromisoformat(
+ body["last_sync_at"].replace("Z", "+00:00")
+ ) == stale_sync_at
+
+
@pytest.mark.asyncio
async def test_reconnect_token_not_found(client: AsyncClient, auth_headers):
resp = await client.post(
diff --git a/backend/tests/test_payee_lookup_collation.py b/backend/tests/test_payee_lookup_collation.py
index 406f9804..fc6949dc 100644
--- a/backend/tests/test_payee_lookup_collation.py
+++ b/backend/tests/test_payee_lookup_collation.py
@@ -200,7 +200,7 @@ async def test_sync_imports_a_shared_counterparty_once(
with patch("app.services.connection_service.get_provider", return_value=mock_provider), \
patch("app.services.connection_service.stamp_primary_amount", new_callable=AsyncMock):
- synced, _ = await sync_connection(
+ synced, _, _ = await sync_connection(
session, connection.id, test_workspace.id, test_user.id
)
diff --git a/backend/tests/test_payee_workspace_scope.py b/backend/tests/test_payee_workspace_scope.py
index 8a59bed2..c1a7b804 100644
--- a/backend/tests/test_payee_workspace_scope.py
+++ b/backend/tests/test_payee_workspace_scope.py
@@ -198,7 +198,7 @@ async def test_connecting_a_bank_succeeds_with_the_name_already_used_elsewhere(
patch("app.services.connection_service.detect_transfer_pairs", new_callable=AsyncMock), \
patch("app.services.connection_service.stamp_primary_amount", new_callable=AsyncMock), \
patch("app.services.connection_service.apply_rules_to_transaction", new_callable=AsyncMock):
- result_conn, _ = await sync_connection(
+ result_conn, _, _ = await sync_connection(
session, conn.id, other.id, test_user.id
)
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts
index 71d78bac..2a8f68b8 100644
--- a/frontend/src/lib/api.ts
+++ b/frontend/src/lib/api.ts
@@ -13,6 +13,7 @@ import type {
CategoryGroup,
BankConnection,
ConnectionSettings,
+ SyncResult,
Account,
AccountSummary,
AccountRunningBalancePoint,
@@ -430,7 +431,7 @@ export const connections = {
const { data } = await api.post(`/connections/${connectionId}/oauth/reauth-url`)
return data.url
},
- sync: async (id: string): Promise<BankConnection> => {
+ sync: async (id: string): Promise<SyncResult> => {
const { data } = await api.post(`/connections/${id}/sync`)
return data
},
diff --git a/frontend/src/locales/cs.json b/frontend/src/locales/cs.json
index 76695782..97973654 100644
--- a/frontend/src/locales/cs.json
+++ b/frontend/src/locales/cs.json
@@ -1292,6 +1292,7 @@
"updated": "Účet aktualizován",
"deleted": "Účet smazán",
"syncDone": "Synchronizace dokončena",
+ "syncRateLimited": "Dosáhnuto denního limitu banky, žádná nová data nebyla stažena. Zkuste to prosím později.",
"syncError": "Synchronizace selhala",
"connected": "Banka úspěšně propojena",
"connectError": "Banku se nepodařilo propojit",
diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json
index 9dc9a31f..47548242 100644
--- a/frontend/src/locales/de.json
+++ b/frontend/src/locales/de.json
@@ -1213,6 +1213,7 @@
"updated": "Konto aktualisiert",
"deleted": "Konto gelöscht",
"syncDone": "Synchronisierung abgeschlossen",
+ "syncRateLimited": "Tägliches Banklimit erreicht, es wurden keine neuen Daten geladen. Bitte später erneut versuchen.",
"syncError": "Synchronisierung fehlgeschlagen",
"connected": "Bank erfolgreich verbunden",
"connectError": "Verbindung zur Bank fehlgeschlagen",
diff --git a/frontend/src/locales/el.json b/frontend/src/locales/el.json
index cf30b9c4..1d2ef74f 100644
--- a/frontend/src/locales/el.json
+++ b/frontend/src/locales/el.json
@@ -942,6 +942,7 @@
"updated": "Ο λογαριασμός ενημερώθηκε",
"deleted": "Ο λογαριασμός διαγράφηκε",
"syncDone": "Ο συγχρονισμός ολοκληρώθηκε",
+ "syncRateLimited": "Συμπληρώθηκε το ημερήσιο όριο της τράπεζας, δεν ανακτήθηκαν νέα δεδομένα. Δοκιμάστε ξανά αργότερα.",
"syncError": "Ο συγχρονισμός απέτυχε",
"connected": "Η τράπεζα συνδέθηκε επιτυχώς",
"connectError": "Αποτυχία σύνδεσης τράπεζας",
diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json
index 55be8df1..597f5ed1 100644
--- a/frontend/src/locales/en.json
+++ b/frontend/src/locales/en.json
@@ -1212,6 +1212,7 @@
"updated": "Account updated",
"deleted": "Account deleted",
"syncDone": "Sync completed",
+ "syncRateLimited": "Bank daily limit reached, no new data was fetched. Try again later.",
"syncError": "Sync failed",
"connected": "Bank connected successfully",
"connectError": "Failed to connect bank",
diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json
index c482e7fb..58ff5537 100644
--- a/frontend/src/locales/es.json
+++ b/frontend/src/locales/es.json
@@ -1216,6 +1216,7 @@
"updated": "Cuenta actualizada",
"deleted": "Cuenta eliminada",
"syncDone": "Sincronización completada",
+ "syncRateLimited": "Límite diario del banco alcanzado, no se ha obtenido ningún dato nuevo. Inténtalo más tarde.",
"syncError": "Error de sincronización",
"connected": "Banco conectado con éxito",
"connectError": "Error al conectar el banco",
diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json
index 3cd35b21..f1c708db 100644
--- a/frontend/src/locales/fr.json
+++ b/frontend/src/locales/fr.json
@@ -1216,6 +1216,7 @@
"updated": "Compte mis à jour",
"deleted": "Compte supprimé",
"syncDone": "Synchronisation terminée",
+ "syncRateLimited": "Limite journalier de la banque atteint, aucune donnée nouvelle n'a été récupérée. Réessayez plus tard.",
"syncError": "Échec de la synchronisation",
"connected": "Banque connectée avec succès",
"connectError": "Échec de la connexion à la banque",
diff --git a/frontend/src/locales/hi.json b/frontend/src/locales/hi.json
index 8a81820e..e164a62d 100644
--- a/frontend/src/locales/hi.json
+++ b/frontend/src/locales/hi.json
@@ -1212,6 +1212,7 @@
"updated": "खाता अपडेट हुआ",
"deleted": "खाता हटाया गया",
"syncDone": "सिंक पूरा हुआ",
+ "syncRateLimited": "बैंक की दैनिक सीमा पूरी हो गई, कोई नया डेटा प्राप्त नहीं हुआ। कृपया बाद में पुनः प्रयास करें।",
"syncError": "सिंक विफल",
"connected": "बैंक सफलतापूर्वक कनेक्ट हुआ",
"connectError": "बैंक कनेक्ट करने में विफल",
diff --git a/frontend/src/locales/hu.json b/frontend/src/locales/hu.json
index c77fca94..053fb9c8 100644
--- a/frontend/src/locales/hu.json
+++ b/frontend/src/locales/hu.json
@@ -1212,6 +1212,7 @@
"updated": "Számla frissítve",
"deleted": "Számla törölve",
"syncDone": "Szinkronizálás kész",
+ "syncRateLimited": "Elérted a bank napi korlátját, nem érkeztek új adatok. Próbáld újra később.",
"syncError": "Sikertelen szinkronizálás",
"connected": "Bank sikeresen csatlakoztatva",
"connectError": "Nem sikerült csatlakoztatni a bankot",
diff --git a/frontend/src/locales/it.json b/frontend/src/locales/it.json
index 766cf6e8..92588017 100644
--- a/frontend/src/locales/it.json
+++ b/frontend/src/locales/it.json
@@ -1216,6 +1216,7 @@
"updated": "Conto aggiornato",
"deleted": "Conto eliminato",
"syncDone": "Sincronizzazione completata",
+ "syncRateLimited": "Limite giornaliero della banca raggiunto, nessun dato nuovo recuperato. Riprova più tardi.",
"syncError": "Sincronizzazione fallita",
"connected": "Banca collegata con successo",
"connectError": "Impossibile collegare la banca",
diff --git a/frontend/src/locales/ja.json b/frontend/src/locales/ja.json
index 27b2b5cf..f98a8fd1 100644
--- a/frontend/src/locales/ja.json
+++ b/frontend/src/locales/ja.json
@@ -1212,6 +1212,7 @@
"updated": "口座を更新しました",
"deleted": "口座を削除しました",
"syncDone": "同期が完了しました",
+ "syncRateLimited": "銀行の1日の利用上限に達したため、新しいデータは取得されませんでした。しばらくしてから再度お試しください。",
"syncError": "同期に失敗しました",
"connected": "銀行を接続しました",
"connectError": "銀行の接続に失敗しました",
diff --git a/frontend/src/locales/nl.json b/frontend/src/locales/nl.json
index 1b4f448e..d184fad9 100644
--- a/frontend/src/locales/nl.json
+++ b/frontend/src/locales/nl.json
@@ -1213,6 +1213,7 @@
"updated": "Account bijgewerkt",
"deleted": "Account verwijderd",
"syncDone": "Synchronisatie voltooid",
+ "syncRateLimited": "Dagelijks banklimiet bereikt, er is geen nieuwe data opgehaald. Probeer het later opnieuw.",
"syncError": "Synchronisatie mislukt",
"connected": "Bank succesvol verbonden",
"connectError": "Kan geen verbinding maken met de bank",
diff --git a/frontend/src/locales/pl.json b/frontend/src/locales/pl.json
index 163cda38..207ea944 100644
--- a/frontend/src/locales/pl.json
+++ b/frontend/src/locales/pl.json
@@ -1262,6 +1262,7 @@
"updated": "Zaktualizowano konto",
"deleted": "Usunięto konto",
"syncDone": "Synchronizacja zakończona",
+ "syncRateLimited": "Osiągnięto dzienny limit banku, nie pobrano nowych danych. Spróbuj ponownie później.",
"syncError": "Synchronizacja nie powiodła się",
"connected": "Pomyślnie połączono bank",
"connectError": "Nie udało się połączyć banku",
diff --git a/frontend/src/locales/pt-BR.json b/frontend/src/locales/pt-BR.json
index 73636288..45f66e93 100644
--- a/frontend/src/locales/pt-BR.json
+++ b/frontend/src/locales/pt-BR.json
@@ -1216,6 +1216,7 @@
"updated": "Conta atualizada",
"deleted": "Conta excluída",
"syncDone": "Sincronização concluída",
+ "syncRateLimited": "Limite diário do banco atingido, nenhum dado novo foi buscado. Tente novamente mais tarde.",
"syncError": "Erro ao sincronizar",
"connected": "Banco conectado com sucesso",
"connectError": "Erro ao conectar banco",
diff --git a/frontend/src/locales/pt-PT.json b/frontend/src/locales/pt-PT.json
index 0c320e2f..5e42afcb 100644
--- a/frontend/src/locales/pt-PT.json
+++ b/frontend/src/locales/pt-PT.json
@@ -1216,6 +1216,7 @@
"updated": "Conta atualizada",
"deleted": "Conta eliminada",
"syncDone": "Sincronização concluída",
+ "syncRateLimited": "Limite diário do banco atingido, nenhum dado novo foi obtido. Tente novamente mais tarde.",
"syncError": "Erro ao sincronizar",
"connected": "Banco conectado com sucesso",
"connectError": "Erro ao conectar banco",
diff --git a/frontend/src/locales/ru.json b/frontend/src/locales/ru.json
index 386359bf..c9a4158b 100644
--- a/frontend/src/locales/ru.json
+++ b/frontend/src/locales/ru.json
@@ -1229,6 +1229,7 @@
"updated": "Счёт обновлён",
"deleted": "Счёт удалён",
"syncDone": "Синхронизация завершена",
+ "syncRateLimited": "Достигнут суточный лимит банка, новые данные не получены. Повторите попытку позже.",
"syncError": "Синхронизация не удалась",
"connected": "Банк успешно подключён",
"connectError": "Не удалось подключить банк",
diff --git a/frontend/src/locales/sk.json b/frontend/src/locales/sk.json
index 5cbbcb9f..f3d6507a 100644
--- a/frontend/src/locales/sk.json
+++ b/frontend/src/locales/sk.json
@@ -1276,6 +1276,7 @@
"updated": "Účet aktualizovaný",
"deleted": "Účet vymazaný",
"syncDone": "Synchronizácia dokončená",
+ "syncRateLimited": "Dosiahnutý denný limit banky, žiadne nové údaje neboli stiahnuté. Skúste to prosím neskôr.",
"syncError": "Synchronizácia zlyhala",
"connected": "Banka úspešne prepojená",
"connectError": "Nepodarilo sa prepojiť banku",
diff --git a/frontend/src/locales/uk.json b/frontend/src/locales/uk.json
index 40a8d10f..8a23e2e5 100644
--- a/frontend/src/locales/uk.json
+++ b/frontend/src/locales/uk.json
@@ -1229,6 +1229,7 @@
"updated": "Рахунок оновлено",
"deleted": "Рахунок видалено",
"syncDone": "Синхронізацію завершено",
+ "syncRateLimited": "Досягнуто добовий ліміт банку, нових даних не отримано. Спробуйте пізніше.",
"syncError": "Синхронізація не вдалася",
"connected": "Банк успішно підключено",
"connectError": "Не вдалося підключити банк",
diff --git a/frontend/src/pages/accounts.tsx b/frontend/src/pages/accounts.tsx
index 7aa57519..f876f326 100644
--- a/frontend/src/pages/accounts.tsx
+++ b/frontend/src/pages/accounts.tsx
@@ -141,8 +141,14 @@ export default function AccountsPage() {
onSuccess: (result) => {
invalidateFinancialQueries(queryClient)
queryClient.invalidateQueries({ queryKey: ['connections'] })
- toast.success(t('accounts.syncDone'))
- const merged = (result as BankConnection & { merged_count?: number })?.merged_count
+ // The provider can throttle the sync (429) and still return success
+ // without pulling anything: say so instead of a false "Sync completed".
+ if (result.sync_outcome === 'rate_limited') {
+ toast.warning(t('accounts.syncRateLimited'))
+ } else {
+ toast.success(t('accounts.syncDone'))
+ }
+ const merged = result?.merged_count
if (merged && merged > 0) {
toast.info(t('accounts.mergedCount', { count: merged }))
}
diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts
index f4db89ee..01bbfecd 100644
--- a/frontend/src/types/index.ts
+++ b/frontend/src/types/index.ts
@@ -155,6 +155,14 @@ export interface ConnectionSettings {
sync_assets?: boolean
}
+// Response of POST /connections/{id}/sync: the connection plus what the run
+// actually did. "rate_limited" means the provider throttled the request
+// (429): nothing was pulled and last_sync_at was left untouched (issue #736).
+export interface SyncResult extends BankConnection {
+ merged_count: number
+ sync_outcome: 'refreshed' | 'rate_limited'
+}
+
export interface Account {
id: string
user_id: string