Skip to content

feat(imports): retry a stopped bank import from Bank connections - #189

Merged
sars merged 1 commit into
mainfrom
feat/retry-import-from-connections
Oct 21, 2026
Merged

sars merged 1 commit into
mainfrom
feat/retry-import-from-connections

Conversation

@sars

@sars sars commented Oct 21, 2026

Copy link
Copy Markdown
Owner

What

A bank import that fails for a reason the scheduler cannot classify latches its connection (<instance>.blocked, review_required), and until now the only remedy was deleting the latch over SSH (Revolut, 20 October 2026: one HTTP 400, answered normally a day later).

  • Bank connections shows "Import stopped, needs a look" on a connection's card while bank_sync_runs.retry_reason reads blocked, with a Retry import button for the member the connection belongs to or the administrator. After the press the card says the retry is queued for the next check, within thirty minutes, not that it ran. The Monobank card gets the same panel for the member's own Monobank connection.
  • POST /api/connections/retry (CSRF, ownership or admin, 409 unless stopped) writes <instance>.retry-requested (0600, atomic rename) into the consent directory — ENABLEBANKING_SESSION_DIRECTORY, the one directory app and worker share — and records an import_retry_requested row in audit_events. GET /api/connections now reports importStopped / retryQueued per approval plus the Monobank connection.
  • src/schedule.ts consumes the marker at the next run, beside the existing approval-based lift: newer than the latch → latch removed, one attempt; older → ignored; no latch → removed; not a plain private file → not believed. A failed attempt latches afresh, newer than any marker, so the button cannot become a loop.
  • Docs: scheduling (Failures and disablement), bank-connectors, bank-consent, containers, STATUS ("In the repository, not yet released").

No deployment change: both containers already mount the consent directory and set the variable.

Commands run

pnpm exec tsc && node --test dist/test/schedule.test.js dist/test/import-retry.test.js
  → 23 tests, 23 pass (4 new scheduler cases, 3 new module cases)
node --test dist/test/frontend-api.test.js dist/test/web.test.js
  → 3 pass (API: 403 wrong CSRF, 403 other member, 409 not stopped, 200 queued, marker on disk, retryQueued true)
pnpm check
  → check_repository OK, format OK, tests 736 / pass 731 / fail 0, frontend build OK,
    check_frontend: entry 114 KB gzip, design rules hold

Screen verified against a scratch server (demo sign-in, consent stub, seeded blocked runs) at 1280 px and 390 px (pnpm shots /connections): button present only on the stopped connection, the click wrote enablebanking-rodion-revolut.retry-requested with mode -rw-------, the card switched to the queued text, and the server logged import_retry_requested.

Not verified: a real timer run on the server consuming the marker; the first latched bank after the release will show that.

🤖 Generated with Claude Code

A bank import that fails for a reason the scheduler cannot classify
latches its connection, and until now only deleting the latch over SSH
could restart it. The connection's card on Bank connections now shows
"Import stopped, needs a look" with a "Retry import" button, for the
member the connection belongs to or the administrator, only while
`bank_sync_runs.retry_reason` reads `blocked`.

The press writes `<instance>.retry-requested` (0600) into the consent
directory, the one directory both containers share, and records an
`import_retry_requested` audit event. The scheduler consumes the marker
at its next run: newer than the latch it lifts the latch for exactly one
attempt; older it is ignored; with no latch it is simply removed; a
marker that is not a plain private file is not believed. A run that
fails again latches afresh, so the button is never a retry loop. The
page says the retry is queued for the next check, not that it ran.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@sars
sars merged commit 97ed85c into main Oct 21, 2026
3 checks passed
@sars
sars deleted the feat/retry-import-from-connections branch October 21, 2026 15:22
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