mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 19:53:50 +00:00
refactor(native)!: report kernel build config coverage as partial or unknown instead of incomplete (#11486)
inspect_kernel_build_config coverage.status was `incomplete` for a config cut by the searched bytes or a budget-stopped search (known gaps), for a malformed framed config, and for a payload that was never searched (examined_bytes 0). Coverage now uses the shared status: `partial` for the known gaps, `unknown` when a config's existence or contents cannot be determined; `unsupported` is unchanged. config.status keeps its own values, and the service's consistency check pairs each config state with its coverage. BREAKING CHANGE: inspect_kernel_build_config `coverage.status` reports `partial` (config_gzip_truncated, config_search_exhausted) or `unknown` (malformed config, payload not searched) instead of `incomplete`.
This commit is contained in:
1 parent
0a9e736aea
commit
acb10754c1
9 files changed
+71
-23
No files matched your search
@@ -204,7 +204,7 @@ it("reports a framed member whose text fails the grammar as malformed, not absen
|
||||
option_count: 0,
|
||||
entries: [],
|
||||
});
|
||||
expect(report.coverage.status).toBe("incomplete");
|
||||
expect(report.coverage.status).toBe("unknown");
|
||||
expect(
|
||||
report.limitations.some((line) => line.includes("not a .config")),
|
||||
).toBe(true);
|
||||
@@ -219,7 +219,7 @@ it("reports a framed member with a bad CRC-32 as malformed, not absent", async (
|
||||
sha256: null,
|
||||
option_count: 0,
|
||||
});
|
||||
expect(report.coverage.status).toBe("incomplete");
|
||||
expect(report.coverage.status).toBe("unknown");
|
||||
expect(report.limitations.some((line) => line.includes("CRC-32"))).toBe(true);
|
||||
});
|
||||
|
||||
@@ -274,7 +274,7 @@ it("reports a framed member that does not decode as malformed, not absent", asyn
|
||||
gzip: { space: "file", offset: 8, bytes: body.length },
|
||||
end_marker: { space: "file", offset: bytes.length - 8, bytes: 8 },
|
||||
});
|
||||
expect(report.coverage.status).toBe("incomplete");
|
||||
expect(report.coverage.status).toBe("unknown");
|
||||
expect(
|
||||
(await parse(Buffer.concat([bytes, embeddedKernelConfig()]))).config
|
||||
.status,
|
||||
@@ -296,7 +296,7 @@ it("reports a truncated IKCFG member as incomplete, not absent", async () => {
|
||||
status: "incomplete",
|
||||
reason: "config_gzip_truncated",
|
||||
});
|
||||
expect(report.coverage.status).toBe("incomplete");
|
||||
expect(report.coverage.status).toBe("partial");
|
||||
});
|
||||
|
||||
it("inflates a bzImage gzip payload and reports payload-relative offsets", async () => {
|
||||
@@ -332,15 +332,16 @@ it("names an xz bzImage payload as unsupported without searching it", async () =
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps truncated and unusable bzImage payloads incomplete", async () => {
|
||||
it("keeps coverage unknown for truncated and unusable bzImage payloads", async () => {
|
||||
const truncated = await parse(bzImageTruncatedGzipFixture());
|
||||
expect(truncated.payload.status).toBe("truncated");
|
||||
expect(truncated.config.reason).toBe("payload_truncated");
|
||||
expect(truncated.coverage.status).toBe("incomplete");
|
||||
expect(truncated.coverage.status).toBe("unknown");
|
||||
|
||||
const old = await parse(bzImageFixture(gzipSync("x"), { version: 0x0206 }));
|
||||
expect(old.payload.status).toBe("unavailable");
|
||||
expect(old.config.reason).toBe("setup_header_payload_unavailable");
|
||||
expect(old.coverage).toMatchObject({ status: "unknown", examined_bytes: 0 });
|
||||
|
||||
const short = bzImageFixture(gzipSync("x"));
|
||||
short.writeUInt32LE(0xffff, 0x24c);
|
||||
@@ -414,7 +415,7 @@ it("stops inflating decoy candidates after the candidate cap and reports incompl
|
||||
reason: "config_search_exhausted",
|
||||
marker: null,
|
||||
});
|
||||
expect(report.coverage.status).toBe("incomplete");
|
||||
expect(report.coverage.status).toBe("partial");
|
||||
expect(
|
||||
report.limitations.some((line) => line.includes("16 IKCFG_ST gzip")),
|
||||
).toBe(true);
|
||||
@@ -737,7 +738,7 @@ it("retains incomplete coverage for a partial config end marker", async () => {
|
||||
reason: "config_gzip_truncated",
|
||||
entries: [],
|
||||
});
|
||||
expect(report.coverage.status).toBe("incomplete");
|
||||
expect(report.coverage.status).toBe("partial");
|
||||
});
|
||||
|
||||
it("ignores marker bytes inside a gzip member", async () => {
|
||||
|
||||
@@ -769,7 +769,6 @@ const reportFromSearch = async (
|
||||
...blobRanges(found, search.space),
|
||||
}
|
||||
: acceptedConfig(found, input, search.space);
|
||||
const complete = found === "absent" || config.status === "present";
|
||||
const banner = await findBanner(search.bytes, search.space, signal);
|
||||
return {
|
||||
artifact,
|
||||
@@ -779,7 +778,14 @@ const reportFromSearch = async (
|
||||
banner,
|
||||
config,
|
||||
coverage: {
|
||||
status: complete ? "complete" : "incomplete",
|
||||
status:
|
||||
found === "absent" || config.status === "present"
|
||||
? "complete"
|
||||
: // A member cut by the searched bytes, or candidates the budget
|
||||
// left uninflated, is a known gap; a malformed config is unreadable.
|
||||
found === "truncated" || found === "exhausted"
|
||||
? "partial"
|
||||
: "unknown",
|
||||
examined_bytes: search.bytes.length,
|
||||
examined_entries: config.option_count,
|
||||
},
|
||||
@@ -857,7 +863,12 @@ const closedReport = (
|
||||
: null,
|
||||
banner: absentBanner("unknown"),
|
||||
config: emptyConfig(input, status, reason),
|
||||
coverage: { status, examined_bytes: 0, examined_entries: 0 },
|
||||
// Nothing was searched, so whether a config exists cannot be determined.
|
||||
coverage: {
|
||||
status: status === "incomplete" ? "unknown" : status,
|
||||
examined_bytes: 0,
|
||||
examined_entries: 0,
|
||||
},
|
||||
limitations: [...baseLimitations(), limitation],
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user