From d06d6a61103ca89ff4809aab50ef184c32df3cdf Mon Sep 17 00:00:00 2001 From: ShuaixinHuang <1836656514@qq.com> Date: Fri, 20 Nov 2026 06:24:01 +0800 Subject: [PATCH] fix(ci): preserve UEFI decoder reachability in Knip (#12545) Co-authored-by: ShuaixinHuang --- src/domain/uefi/uefiFirmwareAnalysis.ts | 9 --------- src/uefi/UefiCodeTables.ts | 10 ---------- src/uefi/UefiLzmaWorker.ts | 6 +++--- tests/fixtures/uefiImage.ts | 10 ---------- 4 files changed, 3 insertions(+), 32 deletions(-) diff --git a/src/domain/uefi/uefiFirmwareAnalysis.ts b/src/domain/uefi/uefiFirmwareAnalysis.ts index 25f996ea63..d91ba65af9 100644 --- a/src/domain/uefi/uefiFirmwareAnalysis.ts +++ b/src/domain/uefi/uefiFirmwareAnalysis.ts @@ -60,11 +60,6 @@ export const ffsChecksumVerdictSchema = z.enum([ "pad-file-unchecked", "unchecked", ]); -/** FFS file types that carry sections in FFS2 layout. */ -export const sectionedFfsTypeNameSchema = ffsTypeNameSchema.exclude([ - "raw", - "freeform", -]); const alignmentSchema = z.enum([ "1", "16", @@ -529,10 +524,6 @@ export type UefiInspectResult = z.infer< export type UefiExtractResult = z.infer< (typeof uefiResultSchemas)["extract_uefi_firmware"] >; -export type UefiNvramVariableRecord = z.infer< - typeof uefiNvramVariableRecordSchema ->; -export type UefiNvramStoreRecord = z.infer; export type UefiNvramInspectResult = z.infer< (typeof uefiResultSchemas)["inspect_uefi_nvram"] >; diff --git a/src/uefi/UefiCodeTables.ts b/src/uefi/UefiCodeTables.ts index a5c17851f2..1757553384 100644 --- a/src/uefi/UefiCodeTables.ts +++ b/src/uefi/UefiCodeTables.ts @@ -76,16 +76,6 @@ export const FFS_ATTRIBUTE_MASKS = { checksumValid: 0x40, } as const; -/** FFS state bits after erase-polarity normalization (PI Specification 3.3.5). */ -export const FFS_STATE_BITS = { - headerConstruction: 0x01, - headerValid: 0x02, - dataValid: 0x04, - markedForUpdate: 0x08, - deleted: 0x10, - headerInvalid: 0x20, -} as const; - /** FIRMWARE_VOLUME_ATTRIBUTES: bit 0x800 marks bits-on-erased-when-set polarity. */ export const FV_ATTRIBUTE_ERASE_POLARITY = 0x800; diff --git a/src/uefi/UefiLzmaWorker.ts b/src/uefi/UefiLzmaWorker.ts index a9b3facd9e..120d6a01aa 100644 --- a/src/uefi/UefiLzmaWorker.ts +++ b/src/uefi/UefiLzmaWorker.ts @@ -63,9 +63,9 @@ const main = async (): Promise => { ); let reply: UefiLzmaReply; try { - const require2 = createRequire(import.meta.url); - const lzma = require2("lzma-purejs"); - const workerModulePath = require2.resolve("lzma-purejs"); + const require = createRequire(import.meta.url); + const lzma = require("lzma-purejs"); + const workerModulePath = require.resolve("lzma-purejs"); const upstreamMetadata = JSON.parse( await readFile(join(workerModulePath, "..", "package.json"), "utf8"), ); diff --git a/tests/fixtures/uefiImage.ts b/tests/fixtures/uefiImage.ts index 90b9775b5f..b1fef15dda 100644 --- a/tests/fixtures/uefiImage.ts +++ b/tests/fixtures/uefiImage.ts @@ -1,7 +1,5 @@ import { Buffer } from "node:buffer"; -import { formatGuidLittleEndian } from "../../src/uefi/UefiGuid.js"; - /** LZMA custom GUIDed-section definition GUID (display form). */ export const GUID_LZMA_CUSTOM_DISPLAY = "ee4e5898-3914-4259-9d6e-dc7bd79403cf"; @@ -279,11 +277,3 @@ export function buildImage(spec: ImageSpec): Buffer { } return Buffer.concat(chunks); } - -/** Round-trip sanity: a built FV header must parse its checksum as valid. */ -export function assertBuiltFvHeaderIntegrity(fv: BuiltFv): void { - const guid = formatGuidLittleEndian(fv.buffer, 16); - if (guid == null || guid !== "8c8ce578-8a3d-4f1c-9935-896185c32dd3") { - throw new Error("fixture FV header GUID mismatch"); - } -}