Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): clean up failed checkpoint writes #9809

Closedim-kvijay(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/9809/headopened View on GitHub

Showing 5 changed files with 98 additions and 0 deletions (loading 3).

x
0 of 5 viewed, 5 left
97 additions and 0 deletionsapps/server/src/checkpointing/CheckpointStore.test.tsModified
View file
@@ -95,6 +95,103 @@
​
it.layer(TestLayer)("CheckpointStore.layer", (it) => {
+ describe("checkpoint capture", () => {
+ it.effect("reads existing objects when the repository path contains control characters", () =>
+ Effect.gen(function* () {
+ const platform = yield* HostProcessPlatform;
+ if (platform === "win32") return;
+ const tmp = yield* makeTmpDir("checkpoint-store-\u0001-");
+ yield* initRepoWithCommit(tmp);
+ const checkpointStore = yield* CheckpointStore.CheckpointStore;
+ const checkpointRef = checkpointRefForThreadTurn(ThreadId.make("control-path"), 0);
+ yield* writeTextFile(NodePath.join(tmp, "new.txt"), "checkpoint contents\n");
+​
+ yield* checkpointStore.captureCheckpoint({ cwd: tmp, checkpointRef });
+​
+ expect(yield* git(tmp, ["show", `${checkpointRef}:README.md`])).toBe("# test");
+ expect(yield* git(tmp, ["show", `${checkpointRef}:new.txt`])).toBe("checkpoint contents");
+ }),
+ );
+​
+ it.effect("restores large untracked files without changing the user index during capture", () =>
+ Effect.gen(function* () {
+ const tmp = yield* makeTmpDir();
+ yield* initRepoWithCommit(tmp);
+ yield* git(tmp, ["config", "core.bigFileThreshold", "1k"]);
+ const fileSystem = yield* FileSystem.FileSystem;
+ const checkpointStore = yield* CheckpointStore.CheckpointStore;
+ const checkpointRef = checkpointRefForThreadTurn(ThreadId.make("large-checkpoint"), 0);