fix(process): identify unknown live processes in cleanup diagnostics
This commit is contained in:
@@ -208,7 +208,7 @@ describe("process environment permission diagnostics", () => {
|
||||
),
|
||||
).resolves.toMatchObject({
|
||||
cleaned: false,
|
||||
reason: `process ownership token could not be read for 1 live process(es): environment_errno_${code}=1`,
|
||||
reason: `process ownership token could not be read for 1 live process(es): environment_errno_${code}=1; live candidates 900=environment_errno_${code}`,
|
||||
failures: [{ pid: 900, reason: "environment-unreadable", diagnostic }],
|
||||
});
|
||||
expect(signalGroup).not.toHaveBeenCalled();
|
||||
|
||||
@@ -193,6 +193,13 @@ describe("opaque process neighbors during cleanup", () => {
|
||||
cleaned: false,
|
||||
reason: expect.stringContaining("environment_unavailable=1"),
|
||||
});
|
||||
if (result.cleaned)
|
||||
throw new Error("Expected unknown ownership to fail closed");
|
||||
expect(result.reason).toContain(
|
||||
"live candidates 900=environment_unavailable",
|
||||
);
|
||||
expect(result.reason).not.toContain("unowned");
|
||||
expect(result.reason).not.toContain("run-token");
|
||||
expect(signalGroup.mock.calls).toEqual([[100, "SIGKILL"]]);
|
||||
expect(signalGroup).not.toHaveBeenCalledWith(900, "SIGKILL");
|
||||
});
|
||||
|
||||
@@ -566,9 +566,15 @@ const cleanupValidationFailure = (
|
||||
.sort(([left], [right]) => left.localeCompare(right))
|
||||
.map(([category, count]) => `${category}=${String(count)}`)
|
||||
.join(", ");
|
||||
const candidates = unreadable
|
||||
.map(
|
||||
({ pid, diagnostic }) =>
|
||||
`${String(pid)}=${sanitizedTokenReadFailure(diagnostic)}`,
|
||||
)
|
||||
.sort((left, right) => left.localeCompare(right));
|
||||
return {
|
||||
cleaned: false,
|
||||
reason: `process ownership token could not be read for ${String(unreadable.length)} live process(es): ${breakdown}`,
|
||||
reason: `process ownership token could not be read for ${String(unreadable.length)} live process(es): ${breakdown}; live candidates ${candidates.join(", ")}`,
|
||||
failures,
|
||||
...unverifiedEntry,
|
||||
};
|
||||
|
||||
@@ -304,7 +304,7 @@ it("retains observations and both causes when process cleanup is unverifiable",
|
||||
owned_process_group: {
|
||||
state: "unverified" as const,
|
||||
reason:
|
||||
"process ownership token could not be read for 1 live process(es): environment_unavailable=1",
|
||||
"process ownership token could not be read for 1 live process(es): environment_unavailable=1; live candidates 900=environment_unavailable",
|
||||
unverified_processes: [
|
||||
{ pid: 900, reason: "platform_binary_environment_withheld" },
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user