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().
This commit is contained in:
Viktor Barzin 2026-05-16 23:47:49 +00:00
parent cb159e17d9
commit c9c0310733

View file

@ -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: