fix(firmware): retain multi-file extraction failures (#978)

This commit is contained in:
morluto
2026-10-07 23:06:41 +08:00
committed by GitHub
parent d5c43d65f0
commit 8aaf9a1978
2 changed files with 74 additions and 0 deletions
+62
View File
@@ -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 [
+12
View File
@@ -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(