Files
reverse-engineering-anything/src/apktool/ApktoolCommandRecovery.test.ts
T
morluto df1e647266 refactor(desktop): let build-computer and agentenv cleanup errors read their owner's release (#10855)
* refactor(errors): read cleanup completion from dependencies instead of pushing it to dependents

AnalysisError.cleanupIncomplete becomes a getter over the error's own unresolved state and its bound dependencies. The WeakRef dependents graph and resolveCleanup's push propagation are removed, and subclasses mark their initial state through markCleanupIncomplete instead of overriding a public mutable field.

* fix(errors): settle bound dependencies before binding more

A composite whose dependencies had released but whose status was never read
stayed incomplete when a later dependency was bound.

* refactor(errors): let errors read a lease group's release instead of resolving them (#10759)

AnalysisCleanupLeaseGroup no longer calls resolveCleanup() on its error.
The error holds the group as a release claim and reads cleanupReleased when
asked, so completion follows the lease owner without a push.

* chore(verify): count resolveCleanup and bindCleanupDependencies calls so they only shrink (#10763)

* refactor(errors): let errors read a lease group's release instead of resolving them

AnalysisCleanupLeaseGroup no longer calls resolveCleanup() on its error.
The error holds the group as a release claim and reads cleanupReleased when
asked, so completion follows the lease owner without a push.

* chore(verify): count resolveCleanup and bindCleanupDependencies calls so they only shrink

* refactor(process): let worker cleanup errors read their root epoch's release

OwnedWorkerRuntime's root epoch is now an AnalysisCleanupReleaseClaim. Errors bound to it read its release when asked instead of the epoch pushing resolveCleanup() through weak references, and a runtime without a retained root binds an already-released owner. Removes the OwnedWorkerCleanupFailure structural type and four resolveCleanup() pushes; the counted baseline shrinks accordingly.

* refactor(pcap): let pcap cleanup errors read command and snapshot release (#10792)

Retained pcap commands, retained snapshot failures and snapshot completion descriptors now own their release and errors read it: commands and snapshot failures implement AnalysisCleanupReleaseClaim, and a failed completion-descriptor close is retried through an AnalysisCleanupLease bound to its error. Removes four resolveCleanup() pushes; the counted baseline shrinks accordingly.

* refactor(process): let Darwin helper cleanup errors read their owner's release

Darwin helper cache and run-token reader root cleanup now record an AnalysisCleanupRelease that every failure reports; a successful retry confirms it. Replaces the first-failure anchor that later failures depended on and the resolveCleanup() push. Removes two resolveCleanup() and two bindCleanupDependencies() calls; both counted baselines shrink.

* refactor(ghidra): let Ghidra cleanup errors read the client's and checkpoint's release

GhidraClient and GhidraCheckpoint bind each cleanup failure to an AnalysisCleanupRelease and confirm it when a later close or retry releases everything, instead of keeping a set of failures and pushing resolveCleanup() to each. Removes two resolveCleanup() calls; the counted baseline shrinks.

* refactor(process): let debugger session cleanup errors read a confirmed stop

OwnedDebuggerSessionRegistry binds each retained gdb or rizin cleanup failure to the session's AnalysisCleanupRelease and confirms it when a stop is confirmed, keeping the latest failure for retry reporting, instead of pushing resolveCleanup() to a set of failures. Removes one resolveCleanup() call; the counted baseline shrinks.

* refactor(process): drop the debugger registry's unused closeOperation option

Returning the latest retained failure removed the last reader of closeOperation; remove the option and the values gdb and rizin supplied.

* refactor(server): let environment shutdown errors read a successful close

serveEnvironment binds each shutdown failure to an AnalysisCleanupRelease that a later successful close confirms, instead of pushing resolveCleanup() to a set of failures. The state-file retry test now also requires the earlier report to read the release. Removes one resolveCleanup() call; the counted baseline shrinks.

* refactor(desktop): release retained screen-judge cleanup through its lease

Each retained judge or screenshot cleanup owner is wrapped in an AnalysisCleanupLease bound to its failure; close() releases the lease, which records the release the failure reads, instead of closing the owner and pushing resolveCleanup(). Removes one resolveCleanup() call; the counted baseline shrinks.

* refactor(ida): let IDA close failures read the session's later close

IdaSessionClient's close failure binds an owner that is both its resource owner and its release claim, read from the client's closed state, instead of keeping weak references and pushing resolveCleanup() after a successful retry. Removes one resolveCleanup() call; the counted baseline shrinks.

* refactor(javascript): let source-map codec cleanup errors read a later close (#10814)

* refactor(javascript): let source-map codec cleanup errors read a later close

OwnedCodec binds each close failure to an AnalysisCleanupRelease that a later successful close confirms, replacing the first-failure anchor that later failures depended on and the resolveCleanup() push. Removes one resolveCleanup() and one bindCleanupDependencies() call; both counted baselines shrink.

* refactor(cutter): let pending Cutter command errors read the completion receipt (#10815)

* refactor(cutter): let pending Cutter command errors read the completion receipt

Each pending Cutter command keeps an AnalysisCleanupRelease bound to its timeout failure; the producer's terminal completion receipt confirms it instead of pushing resolveCleanup(). Removes one resolveCleanup() call; the counted baseline shrinks.

* refactor(application): let provider candidate cleanup errors read the candidate's close (#10817)

* refactor(application): let provider candidate cleanup errors read the candidate's close

AnalysisProviderRegistry keeps one AnalysisCleanupRelease per candidate whose resource close is unconfirmed; failures bind to it and a later confirmed close confirms it, instead of pushing resolveCleanup() to a set of failures. Removes one resolveCleanup() call; the counted baseline shrinks.

* fix(errors): bind a cleanup release claim to an error at most once

AnalysisError kept release claims in an array, so a provider whose retried close returned the same error bound the same claim again on every retry and each cleanupIncomplete read scanned the duplicates. Keep the claims in a set.

* refactor(application): let reverse-tool cleanup errors read a verified stop (#10819)

* refactor(application): let reverse-tool cleanup errors read a verified stop

Each retained provider process group in ReverseEngineeringService keeps an AnalysisCleanupRelease; its command and retry failures bind to it and a later verified stop confirms it, instead of collecting failures and pushing resolveCleanup(). Removes one resolveCleanup() call; the counted baseline shrinks.

* refactor(sqlite): let SQLite worker and root cleanup errors read their release (#10821)

Each retained SQLite snapshot cleanup records an AnalysisCleanupRelease for its worker and for its runtime root; the resource failures bind to them and a verified stop or root removal confirms them, instead of pushing resolveCleanup(). Composite failures keep reading those resource failures. Removes two resolveCleanup() calls; the counted baseline shrinks.

* refactor(android): let JADX cleanup errors read their retained cleanup's release

Each retained JADX cleanup records an AnalysisCleanupRelease for the admission failure's descriptor owners and one for the whole retained cleanup. The admission failure and every error the cleanup reports bind to them, and a confirmed close confirms them, instead of pushing resolveCleanup() through WeakRefs to reported errors. Removes two resolveCleanup() calls; the counted baseline shrinks.

* refactor(application): let session close failures read the client's later close

A retained session cleanup records an AnalysisCleanupRelease; unowned cleanup failures the client's close reported bind to it and the successful close confirms it, instead of the session collecting them and pushing resolveCleanup(). Failures that already follow their own owner keep reading it. Adds a regression for an unowned close failure. Removes one resolveCleanup() call; the counted baseline shrinks.

* refactor(desktop): let build-computer and agentenv cleanup errors read their owner's release

Build-computer teardown, retained task readers, remote reader folders and agentenv solve sandboxes each record an AnalysisCleanupRelease that their bound failures read; a verified teardown or stop confirms it instead of pushing resolveCleanup() through WeakRef sets. Long-run job failures read whether every job they name has confirmed its stop, so a failure naming two jobs no longer reads complete when only one stops (regression added). WeakRef sets kept only where late facts (completion receipts, reader views) are still retained as diagnostics. Removes six resolveCleanup() calls; the counted baseline shrinks.

* refactor(kuna): let source-map and Kuna cache cleanup errors read their owner's release (#10856)

* refactor(browser): let late source-map fetch errors read their response's release

A pending source-map fetch and a response cancellation each record an AnalysisCleanupRelease that their cancellation or deadline failure reads; releasing the late response or the reader lock confirms it instead of pushing resolveCleanup(). Removes two resolveCleanup() calls; the counted baseline shrinks.

* refactor(kuna): let project-cache cleanup errors read each owner's release

Each retained Kuna resource owner (process, staging, hash descriptor, retired file) records a release that the errors reporting it read; an error completes once every owner it reports confirms, and retirement that moves staging to a retained file forwards the staging owner's release to the file's. Replaces the WeakRef report list, its pruning and the resolveCleanup() push. Removes one resolveCleanup() call; the counted baseline shrinks.

* refactor(process): forbid resolveCleanup() pushes; native markers read their supervisor's release (#10857)

* refactor(providers): let an attributed client failure read its source's completed cleanup

Re-attributing a failure whose source cleanup already completed now binds a claim reading that source's release instead of pushing resolveCleanup() onto the new error; a pending source is still bound as a dependency. Resources stay as history, as before. Removes one resolveCleanup() call; the counted baseline shrinks.

* refactor(process): let native command markers read their supervisor's release

ProviderProcessSupervisor records an AnalysisCleanupRelease that a stop proving the process ended confirms. Native command and LLDB resolver cleanup markers bind to their supervisor's release, so a verified stop by either owner completes them, instead of each owner pushing resolveCleanup() onto the markers it tracks. Removes the last two resolveCleanup() calls outside the error base; the counted baseline is empty.

* chore(verify): forbid resolveCleanup() pushes outside the error base

Every production owner now confirms a release its errors read, so the counted baseline is empty. The guard becomes an outright ban with no baseline entry.

* test(native): complete native command and LLDB markers through a direct supervisor stop

* refactor(errors): complete an error's cleanup from its owner's record and every dependency (#10892)

* refactor(errors): complete an error's cleanup from its owner's record and every dependency

* refactor(errors): complete test errors through an owner release and delete resolveCleanup() (#10898)

* refactor(android): compose JADX and Apktool cleanup failures through one shared owner (#10900)

* refactor(android): compose JADX and Apktool cleanup failures through one shared owner

* refactor(application): compose service cleanup failures through the shared owner (#10902)
2026-11-15 20:06:47 +08:00

490 lines
16 KiB
TypeScript

import { writeFile } from "node:fs/promises";
import { join } from "node:path";
import { createTestTempDirectory } from "../../tests/fixtures/temporaryDirectory.js";
import { awaitAcknowledgement } from "../../tests/fixtures/lifecycleAcknowledgement.js";
import { withVerifierCleanup } from "../../scripts/lib/verifier-cleanup.mjs";
import { afterEach, expect, it, vi } from "vitest";
import { createDeferred } from "../../tests/fixtures/binarySession.js";
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
import { ProviderCleanupError } from "../domain/providerCleanupError.js";
import { DarwinProcessOwnershipInspectionError } from "../process/DarwinProcessRunTokenReader.js";
import {
OwnedCommandFailure,
runOwnedCommand,
prepareOwnedCommand,
} from "../process/OwnedCommand.js";
import type { ProviderProcessSupervisor } from "../process/ProviderProcess.js";
import { ApktoolProvider } from "./ApktoolProvider.js";
import { releaseOwnedCleanup } from "../../tests/support/cleanupRelease.js";
vi.mock("../process/OwnedCommand.js", async (original) => ({
...(await original<typeof import("../process/OwnedCommand.js")>()),
runOwnedCommand: vi.fn(),
prepareOwnedCommand: vi.fn(async () => undefined),
}));
afterEach(() => {
vi.mocked(runOwnedCommand).mockReset();
vi.mocked(prepareOwnedCommand).mockReset().mockResolvedValue(undefined);
vi.useRealTimers();
});
const provider = () =>
new ApktoolProvider({
environment: { REA_APKTOOL_COMMAND: "/authored/apktool" },
});
const version = {
stdout: { text: "2.9.3\n", bytes: 6, observedBytes: 6 },
stderr: { text: "", bytes: 0, observedBytes: 0 },
exitCode: 0,
signal: null,
};
const inspect = (client: ApktoolProvider, signal?: AbortSignal) =>
client.execute(
{ operation: "inspect_apktool_client", input: {} },
signal === undefined ? {} : { signal },
);
it.each(["process", "helper"] as const)(
"retains %s cleanup, fences replacement acquisition and clears original and retry errors",
async (kind) => {
const client = provider();
let denied = true;
const reason = { caller: "authored cancellation" };
const controller = new AbortController();
const helperCleanup = new ProviderCleanupError(
"process-ownership",
["authored-helper-root"],
{},
);
const stop = vi.fn(async () =>
denied
? { status: "incomplete" as const, reason: "authored stop denial" }
: { status: "verified-cleanup" as const },
);
const helperClose = vi.fn(async () => {
if (denied) throw helperCleanup;
releaseOwnedCleanup(helperCleanup);
});
const compilerOutput = {
stdout: "authored compiler stdout",
stderr: "authored compiler stderr",
truncated: true,
stdout_bytes: 99,
stderr_bytes: 105,
exit_code: null,
signal: "SIGTERM",
};
const preparation = new DarwinProcessOwnershipInspectionError(
"helper cancellation",
{
cancellation: { reason },
capturedOutput: compilerOutput,
cleanupFailure: helperCleanup,
cleanupOwner: { close: helperClose },
},
);
vi.mocked(runOwnedCommand)
.mockImplementationOnce(async () => {
controller.abort(reason);
throw new OwnedCommandFailure(
"cancelled",
"authored command cancellation",
null,
kind === "process" ? "authored stop denial" : null,
{
cancellation: { reason },
...(kind === "helper" ? { preparationFailure: preparation } : {}),
},
kind === "process" ? ["authored-process-family"] : [],
kind === "process"
? ({ stop } as unknown as ProviderProcessSupervisor)
: undefined,
);
})
.mockImplementation(async (_spawn, limits) => {
limits.observeCompleted?.(version);
return version;
});
try {
const first = await inspect(client, controller.signal);
if (first.ok) throw new Error("Expected retained cleanup");
expect(first.error.cleanupIncomplete).toBe(true);
expect(first.error.cleanupPrimary?.cause).toBe(reason);
if (kind === "helper")
expect(first.error.capturedOutput).toEqual(compilerOutput);
const blocked = await inspect(client);
if (blocked.ok) throw new Error("Expected cleanup admission refusal");
expect(blocked.error.cleanupIncomplete).toBe(true);
expect(runOwnedCommand).toHaveBeenCalledOnce();
denied = false;
expect((await inspect(client)).ok).toBe(true);
expect(first.error.cleanupIncomplete).toBe(false);
expect(blocked.error.cleanupIncomplete).toBe(false);
expect(first.error.cleanupResources).toEqual([]);
if (kind === "helper")
expect(first.error.capturedOutput).toEqual(compilerOutput);
expect(blocked.error.cleanupResources).toEqual([]);
} finally {
denied = false;
await client.close();
}
},
);
it("keeps a physical version failure primary when cancellation arrives after the owner observed it", async () => {
const client = provider();
const controller = new AbortController();
vi.mocked(runOwnedCommand).mockImplementationOnce(async () => {
controller.abort({ caller: "after physical failure" });
throw new OwnedCommandFailure("process", "launcher exited 7");
});
try {
const result = await inspect(client, controller.signal);
expect(result.ok).toBe(false);
if (!result.ok)
expect(result.error._tag).not.toBe("AnalysisCancelledError");
} finally {
await client.close();
}
});
it("finishes independent preparation before giving the version process its twenty-second deadline", async () => {
vi.useFakeTimers();
const client = provider();
const ready = createDeferred<void>();
vi.mocked(prepareOwnedCommand).mockImplementationOnce(() => ready.promise);
vi.mocked(runOwnedCommand).mockImplementation(async (_spawn, limits) => {
limits.observeCompleted?.(version);
return version;
});
const pending = inspect(client);
try {
await vi.advanceTimersByTimeAsync(21_000);
expect(runOwnedCommand).not.toHaveBeenCalled();
ready.resolve();
expect((await pending).ok).toBe(true);
expect(vi.mocked(runOwnedCommand).mock.lastCall?.[1].timeoutMs).toBe(
20_000,
);
} finally {
ready.resolve();
await pending;
await client.close();
}
});
it.each(["2.9.3", "not-a-version", "2.1.0"])(
"preserves a completed version report through cancellation during final cleanup: %s",
async (text) => {
const client = provider();
const controller = new AbortController();
const reason = { caller: "during final version cleanup" };
vi.mocked(runOwnedCommand).mockImplementationOnce(
async (_spawn, limits) => {
limits.observeCompleted?.({ ...version, stdout: { text } } as Awaited<
ReturnType<typeof runOwnedCommand>
>);
controller.abort(reason);
throw new OwnedCommandFailure(
"cancelled",
"authored finalization cancellation",
null,
null,
{ cancellation: { reason } },
);
},
);
try {
const result = await inspect(client, controller.signal);
if (result.ok) throw new Error("Expected finalization failure");
if (text === "2.9.3") {
expect(result.error._tag).toBe("AnalysisCancelledError");
expect(result.error.cause).toBe(reason);
expect(result.error.diagnostics).toMatchObject({
client: { version: text },
});
} else expect(result.error._tag).not.toBe("AnalysisCancelledError");
} finally {
await client.close();
}
},
);
it("keeps cleanup without a recovery capability unresolved and fences its workspace", async () => {
const { ApktoolCommandCleanup } = await import("./ApktoolCommandCleanup.js");
const commands = new ApktoolCommandCleanup();
const failure = commands.retainFailure(
new OwnedCommandFailure(
"process",
"launcher failed",
null,
"ownership unavailable",
undefined,
["authored-family"],
),
new ProviderAdapterError("apktool", "inspect_apktool_client"),
"decode_android_resources",
"/authored/workspace",
);
expect(failure.cleanupIncomplete).toBe(true);
expect(commands.pendingFor("/authored/workspace")).toBe(true);
expect(commands.pendingFor("/other/workspace")).toBe(false);
const acquire = vi.fn(async () => undefined);
await expect(
commands.run(acquire, "inspect_apktool_client"),
).rejects.toMatchObject({ cleanupIncomplete: true });
expect(acquire).not.toHaveBeenCalled();
await expect(commands.close()).rejects.toMatchObject({
cleanupIncomplete: true,
});
expect(failure.cleanupIncomplete).toBe(true);
expect(failure.cleanupResources).toEqual(["authored-family"]);
});
it("attributes prerequisite cleanup to decode and preserves its live recovery", async () => {
const client = provider();
const reason = { caller: "during decode prerequisite" };
const stop = vi.fn(async () => ({ status: "verified-cleanup" as const }));
vi.mocked(runOwnedCommand).mockRejectedValueOnce(
new OwnedCommandFailure(
"cancelled",
"cancelled",
null,
"stop denied",
{ cancellation: { reason } },
["family"],
{ stop } as unknown as ProviderProcessSupervisor,
),
);
try {
const result = await client.execute({
operation: "decode_android_resources",
input: { path: "/fixture/input.apk", include_strings: false },
});
if (result.ok) throw new Error("Expected prerequisite failure");
expect(result.error).toMatchObject({
operation: "decode_android_resources",
});
expect(result.error.cleanupPrimary?.cause).toBe(reason);
await client.close();
expect(result.error.cleanupIncomplete).toBe(false);
} finally {
await client.close();
}
});
it("retries failed command peers without repeating successful helper cleanup", async () => {
const { ApktoolCommandCleanup } = await import("./ApktoolCommandCleanup.js");
const commands = new ApktoolCommandCleanup();
const helper = new ProviderCleanupError("process-ownership", ["helper"], {});
const close = vi.fn(async () => {
releaseOwnedCleanup(helper);
});
let denied = true;
const stop = vi.fn(async () =>
denied
? { status: "incomplete" as const, reason: "denied" }
: { status: "verified-cleanup" as const },
);
const failure = commands.retainFailure(
new OwnedCommandFailure(
"process",
"failed",
null,
"denied",
{
preparationFailure: new DarwinProcessOwnershipInspectionError(
"helper failed",
{ cleanupFailure: helper, cleanupOwner: { close } },
),
},
["process"],
{ stop } as unknown as ProviderProcessSupervisor,
),
new ProviderAdapterError("apktool", "inspect_apktool_client"),
"inspect_apktool_client",
);
try {
await expect(commands.close()).rejects.toMatchObject({
cleanupIncomplete: true,
});
expect(failure.cleanupResources).toEqual(["process"]);
denied = false;
await commands.close();
expect(close).toHaveBeenCalledOnce();
expect(stop).toHaveBeenCalledTimes(2);
expect(failure.cleanupIncomplete).toBe(false);
expect(failure.cleanupResources).toEqual([]);
} finally {
denied = false;
await commands.close();
}
});
it("joins preparation during close and retains a late helper handoff", async () => {
const client = provider();
const ready = createDeferred<void>();
const entered = createDeferred<void>();
const cleanup = new ProviderCleanupError(
"process-ownership",
["late-helper"],
{},
);
const close = vi.fn(async () => {
releaseOwnedCleanup(cleanup);
});
vi.mocked(prepareOwnedCommand).mockImplementationOnce(async () => {
entered.resolve();
await ready.promise;
throw new DarwinProcessOwnershipInspectionError(
"physical preparation failure",
{ cleanupFailure: cleanup, cleanupOwner: { close } },
);
});
const pending = inspect(client);
let closed = false;
let closing: Promise<void> | undefined;
await withVerifierCleanup(async () => {
await awaitAcknowledgement(entered.promise, pending, "command preparation");
closing = client.close().then(() => {
closed = true;
});
await Promise.resolve();
expect(closed).toBe(false);
ready.resolve();
const result = await pending;
if (result.ok) throw new Error("Expected preparation failure");
expect(result.error._tag).not.toBe("AnalysisCancelledError");
await closing;
expect(close).toHaveBeenCalledOnce();
expect(result.error.cleanupIncomplete).toBe(false);
expect(runOwnedCommand).not.toHaveBeenCalled();
}, [
() => ready.resolve(),
async () => {
await pending;
},
async () => {
await closing;
},
() => client.close(),
]);
});
it("preserves an opaque cancellation reason before acquiring a command", async () => {
const client = provider();
const reason = new ProviderCleanupError(
"foreign-owner",
["foreign-resource"],
{},
);
const controller = new AbortController();
controller.abort(reason);
try {
const result = await inspect(client, controller.signal);
if (result.ok) throw new Error("Expected cancellation");
expect(result.error.cause).toBe(reason);
expect(result.error.cleanupIncomplete).toBe(false);
expect(runOwnedCommand).not.toHaveBeenCalled();
expect(prepareOwnedCommand).not.toHaveBeenCalled();
expect(reason.cleanupIncomplete).toBe(true);
} finally {
await client.close();
}
});
it.each([
"refusal",
"spawn",
"collection",
"signal",
"incomplete",
"preparation",
] as const)(
"keeps target identity separate from a %s command outcome",
async (kind) => {
const root = await createTestTempDirectory("rea-apktool-attribution-");
const path = join(root, "caller-selected.apk");
await writeFile(path, "authored input");
const client = provider();
const output = {
stdout: { text: "authored stdout", bytes: 15, observedBytes: 15 },
stderr: { text: "authored decode refusal", bytes: 23, observedBytes: 23 },
exitCode: 1,
signal: null,
diagnosticTruncated: false,
} satisfies Awaited<ReturnType<typeof runOwnedCommand>>;
const compiler = {
stdout: "compiler output",
stderr: "compiler diagnostic",
truncated: false,
stdout_bytes: 15,
stderr_bytes: 19,
exit_code: 1,
signal: null,
};
const failure =
kind === "preparation"
? new DarwinProcessOwnershipInspectionError(
"authored preparation failure",
{ capturedOutput: compiler },
)
: new OwnedCommandFailure(
"process",
"authored command failure",
{
...output,
...(kind === "signal"
? { exitCode: null, signal: "SIGTERM" }
: {}),
...(kind === "incomplete" ? { outputIncomplete: true } : {}),
},
null,
{
...(kind === "spawn"
? { processError: new Error("authored startup failure") }
: {}),
...(kind === "collection" ? { collectionFailure: true } : {}),
},
);
vi.mocked(runOwnedCommand)
.mockImplementationOnce(async (_spawn, limits) => {
limits.observeCompleted?.(version);
return version;
})
.mockRejectedValueOnce(failure);
try {
const result = await client.execute({
operation: "decode_android_resources",
input: { path, include_strings: true },
});
if (result.ok) throw new Error("Expected authored failure");
if (kind === "refusal") {
expect(result.error).toMatchObject({
_tag: "AnalysisUnsupportedTargetError",
path,
});
expect(result.error.message).toContain(path);
expect(result.error.message).not.toContain("/authored/apktool");
} else
expect(result.error).toMatchObject({
_tag: "ProviderAdapterError",
diagnostics: {
target_path: path,
selected_command: "/authored/apktool",
},
});
expect(result.error.capturedOutput).toMatchObject(
kind === "preparation"
? compiler
: { stdout: output.stdout.text, stderr: output.stderr.text },
);
expect(result.error.partialObservation).toMatchObject({
kind: "file-snapshot-hash",
path,
});
} finally {
await client.close();
}
},
);