From 9f8eccab8ea285efbe4f18c6f4c8913d7fa78f6c Mon Sep 17 00:00:00 2001 From: Willie Date: Wed, 30 Sep 2026 03:30:08 +0800 Subject: [PATCH] feat(ui): list failed targets on the Sync page's Last sync card The card showed "partial" and a target count, but not which targets failed, so finding them meant opening the log. It now adds a Failed row naming the targets from the log's failed_targets, or the count for entries written before that field existed. --- ui/src/i18n/locales/de.json | 1 + ui/src/i18n/locales/en.json | 1 + ui/src/i18n/locales/es.json | 1 + ui/src/i18n/locales/fa.json | 1 + ui/src/i18n/locales/fr.json | 1 + ui/src/i18n/locales/id.json | 1 + ui/src/i18n/locales/ja.json | 1 + ui/src/i18n/locales/ko.json | 1 + ui/src/i18n/locales/pt-BR.json | 1 + ui/src/i18n/locales/zh-CN.json | 1 + ui/src/i18n/locales/zh-TW.json | 1 + ui/src/pages/SyncPage.test.tsx | 28 ++++++++++++++++++++++++++++ ui/src/pages/SyncPage.tsx | 7 +++++++ 13 files changed, 46 insertions(+) diff --git a/ui/src/i18n/locales/de.json b/ui/src/i18n/locales/de.json index 6f3a52dc4..40db9534a 100644 --- a/ui/src/i18n/locales/de.json +++ b/ui/src/i18n/locales/de.json @@ -1700,6 +1700,7 @@ "sync.last.targets": "Ziele", "sync.last.took": "Dauer", "sync.last.error": "Fehler", + "sync.last.failed": "Fehlgeschlagen", "sync.last.never": "Es wurde noch nicht synchronisiert.", "sync.last.openLog": "Log öffnen", "gitSync.changes.title": "Änderungen auf diesem Rechner", diff --git a/ui/src/i18n/locales/en.json b/ui/src/i18n/locales/en.json index a24b0a8c0..50349b4eb 100644 --- a/ui/src/i18n/locales/en.json +++ b/ui/src/i18n/locales/en.json @@ -1700,6 +1700,7 @@ "sync.last.targets": "Targets", "sync.last.took": "Took", "sync.last.error": "Error", + "sync.last.failed": "Failed", "sync.last.never": "No sync has run yet.", "sync.last.openLog": "Open log", "gitSync.changes.title": "Changes on this machine", diff --git a/ui/src/i18n/locales/es.json b/ui/src/i18n/locales/es.json index 08bf72b2f..1e59781e6 100644 --- a/ui/src/i18n/locales/es.json +++ b/ui/src/i18n/locales/es.json @@ -1700,6 +1700,7 @@ "sync.last.targets": "Destinos", "sync.last.took": "Duración", "sync.last.error": "Error", + "sync.last.failed": "Fallidos", "sync.last.never": "Aún no se ha sincronizado.", "sync.last.openLog": "Abrir log", "gitSync.changes.title": "Cambios en esta máquina", diff --git a/ui/src/i18n/locales/fa.json b/ui/src/i18n/locales/fa.json index e99efbd97..16e117f77 100644 --- a/ui/src/i18n/locales/fa.json +++ b/ui/src/i18n/locales/fa.json @@ -1700,6 +1700,7 @@ "sync.last.targets": "هدف‌ها", "sync.last.took": "مدت", "sync.last.error": "خطا", + "sync.last.failed": "ناموفق", "sync.last.never": "هنوز همگام‌سازی انجام نشده است.", "sync.last.openLog": "باز کردن log", "gitSync.changes.title": "تغییرات روی این دستگاه", diff --git a/ui/src/i18n/locales/fr.json b/ui/src/i18n/locales/fr.json index 6e336ba51..914ec477e 100644 --- a/ui/src/i18n/locales/fr.json +++ b/ui/src/i18n/locales/fr.json @@ -1700,6 +1700,7 @@ "sync.last.targets": "Cibles", "sync.last.took": "Durée", "sync.last.error": "Erreur", + "sync.last.failed": "Échecs", "sync.last.never": "Aucune synchronisation pour l'instant.", "sync.last.openLog": "Ouvrir le log", "gitSync.changes.title": "Changements sur cette machine", diff --git a/ui/src/i18n/locales/id.json b/ui/src/i18n/locales/id.json index c7a13512a..9d46abd9f 100644 --- a/ui/src/i18n/locales/id.json +++ b/ui/src/i18n/locales/id.json @@ -1700,6 +1700,7 @@ "sync.last.targets": "Target", "sync.last.took": "Durasi", "sync.last.error": "Galat", + "sync.last.failed": "Gagal", "sync.last.never": "Belum pernah sinkronisasi.", "sync.last.openLog": "Buka log", "gitSync.changes.title": "Perubahan di mesin ini", diff --git a/ui/src/i18n/locales/ja.json b/ui/src/i18n/locales/ja.json index 5ab680b31..7ca8c6c87 100644 --- a/ui/src/i18n/locales/ja.json +++ b/ui/src/i18n/locales/ja.json @@ -1700,6 +1700,7 @@ "sync.last.targets": "ターゲット", "sync.last.took": "所要時間", "sync.last.error": "エラー", + "sync.last.failed": "失敗", "sync.last.never": "まだ同期していません。", "sync.last.openLog": "log を開く", "gitSync.changes.title": "このマシンでの変更", diff --git a/ui/src/i18n/locales/ko.json b/ui/src/i18n/locales/ko.json index 2714af2d4..9d22eb758 100644 --- a/ui/src/i18n/locales/ko.json +++ b/ui/src/i18n/locales/ko.json @@ -1700,6 +1700,7 @@ "sync.last.targets": "대상", "sync.last.took": "소요 시간", "sync.last.error": "오류", + "sync.last.failed": "실패", "sync.last.never": "아직 동기화한 적이 없습니다.", "sync.last.openLog": "log 열기", "gitSync.changes.title": "이 컴퓨터의 변경 사항", diff --git a/ui/src/i18n/locales/pt-BR.json b/ui/src/i18n/locales/pt-BR.json index 8dbb091ef..2eb130038 100644 --- a/ui/src/i18n/locales/pt-BR.json +++ b/ui/src/i18n/locales/pt-BR.json @@ -1700,6 +1700,7 @@ "sync.last.targets": "Destinos", "sync.last.took": "Duração", "sync.last.error": "Erro", + "sync.last.failed": "Falharam", "sync.last.never": "Nenhuma sincronização ainda.", "sync.last.openLog": "Abrir log", "gitSync.changes.title": "Alterações nesta máquina", diff --git a/ui/src/i18n/locales/zh-CN.json b/ui/src/i18n/locales/zh-CN.json index a8835b848..fc36a14c1 100644 --- a/ui/src/i18n/locales/zh-CN.json +++ b/ui/src/i18n/locales/zh-CN.json @@ -1700,6 +1700,7 @@ "sync.last.targets": "目标", "sync.last.took": "耗时", "sync.last.error": "错误", + "sync.last.failed": "失败", "sync.last.never": "尚未同步过。", "sync.last.openLog": "打开日志", "gitSync.changes.title": "本机上的变更", diff --git a/ui/src/i18n/locales/zh-TW.json b/ui/src/i18n/locales/zh-TW.json index 2d9df9c5d..fc27b1d69 100644 --- a/ui/src/i18n/locales/zh-TW.json +++ b/ui/src/i18n/locales/zh-TW.json @@ -1700,6 +1700,7 @@ "sync.last.targets": "目標", "sync.last.took": "耗時", "sync.last.error": "錯誤", + "sync.last.failed": "失敗", "sync.last.never": "尚未同步過。", "sync.last.openLog": "開啟日誌", "gitSync.changes.title": "這台電腦上的變更", diff --git a/ui/src/pages/SyncPage.test.tsx b/ui/src/pages/SyncPage.test.tsx index 04e5c5e37..b812b94eb 100644 --- a/ui/src/pages/SyncPage.test.tsx +++ b/ui/src/pages/SyncPage.test.tsx @@ -49,3 +49,31 @@ describe('Sync page folder conflicts', () => { await waitFor(() => expect(api.updateTarget).toHaveBeenCalledWith('codex', { skills_enabled: false })); }); }); + +describe('Sync page last sync', () => { + const renderPage = () => render( + + + , + ); + + beforeEach(() => { + vi.clearAllMocks(); + vi.mocked(api.listTargets).mockResolvedValue({ targets: [target('codex')], sourceSkillCount: 3 }); + vi.mocked(api.diff).mockResolvedValue({ diffs: [], ignored_count: 0, ignored_skills: [], ignore_root: '', ignore_repos: [] }); + vi.mocked(api.diffExtras).mockResolvedValue({ extras: [] }); + vi.mocked(mcpApi.list).mockResolvedValue({ paths: {}, source: { targets: [], servers: {} } } as never); + }); + + it('names the targets the last sync failed', async () => { + vi.mocked(api.listLog).mockResolvedValue({ entries: [{ ts: '2026-09-30T00:00:00Z', cmd: 'sync', status: 'partial', args: { targets_total: 3, targets_failed: 2, failed_targets: ['codex', 'cursor'] } }] } as never); + renderPage(); + expect((await screen.findByText('Failed')).nextElementSibling).toHaveTextContent('codex and cursor'); + }); + + it('counts the failed targets when an older entry has no names', async () => { + vi.mocked(api.listLog).mockResolvedValue({ entries: [{ ts: '2026-09-30T00:00:00Z', cmd: 'sync', status: 'partial', args: { targets_total: 3, targets_failed: 1 } }] } as never); + renderPage(); + expect((await screen.findByText('Failed')).nextElementSibling).toHaveTextContent('1'); + }); +}); diff --git a/ui/src/pages/SyncPage.tsx b/ui/src/pages/SyncPage.tsx index 139b930a8..e67b50669 100644 --- a/ui/src/pages/SyncPage.tsx +++ b/ui/src/pages/SyncPage.tsx @@ -376,6 +376,13 @@ export default function SyncPage() {
{t('sync.last.when')}
{formatRelativeTime(last.ts, locale)}
{typeof last.args?.targets_total === 'number' && <>
{t('sync.last.targets')}
{last.args.targets_total}
} + {last.args?.targets_failed > 0 && ( + <> +
{t('sync.last.failed')}
+ {/* Entries written before failed_targets existed only have the count. */} +
{Array.isArray(last.args?.failed_targets) && last.args.failed_targets.length > 0 ? joinList(last.args.failed_targets, locale) : last.args?.targets_failed}
+ + )} {typeof last.ms === 'number' && <>
{t('sync.last.took')}
{(last.ms / 1000).toFixed(1)} s
} {last.msg && <>
{t('sync.last.error')}
{last.msg}
}