mirror of
https://github.com/morluto/rea.git
synced 2026-11-22 06:25:44 +00:00
fix(process): classify GDB, Apktool and Java-probe launch failures through the shared launch owner (#11631)
* fix(process): classify GDB, Apktool and Java-probe launch failures through the shared launch owner GDB session start, the Apktool version probe and the Jadx and Ghidra Java probes read a launcher's error with launcherFailureOf and report host capacity (EAGAIN, ENOMEM, EMFILE, ENFILE) and E2BIG through the shared classifyLaunchFailure, keeping their own unavailable reports for refusals. Only a launcher-raised errno counts as a launch failure, and a GDB launch failure no longer retries the MI2 dialect. The refusal-only classifyLaunchFailure helper is removed. Refs #11614 * fix(process): name the environment as the E2BIG repair for fixed-argument launches GDB, the Apktool version probe and the Jadx and Ghidra Java probes launch fixed arguments, so selecting less input cannot shrink an oversized launch. The shared launch report takes fixedArguments and then tells the caller to shrink the environment REA runs with. Launch tests check structured facts and guidance delivery instead of whole sentences. * fix(process): report which launch input an E2BIG refusal leaves to shrink as a structured fact
This commit is contained in:
1 parent
0035d8edb3
commit
e5cf021ca6
13 files changed
+371
-56
No files matched your search
@@ -18,6 +18,8 @@ import {
|
||||
import type { OwnedProviderProcessSpawnOptions } from "../process/ProviderProcess.js";
|
||||
import { failedInspectionDescriptor } from "../../tests/fixtures/processInspectionCleanup.js";
|
||||
import { createInspectionResources } from "../../tests/fixtures/inspectionResources.js";
|
||||
import { spawnFailure } from "../../tests/support/process/spawnFailure.js";
|
||||
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
||||
|
||||
it.each([false, true])(
|
||||
"retains physical preparation instead of reporting a Java refusal (batch: %s)",
|
||||
@@ -210,3 +212,78 @@ it.each(["probe", "configuration"] as const)(
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
it.each([
|
||||
{ code: "ENOENT", thrown: "launcher", expected: "runtime_missing" },
|
||||
{ code: "ENOENT", thrown: "reader", expected: "runtime_unavailable" },
|
||||
{ code: "EACCES", thrown: "launcher", expected: "runtime_unavailable" },
|
||||
] as const)(
|
||||
"reads only a launcher's $code as a Java runtime refusal ($thrown)",
|
||||
async ({ code, thrown, expected }) => {
|
||||
const resources = createInspectionResources();
|
||||
const prepare = vi
|
||||
.spyOn(systemProcessOwnershipHost, "prepare")
|
||||
.mockResolvedValue(undefined);
|
||||
try {
|
||||
const result = await inspectJadxJava(
|
||||
"/selected/java",
|
||||
{},
|
||||
{
|
||||
resourceOwner: resources.owner,
|
||||
launcher: async () => {
|
||||
throw thrown === "launcher"
|
||||
? spawnFailure(code, "/selected/java")
|
||||
: Object.assign(new Error("read failed"), { code });
|
||||
},
|
||||
},
|
||||
);
|
||||
expect(result).toMatchObject({ ok: false, error: { code: expected } });
|
||||
} finally {
|
||||
prepare.mockRestore();
|
||||
await resources.close();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
it.each([
|
||||
["EAGAIN", true, {}],
|
||||
// The probe's arguments are fixed, so only the environment can shrink.
|
||||
["E2BIG", false, { oversized_launch_input: "environment" }],
|
||||
] as const)(
|
||||
"reports a host launch constraint %s as a resource constraint, not a Java refusal",
|
||||
async (code, retryable, facts) => {
|
||||
const resources = createInspectionResources();
|
||||
const prepare = vi
|
||||
.spyOn(systemProcessOwnershipHost, "prepare")
|
||||
.mockResolvedValue(undefined);
|
||||
try {
|
||||
const result: unknown = await inspectJadxJava(
|
||||
"/selected/java",
|
||||
{},
|
||||
{
|
||||
resourceOwner: resources.owner,
|
||||
launcher: async () => {
|
||||
throw spawnFailure(code, "/selected/java");
|
||||
},
|
||||
},
|
||||
).catch((cause: unknown) => cause);
|
||||
expect(result).toBeInstanceOf(AnalysisError);
|
||||
if (!(result instanceof AnalysisError)) throw result;
|
||||
expect(projectAnalysisError(result)).toMatchObject({
|
||||
code: "resource_constraint",
|
||||
retryable,
|
||||
details: {
|
||||
diagnostics: {
|
||||
system_code: code,
|
||||
command: "/selected/java",
|
||||
java_executable: "/selected/java",
|
||||
...facts,
|
||||
},
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
prepare.mockRestore();
|
||||
await resources.close();
|
||||
}
|
||||
},
|
||||
);
|
||||
Reference in new issue
Block a user