feat(desktop/account-health): mark freshly bound accounts as live

Bind callbacks now stamp the runtime account as health=live with a fresh
verified_at and seed the health record via markTrackedAccountBound, so the
UI doesn't show a just-bound account as 尚未校验 while waiting for the next
probe. Also let force probes bypass the cached-result short-circuit so the
manual 重新校验 button always re-runs the probe.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-29 17:11:50 +08:00
parent e89349399b
commit 426e94dd6b
2 changed files with 41 additions and 1 deletions
@@ -45,6 +45,7 @@ import {
forgetTrackedAccountHealth,
getAccountHealthSnapshot,
getProjectedAccountHealth,
markTrackedAccountBound,
probeTrackedAccount,
reportAccountFailure,
syncTrackedAccounts,
@@ -1255,9 +1256,12 @@ export async function requestRuntimeAccountProbe(
}
export function noteRuntimeAccountBound(account: DesktopAccountInfo): void {
const verifiedAt = new Date().toISOString();
const normalizedAccount: DesktopAccountInfo = {
...account,
platform_uid: normalizeAccountPlatformUid(account.platform_uid) || account.platform_uid,
health: "live",
verified_at: account.verified_at ?? verifiedAt,
};
const existingIndex = state.accounts.findIndex((item) =>
item.id === normalizedAccount.id
@@ -1282,6 +1286,12 @@ export function noteRuntimeAccountBound(account: DesktopAccountInfo): void {
});
state.lastAccountsSyncAt = Date.now();
syncTrackedAccounts(state.accounts.map((item) => accountIdentityFromDesktopAccount(item)));
markTrackedAccountBound(accountIdentityFromDesktopAccount(normalizedAccount), {
subjectUid: normalizedAccount.platform_uid,
displayName: normalizedAccount.display_name,
avatarUrl: normalizedAccount.avatar_url,
});
enqueueAccountHealthReport(normalizedAccount.id);
refreshAccountNames();
}