feat(account-health): reconcile remote bind state and ignore stale runtime reports
Track an authRevision per local record so a fresh bind cancels in-flight probes, sync server-confirmed health back into the desktop cache via reconcileTrackedAccountRemoteState, include verified_at in the upsert signature, and drop runtime health reports older than the stored verified_at on the server side. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -47,6 +47,7 @@ import {
|
||||
getProjectedAccountHealth,
|
||||
markTrackedAccountBound,
|
||||
probeTrackedAccount,
|
||||
reconcileTrackedAccountRemoteState,
|
||||
reportAccountFailure,
|
||||
syncTrackedAccounts,
|
||||
} from "./account-health";
|
||||
@@ -948,6 +949,19 @@ async function syncAccounts(source: "startup" | "manual"): Promise<void> {
|
||||
const syncedAccounts: Array<DesktopAccountInfo | null> = accounts.map((account) => {
|
||||
const normalizedPlatformUid = normalizeAccountPlatformUid(account.platform_uid) || account.platform_uid;
|
||||
const isAIPlatform = isAIPlatformId(account.platform);
|
||||
const accountIdentity = accountIdentityFromDesktopAccount({
|
||||
...account,
|
||||
platform_uid: normalizedPlatformUid,
|
||||
});
|
||||
reconcileTrackedAccountRemoteState(accountIdentity, {
|
||||
health: account.health,
|
||||
verifiedAt: account.verified_at,
|
||||
profile: {
|
||||
subjectUid: normalizedPlatformUid,
|
||||
displayName: account.display_name,
|
||||
avatarUrl: account.avatar_url,
|
||||
},
|
||||
});
|
||||
const projected = getProjectedAccountHealth({
|
||||
accountId: account.id,
|
||||
platform: account.platform,
|
||||
|
||||
Reference in New Issue
Block a user