diff --git a/src/firmware/FirmwareReports.test.ts b/src/firmware/FirmwareReports.test.ts index 8f658a6cc..2546c8005 100644 --- a/src/firmware/FirmwareReports.test.ts +++ b/src/firmware/FirmwareReports.test.ts @@ -74,6 +74,68 @@ describe("firmware producer boundaries", () => { ]); expect(normalized.coverage).toBe("partial"); }); +}); + +describe("Unblob multi-file extraction diagnostics", () => { + it("retains nested MultiFile extraction failures in partial coverage", () => { + const outputPath = `${context.outputRoot}/multi`; + const childTask = { + path: outputPath, + depth: 1, + blob_id: "multi-id", + is_multi_file: true, + }; + const extractionFailure = { + __typename__: "ExtractorDependencyNotFoundReport", + severity: "ERROR", + dependencies: ["sasquatch"], + }; + const multiFileReport = { + __typename__: "MultiFileReport", + id: "multi-id", + handler_name: "multipart-firmware", + name: "rootfs", + paths: [`${outputPath}/part-a`, `${outputPath}/part-b`], + extraction_reports: [extractionFailure], + }; + const parent = root(); + const normalized = normalizeUnblobReport( + [ + { + ...parent, + reports: parent.reports.filter( + (item) => item.__typename__ !== "UnknownChunkReport", + ), + subtasks: [childTask], + }, + { + task: childTask, + reports: [ + { + __typename__: "StatReport", + path: outputPath, + size: 0, + is_dir: true, + is_file: false, + is_link: false, + link_target: null, + }, + multiFileReport, + ], + subtasks: [], + }, + ], + context, + ); + + expect(normalized.coverage).toBe("partial"); + expect(normalized.diagnostics).toEqual([ + { input_path: "$output/multi", report: multiFileReport }, + ]); + }); +}); + +describe("firmware producer boundaries", () => { it("rejects unknown tasks outside the owned output and disconnected task graphs", () => { const record = root(); for (const path of [ diff --git a/src/firmware/FirmwareReports.ts b/src/firmware/FirmwareReports.ts index 67826d0ad..3a7e93d48 100644 --- a/src/firmware/FirmwareReports.ts +++ b/src/firmware/FirmwareReports.ts @@ -43,6 +43,13 @@ const stat = z.object({ is_link: z.boolean(), link_target: z.string().nullable(), }); +const multiFile = z.object({ + id: z.string(), + handler_name: z.string(), + name: z.string(), + paths: z.array(z.string()), + extraction_reports: z.array(jsonValueSchema), +}); const hashes = z.object({ sha256: digestSchema }); const region = z.object({ id: z.string(), @@ -243,6 +250,11 @@ export const normalizeUnblobReport = ( : null, }); } + if (item.__typename__ === "MultiFileReport") { + const parsed = multiFile.parse(item); + if (parsed.extraction_reports.length > 0) + diagnostics.push({ input_path: path, report: item }); + } } } const recordsByPath = new Map(