@tickernelz/wardmote-plugin-daytona 2026.1108.2 → 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 +5 -5
- package/dist/duplex-command-stream.js +2 -2
- package/dist/duplex-command-stream.js.map +1 -1
- package/dist/duplex-command-stream.test.js +8 -8
- package/dist/duplex-command-stream.test.js.map +1 -1
- package/dist/file-sync.d.ts.map +1 -1
- package/dist/file-sync.js +5 -27
- package/dist/file-sync.js.map +1 -1
- package/dist/file-sync.test.js +66 -68
- package/dist/file-sync.test.js.map +1 -1
- package/dist/login-pty.d.ts +0 -11
- package/dist/login-pty.d.ts.map +1 -1
- package/dist/login-pty.js +2 -54
- package/dist/login-pty.js.map +1 -1
- package/dist/login-pty.test.js +2 -2
- package/dist/login-pty.test.js.map +1 -1
- package/dist/manifest.d.ts +2 -2
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +7 -14
- package/dist/manifest.js.map +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +3 -17
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.test.js +57 -59
- package/dist/plugin.test.js.map +1 -1
- package/package.json +4 -4
package/dist/file-sync.test.js
CHANGED
|
@@ -55,13 +55,13 @@ describe("daytona file-sync inbound scratch cleanup", () => {
|
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
it("removes the reserved scratch tar when a directory extraction fails", async () => {
|
|
58
|
-
const rootDir = await fs.mkdtemp(path.join(os.tmpdir(), "
|
|
58
|
+
const rootDir = await fs.mkdtemp(path.join(os.tmpdir(), "wardmote-daytona-scratch-"));
|
|
59
59
|
cleanupDirs.push(rootDir);
|
|
60
60
|
const sourceDir = path.join(rootDir, "referenced-project");
|
|
61
61
|
await fs.mkdir(sourceDir, { recursive: true });
|
|
62
62
|
await fs.writeFile(path.join(sourceDir, "README.md"), "referenced project\n", "utf8");
|
|
63
63
|
const remoteDir = "/workspace";
|
|
64
|
-
const targetPath = "/workspace/.
|
|
64
|
+
const targetPath = "/workspace/.wardmote-runtime/test-adapter/project-abc";
|
|
65
65
|
const uploadedDestinations = [];
|
|
66
66
|
const commands = [];
|
|
67
67
|
// Fail the extract round trip (the only command that runs `tar -xf`).
|
|
@@ -82,11 +82,9 @@ describe("daytona file-sync inbound scratch cleanup", () => {
|
|
|
82
82
|
remoteDir,
|
|
83
83
|
timeoutSeconds: 30,
|
|
84
84
|
})).rejects.toThrow(/syncIn extract/);
|
|
85
|
-
// The runtime uploaded exactly one reserved scratch tar under the workspace
|
|
86
|
-
// root. Its name carries the reserved `.paperclip-upload-` prefix.
|
|
87
85
|
expect(uploadedDestinations).toHaveLength(1);
|
|
88
86
|
const scratchTar = uploadedDestinations[0];
|
|
89
|
-
expect(scratchTar).toContain(".
|
|
87
|
+
expect(scratchTar).toContain(".wardmote-upload-");
|
|
90
88
|
expect(scratchTar.startsWith(`${remoteDir}/`)).toBe(true);
|
|
91
89
|
// The failure path swept the scratch tar: a standalone `rm -f` of the exact
|
|
92
90
|
// scratch path ran after the failed extract. The extract command itself also
|
|
@@ -98,13 +96,13 @@ describe("daytona file-sync inbound scratch cleanup", () => {
|
|
|
98
96
|
expect(cleanupCommands.length).toBeGreaterThan(0);
|
|
99
97
|
});
|
|
100
98
|
it("does not sweep scratch on the happy path (extract removes it)", async () => {
|
|
101
|
-
const rootDir = await fs.mkdtemp(path.join(os.tmpdir(), "
|
|
99
|
+
const rootDir = await fs.mkdtemp(path.join(os.tmpdir(), "wardmote-daytona-scratch-"));
|
|
102
100
|
cleanupDirs.push(rootDir);
|
|
103
101
|
const sourceDir = path.join(rootDir, "referenced-project");
|
|
104
102
|
await fs.mkdir(sourceDir, { recursive: true });
|
|
105
103
|
await fs.writeFile(path.join(sourceDir, "README.md"), "referenced project\n", "utf8");
|
|
106
104
|
const remoteDir = "/workspace";
|
|
107
|
-
const targetPath = "/workspace/.
|
|
105
|
+
const targetPath = "/workspace/.wardmote-runtime/test-adapter/project-abc";
|
|
108
106
|
const uploadedDestinations = [];
|
|
109
107
|
const commands = [];
|
|
110
108
|
// No failure: every command succeeds, so the extract's own `rm -f` clears the
|
|
@@ -129,7 +127,7 @@ describe("daytona file-sync inbound scratch cleanup", () => {
|
|
|
129
127
|
expect(standaloneRemoves).toHaveLength(0);
|
|
130
128
|
});
|
|
131
129
|
it("writes an inbound file mapping to a sandbox path outside the workspace root", async () => {
|
|
132
|
-
const hostDir = await fs.mkdtemp(path.join(os.tmpdir(), "
|
|
130
|
+
const hostDir = await fs.mkdtemp(path.join(os.tmpdir(), "wardmote-daytona-outside-root-"));
|
|
133
131
|
cleanupDirs.push(hostDir);
|
|
134
132
|
const sourcePath = path.join(hostDir, "source.txt");
|
|
135
133
|
await fs.writeFile(sourcePath, "payload");
|
|
@@ -138,7 +136,7 @@ describe("daytona file-sync inbound scratch cleanup", () => {
|
|
|
138
136
|
// authority over its own filesystem, so the provider no longer confines
|
|
139
137
|
// the target to the remote dir.
|
|
140
138
|
const remoteDir = "/workspace";
|
|
141
|
-
const targetPath = "/etc/
|
|
139
|
+
const targetPath = "/etc/wardmote-outside-root.txt";
|
|
142
140
|
const uploadedDestinations = [];
|
|
143
141
|
const commands = [];
|
|
144
142
|
const sandbox = createMockSandbox({ uploadedDestinations, commands });
|
|
@@ -171,7 +169,7 @@ function sha256OfFile(filePath) {
|
|
|
171
169
|
}
|
|
172
170
|
async function writeCompressibleFile(filePath, sizeBytes) {
|
|
173
171
|
// Low-entropy repeated content compresses well past the 10% saving bar.
|
|
174
|
-
const chunk = Buffer.from("
|
|
172
|
+
const chunk = Buffer.from("wardmote-zstd-transport-compression-fixture-".repeat(64));
|
|
175
173
|
const parts = [];
|
|
176
174
|
for (let written = 0; written < sizeBytes; written += chunk.length)
|
|
177
175
|
parts.push(chunk);
|
|
@@ -194,7 +192,7 @@ function createRecordingSandbox(input) {
|
|
|
194
192
|
executeCommand: async (command) => {
|
|
195
193
|
input.commands.push({ command });
|
|
196
194
|
if (command.includes("mkdir -p")) {
|
|
197
|
-
return { exitCode: 0, result: input.probeReportsZstd ? "
|
|
195
|
+
return { exitCode: 0, result: input.probeReportsZstd ? "WARDMOTE_ZSTD_AVAILABLE\n" : "" };
|
|
198
196
|
}
|
|
199
197
|
return { exitCode: 0, result: "" };
|
|
200
198
|
},
|
|
@@ -250,7 +248,7 @@ const gnuTar = ["gtar", "tar"].map((candidate) => {
|
|
|
250
248
|
return resolved && spawnSync(resolved, ["--version"], { encoding: "utf8" }).stdout?.includes("GNU tar") ? resolved : null;
|
|
251
249
|
}).find(Boolean);
|
|
252
250
|
it.skipIf(!gnuTar)("extracts interleaved read-only skill directories with GNU tar and preserves their modes", async () => {
|
|
253
|
-
const root = await fs.mkdtemp("/tmp/
|
|
251
|
+
const root = await fs.mkdtemp("/tmp/wardmote-daytona-readonly-");
|
|
254
252
|
const source = path.join(root, "source");
|
|
255
253
|
const remoteDir = path.join(root, "remote");
|
|
256
254
|
const target = path.join(remoteDir, "skill");
|
|
@@ -298,7 +296,7 @@ it.skipIf(!gnuTar)("extracts interleaved read-only skill directories with GNU ta
|
|
|
298
296
|
await expect(performSyncIn({ sandbox: sandbox, remoteDir, timeoutSeconds: 30,
|
|
299
297
|
operations: [{ operationId: "corrupt-skill-resume", files: [{ sourcePath: source, targetPath: target, kind: "directory", mode: 0o555 }] }] })).rejects.toThrow("syncIn extract");
|
|
300
298
|
expect(await fs.readFile(qa, "utf8")).toBe("XX instructions");
|
|
301
|
-
expect((await fs.readdir(remoteDir)).filter((name) => name.startsWith(".
|
|
299
|
+
expect((await fs.readdir(remoteDir)).filter((name) => name.startsWith(".wardmote-upload"))).toEqual([]);
|
|
302
300
|
}
|
|
303
301
|
finally {
|
|
304
302
|
for (const base of [source, target]) {
|
|
@@ -309,7 +307,7 @@ it.skipIf(!gnuTar)("extracts interleaved read-only skill directories with GNU ta
|
|
|
309
307
|
}
|
|
310
308
|
}, 30_000);
|
|
311
309
|
it.skipIf(!gnuTar)("uploads gzip directory archives and preserves content, executable modes, and symlinks", async () => {
|
|
312
|
-
const root = await fs.mkdtemp(path.join(os.tmpdir(), "
|
|
310
|
+
const root = await fs.mkdtemp(path.join(os.tmpdir(), "wardmote-daytona-gzip-dir-"));
|
|
313
311
|
const source = path.join(root, "source");
|
|
314
312
|
const remoteDir = path.join(root, "remote");
|
|
315
313
|
const target = path.join(remoteDir, "target");
|
|
@@ -351,7 +349,7 @@ it.skipIf(!gnuTar)("uploads gzip directory archives and preserves content, execu
|
|
|
351
349
|
}
|
|
352
350
|
}, 30_000);
|
|
353
351
|
it.skipIf(!gnuTar)("uploads and extracts a gzip empty directory archive", async () => {
|
|
354
|
-
const root = await fs.mkdtemp(path.join(os.tmpdir(), "
|
|
352
|
+
const root = await fs.mkdtemp(path.join(os.tmpdir(), "wardmote-daytona-gzip-empty-"));
|
|
355
353
|
const source = path.join(root, "source");
|
|
356
354
|
const remoteDir = path.join(root, "remote");
|
|
357
355
|
const target = path.join(remoteDir, "target");
|
|
@@ -405,8 +403,8 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
405
403
|
};
|
|
406
404
|
describeWithZstd("compressed path (real promotion script, real zstd)", () => {
|
|
407
405
|
it("compresses on the host and decompresses in-sandbox to a byte-identical file", async () => {
|
|
408
|
-
const remoteDir = await mkTempDir("
|
|
409
|
-
const hostDir = await mkTempDir("
|
|
406
|
+
const remoteDir = await mkTempDir("wardmote-daytona-zstd-remote-");
|
|
407
|
+
const hostDir = await mkTempDir("wardmote-daytona-zstd-host-");
|
|
410
408
|
const sourcePath = path.join(hostDir, "workspace-upload.tar");
|
|
411
409
|
await writeCompressibleFile(sourcePath, ZSTD_MIN_SOURCE_BYTES_FOR_TEST + 1024);
|
|
412
410
|
const targetPath = path.posix.join(remoteDir, "workspace-upload.tar");
|
|
@@ -424,11 +422,11 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
424
422
|
expect(await sha256OfFile(targetPath)).toBe(await sha256OfFile(sourcePath));
|
|
425
423
|
// Cleanup on success: no reserved scratch (raw or `.zst`) remains.
|
|
426
424
|
const remaining = await fs.readdir(remoteDir);
|
|
427
|
-
expect(remaining.filter((name) => name.includes(".
|
|
425
|
+
expect(remaining.filter((name) => name.includes(".wardmote-upload"))).toHaveLength(0);
|
|
428
426
|
});
|
|
429
427
|
it("removes the private compressed host temp directory after a successful sync", async () => {
|
|
430
|
-
const remoteDir = await mkTempDir("
|
|
431
|
-
const hostDir = await mkTempDir("
|
|
428
|
+
const remoteDir = await mkTempDir("wardmote-daytona-zstd-remote-");
|
|
429
|
+
const hostDir = await mkTempDir("wardmote-daytona-zstd-host-");
|
|
432
430
|
const sourcePath = path.join(hostDir, "workspace-upload.tar");
|
|
433
431
|
await writeCompressibleFile(sourcePath, ZSTD_MIN_SOURCE_BYTES_FOR_TEST + 1024);
|
|
434
432
|
const targetPath = path.posix.join(remoteDir, "target.bin");
|
|
@@ -448,14 +446,14 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
448
446
|
files: [{ sourcePath, targetPath, kind: "file" }],
|
|
449
447
|
}];
|
|
450
448
|
await performSyncIn({ sandbox: sandbox, operations, remoteDir, timeoutSeconds: 30 });
|
|
451
|
-
expect(capturedHostTempDir).toContain("
|
|
449
|
+
expect(capturedHostTempDir).toContain("wardmote-daytona-zstd-");
|
|
452
450
|
// The private host temp directory (not just the file inside it) is gone
|
|
453
451
|
// after a successful sync.
|
|
454
452
|
await expect(fs.stat(capturedHostTempDir)).rejects.toThrow();
|
|
455
453
|
});
|
|
456
454
|
it("reports the sync as successful when the post-promotion `.zst` cleanup fails, and warns with a leftover count but no path", async () => {
|
|
457
|
-
const remoteDir = await mkTempDir("
|
|
458
|
-
const hostDir = await mkTempDir("
|
|
455
|
+
const remoteDir = await mkTempDir("wardmote-daytona-zstd-remote-");
|
|
456
|
+
const hostDir = await mkTempDir("wardmote-daytona-zstd-host-");
|
|
459
457
|
const sourcePath = path.join(hostDir, "workspace-upload.tar");
|
|
460
458
|
await writeCompressibleFile(sourcePath, ZSTD_MIN_SOURCE_BYTES_FOR_TEST + 1024);
|
|
461
459
|
const targetPath = path.posix.join(remoteDir, "target.bin");
|
|
@@ -464,7 +462,7 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
464
462
|
// separate `rm -f` fail, the same way a persistent cleanup error would.
|
|
465
463
|
// The other commands (`mv`, `zstd`, `chmod`) still resolve to the real
|
|
466
464
|
// binaries later on PATH.
|
|
467
|
-
const fakeBinDir = await mkTempDir("
|
|
465
|
+
const fakeBinDir = await mkTempDir("wardmote-daytona-zstd-fakebin-");
|
|
468
466
|
const fakeRmPath = path.join(fakeBinDir, "rm");
|
|
469
467
|
await fs.writeFile(fakeRmPath, "#!/bin/sh\nexit 1\n");
|
|
470
468
|
await fs.chmod(fakeRmPath, 0o755);
|
|
@@ -501,8 +499,8 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
501
499
|
}
|
|
502
500
|
});
|
|
503
501
|
it("recovers a transient post-promotion `.zst` cleanup failure with the bounded sweep, without warning", async () => {
|
|
504
|
-
const remoteDir = await mkTempDir("
|
|
505
|
-
const hostDir = await mkTempDir("
|
|
502
|
+
const remoteDir = await mkTempDir("wardmote-daytona-zstd-remote-");
|
|
503
|
+
const hostDir = await mkTempDir("wardmote-daytona-zstd-host-");
|
|
506
504
|
const sourcePath = path.join(hostDir, "workspace-upload.tar");
|
|
507
505
|
await writeCompressibleFile(sourcePath, ZSTD_MIN_SOURCE_BYTES_FOR_TEST + 1024);
|
|
508
506
|
const targetPath = path.posix.join(remoteDir, "target.bin");
|
|
@@ -510,7 +508,7 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
510
508
|
// own inline `.zst` cleanup. It defers to the real `rm` for every later
|
|
511
509
|
// call. This simulates a transient cleanup failure: the bounded sweep's
|
|
512
510
|
// own, separate `rm -f` is the second call, and it succeeds.
|
|
513
|
-
const fakeBinDir = await mkTempDir("
|
|
511
|
+
const fakeBinDir = await mkTempDir("wardmote-daytona-zstd-fakebin-");
|
|
514
512
|
const counterFile = path.join(fakeBinDir, "rm-call-count");
|
|
515
513
|
const fakeRmPath = path.join(fakeBinDir, "rm");
|
|
516
514
|
await fs.writeFile(fakeRmPath, [
|
|
@@ -549,8 +547,8 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
549
547
|
}
|
|
550
548
|
});
|
|
551
549
|
it("never promotes a partial file when decompression fails, and sweeps all reserved scratch", async () => {
|
|
552
|
-
const remoteDir = await mkTempDir("
|
|
553
|
-
const hostDir = await mkTempDir("
|
|
550
|
+
const remoteDir = await mkTempDir("wardmote-daytona-zstd-remote-");
|
|
551
|
+
const hostDir = await mkTempDir("wardmote-daytona-zstd-host-");
|
|
554
552
|
const sourcePath = path.join(hostDir, "workspace-upload.tar");
|
|
555
553
|
await writeCompressibleFile(sourcePath, ZSTD_MIN_SOURCE_BYTES_FOR_TEST + 1024);
|
|
556
554
|
const targetPath = path.posix.join(remoteDir, "target.bin");
|
|
@@ -576,11 +574,11 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
576
574
|
await expect(performSyncIn({ sandbox: sandbox, operations, remoteDir, timeoutSeconds: 30 })).rejects.toThrow(/syncIn rename/);
|
|
577
575
|
await expect(fs.stat(targetPath)).rejects.toThrow(); // never promoted
|
|
578
576
|
const remaining = await fs.readdir(remoteDir);
|
|
579
|
-
expect(remaining.filter((name) => name.includes(".
|
|
577
|
+
expect(remaining.filter((name) => name.includes(".wardmote-upload"))).toHaveLength(0); // scratch swept
|
|
580
578
|
});
|
|
581
579
|
it("applies mapping.mode via chmod before promotion, when set", async () => {
|
|
582
|
-
const remoteDir = await mkTempDir("
|
|
583
|
-
const hostDir = await mkTempDir("
|
|
580
|
+
const remoteDir = await mkTempDir("wardmote-daytona-zstd-remote-");
|
|
581
|
+
const hostDir = await mkTempDir("wardmote-daytona-zstd-host-");
|
|
584
582
|
const sourceNoMode = path.join(hostDir, "no-mode.tar");
|
|
585
583
|
const sourceWithMode = path.join(hostDir, "with-mode.tar");
|
|
586
584
|
await writeCompressibleFile(sourceNoMode, ZSTD_MIN_SOURCE_BYTES_FOR_TEST + 1024);
|
|
@@ -620,9 +618,9 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
620
618
|
expect((await fs.stat(targetWithMode)).mode & 0o777).toBe(0o640);
|
|
621
619
|
});
|
|
622
620
|
it("runs two concurrent compressed sync operations without cross-talk", async () => {
|
|
623
|
-
const remoteDirA = await mkTempDir("
|
|
624
|
-
const remoteDirB = await mkTempDir("
|
|
625
|
-
const hostDir = await mkTempDir("
|
|
621
|
+
const remoteDirA = await mkTempDir("wardmote-daytona-zstd-remote-a-");
|
|
622
|
+
const remoteDirB = await mkTempDir("wardmote-daytona-zstd-remote-b-");
|
|
623
|
+
const hostDir = await mkTempDir("wardmote-daytona-zstd-host-");
|
|
626
624
|
const sourceA = path.join(hostDir, "a.tar");
|
|
627
625
|
const sourceB = path.join(hostDir, "b.tar");
|
|
628
626
|
await writeCompressibleFile(sourceA, ZSTD_MIN_SOURCE_BYTES_FOR_TEST + 2048);
|
|
@@ -669,8 +667,8 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
669
667
|
let targetPath = "";
|
|
670
668
|
let remoteDir = "";
|
|
671
669
|
try {
|
|
672
|
-
remoteDir = await mkTempDir("
|
|
673
|
-
const hostDir = await mkTempDir("
|
|
670
|
+
remoteDir = await mkTempDir("wardmote-daytona-zstd-remote-");
|
|
671
|
+
const hostDir = await mkTempDir("wardmote-daytona-zstd-host-");
|
|
674
672
|
const sourcePath = path.join(hostDir, "workspace-upload.tar");
|
|
675
673
|
await writeCompressibleFile(sourcePath, ZSTD_MIN_SOURCE_BYTES_FOR_TEST + 1024);
|
|
676
674
|
targetPath = path.posix.join(remoteDir, "target.bin");
|
|
@@ -690,18 +688,18 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
690
688
|
Object.assign(allAttrs, span.attributes);
|
|
691
689
|
const compressionKeys = Object.keys(allAttrs).filter((key) => key.includes(".transfer.compression.") || key.includes(".transfer.decompress."));
|
|
692
690
|
expect(new Set(compressionKeys)).toEqual(new Set([
|
|
693
|
-
"
|
|
694
|
-
"
|
|
695
|
-
"
|
|
696
|
-
"
|
|
697
|
-
"
|
|
691
|
+
"wardmote.sandbox.startup.transfer.compression.codec",
|
|
692
|
+
"wardmote.sandbox.startup.transfer.compression.wall_ms",
|
|
693
|
+
"wardmote.sandbox.startup.transfer.compression.bytes_in",
|
|
694
|
+
"wardmote.sandbox.startup.transfer.compression.bytes_out",
|
|
695
|
+
"wardmote.sandbox.startup.transfer.decompress.wall_ms",
|
|
698
696
|
]));
|
|
699
|
-
expect(allAttrs["
|
|
697
|
+
expect(allAttrs["wardmote.sandbox.startup.transfer.compression.codec"]).toBe("zstd");
|
|
700
698
|
for (const key of [
|
|
701
|
-
"
|
|
702
|
-
"
|
|
703
|
-
"
|
|
704
|
-
"
|
|
699
|
+
"wardmote.sandbox.startup.transfer.compression.wall_ms",
|
|
700
|
+
"wardmote.sandbox.startup.transfer.compression.bytes_in",
|
|
701
|
+
"wardmote.sandbox.startup.transfer.compression.bytes_out",
|
|
702
|
+
"wardmote.sandbox.startup.transfer.decompress.wall_ms",
|
|
705
703
|
]) {
|
|
706
704
|
expect(Number.isFinite(allAttrs[key])).toBe(true);
|
|
707
705
|
}
|
|
@@ -709,7 +707,7 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
709
707
|
});
|
|
710
708
|
describe("raw-path fallback conditions (no real sandbox exec needed)", () => {
|
|
711
709
|
it("falls back to the raw path when the sandbox reports no zstd binary", async () => {
|
|
712
|
-
const hostDir = await mkTempDir("
|
|
710
|
+
const hostDir = await mkTempDir("wardmote-daytona-zstd-host-");
|
|
713
711
|
const sourcePath = path.join(hostDir, "big.tar");
|
|
714
712
|
await writeCompressibleFile(sourcePath, ZSTD_MIN_SOURCE_BYTES_FOR_TEST + 1024);
|
|
715
713
|
const uploadedSources = [];
|
|
@@ -729,7 +727,7 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
729
727
|
expect(uploadedDestinations.some((dest) => dest.endsWith(".zst"))).toBe(false);
|
|
730
728
|
});
|
|
731
729
|
it("falls back to the raw path when the source is below ZSTD_MIN_SOURCE_BYTES", async () => {
|
|
732
|
-
const hostDir = await mkTempDir("
|
|
730
|
+
const hostDir = await mkTempDir("wardmote-daytona-zstd-host-");
|
|
733
731
|
const sourcePath = path.join(hostDir, "small.tar");
|
|
734
732
|
await fs.writeFile(sourcePath, "well below the 8 MiB compression floor\n");
|
|
735
733
|
const uploadedSources = [];
|
|
@@ -749,7 +747,7 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
749
747
|
expect(uploadedDestinations.some((dest) => dest.endsWith(".zst"))).toBe(false);
|
|
750
748
|
});
|
|
751
749
|
it("falls back to the raw path when the saving ratio is below ZSTD_MIN_SAVING_RATIO", async () => {
|
|
752
|
-
const hostDir = await mkTempDir("
|
|
750
|
+
const hostDir = await mkTempDir("wardmote-daytona-zstd-host-");
|
|
753
751
|
const sourcePath = path.join(hostDir, "incompressible.tar");
|
|
754
752
|
await writeIncompressibleFile(sourcePath, ZSTD_MIN_SOURCE_BYTES_FOR_TEST + 1024);
|
|
755
753
|
const uploadedSources = [];
|
|
@@ -775,7 +773,7 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
775
773
|
const original = zlib.createZstdCompress;
|
|
776
774
|
Object.defineProperty(zlib, "createZstdCompress", { value: undefined, configurable: true, writable: true });
|
|
777
775
|
try {
|
|
778
|
-
const hostDir = await mkTempDir("
|
|
776
|
+
const hostDir = await mkTempDir("wardmote-daytona-zstd-host-");
|
|
779
777
|
const sourcePath = path.join(hostDir, "big.tar");
|
|
780
778
|
await writeCompressibleFile(sourcePath, ZSTD_MIN_SOURCE_BYTES_FOR_TEST + 1024);
|
|
781
779
|
const uploadedSources = [];
|
|
@@ -811,7 +809,7 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
811
809
|
writable: true,
|
|
812
810
|
});
|
|
813
811
|
try {
|
|
814
|
-
const hostDir = await mkTempDir("
|
|
812
|
+
const hostDir = await mkTempDir("wardmote-daytona-zstd-host-");
|
|
815
813
|
const sourcePath = path.join(hostDir, "big.tar");
|
|
816
814
|
await writeCompressibleFile(sourcePath, ZSTD_MIN_SOURCE_BYTES_FOR_TEST + 1024);
|
|
817
815
|
const uploadedSources = [];
|
|
@@ -826,11 +824,11 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
826
824
|
operationId: "op-1",
|
|
827
825
|
files: [{ sourcePath, targetPath: "/workspace/target.bin", kind: "file" }],
|
|
828
826
|
}];
|
|
829
|
-
const before = (await fs.readdir(os.tmpdir())).filter((name) => name.startsWith("
|
|
827
|
+
const before = (await fs.readdir(os.tmpdir())).filter((name) => name.startsWith("wardmote-daytona-zstd-"));
|
|
830
828
|
await performSyncIn({ sandbox: sandbox, operations, remoteDir: "/workspace", timeoutSeconds: 30 });
|
|
831
829
|
expect(uploadedSources).toEqual([sourcePath]);
|
|
832
830
|
expect(uploadedDestinations.some((dest) => dest.endsWith(".zst"))).toBe(false);
|
|
833
|
-
const after = (await fs.readdir(os.tmpdir())).filter((name) => name.startsWith("
|
|
831
|
+
const after = (await fs.readdir(os.tmpdir())).filter((name) => name.startsWith("wardmote-daytona-zstd-"));
|
|
834
832
|
expect(after).toEqual(before); // no leftover host temp file
|
|
835
833
|
}
|
|
836
834
|
finally {
|
|
@@ -846,7 +844,7 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
846
844
|
return realStat(targetPath, ...rest);
|
|
847
845
|
});
|
|
848
846
|
try {
|
|
849
|
-
const hostDir = await mkTempDir("
|
|
847
|
+
const hostDir = await mkTempDir("wardmote-daytona-zstd-host-");
|
|
850
848
|
const sourcePath = path.join(hostDir, "big.tar");
|
|
851
849
|
await writeCompressibleFile(sourcePath, ZSTD_MIN_SOURCE_BYTES_FOR_TEST + 1024);
|
|
852
850
|
const uploadedSources = [];
|
|
@@ -861,12 +859,12 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
861
859
|
operationId: "op-1",
|
|
862
860
|
files: [{ sourcePath, targetPath: "/workspace/target.bin", kind: "file" }],
|
|
863
861
|
}];
|
|
864
|
-
const before = (await fs.readdir(os.tmpdir())).filter((name) => name.startsWith("
|
|
862
|
+
const before = (await fs.readdir(os.tmpdir())).filter((name) => name.startsWith("wardmote-daytona-zstd-"));
|
|
865
863
|
await performSyncIn({ sandbox: sandbox, operations, remoteDir: "/workspace", timeoutSeconds: 30 });
|
|
866
864
|
// The post-compression stat failed, so the candidate falls back to the raw path.
|
|
867
865
|
expect(uploadedSources).toEqual([sourcePath]);
|
|
868
866
|
expect(uploadedDestinations.some((dest) => dest.endsWith(".zst"))).toBe(false);
|
|
869
|
-
const after = (await fs.readdir(os.tmpdir())).filter((name) => name.startsWith("
|
|
867
|
+
const after = (await fs.readdir(os.tmpdir())).filter((name) => name.startsWith("wardmote-daytona-zstd-"));
|
|
870
868
|
expect(after).toEqual(before); // the stat failure did not leak the private host temp directory
|
|
871
869
|
}
|
|
872
870
|
finally {
|
|
@@ -874,7 +872,7 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
874
872
|
}
|
|
875
873
|
});
|
|
876
874
|
it("removes the host compressed temp file and sweeps sandbox scratch when the upload itself is rejected (cancellation)", async () => {
|
|
877
|
-
const hostDir = await mkTempDir("
|
|
875
|
+
const hostDir = await mkTempDir("wardmote-daytona-zstd-host-");
|
|
878
876
|
const sourcePath = path.join(hostDir, "big.tar");
|
|
879
877
|
await writeCompressibleFile(sourcePath, ZSTD_MIN_SOURCE_BYTES_FOR_TEST + 1024);
|
|
880
878
|
const commands = [];
|
|
@@ -882,7 +880,7 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
882
880
|
process: {
|
|
883
881
|
executeCommand: async (command) => {
|
|
884
882
|
commands.push({ command });
|
|
885
|
-
return { exitCode: 0, result: command.includes("mkdir -p") ? "
|
|
883
|
+
return { exitCode: 0, result: command.includes("mkdir -p") ? "WARDMOTE_ZSTD_AVAILABLE\n" : "" };
|
|
886
884
|
},
|
|
887
885
|
},
|
|
888
886
|
fs: {
|
|
@@ -892,19 +890,19 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
892
890
|
setFilePermissions: async () => undefined,
|
|
893
891
|
},
|
|
894
892
|
};
|
|
895
|
-
const before = (await fs.readdir(os.tmpdir())).filter((name) => name.startsWith("
|
|
893
|
+
const before = (await fs.readdir(os.tmpdir())).filter((name) => name.startsWith("wardmote-daytona-zstd-"));
|
|
896
894
|
const operations = [{
|
|
897
895
|
operationId: "op-1",
|
|
898
896
|
files: [{ sourcePath, targetPath: "/workspace/target.bin", kind: "file" }],
|
|
899
897
|
}];
|
|
900
898
|
await expect(performSyncIn({ sandbox: sandbox, operations, remoteDir: "/workspace", timeoutSeconds: 30 })).rejects.toThrow(/simulated cancellation/);
|
|
901
|
-
const after = (await fs.readdir(os.tmpdir())).filter((name) => name.startsWith("
|
|
899
|
+
const after = (await fs.readdir(os.tmpdir())).filter((name) => name.startsWith("wardmote-daytona-zstd-"));
|
|
902
900
|
expect(after).toEqual(before); // no leftover host temp file
|
|
903
901
|
const rmCommands = commands.filter((entry) => entry.command.includes("rm -f"));
|
|
904
902
|
expect(rmCommands.length).toBeGreaterThan(0); // both reserved scratch names swept
|
|
905
903
|
});
|
|
906
904
|
it("stages the compressed artifact in a private 0700 directory with a 0600 file, and removes the directory when the upload fails", async () => {
|
|
907
|
-
const hostDir = await mkTempDir("
|
|
905
|
+
const hostDir = await mkTempDir("wardmote-daytona-zstd-host-");
|
|
908
906
|
const sourcePath = path.join(hostDir, "big.tar");
|
|
909
907
|
await writeCompressibleFile(sourcePath, ZSTD_MIN_SOURCE_BYTES_FOR_TEST + 1024);
|
|
910
908
|
let capturedDir = "";
|
|
@@ -914,7 +912,7 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
914
912
|
process: {
|
|
915
913
|
executeCommand: async (command) => ({
|
|
916
914
|
exitCode: 0,
|
|
917
|
-
result: command.includes("mkdir -p") ? "
|
|
915
|
+
result: command.includes("mkdir -p") ? "WARDMOTE_ZSTD_AVAILABLE\n" : "",
|
|
918
916
|
}),
|
|
919
917
|
},
|
|
920
918
|
fs: {
|
|
@@ -943,7 +941,7 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
943
941
|
await expect(fs.stat(capturedDir)).rejects.toThrow();
|
|
944
942
|
});
|
|
945
943
|
it("passes the caller's timeoutSeconds unchanged through every round trip on the compressed path", async () => {
|
|
946
|
-
const hostDir = await mkTempDir("
|
|
944
|
+
const hostDir = await mkTempDir("wardmote-daytona-zstd-host-");
|
|
947
945
|
const sourcePath = path.join(hostDir, "big.tar");
|
|
948
946
|
await writeCompressibleFile(sourcePath, ZSTD_MIN_SOURCE_BYTES_FOR_TEST + 1024);
|
|
949
947
|
const seenTimeouts = [];
|
|
@@ -951,7 +949,7 @@ describe("daytona file-sync inbound zstd transport compression", () => {
|
|
|
951
949
|
process: {
|
|
952
950
|
executeCommand: async (command, _cwd, _env, timeoutSeconds) => {
|
|
953
951
|
seenTimeouts.push(timeoutSeconds);
|
|
954
|
-
return { exitCode: 0, result: command.includes("mkdir -p") ? "
|
|
952
|
+
return { exitCode: 0, result: command.includes("mkdir -p") ? "WARDMOTE_ZSTD_AVAILABLE\n" : "" };
|
|
955
953
|
},
|
|
956
954
|
},
|
|
957
955
|
fs: {
|
|
@@ -977,7 +975,7 @@ describe.skipIf(!gnuTar)("automatic unsafe workspace export recovery", () => {
|
|
|
977
975
|
await Promise.all(cleanupDirs.splice(0).map((root) => fs.rm(root, { recursive: true, force: true })));
|
|
978
976
|
});
|
|
979
977
|
it.each(["/usr/bin/pnpm", "../../outside.txt", "ambiguous", "ambiguous-target"])("preserves files and safe links when a link is unsafe: %s", async (target) => {
|
|
980
|
-
const root = await fs.mkdtemp("/tmp/
|
|
978
|
+
const root = await fs.mkdtemp("/tmp/wardmote-export-recovery-");
|
|
981
979
|
cleanupDirs.push(root);
|
|
982
980
|
const remoteDir = path.join(root, "remote");
|
|
983
981
|
const output = path.join(root, "output");
|
|
@@ -1018,10 +1016,10 @@ describe.skipIf(!gnuTar)("automatic unsafe workspace export recovery", () => {
|
|
|
1018
1016
|
await expect(fs.stat(path.join(output, "cache", "ignored.txt"))).rejects.toMatchObject({ code: "ENOENT" });
|
|
1019
1017
|
expect(await fs.readFile(path.join(root, "outside.txt"), "utf8")).toBe("private bytes");
|
|
1020
1018
|
expect((await fs.lstat(path.join(remoteDir, "nested", linkName))).isSymbolicLink()).toBe(true);
|
|
1021
|
-
expect((await fs.readdir(remoteDir)).filter((name) => name.startsWith(".
|
|
1019
|
+
expect((await fs.readdir(remoteDir)).filter((name) => name.startsWith(".wardmote-upload"))).toEqual([]);
|
|
1022
1020
|
});
|
|
1023
1021
|
it("finishes an export containing only unsafe links with an empty directory", async () => {
|
|
1024
|
-
const root = await fs.mkdtemp("/tmp/
|
|
1022
|
+
const root = await fs.mkdtemp("/tmp/wardmote-export-empty-");
|
|
1025
1023
|
cleanupDirs.push(root);
|
|
1026
1024
|
const remoteDir = path.join(root, "remote");
|
|
1027
1025
|
const output = path.join(root, "output");
|