fix(reverse): reconcile cleanup ownership and mutation diagnostics (#2799)
* feat(process): add owned debugger shutdown lifecycle * feat(reverse): add local inspection commands * feat(gdb): add persistent debugger integration * feat(cutter): add Cutter bridge integration * test(reverse): enforce complete integration coverage * fix(process): preserve debugger shutdown ownership * fix(reverse): retain evidence across interrupted commands * fix(gdb): honor captured provider environment * test(process): cover debugger shutdown retries * fix(reverse): retain evidence for interrupted providers * test(process): cover debugger shutdown retries * fix(reverse): retain evidence for interrupted providers * fix(server): snapshot provider environment at creation * fix(reverse): close review gaps with complete coverage * fix(reverse): address inspection review findings * fix(gdb): bound sessions and retain cleanup ownership * fix(ci): require reverse-tools quality lane * fix(process): unref inherited debugger output pipes * fix(reverse): address remaining PR 1960 findings * fix(gdb): address remaining PR 1961 findings * fix(reverse): account for unrestricted provider execution * fix(process): retain debugger ownership until safe shutdown * fix(process): preserve replacement debugger sessions * fix(reverse): preserve admission and output provenance * fix(process): retain exited debugger until output settles * fix(mcp): bound provider admission and debugger cleanup * fix(reverse): preserve failure provenance and classify E2BIG * fix(gdb): preserve startup cleanup and detach safety * fix(process): retain debugger ownership after detach failure * fix(reverse): preserve mutation and failure provenance * fix(gdb): address debugger review findings * fix(reverse): rebind sessions after external mutation * fix(process): cap debugger output after exit * fix(gdb): protect one-shot detach verification * feat(debugger): add reverse tool coverage gate * test(debugger): cover integrated failure paths * fix(gdb): bound and preserve session observations * fix(gdb): address review regressions * style: format merged integration files * fix(reverse): preserve session and output evidence * refactor(gdb): share repeated test and partial result setup * fix(gdb): invalidate TTY proof for Python aliases * fix(reverse): retain failure output byte counts * test(process): synchronize late debugger output * fix(gdb): invalidate TTY proof for wrapped commands * fix(gdb): recognize wit command abbreviation * test(reverse): wait for cancelled descendant readiness * test(reverse): bound descendant cancellation cleanup * style(reverse): format integration tests and adapters * style: format reverse engineering integration files * test(reverse): remove duplicate environment harness * test(gdb): share session startup assertions * fix(gdb): invalidate output proof for command abbreviations * test(reverse): share composition edge case scenarios * fix(ci): recognize verification and mutation tool entries * test(rizin): cover successful fake inferior detach * test(cli): align full output failure envelope * test(cli): isolate reverse command lifecycle service * test(process): share debugger output fixture setup * fix(binary): preserve high-bit Windows signature bytes * style(binary): format Windows signature parser * test(mcp): preserve call coverage in unchanged comparison * fix(ci): include reverse tools Vitest configs in lint cache * fix(mcp): preserve target content on delivery errors * ci: align duplication ceiling with expanded suite * test(reverse): allow signal admission mutants * fix(reverse): bound retained cleanup failures to process owners * fix(test): replace drifting mutation ranges with owned selectors * fix(reverse): admit persistent commands and retain cleanup ownership * fix(cutter): recover timed-out commands from exact receipts * fix(cutter): reject unsupported bridge request kinds * fix(ci): repair client format and shared verification fixtures * fix(native): preserve debugger cleanup ownership and bridge authentication * test(native): retain diagnostics without perfect coverage requirements * chore(licenses): refresh locked dependency inventory and notices * fix(test): exclude transient command locks from mutation sandboxes * fix(gdb): admit only platforms with safe detach verification * fix(cutter): retain bounded completion receipts until acknowledgement * fix(cutter): acknowledge commands rejected before UI dispatch * test(reverse): fail cancellation checks before fixture teardown * test(gdb): clean up the retained broken-stdin fixture owner * docs(test): clarify focused provider verification scope * fix(rizin): retain close cleanup failures * fix(gdb): wait for inferior stop and bound MI buffering * fix(cutter): retain failed receipt acknowledgements * fix(rizin): return retained session identity on rebind failure * fix(gdb): preserve startup cancellation and lossy status * fix(rizin): retain launch provenance and assemble frames once * fix(cutter): recover receipts across callers and bound discovery * docs: describe debugger evidence and bridge recovery * fix(process): keep cleanup incomplete while writers remain Stopping a debugger no longer reports success when inherited output streams stay open, so BinarySession cannot reopen a binary a child is still changing. Concurrent Cutter cleanup retries share one receipt acknowledgement instead of treating a consumed receipt as failure. * fix(debuggers): recover cleanup with captured process identities * fix(analysis): retire sessions after unrestricted commands * fix(cli): preserve completed evidence after cleanup recovery * fix(cutter): bound frame collection and coalesce cleanup * fix(windows): resolve selected provider paths absolutely * fix(gdb): report decoding loss in failed startup evidence * fix(rizin): scope decoding loss to collected command frames * test(mcp): cover snapshot retirement in reverse tools CI --------- Co-authored-by: Daniel Gonçalves Araujo <47118053+dandgabr@users.noreply.github.com> Co-authored-by: REA Maintainers <noreply@github.com> Co-authored-by: OpenAI Codex <codex@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Daniel Gonçalves Araujo
REA Maintainers
OpenAI Codex
Cursor Agent
parent
2ad2a044d4
commit
4aa51bfe19
@@ -0,0 +1,204 @@
|
||||
import { rm } from "node:fs/promises";
|
||||
|
||||
import { expect, it, vi } from "vitest";
|
||||
|
||||
import { OwnedCommandFailure } from "../../src/process/OwnedCommand.js";
|
||||
import { TestReverseEngineeringService } from "./reverseEngineeringService.js";
|
||||
import {
|
||||
createArtifact,
|
||||
providerSnapshot,
|
||||
} from "./reverseEngineeringCompositionFixtures.js";
|
||||
|
||||
const registerOwnedRizinCommandOutcomeTests = (options: {
|
||||
readonly sweepTokenOwnedProcesses: boolean;
|
||||
}): void => {
|
||||
it.each([
|
||||
["normal exit", providerSnapshot(), "complete", 0, false],
|
||||
[
|
||||
"non-zero exit",
|
||||
providerSnapshot({ exitCode: 7, diagnosticTruncated: true }),
|
||||
"complete",
|
||||
7,
|
||||
true,
|
||||
],
|
||||
[
|
||||
"signal termination",
|
||||
providerSnapshot({
|
||||
exitCode: null,
|
||||
signal: "SIGSEGV",
|
||||
diagnosticTruncated: true,
|
||||
}),
|
||||
"unknown",
|
||||
null,
|
||||
true,
|
||||
],
|
||||
[
|
||||
"signal termination with a numeric exit snapshot",
|
||||
providerSnapshot({ exitCode: 7, signal: "SIGSEGV" }),
|
||||
"unknown",
|
||||
null,
|
||||
false,
|
||||
],
|
||||
[
|
||||
"signal termination without truncation",
|
||||
providerSnapshot({ exitCode: null, signal: "SIGTERM" }),
|
||||
"unknown",
|
||||
null,
|
||||
false,
|
||||
],
|
||||
[
|
||||
"unknown exit status",
|
||||
providerSnapshot({ exitCode: null }),
|
||||
"unknown",
|
||||
null,
|
||||
false,
|
||||
],
|
||||
] as const)(
|
||||
"maps an owned command %s into provider Evidence",
|
||||
async (_name, snapshot, completion, exitCode, outputTruncated) => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const runOwned = vi.fn(async () => snapshot);
|
||||
const service = new TestReverseEngineeringService({
|
||||
runOwned,
|
||||
environment: { REA_RIZIN_COMMAND: "rizin-test" },
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await service.executeRizinCommand({
|
||||
path,
|
||||
command: "iI",
|
||||
});
|
||||
expect(runOwned).toHaveBeenCalledOnce();
|
||||
expect(runOwned).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
command: "rizin-test",
|
||||
arguments: expect.arrayContaining(["-q", "-c", "iI"]),
|
||||
expectedCommand: null,
|
||||
env: expect.objectContaining({ REA_RIZIN_COMMAND: "rizin-test" }),
|
||||
hostEnvironment: {},
|
||||
...(options.sweepTokenOwnedProcesses
|
||||
? { sweepTokenOwnedProcesses: true }
|
||||
: {}),
|
||||
}),
|
||||
{
|
||||
timeoutMs: 120_000,
|
||||
diagnosticBytes: 16 * 1024 * 1024,
|
||||
acceptNonZeroExit: true,
|
||||
},
|
||||
{ signal: expect.any(AbortSignal) },
|
||||
);
|
||||
expect(result).toMatchObject({
|
||||
ok: true,
|
||||
value: {
|
||||
raw_result: {
|
||||
stdout: "captured owned output",
|
||||
completion_status: completion,
|
||||
exit_code: exitCode,
|
||||
output_truncated: outputTruncated,
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!result.ok) throw new Error("Expected provider Evidence");
|
||||
expect(result.value.parameters).toMatchObject({
|
||||
command: "iI",
|
||||
provider_executable: "rizin-test",
|
||||
command_arguments: expect.arrayContaining(["-q", "-c", "iI"]),
|
||||
});
|
||||
expect(result.value.locations).toContainEqual({
|
||||
kind: "artifact-path",
|
||||
path,
|
||||
});
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
const registerOwnedRizinCommandFailureTests = (): void => {
|
||||
it.each([
|
||||
["cancelled", "AnalysisCancelledError", "ABORT_ERR"],
|
||||
["timeout", "AnalysisTimeoutError", "ETIMEDOUT"],
|
||||
["output-limit", "evidence", "ERR_CHILD_PROCESS_STDIO_MAXBUFFER"],
|
||||
["process", "evidence", 7],
|
||||
] as const)(
|
||||
"maps an owned command %s failure while retaining its snapshot",
|
||||
async (reason, expected, mappedCode) => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const snapshot = providerSnapshot({
|
||||
...(reason === "process" ? { exitCode: 7 } : {}),
|
||||
...(reason === "output-limit"
|
||||
? {}
|
||||
: reason === "cancelled"
|
||||
? {}
|
||||
: { diagnosticTruncated: true }),
|
||||
});
|
||||
const service = new TestReverseEngineeringService({
|
||||
runOwned: async () => {
|
||||
throw new OwnedCommandFailure(
|
||||
reason,
|
||||
"owned command failed",
|
||||
snapshot,
|
||||
reason === "timeout" ? "cleanup pending" : null,
|
||||
undefined,
|
||||
reason === "timeout" ? ["run-id", "pid:7"] : [],
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await service.executeRizinCommand({
|
||||
path,
|
||||
command: "iI",
|
||||
});
|
||||
if (expected === "evidence") {
|
||||
expect(result).toMatchObject({
|
||||
ok: true,
|
||||
value: {
|
||||
raw_result: {
|
||||
stdout: "captured owned output",
|
||||
exit_code: mappedCode === 7 ? 7 : null,
|
||||
completion_status:
|
||||
reason === "output-limit" ? "unknown" : "complete",
|
||||
output_truncated: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
_tag: expected,
|
||||
partialObservation: {
|
||||
raw_result: {
|
||||
stdout: "captured owned output",
|
||||
exit_code: null,
|
||||
completion_status: "unknown",
|
||||
output_truncated: reason !== "cancelled",
|
||||
},
|
||||
},
|
||||
...(reason === "timeout"
|
||||
? {
|
||||
cleanup: {
|
||||
reason: "cleanup pending",
|
||||
resources: ["run-id", "pid:7"],
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
});
|
||||
if (result.ok) throw new Error("Expected a tagged command failure");
|
||||
}
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const registerOwnedRizinCommandEvidenceTests = (options: {
|
||||
readonly sweepTokenOwnedProcesses: boolean;
|
||||
}): void => {
|
||||
registerOwnedRizinCommandOutcomeTests(options);
|
||||
registerOwnedRizinCommandFailureTests();
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
import { readFile, rm } from "node:fs/promises";
|
||||
|
||||
import { Client, InMemoryTransport } from "@modelcontextprotocol/client";
|
||||
import { Ajv2020 } from "ajv/dist/2020.js";
|
||||
import { expect, onTestFinished } from "vitest";
|
||||
import { z } from "zod";
|
||||
|
||||
import { toolContract } from "../../src/contracts/toolContracts.js";
|
||||
import { createServer } from "../../src/server/createServer.js";
|
||||
import { createTestBinarySession } from "../fixtures/binarySession.js";
|
||||
|
||||
export const waitForStartedFile = async (path: string): Promise<void> => {
|
||||
await expect
|
||||
.poll(() => readFile(path, "utf8").catch(() => ""))
|
||||
.toBe("started");
|
||||
};
|
||||
|
||||
export const validateDebuggerStatusResponse = async (
|
||||
client: Client,
|
||||
name: "gdb_session_status" | "rizin_debug_session_status",
|
||||
sessionId: string,
|
||||
): Promise<Record<string, unknown>> => {
|
||||
const listed = (await client.listTools()).tools.find(
|
||||
(tool) => tool.name === name,
|
||||
);
|
||||
if (listed?.outputSchema === undefined)
|
||||
throw new Error(`Missing advertised ${name} output schema`);
|
||||
const response = await client.callTool({
|
||||
name,
|
||||
arguments: { session_id: sessionId },
|
||||
});
|
||||
expect(response.isError).not.toBe(true);
|
||||
const parsed = toolContract(name).outputSchema.parse(
|
||||
response.structuredContent,
|
||||
);
|
||||
expect(
|
||||
new Ajv2020({ strict: false, validateFormats: false }).validate(
|
||||
z.record(z.string(), z.unknown()).parse(listed.outputSchema),
|
||||
parsed,
|
||||
),
|
||||
).toBe(true);
|
||||
return z.record(z.string(), z.unknown()).parse(parsed);
|
||||
};
|
||||
|
||||
export const createProviderEnvironmentMcpHarness = async (options: {
|
||||
readonly directory: string;
|
||||
readonly clientName: string;
|
||||
readonly serverOptions: NonNullable<Parameters<typeof createServer>[1]>;
|
||||
}) => {
|
||||
const session = createTestBinarySession(() => {
|
||||
throw new Error("No binary analysis provider should start");
|
||||
});
|
||||
const server = createServer(
|
||||
{ kind: "session", session },
|
||||
options.serverOptions,
|
||||
);
|
||||
const client = new Client({ name: options.clientName, version: "1" });
|
||||
onTestFinished(async () => {
|
||||
await client.close();
|
||||
await server.close();
|
||||
await session.close();
|
||||
await rm(options.directory, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
const [clientTransport, serverTransport] =
|
||||
InMemoryTransport.createLinkedPair();
|
||||
await server.connect(serverTransport);
|
||||
await client.connect(clientTransport);
|
||||
return { client };
|
||||
};
|
||||
@@ -0,0 +1,800 @@
|
||||
import { rm, truncate, writeFile } from "node:fs/promises";
|
||||
|
||||
import { expect, it, vi } from "vitest";
|
||||
|
||||
import { TestReverseEngineeringService as ReverseEngineeringService } from "./reverseEngineeringService.js";
|
||||
import {
|
||||
createArtifact,
|
||||
providerSnapshot,
|
||||
} from "./reverseEngineeringCompositionFixtures.js";
|
||||
import { objdumpCommand } from "../../src/objdump/ObjdumpCommand.js";
|
||||
import {
|
||||
OwnedCommandFailure,
|
||||
runOwnedCommand,
|
||||
} from "../../src/process/OwnedCommand.js";
|
||||
import type { ProviderProcessSupervisor } from "../../src/process/ProviderProcess.js";
|
||||
|
||||
const registerSharedReverseEngineeringEdgeCasesPart1 = (): void => {
|
||||
it("uses the local-only DWARF option when debug links are disabled", () => {
|
||||
expect(
|
||||
objdumpCommand({
|
||||
path: "./sample.bin",
|
||||
operation: "dwarf",
|
||||
follow_debug_links: false,
|
||||
}),
|
||||
).toEqual(["-W", "-WN", expect.stringMatching(/sample\.bin$/u)]);
|
||||
});
|
||||
|
||||
it("does not follow DWARF debug links by default", async () => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const calls: string[][] = [];
|
||||
const service = new ReverseEngineeringService({
|
||||
run: async (_command, args) => {
|
||||
calls.push([...args]);
|
||||
return { stdout: "DWARF output", stderr: "" };
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await service.inspectWithObjdump({
|
||||
path,
|
||||
operation: "dwarf",
|
||||
});
|
||||
expect(result.ok).toBe(true);
|
||||
expect(calls[0]).toEqual(["-W", "-WN", path]);
|
||||
if (result.ok)
|
||||
expect(result.value.parameters.follow_debug_links).toBe(false);
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("marks opted-in external DWARF debug files as unbound Evidence sources", async () => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const service = new ReverseEngineeringService({
|
||||
run: async () => ({ stdout: "DWARF output", stderr: "" }),
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await service.inspectWithObjdump({
|
||||
path,
|
||||
operation: "dwarf",
|
||||
follow_debug_links: true,
|
||||
});
|
||||
expect(result.ok).toBe(true);
|
||||
if (result.ok)
|
||||
expect(result.value.limitations).toContain(
|
||||
"DWARF output may include local debug-link files whose identities are not bound to Evidence.",
|
||||
);
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("rejects malformed objdump requests before touching the provider", async () => {
|
||||
let invoked = false;
|
||||
const service = new ReverseEngineeringService({
|
||||
run: async () => {
|
||||
invoked = true;
|
||||
return { stdout: "", stderr: "" };
|
||||
},
|
||||
});
|
||||
|
||||
const result = await service.inspectWithObjdump({ path: "/tmp/a" });
|
||||
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: { _tag: "AnalysisInputError", operation: "inspect_with_objdump" },
|
||||
});
|
||||
expect(invoked).toBe(false);
|
||||
});
|
||||
|
||||
it("returns cancellation that arrived before the artifact digest starts", async () => {
|
||||
const controller = new AbortController();
|
||||
controller.abort();
|
||||
const service = new ReverseEngineeringService();
|
||||
|
||||
const result = await service.inspectWithObjdump(
|
||||
{ path: "/tmp/a", operation: "file_headers" },
|
||||
{ signal: controller.signal },
|
||||
);
|
||||
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: { _tag: "AnalysisCancelledError" },
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
["EACCES", "AnalysisAccessDeniedError"],
|
||||
["EPERM", "AnalysisAccessDeniedError"],
|
||||
["ETIMEDOUT", "AnalysisTimeoutError"],
|
||||
["EINVAL", "AnalysisInputError"],
|
||||
])(
|
||||
"maps artifact digest failure %s to its tagged analysis error",
|
||||
async (code, tag) => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const service = new ReverseEngineeringService({
|
||||
digest: async () => {
|
||||
throw Object.assign(new Error("digest failure"), { code });
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await service.inspectWithObjdump({
|
||||
path,
|
||||
operation: "file_headers",
|
||||
});
|
||||
expect(result).toMatchObject({ ok: false, error: { _tag: tag } });
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
const registerSharedReverseEngineeringEdgeCasesPart2 = (): void => {
|
||||
it("retains and retries an owned cleanup after an output-limit failure", async () => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const stop = vi
|
||||
.fn()
|
||||
.mockResolvedValueOnce({ status: "incomplete", reason: "still running" })
|
||||
.mockResolvedValueOnce({ status: "incomplete", reason: "still running" })
|
||||
.mockResolvedValueOnce({ status: "incomplete", reason: "still running" })
|
||||
.mockResolvedValueOnce({ status: "verified-cleanup" });
|
||||
await stop(); // The owned-command runner's first cleanup attempt failed.
|
||||
const cleanupOwner = { stop } as unknown as ProviderProcessSupervisor;
|
||||
const runOwned = vi.fn<typeof runOwnedCommand>(async () => {
|
||||
throw new OwnedCommandFailure(
|
||||
"output-limit",
|
||||
"output limit",
|
||||
providerSnapshot({ diagnosticTruncated: true }),
|
||||
"still running",
|
||||
undefined,
|
||||
["run-id", "pid:42"],
|
||||
cleanupOwner,
|
||||
);
|
||||
});
|
||||
const service = new ReverseEngineeringService({
|
||||
runOwned,
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await service.executeRizinCommand({
|
||||
path,
|
||||
command: "wx 00",
|
||||
});
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
cleanupIncomplete: true,
|
||||
cleanup: { reason: "still running", resources: ["run-id", "pid:42"] },
|
||||
partialObservation: {
|
||||
raw_result: {
|
||||
stdout: "captured owned output",
|
||||
output_truncated: true,
|
||||
completion_status: "unknown",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(stop).toHaveBeenCalledTimes(1);
|
||||
const blocked = await service.executeRizinCommand({
|
||||
path,
|
||||
command: "iI",
|
||||
});
|
||||
expect(blocked).toMatchObject({
|
||||
ok: false,
|
||||
error: { cleanupIncomplete: true },
|
||||
});
|
||||
expect(stop).toHaveBeenCalledTimes(2);
|
||||
expect(runOwned).toHaveBeenCalledTimes(1);
|
||||
expect(blocked).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
message: expect.stringContaining(
|
||||
"A previous provider process still requires cleanup.",
|
||||
),
|
||||
},
|
||||
});
|
||||
await expect(service.close()).rejects.toMatchObject({
|
||||
cleanupIncomplete: true,
|
||||
cleanup: { reason: "still running", resources: ["run-id", "pid:42"] },
|
||||
});
|
||||
expect(stop).toHaveBeenCalledTimes(3);
|
||||
await service.close();
|
||||
expect(stop).toHaveBeenCalledTimes(4);
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("maps cancellation during the initial digest to a cancellation error", async () => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const controller = new AbortController();
|
||||
const service = new ReverseEngineeringService({
|
||||
digest: async () => {
|
||||
controller.abort();
|
||||
throw new Error("digest cancelled");
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await service.inspectWithObjdump(
|
||||
{ path, operation: "file_headers" },
|
||||
{ signal: controller.signal },
|
||||
);
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: { _tag: "AnalysisCancelledError" },
|
||||
});
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const registerSharedReverseEngineeringEdgeCasesPart3 = (): void => {
|
||||
it("cancels an in-progress file digest through its abort listener", async () => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const controller = new AbortController();
|
||||
Object.defineProperty(controller.signal, "addEventListener", {
|
||||
value: (
|
||||
type: string,
|
||||
listener: Parameters<EventTarget["addEventListener"]>[1],
|
||||
options?: boolean | AddEventListenerOptions,
|
||||
): void => {
|
||||
EventTarget.prototype.addEventListener.call(
|
||||
controller.signal,
|
||||
type,
|
||||
listener,
|
||||
options,
|
||||
);
|
||||
if (type === "abort") {
|
||||
controller.abort();
|
||||
}
|
||||
},
|
||||
});
|
||||
const service = new ReverseEngineeringService();
|
||||
|
||||
try {
|
||||
const resultPromise = service.inspectWithObjdump(
|
||||
{ path, operation: "file_headers" },
|
||||
{ signal: controller.signal },
|
||||
);
|
||||
const result = await resultPromise;
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: { _tag: "AnalysisCancelledError" },
|
||||
});
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("maps the artifact digest deadline to a timeout error", async () => {
|
||||
const { directory, path } = await createArtifact();
|
||||
await truncate(path, 64 * 1024 * 1024);
|
||||
const service = new ReverseEngineeringService();
|
||||
vi.useFakeTimers({ toFake: ["setTimeout", "clearTimeout"] });
|
||||
|
||||
try {
|
||||
const resultPromise = service.inspectWithObjdump({
|
||||
path,
|
||||
operation: "file_headers",
|
||||
});
|
||||
await new Promise<void>((resolve) => setImmediate(resolve));
|
||||
await vi.advanceTimersByTimeAsync(120_000);
|
||||
const result = await resultPromise;
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: { _tag: "AnalysisTimeoutError" },
|
||||
});
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it.each([
|
||||
["ETIMEDOUT", "AnalysisTimeoutError"],
|
||||
["EACCES", "AnalysisAccessDeniedError"],
|
||||
["EPERM", "AnalysisAccessDeniedError"],
|
||||
["ABORT_ERR", "AnalysisCancelledError"],
|
||||
["unknown", "AnalysisCapabilityUnavailableError"],
|
||||
])(
|
||||
"maps provider failure %s to its tagged analysis error",
|
||||
async (code, tag) => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const service = new ReverseEngineeringService({
|
||||
run: async () => {
|
||||
if (code === "unknown") throw new Error("provider failure");
|
||||
throw Object.assign(new Error("provider failure"), { code });
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await service.inspectWithObjdump({
|
||||
path,
|
||||
operation: "file_headers",
|
||||
});
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
_tag: tag,
|
||||
operation: "inspect_with_objdump",
|
||||
cause: { message: "provider failure" },
|
||||
...(code === "ETIMEDOUT" ? { timeoutMs: 120_000 } : {}),
|
||||
...(code === "EACCES" || code === "EPERM"
|
||||
? { path: "objdump", systemCode: code }
|
||||
: {}),
|
||||
...(code === "unknown"
|
||||
? {
|
||||
providerId: "objdump",
|
||||
reason: "Unable to run configured command (unknown error)",
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
const registerSharedReverseEngineeringEdgeCasesPart4 = (): void => {
|
||||
it("records a changed artifact and unknown post-run digest separately", async () => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const changed = new ReverseEngineeringService({
|
||||
run: async () => {
|
||||
await writeFile(path, "changed during provider execution");
|
||||
return { stdout: "observed", stderr: "" };
|
||||
},
|
||||
});
|
||||
const removed = new ReverseEngineeringService({
|
||||
run: async () => {
|
||||
await rm(path);
|
||||
return { stdout: "observed", stderr: "" };
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
const changedResult = await changed.inspectWithObjdump({
|
||||
path,
|
||||
operation: "file_headers",
|
||||
});
|
||||
expect(changedResult).toMatchObject({
|
||||
ok: true,
|
||||
value: {
|
||||
raw_result: { artifact_changed: true },
|
||||
limitations: expect.arrayContaining([
|
||||
expect.stringContaining("may have changed"),
|
||||
]),
|
||||
},
|
||||
});
|
||||
|
||||
await writeFile(path, "restore for second digest");
|
||||
const removedResult = await removed.inspectWithObjdump({
|
||||
path,
|
||||
operation: "file_headers",
|
||||
});
|
||||
expect(removedResult).toMatchObject({
|
||||
ok: true,
|
||||
value: {
|
||||
raw_result: { artifact_sha256_after: null, artifact_changed: null },
|
||||
limitations: expect.arrayContaining([
|
||||
expect.stringContaining("post-run artifact digest"),
|
||||
]),
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it.each(["EACCES", "EPERM"] as const)(
|
||||
"retains captured output on a permission-denied provider result (%s)",
|
||||
async (code) => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const service = new ReverseEngineeringService({
|
||||
run: async () => {
|
||||
throw Object.assign(new Error("provider permission denied"), {
|
||||
stdout: "partial provider output",
|
||||
stderr: "permission diagnostic",
|
||||
code,
|
||||
signal: null,
|
||||
killed: false,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await service.inspectWithObjdump({
|
||||
path,
|
||||
operation: "file_headers",
|
||||
});
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
_tag: "AnalysisAccessDeniedError",
|
||||
capturedOutput: {
|
||||
stdout: "partial provider output",
|
||||
stderr: "permission diagnostic",
|
||||
},
|
||||
partialObservation: {
|
||||
raw_result: { stdout: "partial provider output" },
|
||||
},
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
const registerSharedReverseEngineeringEdgeCasesPart5 = (): void => {
|
||||
it("cancels after captured output when a provider reports a non-numeric status", async () => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const controller = new AbortController();
|
||||
let digests = 0;
|
||||
const service = new ReverseEngineeringService({
|
||||
digest: async () => {
|
||||
digests += 1;
|
||||
if (digests === 2) controller.abort();
|
||||
return digests === 1 ? "a".repeat(64) : "b".repeat(64);
|
||||
},
|
||||
run: async () => {
|
||||
throw Object.assign(new Error("provider status unavailable"), {
|
||||
stdout: "captured output",
|
||||
stderr: "",
|
||||
code: "provider-status-unknown",
|
||||
signal: null,
|
||||
killed: false,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await service.inspectWithObjdump(
|
||||
{ path, operation: "file_headers" },
|
||||
{ signal: controller.signal },
|
||||
);
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
_tag: "AnalysisCancelledError",
|
||||
partialObservation: {
|
||||
raw_result: { exit_code: null, completion_status: "unknown" },
|
||||
},
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("maps an unavailable Rizin command to the Rizin capability error", async () => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const service = new ReverseEngineeringService({
|
||||
run: async () => {
|
||||
throw Object.assign(new Error("not found"), { code: "ENOENT" });
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await service.executeRizinCommand({ path, command: "iI" });
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
_tag: "AnalysisCapabilityUnavailableError",
|
||||
providerId: "rizin",
|
||||
operation: "execute_rizin_command",
|
||||
reason: "Unable to run configured command (ENOENT)",
|
||||
cause: { message: "not found" },
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("classifies a captured ENOENT as provider unavailability", async () => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const cause = Object.assign(new Error("launch failed"), {
|
||||
stdout: "",
|
||||
stderr: "",
|
||||
code: "ENOENT",
|
||||
signal: null,
|
||||
killed: false,
|
||||
});
|
||||
const service = new ReverseEngineeringService({
|
||||
run: async () => {
|
||||
throw cause;
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await service.inspectWithObjdump({
|
||||
path,
|
||||
operation: "file_headers",
|
||||
});
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
_tag: "AnalysisCapabilityUnavailableError",
|
||||
providerId: "objdump",
|
||||
reason: "Unable to run configured command (ENOENT)",
|
||||
cause: { message: "launch failed" },
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const registerSharedReverseEngineeringEdgeCasesPart6 = (): void => {
|
||||
it("waits for active provider cleanup during shutdown and rejects new work", async () => {
|
||||
const { directory, path } = await createArtifact();
|
||||
let signal: AbortSignal | undefined;
|
||||
let announceStarted: (() => void) | undefined;
|
||||
const started = new Promise<void>((resolve) => {
|
||||
announceStarted = resolve;
|
||||
});
|
||||
let releaseProvider: (() => void) | undefined;
|
||||
const providerGate = new Promise<void>((resolve) => {
|
||||
releaseProvider = resolve;
|
||||
});
|
||||
const stop = vi
|
||||
.fn()
|
||||
.mockResolvedValueOnce({ status: "incomplete", reason: "still running" })
|
||||
.mockResolvedValueOnce({ status: "verified-cleanup" });
|
||||
const cleanupOwner = { stop } as unknown as ProviderProcessSupervisor;
|
||||
const runOwned = vi.fn<typeof runOwnedCommand>(
|
||||
async (_spawn, _limits, options) => {
|
||||
signal = options?.signal;
|
||||
announceStarted?.();
|
||||
await providerGate;
|
||||
throw new OwnedCommandFailure(
|
||||
"cancelled",
|
||||
"Command cancelled during shutdown.",
|
||||
providerSnapshot({ exitCode: null }),
|
||||
"still running",
|
||||
undefined,
|
||||
["run-id", "pid:42"],
|
||||
cleanupOwner,
|
||||
);
|
||||
},
|
||||
);
|
||||
const service = new ReverseEngineeringService({ runOwned });
|
||||
|
||||
try {
|
||||
const operation = service.executeRizinCommand({ path, command: "iI" });
|
||||
await started;
|
||||
let closeSettled = false;
|
||||
const closing = service.close().finally(() => {
|
||||
closeSettled = true;
|
||||
});
|
||||
expect(signal?.aborted).toBe(true);
|
||||
await Promise.resolve();
|
||||
expect(closeSettled).toBe(false);
|
||||
releaseProvider?.();
|
||||
|
||||
await expect(operation).resolves.toMatchObject({
|
||||
ok: false,
|
||||
error: { _tag: "AnalysisCancelledError", cleanupIncomplete: true },
|
||||
});
|
||||
await expect(closing).rejects.toMatchObject({
|
||||
cleanupIncomplete: true,
|
||||
cleanup: { reason: "still running" },
|
||||
});
|
||||
expect(stop).toHaveBeenCalledTimes(1);
|
||||
await expect(
|
||||
service.executeRizinCommand({ path, command: "iI" }),
|
||||
).resolves.toMatchObject({
|
||||
ok: false,
|
||||
error: { _tag: "AnalysisOutputError" },
|
||||
});
|
||||
expect(runOwned).toHaveBeenCalledTimes(1);
|
||||
|
||||
await service.close();
|
||||
expect(stop).toHaveBeenCalledTimes(2);
|
||||
} finally {
|
||||
releaseProvider?.();
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const registerSharedReverseEngineeringEdgeCasesPart7 = (): void => {
|
||||
it("maps an uncaptured owned launcher error to provider unavailability", async () => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const service = new ReverseEngineeringService({
|
||||
runOwned: async () => {
|
||||
throw Object.assign(new Error("missing provider"), { code: "ENOENT" });
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await service.executeRizinCommand({ path, command: "iI" });
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
_tag: "AnalysisCapabilityUnavailableError",
|
||||
providerId: "rizin",
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const registerSharedReverseEngineeringEdgeCasesPart8 = (): void => {
|
||||
it("forwards a caller abort signal to the owned command supervisor", async () => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const controller = new AbortController();
|
||||
const runOwned = vi.fn<typeof runOwnedCommand>(async () =>
|
||||
providerSnapshot(),
|
||||
);
|
||||
const service = new ReverseEngineeringService({ runOwned });
|
||||
|
||||
try {
|
||||
const result = await service.executeRizinCommand(
|
||||
{ path, command: "iI" },
|
||||
{ signal: controller.signal },
|
||||
);
|
||||
expect(result.ok).toBe(true);
|
||||
expect(runOwned.mock.calls[0]?.[2]).toMatchObject({
|
||||
signal: expect.any(AbortSignal),
|
||||
});
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("does not classify a completed provider call as cancelled for a live signal", async () => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const controller = new AbortController();
|
||||
const service = new ReverseEngineeringService({
|
||||
run: async () => ({ stdout: "completed output", stderr: "" }),
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await service.executeRizinCommand(
|
||||
{ path, command: "iI" },
|
||||
{ signal: controller.signal },
|
||||
);
|
||||
expect(result).toMatchObject({
|
||||
ok: true,
|
||||
value: {
|
||||
raw_result: {
|
||||
stdout: "completed output",
|
||||
completion_status: "complete",
|
||||
},
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("classifies an owned launcher failure without a process snapshot", async () => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const service = new ReverseEngineeringService({
|
||||
runOwned: async () => {
|
||||
throw new OwnedCommandFailure("process", "no process snapshot");
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await service.executeRizinCommand({ path, command: "iI" });
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
_tag: "AnalysisCapabilityUnavailableError",
|
||||
providerId: "rizin",
|
||||
partialObservation: undefined,
|
||||
reason: "Unable to run configured command (ERR_PROVIDER_LAUNCH)",
|
||||
cause: {
|
||||
message:
|
||||
"Owned provider command did not produce a complete result.",
|
||||
stdout: "",
|
||||
stderr: "",
|
||||
cause: { reason: "process", message: "no process snapshot" },
|
||||
},
|
||||
capturedOutput: undefined,
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("retains an owned process failure snapshot with an unknown exit code", async () => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const service = new ReverseEngineeringService({
|
||||
runOwned: async () => {
|
||||
throw new OwnedCommandFailure(
|
||||
"process",
|
||||
"process ended before reporting an exit code",
|
||||
providerSnapshot({ exitCode: null }),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await service.executeRizinCommand({ path, command: "iI" });
|
||||
expect(result).toMatchObject({
|
||||
ok: true,
|
||||
value: {
|
||||
raw_result: {
|
||||
stdout: "captured owned output",
|
||||
exit_code: null,
|
||||
completion_status: "unknown",
|
||||
},
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const registerSharedReverseEngineeringEdgeCasesPart9 = (): void => {
|
||||
it("fails with partial unknown Evidence when owned output collection fails after exit 0", async () => {
|
||||
const { directory, path } = await createArtifact();
|
||||
const service = new ReverseEngineeringService({
|
||||
runOwned: async () => {
|
||||
throw Object.assign(
|
||||
new OwnedCommandFailure(
|
||||
"process",
|
||||
"stdout stream failed: fixture read failure",
|
||||
providerSnapshot({ exitCode: 0 }),
|
||||
),
|
||||
{ collectionFailure: true },
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await service.executeRizinCommand({ path, command: "iI" });
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
_tag: "AnalysisOutputError",
|
||||
partialObservation: {
|
||||
raw_result: {
|
||||
stdout: "captured owned output",
|
||||
stderr: "diagnostic",
|
||||
exit_code: null,
|
||||
completion_status: "unknown",
|
||||
},
|
||||
},
|
||||
capturedOutput: { exit_code: null },
|
||||
},
|
||||
});
|
||||
if (result.ok) throw new Error("Expected collection failure");
|
||||
expect(result.error.cause).toMatchObject({
|
||||
collectionFailure: true,
|
||||
cause: { reason: "process" },
|
||||
});
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const registerSharedReverseEngineeringEdgeCaseTests = (): void => {
|
||||
registerSharedReverseEngineeringEdgeCasesPart1();
|
||||
registerSharedReverseEngineeringEdgeCasesPart2();
|
||||
registerSharedReverseEngineeringEdgeCasesPart3();
|
||||
registerSharedReverseEngineeringEdgeCasesPart4();
|
||||
registerSharedReverseEngineeringEdgeCasesPart5();
|
||||
registerSharedReverseEngineeringEdgeCasesPart6();
|
||||
registerSharedReverseEngineeringEdgeCasesPart7();
|
||||
registerSharedReverseEngineeringEdgeCasesPart8();
|
||||
registerSharedReverseEngineeringEdgeCasesPart9();
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
import { mkdtemp, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import type { ProviderProcessSnapshot } from "../../src/process/ProviderProcess.js";
|
||||
import { join } from "node:path";
|
||||
|
||||
export const createArtifact = async (): Promise<{
|
||||
directory: string;
|
||||
path: string;
|
||||
}> => {
|
||||
const directory = await mkdtemp(join(tmpdir(), "rea-reverse-edge-"));
|
||||
const path = join(directory, "sample.bin");
|
||||
await writeFile(path, "initial artifact");
|
||||
return { directory, path };
|
||||
};
|
||||
|
||||
export const providerSnapshot = (
|
||||
overrides: Partial<ProviderProcessSnapshot> = {},
|
||||
): ProviderProcessSnapshot => ({
|
||||
stdout: { text: "captured owned output", bytes: 21, observedBytes: 21 },
|
||||
stderr: { text: "diagnostic", bytes: 10, observedBytes: 10 },
|
||||
exitCode: 0,
|
||||
signal: null,
|
||||
...overrides,
|
||||
});
|
||||
@@ -0,0 +1,33 @@
|
||||
import type { McpServer } from "@modelcontextprotocol/server";
|
||||
|
||||
type RegisteredHandler = (input: unknown, context: unknown) => Promise<unknown>;
|
||||
|
||||
export const invokeWithLiveSignal = (
|
||||
handler: RegisteredHandler,
|
||||
input: unknown,
|
||||
): Promise<unknown> =>
|
||||
handler(input, { mcpReq: { signal: new AbortController().signal } });
|
||||
|
||||
export const createReverseEngineeringMcpHarness = (): {
|
||||
server: McpServer;
|
||||
handler: (name: string) => RegisteredHandler;
|
||||
} => {
|
||||
const registrations = new Map<string, RegisteredHandler>();
|
||||
const server = {
|
||||
registerTool: (
|
||||
name: string,
|
||||
_options: unknown,
|
||||
handler: RegisteredHandler,
|
||||
) => registrations.set(name, handler),
|
||||
} as unknown as McpServer;
|
||||
|
||||
return {
|
||||
server,
|
||||
handler: (name) => {
|
||||
const registered = registrations.get(name);
|
||||
if (registered === undefined)
|
||||
throw new Error(`${name} MCP handler was not registered`);
|
||||
return registered;
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
import { createReverseEngineeringCommandPort } from "../../src/composition/reverseEngineering.js";
|
||||
import {
|
||||
ReverseEngineeringService,
|
||||
type ReverseEngineeringServiceOptions,
|
||||
} from "../../src/application/reverse/ReverseEngineeringService.js";
|
||||
|
||||
type TestServiceOptions = Omit<ReverseEngineeringServiceOptions, "commands"> &
|
||||
Partial<Pick<ReverseEngineeringServiceOptions, "commands">>;
|
||||
|
||||
/** Compose the production provider profiles while allowing service-boundary fakes. */
|
||||
export class TestReverseEngineeringService extends ReverseEngineeringService {
|
||||
constructor(options: TestServiceOptions = {}) {
|
||||
const environment = options.environment ?? process.env;
|
||||
super({
|
||||
...options,
|
||||
environment,
|
||||
commands:
|
||||
options.commands ?? createReverseEngineeringCommandPort(environment),
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user