Harden issue artifact metadata

This commit is contained in:
Dotta 2026-05-30 19:34:44 +00:00
parent 96d266109b
commit bbf77fcb69
6 changed files with 292 additions and 5 deletions

View file

@ -100,6 +100,7 @@ describe("getIssueOutputs", () => {
const result = getIssueOutputs([
makeWorkProduct({ id: "pr-1", type: "pull_request" }),
makeWorkProduct({ id: "doc-1", type: "document" }),
makeWorkProduct({ id: "artifact-1", type: "artifact", provider: "custom", metadata: videoMetadata() }),
]);
expect(result.count).toBe(0);
expect(result.primary).toBeNull();

View file

@ -123,7 +123,7 @@ function toTime(value: string | Date): number {
* marked primary) comes first, then remaining artifacts by most-recent.
*/
export function getIssueOutputs(workProducts: IssueWorkProduct[] | null | undefined): IssueOutputs {
const artifacts = (workProducts ?? []).filter((wp) => wp.type === "artifact");
const artifacts = (workProducts ?? []).filter((wp) => wp.type === "artifact" && wp.provider === "paperclip");
const items: IssueOutputItem[] = artifacts.map((wp) => {
const parsed = attachmentArtifactWorkProductMetadataSchema.safeParse(wp.metadata);