mirror of
https://github.com/morluto/rea.git
synced 2026-10-31 11:56:12 +00:00
fix(process): retain uncertain cleanup ownership (#7845)
* fix(process): retain uncertain cleanup ownership * fix(process): retain moved members through cleanup retry * test(process): reconstruct ownership ledger in cleanup fixture
This commit is contained in:
1 parent
583a316e11
commit
114731eb1e
4 files changed
+271
-12
No files matched your search
@@ -8,6 +8,7 @@ import { JavaScriptAnalysisWorker } from "../../../src/javascript/analysis/JavaS
|
||||
import { createJavaScriptSourceAnalysis } from "../../../src/artifacts/javascript/JavaScriptSourceAnalysis.js";
|
||||
import { ArtifactResourceScope } from "../../../src/artifacts/ArtifactResourceScope.js";
|
||||
import { cleanupOwnedProcessGroup } from "../../../src/process/ProcessOwnership.js";
|
||||
import { ProcessOwnershipEvidenceOwner } from "../../../src/process/ProcessOwnershipEvidence.js";
|
||||
import type { OwnedProcessGroup } from "../../../src/process/ProcessOwnership.js";
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
import { ProviderCleanupError } from "../../../src/domain/providerCleanupError.js";
|
||||
@@ -549,7 +550,9 @@ const worker = new JavaScriptAnalysisWorker({ heapMb: 128, timeoutMs: 10000 }, a
|
||||
] });
|
||||
// The launcher is deliberately orphaned when this host exits; cleanup still
|
||||
// requires its run token and executable identity, rather than its old parent.
|
||||
const { expectedParentPid, ...ownership } = launched.ownership;
|
||||
// The live ledger belongs to this host and cannot be serialized. Transfer
|
||||
// only the process facts needed for the independent fixture cleanup.
|
||||
const { expectedParentPid, evidenceOwner, ...ownership } = launched.ownership;
|
||||
await writeFile(${JSON.stringify(ownershipPath)}, JSON.stringify(ownership));
|
||||
return { ...launched, cleanup: async () => ({ cleaned: false, reason: "fixture inspection unavailable" }) };
|
||||
});
|
||||
@@ -575,9 +578,12 @@ catch (error) {
|
||||
const ownership = JSON.parse(
|
||||
await readFile(ownershipPath, "utf8"),
|
||||
) as OwnedProcessGroup;
|
||||
expect(await cleanupOwnedProcessGroup(ownership)).toMatchObject({
|
||||
cleaned: true,
|
||||
});
|
||||
expect(
|
||||
await cleanupOwnedProcessGroup({
|
||||
...ownership,
|
||||
evidenceOwner: new ProcessOwnershipEvidenceOwner(),
|
||||
}),
|
||||
).toMatchObject({ cleaned: true });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user