Import the longest bank-permitted history and surface real provider errors

Manual history imports failed opaquely once a bank capped lookback on an
established consent (N26 rejects date_from beyond ~90 days with
WRONG_TRANSACTIONS_PERIOD). Backfill now requests the documented longest
fetching strategy, reports the coverage the bank actually provided, and
non-2xx responses surface allowlisted documented error codes instead of a
generic fallback. Dead-session codes map to reconnection. Failed syncs
retry hourly so a stale sync banner no longer persists for a day.
This commit is contained in:
Lars Nolden
2026-09-10 22:58:03 +02:00
parent 4324660888
commit a8722d58c3
7 changed files with 213 additions and 36 deletions
+19 -9
View File
@@ -441,18 +441,28 @@ function BackfillHistory({
setError("");
setSuccess("");
try {
const response = await request<{ imported: number; state: State }>(
"/api/backfill",
{
revision: state.revision,
account_id: account.id,
history_months: months,
},
);
const message =
const response = await request<{
imported: number;
requested_from?: string;
earliest_fetched?: string;
state: State;
}>("/api/backfill", {
revision: state.revision,
account_id: account.id,
history_months: months,
});
let message =
response.imported === 0
? `No new transactions imported for ${account.display_name}. Existing transactions were not duplicated.`
: `Imported ${response.imported} new transactions for ${account.display_name}. Existing transactions were not duplicated.`;
if (!response.earliest_fetched) {
message += " The bank returned no transactions for this range.";
} else if (
response.requested_from &&
response.earliest_fetched > response.requested_from
) {
message += ` The bank provided history starting ${response.earliest_fetched}, not the requested ${response.requested_from}; banks often limit how far back an existing connection can read. Older transactions can be added via CSV import.`;
}
acceptState(response.state, message);
setSuccess(message);
} catch (err) {