mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-04 11:01:16 +01:00
Guard runtime skill mention lookup
This commit is contained in:
1 parent
8b85fdfa3c
commit
62c74820cc
2 files changed
+21
-5
No files matched your search
@@ -274,9 +274,11 @@ describe("resolveExecutionRunAdapterConfig", () => {
|
||||
});
|
||||
|
||||
describe("extractMentionedSkillIdsFromSources", () => {
|
||||
it("collects explicit skill mention ids across issue sources", () => {
|
||||
const releaseHref = buildSkillMentionHref("skill-1", "release-changelog");
|
||||
const browserHref = buildSkillMentionHref("skill-2", "agent-browser");
|
||||
it("collects UUID skill mention ids across issue sources", () => {
|
||||
const releaseSkillId = "11111111-1111-4111-8111-111111111111";
|
||||
const browserSkillId = "22222222-2222-4222-8222-222222222222";
|
||||
const releaseHref = buildSkillMentionHref(releaseSkillId, "release-changelog");
|
||||
const browserHref = buildSkillMentionHref(browserSkillId, "agent-browser");
|
||||
|
||||
expect(
|
||||
extractMentionedSkillIdsFromSources([
|
||||
@@ -284,7 +286,19 @@ describe("extractMentionedSkillIdsFromSources", () => {
|
||||
`And also [/agent-browser](${browserHref})`,
|
||||
`Duplicate mention [/release-changelog](${releaseHref})`,
|
||||
]),
|
||||
).toEqual(["skill-1", "skill-2"]);
|
||||
).toEqual([releaseSkillId, browserSkillId]);
|
||||
});
|
||||
|
||||
it("ignores legacy non-UUID skill mention ids before runtime database lookup", () => {
|
||||
const validSkillId = "33333333-3333-4333-8333-333333333333";
|
||||
const validHref = buildSkillMentionHref(validSkillId, "greploop");
|
||||
const legacyHref = buildSkillMentionHref("skill-greploop", "greploop");
|
||||
|
||||
expect(
|
||||
extractMentionedSkillIdsFromSources([
|
||||
`Use [/greploop](${legacyHref}) and [/prcheckloop](${validHref})`,
|
||||
]),
|
||||
).toEqual([validSkillId]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -528,7 +528,9 @@ export function extractMentionedSkillIdsFromSources(
|
||||
for (const source of sources) {
|
||||
if (typeof source !== "string" || source.length === 0) continue;
|
||||
for (const skillId of extractSkillMentionIds(source)) {
|
||||
mentionedIds.add(skillId);
|
||||
if (isUuidLike(skillId)) {
|
||||
mentionedIds.add(skillId);
|
||||
}
|
||||
}
|
||||
}
|
||||
return [...mentionedIds];
|
||||
|
||||
Reference in new issue
Block a user