@tickernelz/wardmote-adapter-utils 2026.1109.0 → 2026.1111.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 +1 -1
- package/dist/acpx-engine/composed-run-characterization.test.js +13 -16
- package/dist/acpx-engine/composed-run-characterization.test.js.map +1 -1
- package/dist/acpx-engine/ephemeral-session-environment.test.js +1 -1
- package/dist/acpx-engine/ephemeral-session-environment.test.js.map +1 -1
- package/dist/acpx-engine/execute-identity.test.js +3 -3
- package/dist/acpx-engine/execute-identity.test.js.map +1 -1
- package/dist/acpx-engine/execute.d.ts +2 -28
- package/dist/acpx-engine/execute.d.ts.map +1 -1
- package/dist/acpx-engine/execute.js +135 -196
- package/dist/acpx-engine/execute.js.map +1 -1
- package/dist/acpx-engine/execute.test.js +171 -187
- package/dist/acpx-engine/execute.test.js.map +1 -1
- package/dist/acpx-engine/filesystem-protocol.test.js +1 -1
- package/dist/acpx-engine/filesystem-protocol.test.js.map +1 -1
- package/dist/acpx-engine/managed-codex-skills-manifest.d.ts +3 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.d.ts.map +1 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.js +30 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.js.map +1 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.test.d.ts +2 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.test.d.ts.map +1 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.test.js +29 -0
- package/dist/acpx-engine/managed-codex-skills-manifest.test.js.map +1 -0
- package/dist/acpx-engine/operator-stop.test.js +1 -1
- package/dist/acpx-engine/operator-stop.test.js.map +1 -1
- package/dist/acpx-engine/remote-spawn-smoke.test.js +5 -5
- package/dist/acpx-engine/remote-spawn-smoke.test.js.map +1 -1
- package/dist/acpx-engine/run-contracts.d.ts +5 -15
- package/dist/acpx-engine/run-contracts.d.ts.map +1 -1
- package/dist/acpx-engine/run-contracts.js.map +1 -1
- package/dist/acpx-engine/run-fault-matrix.test.js +7 -7
- package/dist/acpx-engine/run-fault-matrix.test.js.map +1 -1
- package/dist/acpx-engine/run-site-sandbox.d.ts +5 -12
- package/dist/acpx-engine/run-site-sandbox.d.ts.map +1 -1
- package/dist/acpx-engine/run-site-sandbox.js +4 -16
- package/dist/acpx-engine/run-site-sandbox.js.map +1 -1
- package/dist/acpx-engine/run-site-sandbox.test.js +10 -13
- package/dist/acpx-engine/run-site-sandbox.test.js.map +1 -1
- package/dist/acpx-engine/settlement-characterization.test.js +20 -20
- package/dist/acpx-engine/settlement-characterization.test.js.map +1 -1
- package/dist/acpx-engine/spawn-smoke.test.js +6 -6
- package/dist/acpx-engine/spawn-smoke.test.js.map +1 -1
- package/dist/acpx-engine/startup-characterization.test.js +14 -18
- package/dist/acpx-engine/startup-characterization.test.js.map +1 -1
- package/dist/acpx-engine/startup-timing.d.ts +27 -45
- package/dist/acpx-engine/startup-timing.d.ts.map +1 -1
- package/dist/acpx-engine/startup-timing.js +1 -19
- package/dist/acpx-engine/startup-timing.js.map +1 -1
- package/dist/acpx-engine/turn-characterization.test.js +3 -3
- package/dist/acpx-engine/turn-characterization.test.js.map +1 -1
- package/dist/acpx-engine/turn-sequence.js +1 -1
- package/dist/acpx-engine/turn-sequence.js.map +1 -1
- package/dist/chat-file-delivery.d.ts +2 -2
- package/dist/chat-file-delivery.d.ts.map +1 -1
- package/dist/chat-file-delivery.js +4 -4
- package/dist/chat-file-delivery.js.map +1 -1
- package/dist/chat-file-delivery.test.js +9 -9
- package/dist/chat-file-delivery.test.js.map +1 -1
- package/dist/command-managed-runtime.js +5 -5
- package/dist/command-managed-runtime.js.map +1 -1
- package/dist/command-managed-runtime.test.js +36 -38
- package/dist/command-managed-runtime.test.js.map +1 -1
- package/dist/directory-merge-lock.test.js +1 -1
- package/dist/directory-merge-lock.test.js.map +1 -1
- package/dist/execution-target-sandbox.test.js +259 -267
- package/dist/execution-target-sandbox.test.js.map +1 -1
- package/dist/execution-target-stdin-race.test.js +55 -65
- package/dist/execution-target-stdin-race.test.js.map +1 -1
- package/dist/execution-target.d.ts +6 -36
- package/dist/execution-target.d.ts.map +1 -1
- package/dist/execution-target.js +35 -86
- package/dist/execution-target.js.map +1 -1
- package/dist/execution-target.test.js +1 -1
- package/dist/execution-target.test.js.map +1 -1
- package/dist/forbidden-config-env.test.js +2 -2
- package/dist/forbidden-config-env.test.js.map +1 -1
- package/dist/git-workspace-sync.d.ts +2 -2
- package/dist/git-workspace-sync.d.ts.map +1 -1
- package/dist/git-workspace-sync.js +7 -7
- package/dist/git-workspace-sync.js.map +1 -1
- package/dist/git-workspace-sync.test.js +61 -61
- package/dist/git-workspace-sync.test.js.map +1 -1
- package/dist/github-launcher-environment.test.js +5 -5
- package/dist/github-launcher-environment.test.js.map +1 -1
- package/dist/github-launcher.js +8 -8
- package/dist/github-launcher.test.js +5 -5
- package/dist/github-launcher.test.js.map +1 -1
- package/dist/http2-bridge-server.test.js +1 -1
- package/dist/http2-bridge-server.test.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/local-process-sandbox.js +7 -7
- package/dist/local-process-sandbox.js.map +1 -1
- package/dist/local-process-sandbox.test.js +16 -16
- package/dist/local-process-sandbox.test.js.map +1 -1
- package/dist/mcp-isolation.integration.test.js +4 -4
- package/dist/mcp-isolation.integration.test.js.map +1 -1
- package/dist/prompt-sections.test.js +11 -11
- package/dist/prompt-sections.test.js.map +1 -1
- package/dist/provider-models/claude.d.ts +0 -1
- package/dist/provider-models/claude.d.ts.map +1 -1
- package/dist/provider-models/claude.js +0 -1
- package/dist/provider-models/claude.js.map +1 -1
- package/dist/remote-managed-runtime.js +6 -6
- package/dist/remote-managed-runtime.js.map +1 -1
- package/dist/remote-managed-runtime.test.js +14 -14
- package/dist/remote-managed-runtime.test.js.map +1 -1
- package/dist/retired-marker-names.d.ts +2 -0
- package/dist/retired-marker-names.d.ts.map +1 -0
- package/dist/retired-marker-names.js +2 -0
- package/dist/retired-marker-names.js.map +1 -0
- package/dist/retired-skill-names.d.ts +3 -0
- package/dist/retired-skill-names.d.ts.map +1 -0
- package/dist/retired-skill-names.js +8 -0
- package/dist/retired-skill-names.js.map +1 -0
- package/dist/runner-connectivity.d.ts +5 -5
- package/dist/runner-connectivity.d.ts.map +1 -1
- package/dist/runner-connectivity.js +11 -11
- package/dist/runner-connectivity.js.map +1 -1
- package/dist/runner-connectivity.test.js +21 -21
- package/dist/runner-connectivity.test.js.map +1 -1
- package/dist/runtime-progress.d.ts.map +1 -1
- package/dist/runtime-progress.js +1 -4
- package/dist/runtime-progress.js.map +1 -1
- package/dist/runtime-progress.test.js +13 -13
- package/dist/runtime-progress.test.js.map +1 -1
- package/dist/sandbox-callback-bridge.d.ts +1 -16
- package/dist/sandbox-callback-bridge.d.ts.map +1 -1
- package/dist/sandbox-callback-bridge.js +28 -61
- package/dist/sandbox-callback-bridge.js.map +1 -1
- package/dist/sandbox-callback-bridge.test.js +67 -88
- package/dist/sandbox-callback-bridge.test.js.map +1 -1
- package/dist/sandbox-file-sync.test.js +9 -9
- package/dist/sandbox-file-sync.test.js.map +1 -1
- package/dist/sandbox-managed-runtime.d.ts +0 -30
- package/dist/sandbox-managed-runtime.d.ts.map +1 -1
- package/dist/sandbox-managed-runtime.js +12 -34
- package/dist/sandbox-managed-runtime.js.map +1 -1
- package/dist/sandbox-managed-runtime.test.js +130 -140
- package/dist/sandbox-managed-runtime.test.js.map +1 -1
- package/dist/sandbox-run-log-stream.js +1 -1
- package/dist/sandbox-run-log-stream.js.map +1 -1
- package/dist/server-utils-env.test.js +8 -7
- package/dist/server-utils-env.test.js.map +1 -1
- package/dist/server-utils.d.ts +118 -144
- package/dist/server-utils.d.ts.map +1 -1
- package/dist/server-utils.js +243 -270
- package/dist/server-utils.js.map +1 -1
- package/dist/server-utils.test.js +274 -257
- package/dist/server-utils.test.js.map +1 -1
- package/dist/skill-library-manifest.d.ts +2 -2
- package/dist/skill-library-manifest.d.ts.map +1 -1
- package/dist/skill-library-manifest.test.js +4 -4
- package/dist/skill-library-manifest.test.js.map +1 -1
- package/dist/ssh-fixture.test.js +57 -57
- package/dist/ssh-fixture.test.js.map +1 -1
- package/dist/ssh.d.ts.map +1 -1
- package/dist/ssh.js +16 -38
- package/dist/ssh.js.map +1 -1
- package/dist/test-fixtures/prompt-context.d.ts +5 -5
- package/dist/test-fixtures/prompt-context.js +5 -5
- package/dist/test-fixtures/prompt-context.js.map +1 -1
- package/dist/tool-profile.d.ts +1 -1
- package/dist/tool-profile.d.ts.map +1 -1
- package/dist/tool-profile.js +1 -1
- package/dist/tool-profile.js.map +1 -1
- package/dist/types.d.ts +13 -31
- package/dist/types.d.ts.map +1 -1
- package/dist/wardmote-mcp-mount.d.ts +9 -9
- package/dist/wardmote-mcp-mount.d.ts.map +1 -1
- package/dist/wardmote-mcp-mount.js +9 -9
- package/dist/wardmote-mcp-mount.js.map +1 -1
- package/dist/wardmote-mcp.d.ts +23 -25
- package/dist/wardmote-mcp.d.ts.map +1 -1
- package/dist/wardmote-mcp.js +32 -33
- package/dist/wardmote-mcp.js.map +1 -1
- package/dist/wardmote-mcp.test.js +52 -52
- package/dist/wardmote-mcp.test.js.map +1 -1
- package/dist/wardmote-runner-permissions.d.ts +14 -19
- package/dist/wardmote-runner-permissions.d.ts.map +1 -1
- package/dist/wardmote-runner-permissions.js +8 -13
- package/dist/wardmote-runner-permissions.js.map +1 -1
- package/dist/wardmote-runner-permissions.test.js +32 -32
- package/dist/wardmote-runner-permissions.test.js.map +1 -1
- package/dist/workspace-git-stream.test.js +1 -1
- package/dist/workspace-git-stream.test.js.map +1 -1
- package/dist/workspace-manifest.test.js +3 -3
- package/dist/workspace-manifest.test.js.map +1 -1
- package/dist/workspace-restore-diagnostics.js +1 -1
- package/dist/workspace-restore-diagnostics.js.map +1 -1
- package/dist/workspace-restore-diagnostics.test.js +5 -5
- package/dist/workspace-restore-diagnostics.test.js.map +1 -1
- package/dist/workspace-restore-merge.js +3 -3
- package/dist/workspace-restore-merge.js.map +1 -1
- package/dist/workspace-restore-merge.test.js +50 -56
- package/dist/workspace-restore-merge.test.js.map +1 -1
- package/dist/workspace-restore-result.test.js +2 -2
- package/dist/workspace-restore-result.test.js.map +1 -1
- package/dist/workspace-restore-teardown.test.js +6 -6
- package/dist/workspace-restore-teardown.test.js.map +1 -1
- package/package.json +2 -2
|
@@ -30,7 +30,7 @@ describe("stdin file race (parent PAP-4037)", () => {
|
|
|
30
30
|
// directly. The child command is `cat`, so every byte the poller writes to
|
|
31
31
|
// the child stdin comes back as a `data` frame.
|
|
32
32
|
async function startPollerWrapper(options) {
|
|
33
|
-
const sessionDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
33
|
+
const sessionDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-stdin-poll-"));
|
|
34
34
|
cleanupDirs.push(sessionDir);
|
|
35
35
|
const stdinDir = path.join(sessionDir, "stdin");
|
|
36
36
|
await mkdir(stdinDir, { recursive: true });
|
|
@@ -236,7 +236,7 @@ describe("stdin file race (parent PAP-4037)", () => {
|
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
238
|
it("serializes host stdin writes so a slow earlier write still lands first", async () => {
|
|
239
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
239
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-stdin-host-order-"));
|
|
240
240
|
cleanupDirs.push(rootDir);
|
|
241
241
|
// The child echoes every stdin byte to stdout, so the wrapper reports the
|
|
242
242
|
// exact bytes and order the child received on its stdin.
|
|
@@ -267,7 +267,7 @@ describe("stdin file race (parent PAP-4037)", () => {
|
|
|
267
267
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
268
268
|
runId: "run-stdin-host-order",
|
|
269
269
|
target,
|
|
270
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
270
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
271
271
|
adapterKey: "acpx",
|
|
272
272
|
command: process.execPath,
|
|
273
273
|
args: [childPath],
|
|
@@ -329,7 +329,7 @@ describe("stdin file race (parent PAP-4037)", () => {
|
|
|
329
329
|
}
|
|
330
330
|
});
|
|
331
331
|
it("holds stdinEnd on stop until an earlier pending stdin write lands first", async () => {
|
|
332
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
332
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-stdin-stop-order-"));
|
|
333
333
|
cleanupDirs.push(rootDir);
|
|
334
334
|
const childPath = path.join(rootDir, "echo-child.mjs");
|
|
335
335
|
await writeFile(childPath, "process.stdin.on('data', (c) => process.stdout.write(c));\n", "utf8");
|
|
@@ -361,7 +361,7 @@ describe("stdin file race (parent PAP-4037)", () => {
|
|
|
361
361
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
362
362
|
runId: "run-stdin-stop-order",
|
|
363
363
|
target,
|
|
364
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
364
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
365
365
|
adapterKey: "acpx",
|
|
366
366
|
command: process.execPath,
|
|
367
367
|
args: [childPath],
|
|
@@ -411,7 +411,7 @@ describe("stdin file race (parent PAP-4037)", () => {
|
|
|
411
411
|
...["prepare", "append", "finalize", "late-finalize"].map((stage) => [stage, "Request failed with status code 502"]),
|
|
412
412
|
...[502, 503, 504].map((status) => ["finalize", `Cloudflare sandbox bridge request failed with HTTP ${status}.`]),
|
|
413
413
|
])("recovers a transient %s failure (%s) without repeating or reordering stdin", async (stage, failure) => {
|
|
414
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
414
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-stdin-retry-"));
|
|
415
415
|
cleanupDirs.push(rootDir);
|
|
416
416
|
const childPath = path.join(rootDir, "echo-child.mjs");
|
|
417
417
|
await writeFile(childPath, "process.stdin.on('data', (c) => process.stdout.write(c));\n", "utf8");
|
|
@@ -481,7 +481,7 @@ describe("stdin file race (parent PAP-4037)", () => {
|
|
|
481
481
|
}
|
|
482
482
|
await waitFor(async () => {
|
|
483
483
|
const files = await readdir(path.join(rootDir, "runtime", "process-sessions"), { recursive: true });
|
|
484
|
-
return files.every((file) => !file.endsWith(".
|
|
484
|
+
return files.every((file) => !file.endsWith(".wardmote-upload.b64") && !file.endsWith(".wardmote-upload.decoded"));
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
487
|
finally {
|
|
@@ -503,7 +503,7 @@ describe("stdin file race (parent PAP-4037)", () => {
|
|
|
503
503
|
["Remote command failed: sensitive-input", 1],
|
|
504
504
|
["Provider never responds", 1],
|
|
505
505
|
])("bounds input failure %s to %i attempts and stops later writes", async (failure, expectedAttempts) => {
|
|
506
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
506
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-stdin-failed-"));
|
|
507
507
|
cleanupDirs.push(rootDir);
|
|
508
508
|
let attempts = 0;
|
|
509
509
|
let laterWrite = false;
|
|
@@ -556,7 +556,7 @@ describe("stdin file race (parent PAP-4037)", () => {
|
|
|
556
556
|
}
|
|
557
557
|
}, 15_000);
|
|
558
558
|
it("stops after exhausted input retries even when failure logging stalls", async () => {
|
|
559
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
559
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-stdin-log-stall-"));
|
|
560
560
|
cleanupDirs.push(rootDir);
|
|
561
561
|
let attempts = 0;
|
|
562
562
|
let loggingStarted = false;
|
|
@@ -613,7 +613,7 @@ describe("stdin file race (parent PAP-4037)", () => {
|
|
|
613
613
|
}, 15_000);
|
|
614
614
|
// ---- Host atomic-write tests ------------------------------------------
|
|
615
615
|
it.each(["fails", "stalls"])("preserves the upload failure when best-effort cleanup %s", async (cleanupMode) => {
|
|
616
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
616
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-upload-cleanup-"));
|
|
617
617
|
cleanupDirs.push(rootDir);
|
|
618
618
|
const local = createLocalSandboxRunner();
|
|
619
619
|
const uploadFailure = new Error("Request failed with status code 502");
|
|
@@ -693,7 +693,7 @@ describe("stdin file race (parent PAP-4037)", () => {
|
|
|
693
693
|
};
|
|
694
694
|
}
|
|
695
695
|
it("finalizes the command-managed host write with an atomic rename onto the .json path", async () => {
|
|
696
|
-
const remoteRoot = await mkdtemp(path.join(os.tmpdir(), "
|
|
696
|
+
const remoteRoot = await mkdtemp(path.join(os.tmpdir(), "wardmote-stdin-host-cmd-"));
|
|
697
697
|
cleanupDirs.push(remoteRoot);
|
|
698
698
|
const stdinDir = path.join(remoteRoot, "stdin");
|
|
699
699
|
await mkdir(stdinDir, { recursive: true });
|
|
@@ -718,10 +718,10 @@ describe("stdin file race (parent PAP-4037)", () => {
|
|
|
718
718
|
expect(finalizeScript).toBeDefined();
|
|
719
719
|
expect(finalizeScript).toContain(`mv `);
|
|
720
720
|
expect(finalizeScript).not.toContain(`> '${jsonPath}'`);
|
|
721
|
-
expect(finalizeScript).toMatch(/> '[^']+\.
|
|
721
|
+
expect(finalizeScript).toMatch(/> '[^']+\.wardmote-upload\.decoded'/);
|
|
722
722
|
});
|
|
723
723
|
it("never exposes a partial .json file under a concurrent reader (command-managed host write)", async () => {
|
|
724
|
-
const remoteRoot = await mkdtemp(path.join(os.tmpdir(), "
|
|
724
|
+
const remoteRoot = await mkdtemp(path.join(os.tmpdir(), "wardmote-stdin-host-race-"));
|
|
725
725
|
cleanupDirs.push(remoteRoot);
|
|
726
726
|
const stdinDir = path.join(remoteRoot, "stdin");
|
|
727
727
|
await mkdir(stdinDir, { recursive: true });
|
|
@@ -845,7 +845,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
845
845
|
async function getFakeBirthtimePreloadPath() {
|
|
846
846
|
if (!fakeBirthtimePreloadPath) {
|
|
847
847
|
fakeBirthtimePreloadPath = (async () => {
|
|
848
|
-
const dir = await mkdtemp(path.join(os.tmpdir(), "
|
|
848
|
+
const dir = await mkdtemp(path.join(os.tmpdir(), "wardmote-birthtime-preload-"));
|
|
849
849
|
fakeBirthtimePreloadDir = dir;
|
|
850
850
|
const preloadPath = path.join(dir, "fake-birthtime-preload.cjs");
|
|
851
851
|
await writeFile(preloadPath, [
|
|
@@ -894,7 +894,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
894
894
|
async function getProbeSwapPreloadPath() {
|
|
895
895
|
if (!probeSwapPreloadPath) {
|
|
896
896
|
probeSwapPreloadPath = (async () => {
|
|
897
|
-
const dir = await mkdtemp(path.join(os.tmpdir(), "
|
|
897
|
+
const dir = await mkdtemp(path.join(os.tmpdir(), "wardmote-probe-swap-preload-"));
|
|
898
898
|
probeSwapPreloadDir = dir;
|
|
899
899
|
const preloadPath = path.join(dir, "probe-swap-preload.cjs");
|
|
900
900
|
await writeFile(preloadPath, [
|
|
@@ -904,7 +904,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
904
904
|
`const seq = process.env.WARDMOTE_TEST_PROBE_SWAP_SEQ;`,
|
|
905
905
|
`const symlinkTarget = process.env.WARDMOTE_TEST_PROBE_SWAP_SYMLINK_TARGET;`,
|
|
906
906
|
`if (mode && seq) {`,
|
|
907
|
-
` const expectedName = ".
|
|
907
|
+
` const expectedName = ".wardmote-birthtime-probe-" + process.pid + "-" + seq;`,
|
|
908
908
|
` let swapped = false;`,
|
|
909
909
|
` const originalLstat = fs.promises.lstat.bind(fs.promises);`,
|
|
910
910
|
` fs.promises.lstat = async (candidatePath, opts) => {`,
|
|
@@ -941,7 +941,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
941
941
|
async function getFstatFailurePreloadPath() {
|
|
942
942
|
if (!fstatFailurePreloadPath) {
|
|
943
943
|
fstatFailurePreloadPath = (async () => {
|
|
944
|
-
const dir = await mkdtemp(path.join(os.tmpdir(), "
|
|
944
|
+
const dir = await mkdtemp(path.join(os.tmpdir(), "wardmote-fstat-failure-preload-"));
|
|
945
945
|
fstatFailurePreloadDir = dir;
|
|
946
946
|
const preloadPath = path.join(dir, "fstat-failure-preload.cjs");
|
|
947
947
|
await writeFile(preloadPath, [
|
|
@@ -949,7 +949,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
949
949
|
`const path = require("path");`,
|
|
950
950
|
`const seq = process.env.WARDMOTE_TEST_FSTAT_FAILURE_SEQ;`,
|
|
951
951
|
`if (seq) {`,
|
|
952
|
-
` const expectedName = ".
|
|
952
|
+
` const expectedName = ".wardmote-birthtime-probe-" + process.pid + "-" + seq;`,
|
|
953
953
|
` const originalOpen = fs.promises.open.bind(fs.promises);`,
|
|
954
954
|
` fs.promises.open = async (targetPath, flags, mode) => {`,
|
|
955
955
|
` const handle = await originalOpen(targetPath, flags, mode);`,
|
|
@@ -972,7 +972,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
972
972
|
// ChildProcess handle directly, so it can observe the wrapper's own exit
|
|
973
973
|
// without storing or signaling any process identifier itself.
|
|
974
974
|
async function startWrapperProcess(options) {
|
|
975
|
-
const sessionDir = await mkdtemp(path.join(options?.parentDir ?? os.tmpdir(), "
|
|
975
|
+
const sessionDir = await mkdtemp(path.join(options?.parentDir ?? os.tmpdir(), "wardmote-wrapper-lifecycle-"));
|
|
976
976
|
cleanupDirs.push(sessionDir);
|
|
977
977
|
const stdinDir = path.join(sessionDir, "stdin");
|
|
978
978
|
const eventsDir = path.join(sessionDir, "events");
|
|
@@ -1133,7 +1133,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1133
1133
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1134
1134
|
runId: input.runId,
|
|
1135
1135
|
target,
|
|
1136
|
-
runtimeRootDir: path.posix.join(input.rootDir, ".
|
|
1136
|
+
runtimeRootDir: path.posix.join(input.rootDir, ".wardmote-runtime", "acpx"),
|
|
1137
1137
|
adapterKey: "acpx",
|
|
1138
1138
|
command: process.execPath,
|
|
1139
1139
|
args: [childPath],
|
|
@@ -1160,7 +1160,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1160
1160
|
]);
|
|
1161
1161
|
});
|
|
1162
1162
|
it("T2 leaves neither the wrapper nor a stubborn child alive after stop()", async () => {
|
|
1163
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1163
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-stubborn-child-"));
|
|
1164
1164
|
cleanupDirs.push(rootDir);
|
|
1165
1165
|
const runner = createLocalSandboxRunner();
|
|
1166
1166
|
const session = await startTrackedBridgeSession({
|
|
@@ -1172,7 +1172,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1172
1172
|
// The emitted wrapper script's own path is unique to this test (it lives
|
|
1173
1173
|
// under this test's fresh temp root), so a `ps` grep on it identifies
|
|
1174
1174
|
// only this test's wrapper process, not a sibling test's.
|
|
1175
|
-
const wrapperScriptSubstring = path.posix.join(rootDir, ".
|
|
1175
|
+
const wrapperScriptSubstring = path.posix.join(rootDir, ".wardmote-runtime", "acpx", "process-sessions");
|
|
1176
1176
|
try {
|
|
1177
1177
|
expect(isPidAlive(session.pid)).toBe(true);
|
|
1178
1178
|
await waitFor(async () => (await findLivePidsByArgvSubstring(wrapperScriptSubstring)).length > 0, 4_000);
|
|
@@ -1203,7 +1203,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1203
1203
|
expect(events.some((event) => event.type === "exit")).toBe(true);
|
|
1204
1204
|
});
|
|
1205
1205
|
it("T4 stopping one session leaves a sibling session's wrapper and child alive", async () => {
|
|
1206
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1206
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-session-isolation-"));
|
|
1207
1207
|
cleanupDirs.push(rootDir);
|
|
1208
1208
|
const runner = createLocalSandboxRunner();
|
|
1209
1209
|
const sessionA = await startTrackedBridgeSession({
|
|
@@ -1233,7 +1233,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1233
1233
|
}
|
|
1234
1234
|
}, 15_000);
|
|
1235
1235
|
it("T5 still writes both control messages, finishes fast, and warns never after a forged exit event the live poll reads early", async () => {
|
|
1236
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1236
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-forged-exit-"));
|
|
1237
1237
|
cleanupDirs.push(rootDir);
|
|
1238
1238
|
const childPath = path.join(rootDir, "quiet-child.mjs");
|
|
1239
1239
|
await writeFile(childPath, "process.stdin.resume();\n", "utf8");
|
|
@@ -1253,7 +1253,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1253
1253
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1254
1254
|
runId: "run-forged-exit",
|
|
1255
1255
|
target,
|
|
1256
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1256
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1257
1257
|
adapterKey: "acpx",
|
|
1258
1258
|
command: process.execPath,
|
|
1259
1259
|
args: [childPath],
|
|
@@ -1283,7 +1283,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1283
1283
|
const start = Date.now();
|
|
1284
1284
|
await bridge.stop();
|
|
1285
1285
|
const elapsedMs = Date.now() - start;
|
|
1286
|
-
const finalizeWrites = scripts.filter((script) => script.includes("base64 -d") && script.includes(".
|
|
1286
|
+
const finalizeWrites = scripts.filter((script) => script.includes("base64 -d") && script.includes(".wardmote-upload.decoded"));
|
|
1287
1287
|
// stdinEnd, then shutdown: both control messages still land.
|
|
1288
1288
|
expect(finalizeWrites.length).toBeGreaterThanOrEqual(2);
|
|
1289
1289
|
const removeScript = scripts.find((script) => script.trim().startsWith("rm -rf"));
|
|
@@ -1297,7 +1297,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1297
1297
|
expect(warnedCount).toBe(0);
|
|
1298
1298
|
}, 10_000);
|
|
1299
1299
|
it("T14 a forged exit event alone does not shorten the wait when the wrapper never truly runs", async () => {
|
|
1300
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1300
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-forged-only-"));
|
|
1301
1301
|
cleanupDirs.push(rootDir);
|
|
1302
1302
|
const childPath = path.join(rootDir, "quiet-child.mjs");
|
|
1303
1303
|
await writeFile(childPath, "process.stdin.resume();\n", "utf8");
|
|
@@ -1337,7 +1337,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1337
1337
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1338
1338
|
runId: "run-forged-only",
|
|
1339
1339
|
target,
|
|
1340
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1340
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1341
1341
|
adapterKey: "acpx",
|
|
1342
1342
|
command: process.execPath,
|
|
1343
1343
|
args: [childPath],
|
|
@@ -1376,7 +1376,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1376
1376
|
expect(removeScript).toBeDefined();
|
|
1377
1377
|
}, 10_000);
|
|
1378
1378
|
it("T6 issues no operating-system signal from the host during stop()", async () => {
|
|
1379
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1379
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-no-signal-"));
|
|
1380
1380
|
cleanupDirs.push(rootDir);
|
|
1381
1381
|
const childPath = path.join(rootDir, "quiet-child.mjs");
|
|
1382
1382
|
await writeFile(childPath, "process.stdin.resume();\n", "utf8");
|
|
@@ -1395,7 +1395,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1395
1395
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1396
1396
|
runId: "run-no-signal",
|
|
1397
1397
|
target,
|
|
1398
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1398
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1399
1399
|
adapterKey: "acpx",
|
|
1400
1400
|
command: process.execPath,
|
|
1401
1401
|
args: [childPath],
|
|
@@ -1436,7 +1436,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1436
1436
|
expect(events.filter((event) => event.type === "error").length).toBe(0);
|
|
1437
1437
|
});
|
|
1438
1438
|
it("T9 exits with an error event when sessionDir is a symbolic link", async () => {
|
|
1439
|
-
const targetDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1439
|
+
const targetDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-symlink-target-"));
|
|
1440
1440
|
cleanupDirs.push(targetDir);
|
|
1441
1441
|
const linkDir = `${targetDir}-link`;
|
|
1442
1442
|
const { symlink } = await import("node:fs/promises");
|
|
@@ -1535,7 +1535,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1535
1535
|
// the file-poll loop stopped re-arming right after it delivered the
|
|
1536
1536
|
// `exit` event and so never read the `shutdownAck` file that followed it.
|
|
1537
1537
|
it("T12 stop() finishes well inside the shutdown budget and logs no warning after a normal child exit", async () => {
|
|
1538
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1538
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-normal-exit-"));
|
|
1539
1539
|
cleanupDirs.push(rootDir);
|
|
1540
1540
|
const childPath = path.join(rootDir, "quick-exit-child.mjs");
|
|
1541
1541
|
await writeFile(childPath, "process.exit(0);\n", "utf8");
|
|
@@ -1552,7 +1552,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1552
1552
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1553
1553
|
runId: "run-normal-exit",
|
|
1554
1554
|
target,
|
|
1555
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1555
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1556
1556
|
adapterKey: "acpx",
|
|
1557
1557
|
command: process.execPath,
|
|
1558
1558
|
args: [childPath],
|
|
@@ -1579,7 +1579,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1579
1579
|
// remove `sessionDir`. The fix must not turn the bounded wait into an
|
|
1580
1580
|
// unconditional skip.
|
|
1581
1581
|
it("T13 warns and still removes sessionDir when the wrapper never acknowledges and never exits", async () => {
|
|
1582
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1582
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-never-acks-"));
|
|
1583
1583
|
cleanupDirs.push(rootDir);
|
|
1584
1584
|
const childPath = path.join(rootDir, "quiet-child.mjs");
|
|
1585
1585
|
await writeFile(childPath, "process.stdin.resume();\n", "utf8");
|
|
@@ -1620,7 +1620,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1620
1620
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1621
1621
|
runId: "run-never-acks",
|
|
1622
1622
|
target,
|
|
1623
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1623
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1624
1624
|
adapterKey: "acpx",
|
|
1625
1625
|
command: process.execPath,
|
|
1626
1626
|
args: [childPath],
|
|
@@ -1664,7 +1664,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1664
1664
|
// gap, because it is set fresh on every inode allocation even when the
|
|
1665
1665
|
// allocator reissues an old inode number.
|
|
1666
1666
|
it("T15 latches on a lost session identity: a recreated control directory cannot keep the wrapper or its child alive", async () => {
|
|
1667
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1667
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-lost-identity-"));
|
|
1668
1668
|
cleanupDirs.push(rootDir);
|
|
1669
1669
|
const pidFile = path.join(rootDir, "t15-child.pid");
|
|
1670
1670
|
const childPath = path.join(rootDir, "t15-child.mjs");
|
|
@@ -1749,7 +1749,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1749
1749
|
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
|
|
1750
1750
|
runId: "run-lost-identity",
|
|
1751
1751
|
target,
|
|
1752
|
-
runtimeRootDir: path.posix.join(rootDir, ".
|
|
1752
|
+
runtimeRootDir: path.posix.join(rootDir, ".wardmote-runtime", "acpx"),
|
|
1753
1753
|
adapterKey: "acpx",
|
|
1754
1754
|
command: process.execPath,
|
|
1755
1755
|
args: [childPath],
|
|
@@ -1768,7 +1768,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1768
1768
|
await waitFor(async () => (await readFile(pidFile, "utf8").catch(() => "")).trim().length > 0, 8_000);
|
|
1769
1769
|
const pid = Number.parseInt((await readFile(pidFile, "utf8")).trim(), 10);
|
|
1770
1770
|
expect(isPidAlive(pid)).toBe(true);
|
|
1771
|
-
const wrapperScriptSubstring = path.posix.join(rootDir, ".
|
|
1771
|
+
const wrapperScriptSubstring = path.posix.join(rootDir, ".wardmote-runtime", "acpx", "process-sessions");
|
|
1772
1772
|
await waitFor(async () => (await findLivePidsByArgvSubstring(wrapperScriptSubstring)).length > 0, 4_000);
|
|
1773
1773
|
await bridge.stop();
|
|
1774
1774
|
// Both the attacker's forged shutdownAck and its directory recreation
|
|
@@ -1815,7 +1815,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1815
1815
|
expect(await findLivePidsByArgvSubstring(substring)).toEqual([]);
|
|
1816
1816
|
}
|
|
1817
1817
|
it("T16 accepts a zero creation time when the filesystem does not report birth time", async () => {
|
|
1818
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1818
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-birthtime-zero-"));
|
|
1819
1819
|
cleanupDirs.push(rootDir);
|
|
1820
1820
|
const pidFile = path.join(rootDir, "t16-child.pid");
|
|
1821
1821
|
const childPath = path.join(rootDir, "t16-child.mjs");
|
|
@@ -1839,7 +1839,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1839
1839
|
expect(wrapper.stderrText()).not.toMatch(/not usable/);
|
|
1840
1840
|
}, 15_000);
|
|
1841
1841
|
it("T17 fails closed at capture when the reported creation time follows the change time, so a change-time copy never passes as a real creation time", async () => {
|
|
1842
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1842
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-birthtime-followctime-"));
|
|
1843
1843
|
cleanupDirs.push(rootDir);
|
|
1844
1844
|
const pidFile = path.join(rootDir, "t17-child.pid");
|
|
1845
1845
|
const childPath = path.join(rootDir, "t17-child.mjs");
|
|
@@ -1864,7 +1864,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1864
1864
|
// temp directory: the test denies traversal on that parent, and doing
|
|
1865
1865
|
// that to the shared OS temp directory would break every other process
|
|
1866
1866
|
// on the host that also uses it.
|
|
1867
|
-
const parentDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1867
|
+
const parentDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-eacces-sessiondir-"));
|
|
1868
1868
|
cleanupDirs.push(parentDir);
|
|
1869
1869
|
const pidFile = path.join(parentDir, "t18-child.pid");
|
|
1870
1870
|
const childPath = path.join(parentDir, "t18-child.mjs");
|
|
@@ -1893,7 +1893,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1893
1893
|
}, 15_000);
|
|
1894
1894
|
it("T19 latches on an EACCES lstat failure on stdinDir during verification, even though sessionDir itself still stats cleanly", async () => {
|
|
1895
1895
|
const wrapperOptions = { outputToStdout: false, terminateGraceMs: 200 };
|
|
1896
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1896
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-eacces-stdindir-"));
|
|
1897
1897
|
cleanupDirs.push(rootDir);
|
|
1898
1898
|
const pidFile = path.join(rootDir, "t19-child.pid");
|
|
1899
1899
|
const childPath = path.join(rootDir, "t19-child.mjs");
|
|
@@ -1914,12 +1914,12 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1914
1914
|
expect(wrapper.stderrText()).toMatch(/Latching on a lost process session identity/);
|
|
1915
1915
|
}, 15_000);
|
|
1916
1916
|
it("T20 refuses to write through a probe path a sandbox peer pre-created as a symbolic link, and leaves that link and its target untouched", async () => {
|
|
1917
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1917
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-probe-symlink-race-"));
|
|
1918
1918
|
cleanupDirs.push(rootDir);
|
|
1919
1919
|
const pidFile = path.join(rootDir, "t20-child.pid");
|
|
1920
1920
|
const childPath = path.join(rootDir, "t20-child.mjs");
|
|
1921
1921
|
await writeFile(childPath, trackedChildSource(pidFile), "utf8");
|
|
1922
|
-
const sessionDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1922
|
+
const sessionDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-probe-symlink-session-"));
|
|
1923
1923
|
cleanupDirs.push(sessionDir);
|
|
1924
1924
|
const stdinDir = path.join(sessionDir, "stdin");
|
|
1925
1925
|
await mkdir(stdinDir, { recursive: true });
|
|
@@ -1941,17 +1941,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1941
1941
|
},
|
|
1942
1942
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1943
1943
|
});
|
|
1944
|
-
|
|
1945
|
-
// nextProbeFileName() is deterministic: it names
|
|
1946
|
-
// ".paperclip-birthtime-probe-<pid>-1" on the wrapper's first probe call,
|
|
1947
|
-
// which always targets sessionDir. child.pid is available synchronously
|
|
1948
|
-
// right after spawn() returns, well before the freshly spawned process
|
|
1949
|
-
// has loaded Node or parsed its own script, so this synchronous
|
|
1950
|
-
// symlinkSync call lands first. This is the same advantage a real
|
|
1951
|
-
// sandbox peer racing to pre-create the path would have, so it gives the
|
|
1952
|
-
// strongest proof: the real wrapper process, under the real race, must
|
|
1953
|
-
// still refuse to follow the link.
|
|
1954
|
-
const probePath = path.join(sessionDir, `.paperclip-birthtime-probe-${child.pid}-1`);
|
|
1944
|
+
const probePath = path.join(sessionDir, `.wardmote-birthtime-probe-${child.pid}-1`);
|
|
1955
1945
|
symlinkSync(probeLinkTarget, probePath);
|
|
1956
1946
|
let stderrText = "";
|
|
1957
1947
|
child.stderr.on("data", (chunk) => {
|
|
@@ -1977,7 +1967,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1977
1967
|
// time: it swaps the path the instant the wrapper itself looks at it for
|
|
1978
1968
|
// the last time before deciding whether to remove it.
|
|
1979
1969
|
it("T21 still removes its own probe file normally when no peer ever replaces it", async () => {
|
|
1980
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1970
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-probe-no-swap-"));
|
|
1981
1971
|
cleanupDirs.push(rootDir);
|
|
1982
1972
|
const pidFile = path.join(rootDir, "t21-child.pid");
|
|
1983
1973
|
const childPath = path.join(rootDir, "t21-child.mjs");
|
|
@@ -1988,12 +1978,12 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
1988
1978
|
args: [childPath],
|
|
1989
1979
|
});
|
|
1990
1980
|
await waitForTrackedChildPid(pidFile);
|
|
1991
|
-
const probePath = path.join(wrapper.sessionDir, `.
|
|
1981
|
+
const probePath = path.join(wrapper.sessionDir, `.wardmote-birthtime-probe-${wrapper.pid}-1`);
|
|
1992
1982
|
await waitFor(async () => !(await lstat(probePath).then(() => true).catch(() => false)), 4_000);
|
|
1993
1983
|
await expect(lstat(probePath)).rejects.toThrow();
|
|
1994
1984
|
}, 15_000);
|
|
1995
1985
|
it("T22 leaves a peer's replacement file untouched instead of deleting it", async () => {
|
|
1996
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
1986
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-probe-swap-file-"));
|
|
1997
1987
|
cleanupDirs.push(rootDir);
|
|
1998
1988
|
const pidFile = path.join(rootDir, "t22-child.pid");
|
|
1999
1989
|
const childPath = path.join(rootDir, "t22-child.mjs");
|
|
@@ -2005,7 +1995,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
2005
1995
|
probeSwap: { seq: 1, mode: "file" },
|
|
2006
1996
|
});
|
|
2007
1997
|
await waitForTrackedChildPid(pidFile);
|
|
2008
|
-
const probePath = path.join(wrapper.sessionDir, `.
|
|
1998
|
+
const probePath = path.join(wrapper.sessionDir, `.wardmote-birthtime-probe-${wrapper.pid}-1`);
|
|
2009
1999
|
await waitFor(async () => (await readFile(probePath, "utf8").catch(() => null)) === "peer-owned-content", 4_000);
|
|
2010
2000
|
// The wrapper's own cleanup call already ran (the preload only swaps the
|
|
2011
2001
|
// path the moment the wrapper itself checks it). This delay proves that
|
|
@@ -2014,7 +2004,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
2014
2004
|
expect(await readFile(probePath, "utf8")).toBe("peer-owned-content");
|
|
2015
2005
|
}, 15_000);
|
|
2016
2006
|
it("T23 leaves a peer's replacement directory untouched instead of deleting it", async () => {
|
|
2017
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2007
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-probe-swap-dir-"));
|
|
2018
2008
|
cleanupDirs.push(rootDir);
|
|
2019
2009
|
const pidFile = path.join(rootDir, "t23-child.pid");
|
|
2020
2010
|
const childPath = path.join(rootDir, "t23-child.mjs");
|
|
@@ -2026,13 +2016,13 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
2026
2016
|
probeSwap: { seq: 1, mode: "dir" },
|
|
2027
2017
|
});
|
|
2028
2018
|
await waitForTrackedChildPid(pidFile);
|
|
2029
|
-
const probePath = path.join(wrapper.sessionDir, `.
|
|
2019
|
+
const probePath = path.join(wrapper.sessionDir, `.wardmote-birthtime-probe-${wrapper.pid}-1`);
|
|
2030
2020
|
await waitFor(async () => await lstat(probePath).then((stats) => stats.isDirectory()).catch(() => false), 4_000);
|
|
2031
2021
|
await delay(200);
|
|
2032
2022
|
expect((await lstat(probePath)).isDirectory()).toBe(true);
|
|
2033
2023
|
}, 15_000);
|
|
2034
2024
|
it("T24 leaves a peer's replacement symbolic link and its target untouched instead of deleting or following it", async () => {
|
|
2035
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2025
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-probe-swap-symlink-"));
|
|
2036
2026
|
cleanupDirs.push(rootDir);
|
|
2037
2027
|
const pidFile = path.join(rootDir, "t24-child.pid");
|
|
2038
2028
|
const childPath = path.join(rootDir, "t24-child.mjs");
|
|
@@ -2047,7 +2037,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
2047
2037
|
probeSwap: { seq: 1, mode: "symlink", symlinkTarget: linkTarget },
|
|
2048
2038
|
});
|
|
2049
2039
|
await waitForTrackedChildPid(pidFile);
|
|
2050
|
-
const probePath = path.join(wrapper.sessionDir, `.
|
|
2040
|
+
const probePath = path.join(wrapper.sessionDir, `.wardmote-birthtime-probe-${wrapper.pid}-1`);
|
|
2051
2041
|
await waitFor(async () => await lstat(probePath).then((stats) => stats.isSymbolicLink()).catch(() => false), 4_000);
|
|
2052
2042
|
await delay(200);
|
|
2053
2043
|
expect((await lstat(probePath)).isSymbolicLink()).toBe(true);
|
|
@@ -2055,7 +2045,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
2055
2045
|
expect(await readFile(linkTarget, "utf8")).toBe(knownContent);
|
|
2056
2046
|
}, 15_000);
|
|
2057
2047
|
it("T25 fails closed at capture when its own probe file's identity cannot be read, so no orphan wrapper or child ever starts polling", async () => {
|
|
2058
|
-
const rootDir = await mkdtemp(path.join(os.tmpdir(), "
|
|
2048
|
+
const rootDir = await mkdtemp(path.join(os.tmpdir(), "wardmote-probe-fstat-failure-"));
|
|
2059
2049
|
cleanupDirs.push(rootDir);
|
|
2060
2050
|
const pidFile = path.join(rootDir, "t25-child.pid");
|
|
2061
2051
|
const childPath = path.join(rootDir, "t25-child.mjs");
|
|
@@ -2078,7 +2068,7 @@ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", ()
|
|
|
2078
2068
|
// remove it by path alone: it leaves the file exactly as it created it,
|
|
2079
2069
|
// rather than risking removal of a different entry a peer may have put
|
|
2080
2070
|
// at the same path.
|
|
2081
|
-
const probePath = path.join(wrapper.sessionDir, `.
|
|
2071
|
+
const probePath = path.join(wrapper.sessionDir, `.wardmote-birthtime-probe-${wrapper.pid}-1`);
|
|
2082
2072
|
expect((await lstat(probePath)).isFile()).toBe(true);
|
|
2083
2073
|
}, 15_000);
|
|
2084
2074
|
});
|