Refreshes missing profiles from AiPrise, sequentially so one bad id
(deleted at AiPrise, transient 5xx) never aborts the rest, and capped per
run (each refresh is an external GET inside one server-action request).
Re-running is idempotent — refresh upserts, and already-shadowed ids
are no longer missing on the next scan — so the caller drains remaining
by running again.
Optionalargs: { limit?: number }
Optionallimit?: numberMax missing profiles refreshed this run. Defaults to 25.
Enumerates every AiPrise profile id the source tables reference, diffs against the shadow tables, and reports totals + missing ids per type. Read-only; the page calls it on every render for the sync-health line.
Count-only twin of scan for the page header: pure SQL counts
(count over the shadow tables, anti-join counts for the missing side) —
no id materialization, no pagination. backfill keeps using scan,
which needs the actual missing ids.
Finds AiPrise profiles referenced by our entities that predate the webhook shadow sync (
aiprise_business_profile/aiprise_user_profilerows are written by the identity-api webhook consumer, so anything verified before that wiring has no shadow row) and imports them via the shadow services'refresh.Source-of-truth references, per profile type:
organization.data.verificationProfileId, plus US/SWIFT wire payment instruments with a BUSINESS beneficiary (instrument_data.verificationProfileId).identity.verification.verificationProfileId,related_person.data.verificationProfileId, plus US/SWIFT wire payment instruments with a PERSON beneficiary.Admin-only — the /aiprise/profiles page in
admin-dashboardis the sole consumer, so it lives here rather than in the shared aiprise domain package (mirrorsRouteFusionEntityBackfillService).