fix(process): classify macOS ownership helper capacity exhaustion as resource constraint (#11771)

* fix(process): classify macOS ownership helper capacity exhaustion as resource constraint

Refs #11679

Refs #11714

* fix(process): exclude cancelled preparation from host capacity detection
This commit is contained in:
morluto authored and GitHub committed 2026-11-16 14:58:30 -05:00
1 parent 0ef08895f1
commit bc8b3c4cfa
11 files changed
+293 -41

No files matched your search

+41
View File
@@ -1,4 +1,5 @@
import { validateJadxConfiguration } from "./JadxConfiguration.js";
import { DarwinProcessOwnershipInspectionError } from "../process/DarwinProcessRunTokenReader.js";
import { ProviderCleanupError } from "../domain/providerCleanupError.js";
import { ArtifactResourceRetryFailure } from "../resources/ArtifactResourceScope.js";
import { expect, it, vi } from "vitest";
@@ -287,3 +288,43 @@ it.each([
}
},
);
it("reports EMFILE during macOS ownership helper preparation as a resource constraint", async () => {
const resources = createInspectionResources();
const emfile = spawnFailure("EMFILE", "/usr/bin/swiftc");
const prepare = vi
.spyOn(systemProcessOwnershipHost, "prepare")
.mockRejectedValue(
new DarwinProcessOwnershipInspectionError("helper capacity exhausted", {
cause: emfile,
}),
);
try {
const result: unknown = await inspectJadxJava(
"/selected/java",
{},
{
resourceOwner: resources.owner,
launcher: async (input) => {
await prepareProcessOwnershipInspection(input.signal);
throw new Error("Java must not start");
},
},
).catch((cause: unknown) => cause);
expect(result).toBeInstanceOf(AnalysisError);
if (!(result instanceof AnalysisError)) throw result;
expect(projectAnalysisError(result)).toMatchObject({
code: "resource_constraint",
retryable: true,
details: {
diagnostics: {
system_code: "EMFILE",
java_executable: "/selected/java",
},
},
});
} finally {
prepare.mockRestore();
await resources.close();
}
});