fix(android): report validated ADB and Apktool host availability
Probe the selected clients through their owning providers and expose current host availability through binary_session. Keep device/serial and target applicability separate. Reject unrecognized successful version output; retain the bounded producer output and original version spelling. Apply the documented Apktool floor, including the verified Debian dirty build. Validation: provider/version tests and public MCP grouped availability; no real Android device or APK provider verification claimed. Fixes #3067 Fixes #3068 Related: #3077 Co-authored-by: Taksh <[email protected]>
This commit is contained in:
1 parent
cf806ea02a
commit
e5deb832cb
14 files changed
+379
-25
No files matched your search
@@ -97,6 +97,53 @@ const entry = (
|
||||
return found;
|
||||
};
|
||||
|
||||
describe("ADB and Apktool host availability", () => {
|
||||
it("uses only their selected owner probes", () => {
|
||||
const ready = {
|
||||
status: "available" as const,
|
||||
code: null,
|
||||
reason: null,
|
||||
diagnostics: {},
|
||||
};
|
||||
const configuredButInvalid = {
|
||||
status: "unavailable" as const,
|
||||
code: "not_configured" as const,
|
||||
reason: "REA_ADB_PATH is invalid",
|
||||
diagnostics: {},
|
||||
};
|
||||
const readyInventory = buildCapabilityInventory(status(), {
|
||||
...enabledPolicy,
|
||||
adbAnalysisAvailability: ready,
|
||||
apktoolAnalysisAvailability: ready,
|
||||
});
|
||||
expect(
|
||||
readyInventory.find(({ name }) => name === "inspect_adb_client"),
|
||||
).toMatchObject({ available: true, reason: "available" });
|
||||
expect(
|
||||
readyInventory.find(({ name }) => name === "inspect_apktool_client"),
|
||||
).toMatchObject({ available: true, reason: "available" });
|
||||
|
||||
const unavailableInventory = buildCapabilityInventory(status(), {
|
||||
...enabledPolicy,
|
||||
adbAnalysisAvailability: configuredButInvalid,
|
||||
apktoolAnalysisAvailability: {
|
||||
status: "unavailable",
|
||||
code: "unsupported_version",
|
||||
reason: "Apktool 2.6.3 is older than 2.7.0",
|
||||
diagnostics: {},
|
||||
},
|
||||
});
|
||||
expect(
|
||||
unavailableInventory.find(({ name }) => name === "inspect_adb_client"),
|
||||
).toMatchObject({ available: false, reason: "provider_missing" });
|
||||
expect(
|
||||
unavailableInventory.find(
|
||||
({ name }) => name === "decode_android_resources",
|
||||
),
|
||||
).toMatchObject({ available: false, reason: "provider_unavailable" });
|
||||
});
|
||||
});
|
||||
|
||||
describe("capability failure reasons", () => {
|
||||
it("keeps an unavailable Android runtime distinct from a missing provider", () => {
|
||||
const inventory = buildCapabilityInventory(status(), {
|
||||
|
||||
@@ -54,6 +54,8 @@ export type AvailabilityPolicy = {
|
||||
readonly firmwareInspectionEnabled?: boolean;
|
||||
readonly firmwareExtractionEnabled?: boolean;
|
||||
readonly androidAnalysisAvailability?: ProviderAvailability;
|
||||
readonly adbAnalysisAvailability?: ProviderAvailability;
|
||||
readonly apktoolAnalysisAvailability?: ProviderAvailability;
|
||||
readonly jebAnalysisAvailability?: ProviderAvailability;
|
||||
readonly javascriptRecoveryEnabled?: boolean;
|
||||
readonly webModuleResolutionEnabled?: boolean;
|
||||
@@ -473,6 +475,16 @@ const workflowAvailabilityFor = ({
|
||||
policy.androidAnalysisAvailability?.reason ??
|
||||
"Set REA_JADX_MCP_JAR to a caller-supplied jadx-headless-mcp 0.7.1 JAR and provide a full JDK on Linux, macOS, or Windows x64 with its matching bundled native controls.",
|
||||
};
|
||||
if (kind === "adb-provider")
|
||||
return ownerProbeAvailability(
|
||||
policy.adbAnalysisAvailability,
|
||||
"Set REA_ADB_PATH to a caller-supplied adb executable or make adb available on PATH. This checks the client version only; device and serial availability depend on the request.",
|
||||
);
|
||||
if (kind === "apktool-provider")
|
||||
return ownerProbeAvailability(
|
||||
policy.apktoolAnalysisAvailability,
|
||||
"Set REA_APKTOOL_COMMAND to a caller-supplied Apktool executable or make Apktool 2.7.0 or newer available on PATH.",
|
||||
);
|
||||
if (kind === "jeb-provider")
|
||||
return policy.jebAnalysisAvailability?.status === "available"
|
||||
? { reason: "available", remediation: null }
|
||||
@@ -506,6 +518,25 @@ const workflowAvailabilityFor = ({
|
||||
return null;
|
||||
};
|
||||
|
||||
const ownerProbeAvailability = (
|
||||
observation: ProviderAvailability | undefined,
|
||||
missingRemediation: string,
|
||||
): Availability => {
|
||||
if (observation === undefined)
|
||||
return { reason: "provider_missing", remediation: missingRemediation };
|
||||
if (observation.status === "available")
|
||||
return { reason: "available", remediation: null };
|
||||
return {
|
||||
reason:
|
||||
observation.code === "unsupported_host"
|
||||
? "unsupported_host"
|
||||
: observation.code === "not_configured"
|
||||
? "provider_missing"
|
||||
: "provider_unavailable",
|
||||
remediation: observation.reason,
|
||||
};
|
||||
};
|
||||
|
||||
const electronProviderAvailability = (
|
||||
name: string,
|
||||
kind: ToolKind,
|
||||
|
||||
Reference in new issue
Block a user