fix: search prints no results when a skills.sh row matches (#3379)

Normalize skills.sh installs into the canonical downloads field so released clients can parse and render mixed-source search results.
This commit is contained in:
Santiago
2026-08-03 19:10:44 -07:00
committed by GitHub
parent d1f9b87f43
commit fd9902b58b
6 changed files with 28 additions and 3 deletions
+1
View File
@@ -2114,6 +2114,7 @@ describe("httpApiV1 handlers", () => {
source: "skills-sh",
slug: "find-skills",
score: 5_095,
downloads: 3_062,
canonicalUrl: "/skills-sh/vercel-labs/skills/find-skills",
},
];
+1
View File
@@ -1365,6 +1365,7 @@ describe("search helpers", () => {
install: { reference: "skills-sh:acme/skills/calendar" },
icon: null,
sourceIdentity: { lifetimeInstalls: 10_000_000 },
downloads: 10_000_000,
});
});
+2 -2
View File
@@ -621,7 +621,7 @@ type CanonicalSkillSearchResult = {
// Compatibility fields retained for existing CLI/OpenClaw parsers.
ownerHandle: string | null;
version: string | null;
downloads: number | null;
downloads: number;
updatedAt: number;
};
@@ -812,7 +812,7 @@ function buildExternalCanonicalResult(
native: null,
ownerHandle: sourceOwner,
version: null,
downloads: null,
downloads: digest.upstreamInstalls,
};
}
@@ -74,6 +74,12 @@ describe("packages/clawhub skill metadata schema", () => {
displayName: "Calendar",
summary: "Calendar workflows",
score: 6_110,
// The canonical downloads field normalizes the source-owned count:
// ClawHub downloads for native rows, skills.sh installs for mirrors.
version: null,
downloads: 99_000,
ownerHandle: "acme",
updatedAt: 10,
canonicalUrl: "/skills-sh/acme/skills/calendar",
official: false,
featured: false,
@@ -124,6 +130,7 @@ describe("packages/clawhub skill metadata schema", () => {
]);
expect(parsed.results[0]?.install?.reference).toBe("skills-sh:acme/skills/calendar");
expect(parsed.results[0]?.trust?.sourceFreshness).toBe("observed-only");
expect(parsed.results[0]?.downloads).toBe(99_000);
});
it("parses pending package publish responses with legacy IDs", () => {
+16
View File
@@ -508,6 +508,22 @@ describe("clawhub-schema", () => {
expect(parsed.results[0]?.owner?.displayName).toBe("OpenClaw");
});
it("parses canonical skills.sh download counters", () => {
// Search normalizes skills.sh installs into the canonical downloads field,
// so already-released clients can parse mixed-source results unchanged.
const parsed = parseArk(
ApiV1SearchResponseSchema,
{
results: [
{ slug: "humanizer", score: 6_110, version: null, downloads: 2_190, ownerHandle: "acme" },
],
},
"Search",
);
expect(parsed.results[0]?.downloads).toBe(2_190);
});
it("parses flattened skill verification envelopes", () => {
const parsed = parseArk(
ApiV1SkillVerifyResponseSchema,
+1 -1
View File
@@ -77,7 +77,7 @@ export type SkillSearchEntry = {
} | null;
ownerHandle: string | null;
version: string | null;
downloads: number | null;
downloads: number;
updatedAt: number;
};