fix(process): retain owned command cleanup diagnostics (#1907)
Preserve per-member verification failures and sweep uncertainty across supervisor stop and owned-command failures. Report the observed token mismatch with its PID coordinates instead of implying PID reuse. Keep unresolved ownership unsignaled and retain the supervisor for a later verified stop. Exercise cancellation, timeout and cleanup revalidation with source-owned process fixtures and cooperative settlement. Closes #1856 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
This commit is contained in:
co-authored by
factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Kaoru0822
parent
23d50ea3be
commit
38539a2f4a
@@ -358,6 +358,57 @@ describe("provider process output and cleanup primitives", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("retains member failures and sweep uncertainty from a failed cleanup recheck", async () => {
|
||||
const child = spawnProviderProcessFixture("stubborn");
|
||||
await waitForProviderProcessReady(child);
|
||||
const pid = child.pid;
|
||||
if (pid === undefined) {
|
||||
await stopProviderProcessFixture(child);
|
||||
throw new Error("The acquired ready fixture must have a process ID");
|
||||
}
|
||||
const failed = {
|
||||
cleaned: false as const,
|
||||
reason: "fixture identity unavailable during recheck",
|
||||
failures: [
|
||||
{
|
||||
pid,
|
||||
reason: "process-identity-unavailable" as const,
|
||||
diagnostic: "fixture identity reader unavailable",
|
||||
},
|
||||
],
|
||||
unverified: [
|
||||
{ pid: 777, diagnostic: "fixture foreign process token unavailable" },
|
||||
],
|
||||
};
|
||||
let attempts = 0;
|
||||
let release = false;
|
||||
const supervisor = new ProviderProcessSupervisor({
|
||||
process: child,
|
||||
ownsProcessLifetime: true,
|
||||
cleanup: async () => {
|
||||
if (release) child.kill("SIGKILL");
|
||||
attempts += 1;
|
||||
return release || attempts === 1
|
||||
? { cleaned: true as const, signaled: release }
|
||||
: failed;
|
||||
},
|
||||
});
|
||||
try {
|
||||
await expect(supervisor.stop({ killGraceMs: 20 })).resolves.toEqual({
|
||||
status: "incomplete",
|
||||
reason: failed.reason,
|
||||
cleanupResult: failed,
|
||||
});
|
||||
expect(child.exitCode).toBeNull();
|
||||
release = true;
|
||||
await expect(supervisor.stop()).resolves.toEqual({
|
||||
status: "verified-cleanup",
|
||||
});
|
||||
} finally {
|
||||
await stopProviderProcessFixture(child);
|
||||
}
|
||||
});
|
||||
|
||||
describe("provider process host injection", () => {
|
||||
it("uses injected host platform and environment when spawning", async () => {
|
||||
const spawned = await spawnOwnedProviderProcess({
|
||||
|
||||
Reference in New Issue
Block a user