@devries-cameron20 / t3code Mirror · read-only / commits / 043d712294
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 14:45 UTC

fix(shared): atomic saves handle long filenames (#33250)

Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com> Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Simone committed Nov 14, 2026 at 17:00 UTC 043d712294cf9d355d243fffc7a3bd46c25acf9a
2 files changed +16 -1
packages/shared/src/atomicWrite.test.ts
+15
@@ -79,6 +79,21 @@ it.layer(NodeServices.layer)("writeFileStringAtomically", (it) => {
79 }),
80 );
81
82 + it.effect.each(HostProcess.Platform.defaultValue() === "linux" ? [255] : [])(
83 + "saves a file whose name is %i bytes long",
84 + (length) =>
85 + Effect.gen(function* () {
86 + const fs = yield* FileSystem.FileSystem;
87 + const path = yield* Path.Path;
88 + const root = yield* fs.makeTempDirectoryScoped({ prefix: "t3-atomic-write-" });
89 + const filePath = path.join(root, `${"s".repeat(length - 5)}.json`);
90 +
91 + yield* writeFileStringAtomically({ filePath, contents: "after" });
92 +
93 + assert.strictEqual(yield* fs.readFileString(filePath), "after");
94 + }),
95 + );
96 +
97 it.effect("keeps a dangling symlink linked and creates its destination", () =>
98 Effect.gen(function* () {
99 const fs = yield* FileSystem.FileSystem;
packages/shared/src/atomicWrite.ts
+1 -1
@@ -36,7 +36,7 @@ export const writeFileStringAtomically = (input: {
36 const tempDirectory = yield* Effect.acquireRelease(
37 fs.makeTempDirectory({
38 directory: targetDirectory,
39 - prefix: `${path.basename(targetPath)}.`,
39 + prefix: "t3-write-",
40 }),
41 (directory) => fs.remove(directory, { recursive: true }).pipe(Effect.ignore({ log: true })),
42 );