From e36c38abfce96b9a08a71874c86fc1896e595293 Mon Sep 17 00:00:00 2001 From: Willie Date: Thu, 8 Oct 2026 12:34:59 +0800 Subject: [PATCH] fix(ui): show a skill and an agent with the same name as two sync rows The sync item grid indexed rows by display path, so a skill "reviewer" and an agent "reviewer.md" collapsed into one entry while the header still counted two changes. Keep every row under a shared path. --- ui/src/pages/SyncPage.test.tsx | 12 ++++++++++++ ui/src/pages/SyncPage.tsx | 10 ++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ui/src/pages/SyncPage.test.tsx b/ui/src/pages/SyncPage.test.tsx index 2182ebdb3..f2d29dd8a 100644 --- a/ui/src/pages/SyncPage.test.tsx +++ b/ui/src/pages/SyncPage.test.tsx @@ -115,6 +115,18 @@ describe('Sync page last sync', () => { expect(screen.queryByRole('button', { name: 'Discard all' })).toBeNull(); }); + it('lists a skill and an agent with the same name as two changes', async () => { + vi.mocked(api.listTargets).mockResolvedValue({ targets: [target('codex')], sourceSkillCount: 1 }); + vi.mocked(api.diff).mockResolvedValue({ + diffs: [{ target: 'codex', items: [{ skill: 'reviewer', action: 'link', reason: 'new' }, { skill: 'reviewer', kind: 'agent', action: 'link', reason: 'new' }] }], + ignored_count: 0, ignored_skills: [], ignore_root: '', ignore_repos: [], + } as never); + renderPage(); + + expect(await screen.findByText(/Sync 2 changes/)).toBeInTheDocument(); + expect(screen.getAllByText('reviewer', { selector: '.grid-cols-3 .truncate' })).toHaveLength(2); + }); + 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(); diff --git a/ui/src/pages/SyncPage.tsx b/ui/src/pages/SyncPage.tsx index 475303193..286ae0094 100644 --- a/ui/src/pages/SyncPage.tsx +++ b/ui/src/pages/SyncPage.tsx @@ -207,16 +207,18 @@ export default function SyncPage() { /** Skill and agent changes as names by folder, three to a line: hundreds of rows stay readable. */ const itemGrid = (rows: ChangeGroup['rows'], icons = true, from = '') => { - const byPath = new Map(rows.map((r) => [display(r), r])); + // A skill and an agent can share a display path, so a path holds a list. + const byPath = new Map(); + for (const r of rows) byPath.set(display(r), [...(byPath.get(display(r)) ?? []), r]); return groupByFolder([...byPath.keys()]).map(({ folder, items }) => { // The head already names the shared root, so a folder drops it. const label = (from && folder.startsWith(`${from}/`) && folder !== `${from}/` ? folder.slice(from.length + 1) : folder).replace(/\/$/, ''); + const entries = items.flatMap((name) => byPath.get(folder + name)!.map((r) => ({ name, r }))); return (
- {folder &&
{label} · {items.length}
} + {folder &&
{label} · {entries.length}
}
- {items.map((name) => { - const r = byPath.get(folder + name)!; + {entries.map(({ name, r }) => { const why = r.text ? t(r.text) : r.detail; return {icons && rowIcon(r.icon, true)}{name}; })}