Feat/bunq provider #6103
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.57) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #6103"
general
weight: 0.35
jjmata
Mostly LLM generated code, ruby is not my favourite language, open for feedback ;-)
Problem
bunq exposes a well-documented public API, but connecting it to Sure is not a
two-step OAuth dance: a personal API key authenticates in three steps
(installation, device registration, session), is bound to the IP address it was
installed from, and the setup endpoints allow as few as ten requests a day.
Getting any of that wrong strands a
DeviceServeron the user's bunq account andburns the quota that would have fixed it.
What this does
pair, installation id/token, device id and session token live on the
connection, encrypted at rest. Only the session is rebuilt when bunq answers
401; the installation is never repeated on purpose.
accounts become accounts; payments become entries, deduplicated on the payment
id, with counterparty, merchant reference and
balance_after_mutationstoredunder the entry's bunq metadata. A foreign-currency payment keeps its own
currency and records the pair. bunq signs a payment from the account's point of
view, so the processor negates it to Sure's positive-is-expense convention.
connection's own accounts is linked to the matching leg, including the
currency guard, and a removed leg is rejected rather than silently dropped.
the payee kept, matching how the other bank syncs name their rows.
connection
requires_update, a rotated API key resets the stale API context,and the provider card shows what happened.
connection (
declares_connection),BunqItemsControllerbuilds onProviderItemsController, the routes use theprovider_itemsconcern, and thepanel/card/dialogs are the kit's components. Nothing is hardcoded in
Settings::ProvidersController,SettingsHelperorProvider::Metadata; thesettings panel, the accounts index, the provider picker and the logo all come
from the declaration.
Validation
covering the bunq client, adapter, importer, syncer, self-transfer linker,
processors and the wizard's controller routes, plus the provider-kit contract
tests that pin every declared connection's list queries, the settings panel
providers and the accounts-index providers (
Provider::ConnectionDeclarationTest),and the provider-item component/card tests.
The documented behaviour was verified against the bunq sandbox
(installation → device → session → account → payment) as described in
docs/providers/bunq.md, which also carries the runbook for a key that isrefused.
Notes for review
main(7e86933) in 26 linear commits andtouches no MoneyMoney import code, so it can be reviewed on its own.
docs/providers/bunq.mdexplains why OAuth was rejected (bunq asks for it frompublic projects only, and a self-hosted app cannot offer the fixed redirect URI
a registered client needs).
test enumerates the panel and accounts-index providers, so this branch updates
that list too.
Fixes from production use
Two defects surfaced on a live connection running an earlier tag; both are
fixed on this branch, each with a test that failed first.
pending transfer as soon as both legs exist — during the import, before this
linker runs — so the linker found the leg already carrying a transfer and
skipped it. The one component that can prove the pairing (the counterparty
IBAN) declined to confirm what the heuristic had only guessed, leaving five
savings moves for a person to confirm by hand after a single sync. The linker
now confirms a pending proposal that joins exactly the two legs it would link,
and still leaves a confirmed transfer alone.
for a move between its own accounts and the payee is deliberately dropped
there, so both halves were blank and the row fell back to the literal name
"Transaction". The holder's name bunq reports is the fallback now.
look like a removal and detached the linked Sure account), honours the
connection-level sync start date, and dropped two pieces of dead code.
security:backfill_encryptionwalks a manifest of models whose encryptedcolumns it re-encrypts;
BunqItemandBunqAccountwere missing from it, sotheir ciphertext would never have been backfilled. Both are listed now, with
the manifest version bumped and the digest its test pins.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Added support for connecting Bunq with an API key and syncing account balances and transactions.
Added account selection and setup flows, including production and sandbox options.
Transactions between accounts on the same Bunq connection can be linked as transfers.
Bunq connections and sync status now appear in the app.
Bug Fixes
Deleting a Bunq-linked transfer prevents it from being automatically recreated.
Documentation
* Added Bunq setup, sync, and transaction-import guidance.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->