fix(native): keep truncated empty class-import scans partial (#6153)

* fix(native): keep truncated empty class-import scans partial

An explicitly present empty objc_class_import_addresses list with
objc_class_import_addresses_complete false reported binding coverage as
not_requested with a null reason, discarding the caller's declaration that
the candidate scan was truncated. Only an omitted list, or an empty list
declared complete, is not a request; a truncated empty scan now reports
partial coverage with the existing record-budget reason and zero examined
and decoded addresses.

Refs #6086

* test(native): cover empty truncated class-import candidate scans

Refs #6086
This commit is contained in:
Vinícius Andrade authored and GitHub committed 2026-10-23 02:22:23 +08:00
1 parent 6da3839b57
commit ab2119e9b8
2 files changed
+24 -1

No files matched your search

@@ -201,4 +201,25 @@ describe("Objective-C import binding address inspection", () => {
},
});
});
it("keeps an explicitly truncated empty candidate scan partial", () => {
expect(
inspectObjcClassImportBindings(
createInput({ addresses: [], addressesComplete: false }),
),
).toMatchObject({
bindings: [],
coverage: {
status: "partial",
examined: 0,
decoded: 0,
reason: expect.stringContaining("max_records limit"),
},
});
expect(
inspectObjcClassImportBindings(
createInput({ addresses: [], addressesComplete: true }),
).coverage,
).toMatchObject({ status: "not_requested", reason: null, examined: 0 });
});
});
+3 -1
View File
@@ -23,7 +23,9 @@ export const inspectObjcClassImportBindings = (input: {
}): ObjcClassImportBindingScan => {
const { bytes, layout, fixups, addresses, addressesComplete, maxRecords } =
input;
if (addresses === undefined || addresses.length === 0)
// An explicitly truncated candidate scan keeps its limitation even when no
// candidate was retained.
if (addresses === undefined || (addresses.length === 0 && addressesComplete))
return {
bindings: [],
coverage: {