Files
rea/tests/boundary/cli/apktoolBooleanOptions.test.ts
01788bac86 fix(android): name the JADX deadline and recover apktool decode (#6024)
* fix(android): name the JADX deadline and recover apktool decode

JADX operation timeouts now name REA_JADX_OPERATION_TIMEOUT_MS, the
effective milliseconds, the 1..2147483647 range, and that a change applies
on the next process start. Apktool decode accepts decode_timeout_ms,
omitted means 600000, and a timeout names that key. ADB deadlines and
apktool and Java version probes stay fixed and say there is no runtime
override.

Refs #5910

Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(android): derive capture recovery from the fixed allowance

Main now stores a fixed allowance instead of a prebuilt remediation
string. Apktool and adb capture refusals keep the no-runtime-override
sentence in that allowance name, including that decode_timeout_ms does
not raise the apktool output cap.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* test(apktool): observe a real decode deadline and process cleanup

A hanging interpreter launcher and its pipe-holding child stay alive
until decode_timeout_ms elapses. The provider then reports
provider_timeout with completed cleanup, and both processes are gone.

Co-authored-by: morluto <morluto@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>
2026-10-22 00:31:43 +08:00

78 lines
2.0 KiB
TypeScript

import { expect, it } from "vitest";
import { invokeApktoolCli } from "../../support/cli/apktoolCli.js";
it("dispatches --no-strings as include_strings false", async () => {
const result = await invokeApktoolCli([
"decode-android-resources",
"/targets/app.apk",
"--no-strings",
"--json",
]);
expect(result.exitCode).toBe(0);
expect(result.requests).toEqual([
{
operation: "decode_android_resources",
input: { path: "/targets/app.apk", include_strings: false },
},
]);
});
it("keeps string projection enabled when the flag is omitted", async () => {
const result = await invokeApktoolCli([
"decode-android-resources",
"/targets/app.apk",
"--json",
]);
expect(result.exitCode).toBe(0);
expect(result.requests).toEqual([
{
operation: "decode_android_resources",
input: { path: "/targets/app.apk", include_strings: true },
},
]);
});
it("passes decode_timeout_ms only when the caller selects it", async () => {
const omitted = await invokeApktoolCli([
"decode-android-resources",
"/targets/app.apk",
"--json",
]);
expect(omitted.exitCode).toBe(0);
expect(omitted.requests[0]?.input).not.toHaveProperty("decode_timeout_ms");
const selected = await invokeApktoolCli([
"decode-android-resources",
"/targets/app.apk",
"--decode-timeout-ms",
"900000",
"--json",
]);
expect(selected.exitCode).toBe(0);
expect(selected.requests[0]?.input).toMatchObject({
decode_timeout_ms: 900_000,
});
for (const value of ["0", "2147483648"]) {
const rejected = await invokeApktoolCli([
"decode-android-resources",
"/targets/app.apk",
"--decode-timeout-ms",
value,
"--json",
]);
expect(rejected.exitCode).not.toBe(0);
expect(rejected.requests).toEqual([]);
}
});
it("documents the supported negative flag in command help", async () => {
const result = await invokeApktoolCli(["decode-android-resources", "--help"]);
expect(result.exitCode).toBe(0);
expect(result.stdout).toContain("--no-strings");
});