fix(android): report method disassembly failure as unavailable body (#12090)

* fix(android): report method disassembly failure as unavailable body

Catch JADX bridge get_method_body failures in inspectMethod and project as an unavailable body with disassembly_failed marker, avoiding generic execution_failure with irrelevant rea doctor remediation.

Fixes #10482

* fix(android): preserve method identity when disassembly is unavailable

* fix(android): retain method identity when smali generation fails

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
Ahmedandmorluto authored and GitHub committed 2026-11-18 15:23:34 -05:00
1 parent 486470ec9b
commit dc6799d488
10 files changed
+251 -65

No files matched your search

@@ -217,21 +217,38 @@ it.each(["inspect_android_class", "inspect_android_method"] as const)(
},
);
it("preserves native absence and optional historical omission without inventing mapping facts", () => {
const { mapping: _mapping, ...native } = methodReport();
const facts = {
...native,
body_status: "not_available",
it.each([
{
markers: ["native_method"],
source: { status: "complete", text: "", reported_total_bytes: 0 },
};
const { parent } = fixture("inspect_android_method", facts);
const result = projectAnalysisView(parent, { kind: "summary" });
if (!result.ok) throw result.error;
const view = androidMethodSummaryViewResultSchema.parse(result.value);
expect(view.summary).toEqual(facts);
expect(Object.hasOwn(view.summary, "mapping")).toBe(false);
});
},
{
representation: null,
body_unavailable_reason:
"Selected method disassembly is incomplete: update()V",
markers: ["disassembly_failed"],
source: null,
},
])(
"preserves method absence with $markers and historical omission of mapping",
(absence) => {
const { mapping: _mapping, ...method } = methodReport();
const facts = {
...method,
body_status: "not_available",
fell_back: false,
...absence,
};
const { parent } = fixture("inspect_android_method", facts);
const result = projectAnalysisView(parent, { kind: "summary" });
if (!result.ok) throw result.error;
const view = androidMethodSummaryViewResultSchema.parse(result.value);
expect(view.summary).toEqual(facts);
expect(Object.hasOwn(view.summary, "mapping")).toBe(false);
if (absence.source === null)
expect(view.unknowns).toContain(absence.body_unavailable_reason);
},
);
it.each(["inspect_android_class", "inspect_android_method"] as const)(
"rejects malformed historical %s facts with a typed source error",
+4 -1
View File
@@ -127,7 +127,10 @@ export const projectAndroidSymbolSummary = (
summary: parsed.value,
unknowns: [
...shared.unknowns,
...(parsed.value.source.status === "partial"
...(parsed.value.source === null
? [parsed.value.body_unavailable_reason]
: []),
...(parsed.value.source?.status === "partial"
? [
"The selected method source is partial; retained text does not establish a complete method body.",
]