From 13ffe9b42fb05cee7cd0c76ceab2b8fc0bb862d8 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 6 Dec 2026 08:02:40 +0800 Subject: [PATCH] refactor(native): share single-observation Mach-O UUID reconciliation (#17300) --- src/native/parsers/machoUuid.ts | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/native/parsers/machoUuid.ts b/src/native/parsers/machoUuid.ts index b57870551be..faeae53f885 100644 --- a/src/native/parsers/machoUuid.ts +++ b/src/native/parsers/machoUuid.ts @@ -183,28 +183,23 @@ const reconcileObservations = ( ], }; } - if (dwarfdump.kind === "valid" && loadUuid.kind === "conflict") - return { value: null, limitations: [loadUuid.reason] }; - if (loadUuid.kind === "valid" && dwarfdump.kind === "conflict") - return { value: null, limitations: [dwarfdump.reason] }; - if (dwarfdump.kind === "valid") + const valid = dwarfdump.kind === "valid" ? dwarfdump : loadUuid; + const other = dwarfdump.kind === "valid" ? loadUuid : dwarfdump; + if (valid.kind === "valid") { + if (other.kind === "conflict") + return { value: null, limitations: [other.reason] }; + const source = + dwarfdump.kind === "valid" + ? "dwarfdump UUID" + : "binary load commands LC_UUID"; return { - value: dwarfdump.value, + value: valid.value, limitations: - loadUuid.kind === "invalid" - ? [`${loadUuid.reason}; using the unambiguous dwarfdump UUID.`] - : [], - }; - if (loadUuid.kind === "valid") - return { - value: loadUuid.value, - limitations: - dwarfdump.kind === "invalid" - ? [ - `${dwarfdump.reason}; using the unambiguous binary load commands LC_UUID.`, - ] + other.kind === "invalid" + ? [`${other.reason}; using the unambiguous ${source}.`] : [], }; + } return { value: null,