fix(process): preserve partial evidence and verify detached cleanup (#1011)

* test(ci): allow transport delivery in source identity regression

* fix(process): preserve partial evidence and verify detached cleanup

* fix(process): scope Linux token sweeps by stable process identity

* fix(process): retain environment permission failure codes

* fix(process): wait for signaled processes before verifying cleanup

* fix(process): verify sampled detached groups during cleanup

* fix(electron): preserve prelaunch identities through cleanup

* fix(process): retry growing Darwin process table snapshots

* fix(process): retain compatibility with saved v3 capture evidence

* fix(process): migrate saved v3 captures during reconstruction verification

* fix(process): preserve cancellation during Darwin helper compilation

* fix(process): propagate cancellation through ownership baselines

* perf(javascript): cache canonical export comparison sort keys

* fix(process): cancel provider ownership preparation before spawn

* fix(process): isolate native compiler waiter cancellation
This commit is contained in:
morluto
2026-10-08 04:46:46 +08:00
committed by GitHub
parent 63ba7424c0
commit 63cf28fd8f
51 changed files with 5506 additions and 316 deletions
+50 -1
View File
@@ -8,7 +8,10 @@ import { PendingOperations } from "../../../src/process/PendingOperations.js";
import { PrivateRuntimeRoot } from "../../../src/process/PrivateRuntimeRoot.js";
import { ProviderStartupDeadline } from "../../../src/process/ProviderDeadline.js";
import { cleanupOwnedProcessGroup } from "../../../src/process/ProcessOwnership.js";
import { observeOwnedProcessLineage } from "../../../src/process/ProcessOwnershipObservation.js";
import {
observeOwnedProcessLineage,
systemProcessOwnershipHost,
} from "../../../src/process/ProcessOwnershipObservation.js";
import {
ProviderProcessSupervisor,
spawnOwnedProviderProcess,
@@ -371,6 +374,52 @@ describe("provider process host injection", () => {
});
});
describe("provider startup cancellation", () => {
it("rejects an already cancelled launch before preparing or spawning", async () => {
const controller = new AbortController();
const cancellation = new Error("provider launch already cancelled");
controller.abort(cancellation);
await expect(
spawnOwnedProviderProcess({
command: `${tmpdir()}/rea-provider-must-not-spawn-after-cancel`,
arguments: [],
runId: "provider-process-pre-aborted-run",
signal: controller.signal,
}),
).rejects.toBe(cancellation);
});
it.skipIf(process.platform !== "darwin")(
"forwards cancellation through native ownership preparation before spawning",
async () => {
const controller = new AbortController();
const cancellation = new Error("cancelled during native preparation");
const prepare = vi.spyOn(systemProcessOwnershipHost, "prepare");
prepare.mockImplementation(async (signal) => {
expect(signal).toBe(controller.signal);
await new Promise<void>((resolve) => {
signal?.addEventListener("abort", () => resolve(), { once: true });
});
});
try {
const starting = spawnOwnedProviderProcess({
command: `${tmpdir()}/rea-provider-must-not-spawn-after-cancel`,
arguments: [],
runId: "provider-process-cancelled-preparation-run",
signal: controller.signal,
});
controller.abort(cancellation);
await expect(starting).rejects.toBe(cancellation);
expect(prepare).toHaveBeenCalledOnce();
} finally {
prepare.mockRestore();
}
},
);
});
describe("provider process spawning primitives", () => {
it("spawns an owned process group with exact identity coordinates", async () => {
const runId = "provider-process-run";