diff --git a/ui/src/components/sync/syncView.test.ts b/ui/src/components/sync/syncView.test.ts index 6c28be0fa..fd4ee3ed9 100644 --- a/ui/src/components/sync/syncView.test.ts +++ b/ui/src/components/sync/syncView.test.ts @@ -2,7 +2,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import { api, type DiffTarget, type Target } from '../../api/client'; import { hooksApi, type HookPlan } from '../../api/hooks'; import { mcpApi, type MCPPlan } from '../../api/mcp'; -import { changeSets, countChanges, countEdited, discardable, extraGroups, failureExplanation, groupByFolder, groupInSync, HOOKS_CHANGED, hooksGroups, MCP_CHANGED, mcpGroups, otherWarnings, pendingCount, resourceGroups, runSync, skippedHintKeys, type SyncFailure } from './syncView'; +import { changeSets, countChanges, countEdited, discardable, extraGroups, failureExplanation, groupByFolder, groupInSync, HOOKS_CHANGED, hooksGroups, MCP_CHANGED, mcpGroups, otherWarnings, pendingCount, receivesSkill, resourceGroups, runSync, skippedHintKeys, type SyncFailure } from './syncView'; vi.mock('../../api/client', async (load) => ({ ...await load(), api: { sync: vi.fn(), syncExtras: vi.fn() } })); vi.mock('../../api/mcp', async (load) => ({ ...await load(), mcpApi: { preview: vi.fn(), configure: vi.fn() } })); @@ -318,3 +318,13 @@ describe('skippedHintKeys', () => { expect(skippedHintKeys({ target: 'codex', items: [], ...counts })).toEqual(key); }); }); + +// The matrix reports both as 'na'; only a symlinked folder carries the skill (issue #925). +describe('receivesSkill', () => { + it.each([ + ['symlink mode — filters not applicable', 'sync_matrix.symlink_filters_not_applicable', true], + ['skills off for this target', undefined, false], + ])('reads %s as %s → %s', (reason, reasonCode, expected) => { + expect(receivesSkill({ skill: 'pdf', target: 'copilot', status: 'na', reason, reasonCode })).toBe(expected); + }); +}); diff --git a/ui/src/pages/ResourceDetailPage.tsx b/ui/src/pages/ResourceDetailPage.tsx index b7eb13779..bbec8daf3 100644 --- a/ui/src/pages/ResourceDetailPage.tsx +++ b/ui/src/pages/ResourceDetailPage.tsx @@ -19,6 +19,7 @@ import { repoOf, sourceLinkOf } from '../lib/resourceGrouping'; import { targetFilterPatch } from '../lib/targetFilter'; import { useSyncMatrix } from '../hooks/useSyncMatrix'; import { projectUrl } from '../components/projects/projectView'; +import { receivesSkill } from '../components/sync/syncView'; import { formatDateTime, formatRelativeTime, useI18n, useT, plural } from '../i18n'; import AgentIcon from '../components/AgentIcon'; import Button from '../components/Button'; @@ -586,7 +587,7 @@ function TargetsSection({ resource }: { resource: Skill }) { const entry = entries.get(target.name); const action = diffQuery.data?.diffs.find((d) => d.target === target.name)?.items .find((i) => i.skill === resource.flatName && (i.kind ?? 'skill') === 'skill')?.action; - return { target, entry, action, on: entry?.status === 'synced' || entry?.status === 'na' }; + return { target, entry, action, on: !!entry && receivesSkill(entry) }; }); const supported = rows.filter((r) => r.entry); @@ -620,7 +621,8 @@ function TargetsSection({ resource }: { resource: Skill }) { case 'skill_target_mismatch': return t('resourceDetail.targets.mismatch'); case 'na': - return t('resourceDetail.targets.symlink'); + // Skills switched off for the target is 'na' too, but nothing syncs there. + return t(receivesSkill(entry) ? 'resourceDetail.targets.symlink' : 'targets.skillsOff'); default: return null; } @@ -695,7 +697,7 @@ export function ProjectsList({ resource, diffs, statusText }: { } const projects = [...byProject.values()].sort((a, b) => a.name.localeCompare(b.name)); if (projects.length === 0) return null; - const on = (p: (typeof projects)[number]) => p.rows.some((r) => r.entry.status === 'synced' || r.entry.status === 'na'); + const on = (p: (typeof projects)[number]) => p.rows.some((r) => receivesSkill(r.entry)); return ( <>