@codyswann/lisa 4.28.4 → 4.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/all/copy-overwrite/scripts/lisa-gates.mjs +2 -1
- package/all/copy-overwrite/scripts/lisa-hooks/sonar-secrets.sh +3 -2
- package/all/copy-overwrite/scripts/lisa-postinstall.mjs +6 -2
- package/cdk/create-only/vitest.config.local.ts +5 -1
- package/cdk/package-lisa/package.lisa.json +14 -7
- package/dist/cli/apply.d.ts +20 -0
- package/dist/cli/apply.d.ts.map +1 -1
- package/dist/cli/apply.js +70 -3
- package/dist/cli/apply.js.map +1 -1
- package/dist/cli/doctor-apply-freshness.d.ts.map +1 -1
- package/dist/cli/doctor-apply-freshness.js +10 -4
- package/dist/cli/doctor-apply-freshness.js.map +1 -1
- package/dist/cli/lisa-test-run-bootstrap.d.ts +3 -0
- package/dist/cli/lisa-test-run-bootstrap.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-bootstrap.js +201 -0
- package/dist/cli/lisa-test-run-bootstrap.js.map +1 -0
- package/dist/cli/lisa-test-run-ipc.d.ts +42 -0
- package/dist/cli/lisa-test-run-ipc.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-ipc.js +200 -0
- package/dist/cli/lisa-test-run-ipc.js.map +1 -0
- package/dist/cli/lisa-test-run-process-group.d.ts +30 -0
- package/dist/cli/lisa-test-run-process-group.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-process-group.js +123 -0
- package/dist/cli/lisa-test-run-process-group.js.map +1 -0
- package/dist/cli/lisa-test-run-reaper.d.ts +3 -0
- package/dist/cli/lisa-test-run-reaper.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-reaper.js +195 -0
- package/dist/cli/lisa-test-run-reaper.js.map +1 -0
- package/dist/cli/lisa-test-run-runtime.d.ts +46 -0
- package/dist/cli/lisa-test-run-runtime.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-runtime.js +123 -0
- package/dist/cli/lisa-test-run-runtime.js.map +1 -0
- package/dist/cli/lisa-test-run-supervisor.d.ts +13 -0
- package/dist/cli/lisa-test-run-supervisor.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-supervisor.js +268 -0
- package/dist/cli/lisa-test-run-supervisor.js.map +1 -0
- package/dist/cli/lisa-test-run.d.ts +3 -0
- package/dist/cli/lisa-test-run.d.ts.map +1 -0
- package/dist/cli/lisa-test-run.js +66 -0
- package/dist/cli/lisa-test-run.js.map +1 -0
- package/dist/cli/shared-options.d.ts +11 -4
- package/dist/cli/shared-options.d.ts.map +1 -1
- package/dist/cli/shared-options.js +8 -8
- package/dist/cli/shared-options.js.map +1 -1
- package/dist/configs/vitest/base.d.ts.map +1 -1
- package/dist/configs/vitest/base.js +5 -2
- package/dist/configs/vitest/base.js.map +1 -1
- package/dist/configs/vitest/cdk.d.ts +4 -0
- package/dist/configs/vitest/cdk.d.ts.map +1 -1
- package/dist/configs/vitest/cdk.js +5 -0
- package/dist/configs/vitest/cdk.js.map +1 -1
- package/dist/configs/vitest/harper-fabric.d.ts.map +1 -1
- package/dist/configs/vitest/harper-fabric.js +1 -0
- package/dist/configs/vitest/harper-fabric.js.map +1 -1
- package/dist/configs/vitest/nestjs.d.ts.map +1 -1
- package/dist/configs/vitest/nestjs.js +1 -0
- package/dist/configs/vitest/nestjs.js.map +1 -1
- package/dist/configs/vitest/phaser.d.ts.map +1 -1
- package/dist/configs/vitest/phaser.js +1 -0
- package/dist/configs/vitest/phaser.js.map +1 -1
- package/dist/configs/vitest/scratch-authority.d.ts +25 -0
- package/dist/configs/vitest/scratch-authority.d.ts.map +1 -0
- package/dist/configs/vitest/scratch-authority.js +107 -0
- package/dist/configs/vitest/scratch-authority.js.map +1 -0
- package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts +5 -0
- package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts.map +1 -0
- package/dist/configs/vitest/scratch-bound-cleanup-programs.js +219 -0
- package/dist/configs/vitest/scratch-bound-cleanup-programs.js.map +1 -0
- package/dist/configs/vitest/scratch-bound-cleanup.d.ts +28 -0
- package/dist/configs/vitest/scratch-bound-cleanup.d.ts.map +1 -0
- package/dist/configs/vitest/scratch-bound-cleanup.js +155 -0
- package/dist/configs/vitest/scratch-bound-cleanup.js.map +1 -0
- package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts +17 -0
- package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts.map +1 -0
- package/dist/configs/vitest/scratch-bound-root-cleanup.js +149 -0
- package/dist/configs/vitest/scratch-bound-root-cleanup.js.map +1 -0
- package/dist/configs/vitest/scratch-global-setup.d.ts +17 -9
- package/dist/configs/vitest/scratch-global-setup.d.ts.map +1 -1
- package/dist/configs/vitest/scratch-global-setup.js +103 -35
- package/dist/configs/vitest/scratch-global-setup.js.map +1 -1
- package/dist/configs/vitest/scratch-leak-setup.d.ts +2 -0
- package/dist/configs/vitest/scratch-leak-setup.d.ts.map +1 -0
- package/dist/configs/vitest/scratch-leak-setup.js +108 -0
- package/dist/configs/vitest/scratch-leak-setup.js.map +1 -0
- package/dist/configs/vitest/scratch-namespace-authority.d.ts +80 -0
- package/dist/configs/vitest/scratch-namespace-authority.d.ts.map +1 -0
- package/dist/configs/vitest/scratch-namespace-authority.js +291 -0
- package/dist/configs/vitest/scratch-namespace-authority.js.map +1 -0
- package/dist/configs/vitest/scratch-owner.d.ts +131 -0
- package/dist/configs/vitest/scratch-owner.d.ts.map +1 -0
- package/dist/configs/vitest/scratch-owner.js +297 -0
- package/dist/configs/vitest/scratch-owner.js.map +1 -0
- package/dist/configs/vitest/scratch-route-profile.d.ts +36 -0
- package/dist/configs/vitest/scratch-route-profile.d.ts.map +1 -0
- package/dist/configs/vitest/scratch-route-profile.js +217 -0
- package/dist/configs/vitest/scratch-route-profile.js.map +1 -0
- package/dist/configs/vitest/scratch-run-root-compatibility.d.ts +33 -0
- package/dist/configs/vitest/scratch-run-root-compatibility.d.ts.map +1 -0
- package/dist/configs/vitest/scratch-run-root-compatibility.js +137 -0
- package/dist/configs/vitest/scratch-run-root-compatibility.js.map +1 -0
- package/dist/configs/vitest/scratch-run-root-intent.d.ts +66 -0
- package/dist/configs/vitest/scratch-run-root-intent.d.ts.map +1 -0
- package/dist/configs/vitest/scratch-run-root-intent.js +183 -0
- package/dist/configs/vitest/scratch-run-root-intent.js.map +1 -0
- package/dist/configs/vitest/scratch-setup.d.ts.map +1 -1
- package/dist/configs/vitest/scratch-setup.js +45 -15
- package/dist/configs/vitest/scratch-setup.js.map +1 -1
- package/dist/configs/vitest/scratch-supervision-intent.d.ts +8 -0
- package/dist/configs/vitest/scratch-supervision-intent.d.ts.map +1 -0
- package/dist/configs/vitest/scratch-supervision-intent.js +125 -0
- package/dist/configs/vitest/scratch-supervision-intent.js.map +1 -0
- package/dist/configs/vitest/scratch-supervision-protocol.d.ts +12 -0
- package/dist/configs/vitest/scratch-supervision-protocol.d.ts.map +1 -0
- package/dist/configs/vitest/scratch-supervision-protocol.js +230 -0
- package/dist/configs/vitest/scratch-supervision-protocol.js.map +1 -0
- package/dist/configs/vitest/scratch-supervision.d.ts +64 -0
- package/dist/configs/vitest/scratch-supervision.d.ts.map +1 -0
- package/dist/configs/vitest/scratch-supervision.js +209 -0
- package/dist/configs/vitest/scratch-supervision.js.map +1 -0
- package/dist/configs/vitest/scratch-sweep.d.ts +66 -0
- package/dist/configs/vitest/scratch-sweep.d.ts.map +1 -0
- package/dist/configs/vitest/scratch-sweep.js +82 -0
- package/dist/configs/vitest/scratch-sweep.js.map +1 -0
- package/dist/configs/vitest/scratch.d.ts +14 -187
- package/dist/configs/vitest/scratch.d.ts.map +1 -1
- package/dist/configs/vitest/scratch.js +18 -285
- package/dist/configs/vitest/scratch.js.map +1 -1
- package/dist/configs/vitest/typescript.d.ts.map +1 -1
- package/dist/configs/vitest/typescript.js +1 -0
- package/dist/configs/vitest/typescript.js.map +1 -1
- package/dist/core/apply-mode.d.ts +80 -29
- package/dist/core/apply-mode.d.ts.map +1 -1
- package/dist/core/apply-mode.js +23 -2
- package/dist/core/apply-mode.js.map +1 -1
- package/dist/core/apply-receipt.d.ts +5 -1
- package/dist/core/apply-receipt.d.ts.map +1 -1
- package/dist/core/apply-receipt.js.map +1 -1
- package/dist/core/config.d.ts +24 -12
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +8 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +63 -15
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/dist/migrations/ensure-lisa-postinstall.d.ts +1 -1
- package/dist/migrations/ensure-lisa-postinstall.d.ts.map +1 -1
- package/dist/migrations/ensure-lisa-postinstall.js +28 -5
- package/dist/migrations/ensure-lisa-postinstall.js.map +1 -1
- package/dist/utils/postinstall-trampoline-source.js +10 -1
- package/dist/utils/postinstall-trampoline-source.js.map +1 -1
- package/expo/package-lisa/package.lisa.json +14 -14
- package/harper-fabric/package-lisa/package.lisa.json +8 -3
- package/nestjs/create-only/vitest.config.local.ts +5 -1
- package/nestjs/package-lisa/package.lisa.json +14 -8
- package/npm-package/package-lisa/package.lisa.json +8 -0
- package/package.json +17 -13
- package/phaser/package-lisa/package.lisa.json +9 -3
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/hooks/sonar-secrets.sh +3 -2
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/hooks/sonar-secrets.sh +3 -2
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/hooks/sonar-secrets.sh +3 -2
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/src/base/hooks/sonar-secrets.sh +3 -2
- package/scripts/install-claude-plugins.sh +7 -2
- package/typescript/create-only/vitest.config.local.ts +5 -1
- package/typescript/package-lisa/package.lisa.json +14 -8
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { once } from "node:events";
|
|
2
|
+
import { env } from "node:process";
|
|
3
|
+
import { parseScratchProtocolMessage, } from "../configs/vitest/scratch-supervision.js";
|
|
4
|
+
/** Protocol timeout for one inert local acknowledgement. */
|
|
5
|
+
const ACK_TIMEOUT_MS = 10_000;
|
|
6
|
+
/** Private deterministic protocol-fault seam. */
|
|
7
|
+
const TEST_FAULT_ENV = "LISA_TEST_RUN_TEST_FAULT";
|
|
8
|
+
/**
|
|
9
|
+
* Whether one companion has already reached a terminal child-process state.
|
|
10
|
+
* @param child - Protocol companion
|
|
11
|
+
* @returns Whether Node has recorded an exit code or terminal signal
|
|
12
|
+
*/
|
|
13
|
+
function companionExited(child) {
|
|
14
|
+
return child.exitCode !== null || child.signalCode !== null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Arm one listener-first, cancellable, bounded companion-exit wait.
|
|
18
|
+
* @param child - Protocol companion
|
|
19
|
+
* @returns Exit promise and listener/timer cancellation
|
|
20
|
+
*/
|
|
21
|
+
function boundedExitWait(child) {
|
|
22
|
+
const controller = new AbortController();
|
|
23
|
+
const exitEvent = once(child, "exit", { signal: controller.signal }).then(() => undefined);
|
|
24
|
+
const observedExit = companionExited(child) ? Promise.resolve() : exitEvent;
|
|
25
|
+
const timeout = new Promise((_resolve, reject) => {
|
|
26
|
+
const timer = setTimeout(() => reject(new Error("Timed out waiting for bootstrap shutdown")), ACK_TIMEOUT_MS);
|
|
27
|
+
controller.signal.addEventListener("abort", () => clearTimeout(timer), {
|
|
28
|
+
once: true,
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
promise: Promise.race([observedExit, timeout]).finally(() => controller.abort()),
|
|
33
|
+
cancel: () => controller.abort(),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** Deterministic test-only representation of a closed IPC transport. */
|
|
37
|
+
class ClosedIpcChannelError extends Error {
|
|
38
|
+
code = "ERR_IPC_CHANNEL_CLOSED";
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Wait for one exact child acknowledgement or fail closed.
|
|
42
|
+
* @param child - Protocol companion
|
|
43
|
+
* @param expected - Exact expected type
|
|
44
|
+
* @param correlation - Optional exact root token
|
|
45
|
+
* @returns Promise settled by the exact validated acknowledgement
|
|
46
|
+
*/
|
|
47
|
+
export function waitForMessage(child, expected, correlation) {
|
|
48
|
+
return new Promise((resolve, reject) => {
|
|
49
|
+
const timer = setTimeout(() => {
|
|
50
|
+
cleanup();
|
|
51
|
+
reject(new Error(`Timed out waiting for ${expected}`));
|
|
52
|
+
}, ACK_TIMEOUT_MS);
|
|
53
|
+
const onMessage = (message) => {
|
|
54
|
+
try {
|
|
55
|
+
const value = parseScratchProtocolMessage(message);
|
|
56
|
+
if (value.type !== expected ||
|
|
57
|
+
(correlation !== undefined && value["correlation"] !== correlation) ||
|
|
58
|
+
(correlation === undefined && Object.hasOwn(value, "correlation"))) {
|
|
59
|
+
throw new Error(`Unexpected ${value.type} while waiting for ${expected}`);
|
|
60
|
+
}
|
|
61
|
+
cleanup();
|
|
62
|
+
resolve(value);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
cleanup();
|
|
66
|
+
reject(error);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const onExit = () => {
|
|
70
|
+
cleanup();
|
|
71
|
+
reject(new Error(`Protocol process exited before ${expected}`));
|
|
72
|
+
};
|
|
73
|
+
const cleanup = () => {
|
|
74
|
+
clearTimeout(timer);
|
|
75
|
+
child.off("message", onMessage);
|
|
76
|
+
child.off("exit", onExit);
|
|
77
|
+
};
|
|
78
|
+
child.on("message", onMessage);
|
|
79
|
+
child.once("exit", onExit);
|
|
80
|
+
if (companionExited(child))
|
|
81
|
+
onExit();
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Wait until a protocol companion is absent from the process table.
|
|
86
|
+
* @param child - Protocol companion
|
|
87
|
+
* @returns Promise settled after exit
|
|
88
|
+
*/
|
|
89
|
+
export function waitForExit(child) {
|
|
90
|
+
if (child.exitCode !== null || child.signalCode !== null) {
|
|
91
|
+
return Promise.resolve();
|
|
92
|
+
}
|
|
93
|
+
return new Promise(resolve => child.once("exit", () => resolve()));
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Send one versioned message or reject a closed IPC channel.
|
|
97
|
+
* @param child - Protocol companion
|
|
98
|
+
* @param message - Exact message body without schema
|
|
99
|
+
* @returns Callback-settled send promise
|
|
100
|
+
*/
|
|
101
|
+
export function sendMessage(child, message) {
|
|
102
|
+
if (env[TEST_FAULT_ENV] === "signal-send-rejected" &&
|
|
103
|
+
message["type"] === "SIGNAL") {
|
|
104
|
+
return Promise.reject(new Error("deterministic signal-send rejection"));
|
|
105
|
+
}
|
|
106
|
+
if (env[TEST_FAULT_ENV] === "stop-send-rejected" &&
|
|
107
|
+
message["type"] === "STOP") {
|
|
108
|
+
return Promise.reject(new Error("deterministic STOP send rejection"));
|
|
109
|
+
}
|
|
110
|
+
if (env[TEST_FAULT_ENV] === "stop-send-closed" &&
|
|
111
|
+
message["type"] === "STOP") {
|
|
112
|
+
return new Promise((_resolve, reject) => {
|
|
113
|
+
child.send({ schema: 1, ...message }, () => {
|
|
114
|
+
reject(new ClosedIpcChannelError("deterministic closed STOP channel"));
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return new Promise((resolve, reject) => {
|
|
119
|
+
child.send({ schema: 1, ...message }, error => {
|
|
120
|
+
if (error === null)
|
|
121
|
+
resolve();
|
|
122
|
+
else
|
|
123
|
+
reject(error);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Whether an IPC send failure proves the channel is already unusable.
|
|
129
|
+
* @param error - IPC callback or synchronous error
|
|
130
|
+
* @returns Whether the channel is conclusively closed
|
|
131
|
+
*/
|
|
132
|
+
function isClosedIpcError(error) {
|
|
133
|
+
const code = error.code;
|
|
134
|
+
return code === "ERR_IPC_CHANNEL_CLOSED" || code === "ERR_IPC_DISCONNECTED";
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Wait for the payload result and reject every other message.
|
|
138
|
+
* @param bootstrap - Inert bootstrap leader
|
|
139
|
+
* @param signalEscalating - Whether parent signal escalation owns its exit
|
|
140
|
+
* @returns Exact payload result
|
|
141
|
+
*/
|
|
142
|
+
export function waitForPayload(bootstrap, signalEscalating = () => false) {
|
|
143
|
+
return new Promise((resolve, reject) => {
|
|
144
|
+
const onMessage = (message) => {
|
|
145
|
+
try {
|
|
146
|
+
const value = parseScratchProtocolMessage(message);
|
|
147
|
+
if (value.type === "PAYLOAD_ERROR") {
|
|
148
|
+
throw new Error(value["message"]);
|
|
149
|
+
}
|
|
150
|
+
if (value.type !== "PAYLOAD_EXIT") {
|
|
151
|
+
throw new Error(`Unexpected ${value.type} during payload execution`);
|
|
152
|
+
}
|
|
153
|
+
cleanup();
|
|
154
|
+
resolve({
|
|
155
|
+
code: value["code"],
|
|
156
|
+
signal: value["signal"],
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
cleanup();
|
|
161
|
+
reject(error);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const onExit = () => {
|
|
165
|
+
cleanup();
|
|
166
|
+
if (signalEscalating())
|
|
167
|
+
return;
|
|
168
|
+
reject(new Error("Bootstrap exited before reporting payload result"));
|
|
169
|
+
};
|
|
170
|
+
const cleanup = () => {
|
|
171
|
+
bootstrap.off("message", onMessage);
|
|
172
|
+
bootstrap.off("exit", onExit);
|
|
173
|
+
};
|
|
174
|
+
bootstrap.on("message", onMessage);
|
|
175
|
+
bootstrap.once("exit", onExit);
|
|
176
|
+
if (companionExited(bootstrap))
|
|
177
|
+
onExit();
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Stop the inert leader and wait for it to leave the target group.
|
|
182
|
+
* @param bootstrap - Inert bootstrap leader
|
|
183
|
+
*/
|
|
184
|
+
export async function stopBootstrap(bootstrap) {
|
|
185
|
+
if (companionExited(bootstrap))
|
|
186
|
+
return;
|
|
187
|
+
const exitWait = boundedExitWait(bootstrap);
|
|
188
|
+
try {
|
|
189
|
+
await sendMessage(bootstrap, { type: "STOP" });
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
if (!companionExited(bootstrap) && !isClosedIpcError(error)) {
|
|
193
|
+
exitWait.cancel();
|
|
194
|
+
await exitWait.promise.catch(() => undefined);
|
|
195
|
+
throw error;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
await exitWait.promise;
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=lisa-test-run-ipc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lisa-test-run-ipc.js","sourceRoot":"","sources":["../../src/cli/lisa-test-run-ipc.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EACL,2BAA2B,GAE5B,MAAM,0CAA0C,CAAC;AAElD,4DAA4D;AAC5D,MAAM,cAAc,GAAG,MAAM,CAAC;AAE9B,iDAAiD;AACjD,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAElD;;;;GAIG;AACH,SAAS,eAAe,CAAC,KAAmB;IAC1C,OAAO,KAAK,CAAC,QAAQ,KAAK,IAAI,IAAI,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;AAC9D,CAAC;AAED;;;;GAIG;AACH,SAAS,eAAe,CAAC,KAAmB;IAI1C,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CACvE,GAAG,EAAE,CAAC,SAAS,CAChB,CAAC;IACF,MAAM,YAAY,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5E,MAAM,OAAO,GAAG,IAAI,OAAO,CAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE;QACtD,MAAM,KAAK,GAAG,UAAU,CACtB,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC,EACnE,cAAc,CACf,CAAC;QACF,UAAU,CAAC,MAAM,CAAC,gBAAgB,C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AC,SAAS,EAAE,SAAS,CAAC,CAAC;QACnC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/B,IAAI,eAAe,CAAC,SAAS,CAAC;YAAE,MAAM,EAAE,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,SAAuB;IACzD,IAAI,eAAe,CAAC,SAAS,CAAC;QAAE,OAAO;IACvC,MAAM,QAAQ,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;IAC5C,IAAI,CAAC;QACH,MAAM,WAAW,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IACjD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5D,QAAQ,CAAC,MAAM,EAAE,CAAC;YAClB,MAAM,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YAC9C,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IACD,MAAM,QAAQ,CAAC,OAAO,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reject unsupported platforms before any scratch root or companion exists.
|
|
3
|
+
* @param platform - Runtime platform
|
|
4
|
+
*/
|
|
5
|
+
export declare function assertTestRunPlatform(platform?: NodeJS.Platform): void;
|
|
6
|
+
/** Armed bootstrap leader and process-group identity. */
|
|
7
|
+
export interface TestRunTargetIntent {
|
|
8
|
+
readonly pid: number;
|
|
9
|
+
readonly pgid: number;
|
|
10
|
+
readonly processBirthFingerprint: string;
|
|
11
|
+
}
|
|
12
|
+
/** Injectable probes used to deterministically prove fail-closed authority. */
|
|
13
|
+
export interface TestRunProcessGroupProbes {
|
|
14
|
+
readonly isProcessAlive: (pid: number) => boolean;
|
|
15
|
+
readonly processBirthFingerprint: (pid: number) => string | undefined;
|
|
16
|
+
readonly processGroupAlive: (pgid: number) => boolean;
|
|
17
|
+
readonly signalGroup: (pgid: number, signal: NodeJS.Signals) => void;
|
|
18
|
+
readonly delay: (milliseconds: number) => Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
/** Optional probe overrides for one drain attempt. */
|
|
21
|
+
export interface DrainTestRunTargetOptions {
|
|
22
|
+
readonly probes?: Partial<TestRunProcessGroupProbes>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Drain only the group whose leader still has its armed process birth.
|
|
26
|
+
* @param target - Armed leader and group identity
|
|
27
|
+
* @param options - Optional deterministic probe overrides
|
|
28
|
+
*/
|
|
29
|
+
export declare function drainTestRunTarget(target: TestRunTargetIntent | undefined, options?: DrainTestRunTargetOptions): Promise<void>;
|
|
30
|
+
//# sourceMappingURL=lisa-test-run-process-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lisa-test-run-process-group.d.ts","sourceRoot":"","sources":["../../src/cli/lisa-test-run-process-group.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAC3C,IAAI,CAMN;AAED,yDAAyD;AACzD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;CAC1C;AAED,+EAA+E;AAC/E,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAClD,QAAQ,CAAC,uBAAuB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACtE,QAAQ,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACtD,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC;IACrE,QAAQ,CAAC,KAAK,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD;AAED,sDAAsD;AACtD,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;CACtD;AAqFD;;;;GAIG;AAEH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,mBAAmB,GAAG,SAAS,EACvC,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,IAAI,CAAC,CAkCf"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/** Birth-bound process-group draining shared by the supervisor and reaper. */
|
|
2
|
+
import { isProcessAlive } from "../configs/vitest/scratch.js";
|
|
3
|
+
import { processBirthFingerprint } from "../configs/vitest/scratch-owner.js";
|
|
4
|
+
/**
|
|
5
|
+
* Reject unsupported platforms before any scratch root or companion exists.
|
|
6
|
+
* @param platform - Runtime platform
|
|
7
|
+
*/
|
|
8
|
+
export function assertTestRunPlatform(platform = process.platform) {
|
|
9
|
+
if (platform !== "darwin" && platform !== "linux") {
|
|
10
|
+
throw new Error(`lisa-test-run requires Darwin or Linux process-group authority; received ${platform}`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** Time allowed for each process-group drain phase. */
|
|
14
|
+
const DRAIN_GRACE_MS = 2_000;
|
|
15
|
+
/** Poll interval for bounded group drain. */
|
|
16
|
+
const DRAIN_POLL_MS = 25;
|
|
17
|
+
/** Attempts allowed when a live process has no readable birth fingerprint. */
|
|
18
|
+
const BIRTH_PROBE_ATTEMPTS = 4;
|
|
19
|
+
/**
|
|
20
|
+
* Whether any member still occupies a process group.
|
|
21
|
+
* @param pgid - Armed process-group identifier
|
|
22
|
+
* @returns Whether the group still resolves
|
|
23
|
+
*/
|
|
24
|
+
function processGroupAlive(pgid) {
|
|
25
|
+
try {
|
|
26
|
+
process.kill(-pgid, 0);
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
return error.code === "EPERM";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Signal a group without turning an already-absent group into a failure.
|
|
35
|
+
* @param pgid - Armed process-group identifier
|
|
36
|
+
* @param signal - Signal to deliver
|
|
37
|
+
*/
|
|
38
|
+
function signalGroup(pgid, signal) {
|
|
39
|
+
try {
|
|
40
|
+
process.kill(-pgid, signal);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
const code = error.code;
|
|
44
|
+
if (code !== "ESRCH" && code !== "EPERM")
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Wait without leaving a permanent timer handle.
|
|
50
|
+
* @param milliseconds - Bounded poll delay
|
|
51
|
+
* @returns Promise settled after the delay
|
|
52
|
+
*/
|
|
53
|
+
const delay = async (milliseconds) => await new Promise(resolve => setTimeout(resolve, milliseconds));
|
|
54
|
+
/** Real operating-system probes used outside deterministic unit controls. */
|
|
55
|
+
const DEFAULT_PROBES = {
|
|
56
|
+
isProcessAlive,
|
|
57
|
+
processBirthFingerprint,
|
|
58
|
+
processGroupAlive,
|
|
59
|
+
signalGroup,
|
|
60
|
+
delay,
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Establish that a live leader is still the exact process originally armed.
|
|
64
|
+
* @param target - Armed leader identity
|
|
65
|
+
* @param probes - Operating-system probes
|
|
66
|
+
* @param attempt - Current bounded unavailable-probe attempt
|
|
67
|
+
* @returns Whether the armed leader remains present with birth authority
|
|
68
|
+
*/
|
|
69
|
+
async function assertTargetBirthAuthority(target, probes, attempt = 0) {
|
|
70
|
+
if (!probes.isProcessAlive(target.pid))
|
|
71
|
+
return false;
|
|
72
|
+
const observed = probes.processBirthFingerprint(target.pid);
|
|
73
|
+
if (observed === target.processBirthFingerprint)
|
|
74
|
+
return true;
|
|
75
|
+
if (observed !== undefined) {
|
|
76
|
+
throw new Error("target leader process-birth fingerprint changed; refusing group signal");
|
|
77
|
+
}
|
|
78
|
+
if (attempt + 1 < BIRTH_PROBE_ATTEMPTS) {
|
|
79
|
+
await probes.delay(DRAIN_POLL_MS);
|
|
80
|
+
return await assertTargetBirthAuthority(target, probes, attempt + 1);
|
|
81
|
+
}
|
|
82
|
+
throw new Error("target leader process-birth fingerprint remained unavailable");
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Drain only the group whose leader still has its armed process birth.
|
|
86
|
+
* @param target - Armed leader and group identity
|
|
87
|
+
* @param options - Optional deterministic probe overrides
|
|
88
|
+
*/
|
|
89
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity -- fail-closed birth and two-phase signal authority are one bounded decision
|
|
90
|
+
export async function drainTestRunTarget(target, options = {}) {
|
|
91
|
+
if (target === undefined)
|
|
92
|
+
return;
|
|
93
|
+
const probes = { ...DEFAULT_PROBES, ...options.probes };
|
|
94
|
+
const targetPresent = await assertTargetBirthAuthority(target, probes);
|
|
95
|
+
const groupPresent = probes.processGroupAlive(target.pgid);
|
|
96
|
+
if (!targetPresent) {
|
|
97
|
+
if (groupPresent) {
|
|
98
|
+
throw new Error("target leader is absent while its process group is live; refusing group signal");
|
|
99
|
+
}
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (!groupPresent)
|
|
103
|
+
return;
|
|
104
|
+
const deadline = Date.now() + DRAIN_GRACE_MS;
|
|
105
|
+
probes.signalGroup(target.pgid, "SIGTERM");
|
|
106
|
+
while (probes.processGroupAlive(target.pgid) && Date.now() < deadline) {
|
|
107
|
+
await probes.delay(DRAIN_POLL_MS);
|
|
108
|
+
}
|
|
109
|
+
if (probes.processGroupAlive(target.pgid)) {
|
|
110
|
+
if (!(await assertTargetBirthAuthority(target, probes))) {
|
|
111
|
+
throw new Error("target leader is absent while its process group is live; refusing group signal");
|
|
112
|
+
}
|
|
113
|
+
const killDeadline = Date.now() + DRAIN_GRACE_MS;
|
|
114
|
+
probes.signalGroup(target.pgid, "SIGKILL");
|
|
115
|
+
while (probes.processGroupAlive(target.pgid) && Date.now() < killDeadline) {
|
|
116
|
+
await probes.delay(DRAIN_POLL_MS);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (probes.processGroupAlive(target.pgid)) {
|
|
120
|
+
throw new Error("target process group survived bounded drain");
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=lisa-test-run-process-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lisa-test-run-process-group.js","sourceRoot":"","sources":["../../src/cli/lisa-test-run-process-group.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,WAA4B,OAAO,CAAC,QAAQ;IAE5C,IAAI,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CACb,4EAA4E,QAAQ,EAAE,CACvF,CAAC;IACJ,CAAC;AACH,CAAC;AAuBD,uDAAuD;AACvD,MAAM,cAAc,GAAG,KAAK,CAAC;AAE7B,6CAA6C;AAC7C,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB,8EAA8E;AAC9E,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAE/B;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,IAAY;IACrC,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,C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CAAC,MAAM,0BAA0B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;YACxD,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;QACJ,CAAC;QACD,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,cAAc,CAAC;QACjD,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC3C,OAAO,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;YAC1E,MAAM,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IACD,IAAI,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lisa-test-run-reaper.d.ts","sourceRoot":"","sources":["../../src/cli/lisa-test-run-reaper.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/** Detached one-run reaper for supervisor death and scratch cleanup. */
|
|
3
|
+
import { env } from "node:process";
|
|
4
|
+
import { materializeOwnedScratchRunRoot, openOwnedScratchRunRoot, removeOwnedScratchRunRoot, } from "../configs/vitest/scratch.js";
|
|
5
|
+
import { processBirthFingerprint, writeScratchOwnerRecord, } from "../configs/vitest/scratch-owner.js";
|
|
6
|
+
import { parseScratchProtocolMessage, validateScratchRunRootIntent, } from "../configs/vitest/scratch-supervision.js";
|
|
7
|
+
import { drainTestRunTarget, } from "./lisa-test-run-process-group.js";
|
|
8
|
+
/** Private deterministic fault seam, stripped before payload execution. */
|
|
9
|
+
const TEST_FAULT_ENV = "LISA_TEST_RUN_TEST_FAULT";
|
|
10
|
+
/**
|
|
11
|
+
* Validate and arm one pre-materialization root intent.
|
|
12
|
+
* @param value - Exact root-intent message
|
|
13
|
+
* @returns Immutable root intent
|
|
14
|
+
*/
|
|
15
|
+
function armRootIntent(value) {
|
|
16
|
+
const candidate = validateScratchRunRootIntent(value["intent"]);
|
|
17
|
+
if (value["correlation"] !== candidate.token ||
|
|
18
|
+
openOwnedScratchRunRoot(candidate) !== undefined ||
|
|
19
|
+
env[TEST_FAULT_ENV] === "reaper-refuse-root-intent") {
|
|
20
|
+
throw new Error("Scratch root intent was not conclusively absent");
|
|
21
|
+
}
|
|
22
|
+
return candidate;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Materialize the exact armed intent inside the detached authority.
|
|
26
|
+
* @param value - Exact correlated materialization request
|
|
27
|
+
* @param intent - Previously armed root intent
|
|
28
|
+
* @returns Newly persisted root identity
|
|
29
|
+
*/
|
|
30
|
+
function materializeArmedRoot(value, intent) {
|
|
31
|
+
if (intent === undefined ||
|
|
32
|
+
value["correlation"] !== intent.token ||
|
|
33
|
+
openOwnedScratchRunRoot(intent) !== undefined) {
|
|
34
|
+
throw new Error("Scratch root materialization does not match armed intent");
|
|
35
|
+
}
|
|
36
|
+
const owned = materializeOwnedScratchRunRoot(intent, {
|
|
37
|
+
writeOwnerRecord: (root, owner) => {
|
|
38
|
+
if (env[TEST_FAULT_ENV] === "pause-before-owner-marker") {
|
|
39
|
+
process.kill(process.pid, "SIGSTOP");
|
|
40
|
+
}
|
|
41
|
+
writeScratchOwnerRecord(root, owner);
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
return owned.owner.root;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Validate and arm one birth-bound target before root materialization.
|
|
48
|
+
* @param value - Exact target-intent message
|
|
49
|
+
* @param intent - Previously armed root intent
|
|
50
|
+
* @returns Immutable target authority
|
|
51
|
+
*/
|
|
52
|
+
function armTargetIntent(value, intent) {
|
|
53
|
+
const candidate = value["target"];
|
|
54
|
+
if (intent === undefined ||
|
|
55
|
+
value["correlation"] !== intent.token ||
|
|
56
|
+
openOwnedScratchRunRoot(intent) !== undefined ||
|
|
57
|
+
processBirthFingerprint(candidate.pid) !==
|
|
58
|
+
candidate.processBirthFingerprint ||
|
|
59
|
+
env[TEST_FAULT_ENV] === "reaper-refuse-target-intent") {
|
|
60
|
+
throw new Error("Target intent does not match the armed root correlation");
|
|
61
|
+
}
|
|
62
|
+
return candidate;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Run detached recovery once, then exit with no permanent companion.
|
|
66
|
+
* @param state - Reaper lifecycle state
|
|
67
|
+
*/
|
|
68
|
+
async function recover(state) {
|
|
69
|
+
if (state.recovering || state.disarmed)
|
|
70
|
+
return;
|
|
71
|
+
// eslint-disable-next-line functional/immutable-data -- exactly-once recovery transition
|
|
72
|
+
state.recovering = true;
|
|
73
|
+
try {
|
|
74
|
+
if (env[TEST_FAULT_ENV] === "pause-recovery-before-drain") {
|
|
75
|
+
process.kill(process.pid, "SIGSTOP");
|
|
76
|
+
}
|
|
77
|
+
await drainTestRunTarget(state.target);
|
|
78
|
+
if (state.intent !== undefined)
|
|
79
|
+
removeOwnedScratchRunRoot(state.intent);
|
|
80
|
+
process.exit(0);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
process.stderr.write(`lisa-test-run reaper failed: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Send one exact acknowledgement or enter detached recovery.
|
|
89
|
+
* @param state - Reaper lifecycle state
|
|
90
|
+
* @param type - Exact acknowledgement type
|
|
91
|
+
* @param correlation - Optional root token correlation
|
|
92
|
+
* @param body - Exact type-specific acknowledgement fields
|
|
93
|
+
* @param onSent - Optional terminal action after the IPC callback flushes
|
|
94
|
+
*/
|
|
95
|
+
function sendAcknowledgement(state, type, correlation, body = {}, onSent) {
|
|
96
|
+
if (env[TEST_FAULT_ENV] === "reaper-close-root-armed" &&
|
|
97
|
+
type === "ROOT_ARMED" &&
|
|
98
|
+
process.connected) {
|
|
99
|
+
process.disconnect();
|
|
100
|
+
}
|
|
101
|
+
if (!process.connected || process.send === undefined) {
|
|
102
|
+
void recover(state);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
process.send({
|
|
107
|
+
schema: 1,
|
|
108
|
+
type,
|
|
109
|
+
...(correlation === undefined ? {} : { correlation }),
|
|
110
|
+
...body,
|
|
111
|
+
}, error => {
|
|
112
|
+
if (error !== null)
|
|
113
|
+
void recover(state);
|
|
114
|
+
else
|
|
115
|
+
onSent?.();
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
void recover(state);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Apply one exact message to the current reaper phase.
|
|
124
|
+
* @param state - Reaper lifecycle state
|
|
125
|
+
* @param message - Untrusted IPC message
|
|
126
|
+
*/
|
|
127
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity -- four explicit protocol phases are kept visibly fail-closed
|
|
128
|
+
function handleMessage(state, message) {
|
|
129
|
+
const value = parseScratchProtocolMessage(message);
|
|
130
|
+
if (state.phase === "await-root-intent" && value.type === "ROOT_INTENT") {
|
|
131
|
+
const intent = armRootIntent(value);
|
|
132
|
+
// eslint-disable-next-line functional/immutable-data -- immutable authority captured once
|
|
133
|
+
state.intent = intent;
|
|
134
|
+
// eslint-disable-next-line functional/immutable-data -- ordered protocol transition
|
|
135
|
+
state.phase = "await-target-intent";
|
|
136
|
+
sendAcknowledgement(state, "ROOT_INTENT_ARMED", intent.token);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (state.phase === "await-target-intent" && value.type === "TARGET_INTENT") {
|
|
140
|
+
const target = armTargetIntent(value, state.intent);
|
|
141
|
+
// eslint-disable-next-line functional/immutable-data -- immutable target captured once
|
|
142
|
+
state.target = target;
|
|
143
|
+
// eslint-disable-next-line functional/immutable-data -- ordered protocol transition
|
|
144
|
+
state.phase = "await-materialization";
|
|
145
|
+
sendAcknowledgement(state, "TARGET_ARMED", state.intent?.token);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (state.phase === "await-materialization" &&
|
|
149
|
+
value.type === "MATERIALIZE_ROOT") {
|
|
150
|
+
const root = materializeArmedRoot(value, state.intent);
|
|
151
|
+
// eslint-disable-next-line functional/immutable-data -- ordered protocol transition
|
|
152
|
+
state.phase = "armed";
|
|
153
|
+
sendAcknowledgement(state, "ROOT_ARMED", state.intent?.token, { root });
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (state.phase === "armed" && value.type === "CLEANED") {
|
|
157
|
+
if (state.intent !== undefined &&
|
|
158
|
+
openOwnedScratchRunRoot(state.intent) !== undefined) {
|
|
159
|
+
throw new Error("Foreground cleanup did not remove the armed root");
|
|
160
|
+
}
|
|
161
|
+
// eslint-disable-next-line functional/immutable-data -- terminal disarm transition
|
|
162
|
+
state.disarmed = true;
|
|
163
|
+
// eslint-disable-next-line functional/immutable-data -- terminal disarm transition
|
|
164
|
+
state.phase = "disarmed";
|
|
165
|
+
sendAcknowledgement(state, "DISARMED", undefined, {}, () => {
|
|
166
|
+
process.disconnect();
|
|
167
|
+
process.exit(0);
|
|
168
|
+
});
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
throw new Error(`Unexpected ${value.type} in reaper state ${state.phase}`);
|
|
172
|
+
}
|
|
173
|
+
/** Start the one-shot detached recovery protocol. */
|
|
174
|
+
function main() {
|
|
175
|
+
const state = {
|
|
176
|
+
disarmed: false,
|
|
177
|
+
recovering: false,
|
|
178
|
+
phase: "await-root-intent",
|
|
179
|
+
};
|
|
180
|
+
process.on("message", message => {
|
|
181
|
+
try {
|
|
182
|
+
handleMessage(state, message);
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
process.stderr.write(`lisa-test-run reaper refused protocol: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
186
|
+
void recover(state);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
process.once("disconnect", () => void recover(state));
|
|
190
|
+
sendAcknowledgement(state, "REAPER_READY");
|
|
191
|
+
}
|
|
192
|
+
if (env[TEST_FAULT_ENV] === "reaper-startup")
|
|
193
|
+
process.exit(77);
|
|
194
|
+
main();
|
|
195
|
+
//# sourceMappingURL=lisa-test-run-reaper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lisa-test-run-reaper.js","sourceRoot":"","sources":["../../src/cli/lisa-test-run-reaper.ts"],"names":[],"mappings":";AACA,wEAAwE;AACxE,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EACL,8BAA8B,EAC9B,uBAAuB,EACvB,yBAAyB,GAE1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,uBAAuB,EACvB,uBAAuB,GAExB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,GAE7B,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACL,kBAAkB,GAEnB,MAAM,kCAAkC,CAAC;AAE1C,2EAA2E;AAC3E,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAgBlD;;;;GAIG;AACH,SAAS,aAAa,CACpB,KAA+B;IAE/B,MAAM,SAAS,GAAG,4BAA4B,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAChE,IACE,KAAK,CAAC,aAAa,CAAC,KAAK,SAAS,CAAC,KAAK;QACxC,uBAAuB,CAAC,SAAS,CAAC,KAAK,SAAS;QAChD,GAAG,CAAC,cAAc,CAAC,KAAK,2BAA2B,EACnD,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB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CAAC,SAAS,EAAE,OAAO,CAAC,EAAE;QAC9B,IAAI,CAAC;YACH,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,0CAA0C,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CACrG,CAAC;YACF,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IACtD,mBAAmB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AAC7C,CAAC;AAED,IAAI,GAAG,CAAC,cAAc,CAAC,KAAK,gBAAgB;IAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC/D,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** Runtime-only companion, environment, and signal escalation primitives. */
|
|
2
|
+
import { type ChildProcess } from "node:child_process";
|
|
3
|
+
import { type ScratchRouteProfile } from "../configs/vitest/scratch-route-profile.js";
|
|
4
|
+
import type { PayloadOutcome } from "./lisa-test-run-ipc.js";
|
|
5
|
+
import { type TestRunTargetIntent } from "./lisa-test-run-process-group.js";
|
|
6
|
+
/** Catchable signals forwarded to the target process group. */
|
|
7
|
+
export declare const FORWARDED_SIGNALS: readonly NodeJS.Signals[];
|
|
8
|
+
/** Cancellable escalation armed by the first forwarded catchable signal. */
|
|
9
|
+
export interface SignalEscalation {
|
|
10
|
+
readonly promise: Promise<PayloadOutcome>;
|
|
11
|
+
readonly begin: (signal: NodeJS.Signals) => void;
|
|
12
|
+
readonly cancel: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Start one source-or-built sibling as a detached IPC child.
|
|
16
|
+
* @param name - Sibling module basename
|
|
17
|
+
* @returns Detached protocol companion
|
|
18
|
+
*/
|
|
19
|
+
export declare function forkDetachedSibling(name: string): ChildProcess;
|
|
20
|
+
/**
|
|
21
|
+
* Convert inherited values plus the frozen lease to the spawn contract.
|
|
22
|
+
* @param lease - Serialized exact suite lease
|
|
23
|
+
* @param profile - Frozen wrapper route profile
|
|
24
|
+
* @param directScratchRoot - Direct-adapter platform temp root, when applicable
|
|
25
|
+
* @returns String-only payload environment
|
|
26
|
+
*/
|
|
27
|
+
export declare function payloadEnvironment(lease: string, profile: ScratchRouteProfile, directScratchRoot?: string): Record<string, string>;
|
|
28
|
+
/**
|
|
29
|
+
* Reject if the detached cleanup authority exits during the payload.
|
|
30
|
+
* @param reaper - Armed detached reaper
|
|
31
|
+
* @returns Promise that only rejects on exit
|
|
32
|
+
*/
|
|
33
|
+
export declare function rejectOnReaperExit(reaper: ChildProcess): Promise<never>;
|
|
34
|
+
/**
|
|
35
|
+
* Drain with deterministic birth-probe failures only in dedicated controls.
|
|
36
|
+
* @param target - Armed target authority
|
|
37
|
+
* @returns Bounded drain promise
|
|
38
|
+
*/
|
|
39
|
+
export declare function drainSupervisedTarget(target: TestRunTargetIntent | undefined): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Build one cancellable TERM-to-KILL escalation.
|
|
42
|
+
* @param target - Armed birth-bound target
|
|
43
|
+
* @returns Cancellable escalation
|
|
44
|
+
*/
|
|
45
|
+
export declare function createSignalEscalation(target: TestRunTargetIntent): SignalEscalation;
|
|
46
|
+
//# sourceMappingURL=lisa-test-run-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lisa-test-run-runtime.d.ts","sourceRoot":"","sources":["../../src/cli/lisa-test-run-runtime.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,OAAO,EAAQ,KAAK,YAAY,EAAE,MAAM,oBAAoB,C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