From 2f2ea8c5dfef21d9bc299e9f13495ec31d9a2843 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Fri, 28 Aug 2026 08:34:11 -0700 Subject: [PATCH] test(skills): pin that a later granting source still grants visibility find() let the first source at a path decide; the ordering is only observable when two roots resolve to one path with different owners. --- .../use-native-chat-skills.test.ts | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/renderer/src/components/native-chat/use-native-chat-skills.test.ts b/src/renderer/src/components/native-chat/use-native-chat-skills.test.ts index 575b9808e1e..ce2cbb93ecd 100644 --- a/src/renderer/src/components/native-chat/use-native-chat-skills.test.ts +++ b/src/renderer/src/components/native-chat/use-native-chat-skills.test.ts @@ -123,6 +123,35 @@ describe('isNativeChatSkillForAgent', () => { }) expect(isNativeChatSkillForAgent('claude', codexOnly, result)).toBe(false) }) + + it('does not let a non-granting source at a path hide a granting one behind it', () => { + // Two roots can resolve to one path (see `rootScanKey` in main/skills/discovery.ts), + // and a provider root override can put an unowned root ahead of the agent's own. + const result = { + sources: [ + { + id: 'shared-home', + label: 'Agent skills home', + path: '/Users/test/.claude/skills', + sourceKind: 'home' as const, + providers: ['agent-skills' as const], + owner: null, + exists: true + }, + { + id: 'home-claude', + label: 'Claude home', + path: '/Users/test/.claude/skills', + sourceKind: 'home' as const, + providers: ['claude' as const], + owner: 'claude' as const, + exists: true + } + ] + } satisfies Pick + const shared = skill({ rootPath: '/Users/test/.claude/skills' }) + expect(isNativeChatSkillForAgent('claude', shared, result)).toBe(true) + }) }) describe('resolveNativeChatSkillDiscoveryCwd', () => {