Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ export const AWESOME_CLAUDE_CONTENT_SPEC: ContentRepoSpec = {
"repositoryUrl",
"sourceUrl",
"websiteUrl",
// snake_case aliases, matching urlFields one-for-one (#7250): source-evidence.ts read only the camelCase
// names, so an entry using a legitimately-listed snake_case key (e.g. the canonical `source_url`) was visible
// to duplicates.ts but invisible to the source-evidence gate.
"docs_url",
"download_url",
"github_url",
"package_url",
"repo_url",
"repository_url",
"source_url",
"website_url",
],
sourceUrlListFields: new Set(["sourceUrls", "retrievalSources"]),
distributionSourceFields: new Set(["downloadUrl", "packageUrl"]),
Expand Down
12 changes: 12 additions & 0 deletions test/unit/content-lane-source-evidence.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ describe("extractSubmittedSourceUrls", () => {
const urls = extractSubmittedSourceUrls(mdx({ downloadUrl: "/downloads/skills/foo.zip" }));
expect(urls).toHaveLength(0);
});

it("reads snake_case source fields (e.g. the canonical source_url), matching urlFields (#7250)", () => {
// Before #7250, sourceUrlFields listed only the camelCase names, so a legitimately-aliased snake_case field
// was invisible to the source-evidence gate even though duplicates.ts (which reads urlFields) saw it.
const pairs = extractSubmittedSourceUrls(mdx({ source_url: "https://github.com/acme/y" })).map((u) => `${u.field}:${u.url}`);
expect(pairs).toContain("source_url:https://github.com/acme/y");
// Every snake_case alias urlFields carries is now recognized here too.
for (const field of ["docs_url", "download_url", "github_url", "package_url", "repo_url", "repository_url", "source_url", "website_url"]) {
expect(AWESOME_CLAUDE_CONTENT_SPEC.sourceUrlFields).toContain(field);
expect(AWESOME_CLAUDE_CONTENT_SPEC.urlFields.has(field)).toBe(true);
}
});
});

describe("checkSubmittedSourceEvidence", () => {
Expand Down