From c9c0310733bf0efa61952ccb5fcc708078ba29c3 Mon Sep 17 00:00:00 2001 From: Viktor Barzin Date: Sat, 16 May 2026 23:47:49 +0000 Subject: [PATCH] fidelity: snapshot push needs WF account UUID, not logical id /api/v1/snapshots/import lookups the account by Wealthfolio's own UUID; passing our provider-side logical id ('fidelity-workplace-pension') returns 400 'Database operation failed: Record not found'. Resolve via sink.ensure_account() which the pipeline already runs idempotently, then pass the returned UUID into push_manual_snapshots(). --- broker_sync/cli.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/broker_sync/cli.py b/broker_sync/cli.py index 385fd01..879c3a2 100644 --- a/broker_sync/cli.py +++ b/broker_sync/cli.py @@ -440,9 +440,6 @@ def fidelity_ingest( async def _run() -> None: from datetime import date as _date_t - from broker_sync.providers.fidelity_planviewer import ( - ACCOUNT_ID as FID_ACCOUNT_ID, - ) from broker_sync.providers.fidelity_planviewer import ( fidelity_holdings_to_snapshot, ) @@ -478,8 +475,14 @@ def fidelity_ingest( as_of=_date_t.today(), ) if snapshot is not None: + # /api/v1/snapshots/import wants WF's own account UUID, + # not our logical provider id — look it up via the same + # match the pipeline used (provider+providerAccountId). + wf_account_id = await sink.ensure_account( + provider.accounts()[0], + ) push_result = await sink.push_manual_snapshots( - account_id=FID_ACCOUNT_ID, snapshots=[snapshot], + account_id=wf_account_id, snapshots=[snapshot], ) snapshot_imported = int(push_result.get("snapshotsImported", 0)) finally: