GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): checkpoints skip a project folder its parent repo ignore… · pingdotgg/t3code@6d266ea

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src
    • orchestration-v2
      • CheckpointService.test.ts
      • CheckpointService.ts
    • vcs
      • GitVcsDriver.test.ts
      • GitVcsDriver.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/orchestration-v2/CheckpointService.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/CheckpointService.test.ts
+78Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
ThreadId,
99
type OrchestrationV2CheckpointScope,
1010
VcsProcessTimeoutError,
11+
VcsUnsupportedOperationError,
1112
} from "@t3tools/contracts";
1213
import * as DateTime from "effect/DateTime";
1314
import * as Effect from "effect/Effect";
@@ -103,3 +104,80 @@ it.effect.each([false, true, "interrupt"] as const)(
103104
}).pipe(Effect.provide(layerTest));
104105
},
105106
);
107+
108+
it.effect(
109+
"skips unsupported baseline and turn checkpoints without swallowing capture failures",
110+
() =>
111+
Effect.gen(function* () {
112+
const scope: OrchestrationV2CheckpointScope = {
113+
id: CheckpointScopeId.make("checkpoint-scope:capture-failure"),
114+
threadId: ThreadId.make("thread:capture-failure"),
115+
runId: RunId.make("run:capture-failure:1"),
116+
nodeId: NodeId.make("node:capture-failure:1"),
117+
parentScopeId: null,
118+
providerThreadId: ProviderThreadId.make("provider-thread:capture-failure"),
119+
kind: "root_run",
120+
ordinalWithinParent: 0,
121+
advancesAppRunCount: true,
122+
cwd: "/repo/ignored",
123+
createdAt: DateTime.makeUnsafe("2026-07-28T00:00:00.000Z"),
124+
};
125+
for (const captureError of [
126+
new VcsProcessTimeoutError({
127+
operation: "test.capture",
128+
command: "git",
129+
cwd: scope.cwd,
130+
timeoutMs: 30000,
131+
}),
132+
new VcsUnsupportedOperationError({
133+
operation: "test.capture",
134+
kind: "git",
135+
detail: "The workspace directory is ignored by its Git repository.",
136+
}),
137+
]) {
138+
const layerTest = CheckpointService.layer.pipe(
139+
Layer.provide(
140+
Layer.mergeAll(
141+
IdAllocator.layer,
142+
Layer.mock(CheckpointStore.CheckpointStore)({
143+
isGitRepository: () => Effect.succeed(true),
144+
hasCheckpointRef: () => Effect.succeed(false),
145+
captureCheckpoint: () => Effect.fail(captureError),
146+
}),
147+
),
148+
),
149+
Layer.provideMerge(NodeCrypto.layer),
150+
);
151+
yield* Effect.gen(function* () {
152+
const checkpoints = yield* CheckpointService.CheckpointServiceV2;
153+
const baseline = yield* Effect.result(
154+
checkpoints.captureBaseline({ scope, ordinalWithinScope: 0 }),
155+
);
156+
const checkpoint = yield* checkpoints.capture({
157+
scope,
158+
ordinalWithinScope: 1,
159+
runId: scope.runId!,
160+
nodeId: scope.nodeId!,
161+
appRunOrdinal: 1,
162+
capturedAt: scope.createdAt,
163+
});
164+
165+
assert.deepEqual(
166+
{ baseline: baseline._tag, turn: checkpoint.status, files: checkpoint.files },
167+
captureError._tag === "VcsUnsupportedOperationError"
168+
? { baseline: "Success", turn: "missing", files: [] }
169+
: { baseline: "Failure", turn: "error", files: [] },
170+
);
171+
if (baseline._tag === "Failure") {
172+
assert.strictEqual(baseline.failure.cause, captureError);
173+
} else {
174+
const materialized = yield* checkpoints.materializeBaselineCheckpoint({
175+
scope,
176+
ordinalWithinScope: 0,
177+
});
178+
assert.strictEqual(materialized.status, "missing");
179+
}
180+
}).pipe(Effect.provide(layerTest));
181+
}
182+
}),
183+
);
Collapse file

‎apps/server/src/orchestration-v2/CheckpointService.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/CheckpointService.ts
+18-9Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,16 @@ export const layer: Layer.Layer<
284284
return;
285285
}
286286

287-
yield* checkpointStore.captureCheckpoint({
288-
cwd: input.scope.cwd,
289-
checkpointRef,
290-
});
287+
yield* checkpointStore
288+
.captureCheckpoint({
289+
cwd: input.scope.cwd,
290+
checkpointRef,
291+
})
292+
.pipe(
293+
Effect.catchTags({
294+
VcsUnsupportedOperationError: () => Effect.void,
295+
}),
296+
);
291297
}),
292298
).pipe(
293299
Effect.mapError(
@@ -394,23 +400,26 @@ export const layer: Layer.Layer<
394400
});
395401
}
396402

397-
const captured = yield* checkpointStore
403+
const captureStatus = yield* checkpointStore
398404
.captureCheckpoint({
399405
cwd: input.scope.cwd,
400406
checkpointRef,
401407
})
402408
.pipe(
403-
Effect.as(true),
409+
Effect.as("ready" as const),
410+
Effect.catchTags({
411+
VcsUnsupportedOperationError: () => Effect.succeed("missing" as const),
412+
}),
404413
Effect.catch((cause) =>
405414
Effect.logWarning("orchestration V2 checkpoint capture failed", {
406415
scopeId: input.scope.id,
407416
checkpointRef,
408417
cause: String(cause),
409-
}).pipe(Effect.as(false)),
418+
}).pipe(Effect.as("error" as const)),
410419
),
411420
);
412421

413-
if (!captured) {
422+
if (captureStatus !== "ready") {
414423
return makeCheckpoint({
415424
id: checkpointId,
416425
scope: input.scope,
@@ -420,7 +429,7 @@ export const layer: Layer.Layer<
420429
ordinalWithinScope: input.ordinalWithinScope,
421430
appRunOrdinal: input.appRunOrdinal,
422431
ref: checkpointRef,
423-
status: "error",
432+
status: captureStatus,
424433
files: [],
425434
capturedAt: input.capturedAt,
426435
});
Collapse file

‎apps/server/src/vcs/GitVcsDriver.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/vcs/GitVcsDriver.test.ts
+95Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ it.effect("checkpoint capture still fails when a clean filter rejects a file", (
264264
);
265265

266266
assert.strictEqual(result._tag, "Failure");
267+
if (result._tag === "Failure") {
268+
assert.strictEqual(result.failure._tag, "VcsProcessExitError");
269+
}
267270
assert.deepEqual(yield* fileSystem.readFile(path.join(cwd, ".git", "index")), originalIndex);
268271
assert.isFalse(yield* driver.checkpoints.hasCheckpointRef({ cwd, checkpointRef }));
269272
}).pipe(Effect.scoped, Effect.provide(layerGitContract)),
@@ -299,6 +302,98 @@ it.effect("checkpoint capture refuses a truncated nested repository listing", ()
299302
}).pipe(Effect.scoped, Effect.provide(layerGitContract)),
300303
);
301304

305+
it.effect("checkpoint capture skips an ignored project while keeping its allowed sibling", () =>
306+
Effect.gen(function* () {
307+
const fs = yield* FileSystem.FileSystem;
308+
const path = yield* Path.Path;
309+
const driver = yield* GitVcsDriver.makeVcsDriverShape();
310+
const parent = yield* fs.makeTempDirectoryScoped({ prefix: "t3-checkpoint-ignored-" });
311+
const { git } = yield* makeCheckpointFixture(driver, parent);
312+
yield* fs.writeFileString(
313+
path.join(parent, ".gitignore"),
314+
"*\n!.gitignore\n!file.txt\n!keep/\n!keep/**\n",
315+
);
316+
const ignoredCwd = path.join(parent, "ignored");
317+
const keepCwd = path.join(parent, "keep");
318+
yield* fs.makeDirectory(ignoredCwd);
319+
yield* fs.makeDirectory(keepCwd);
320+
yield* fs.writeFileString(path.join(ignoredCwd, "secret.txt"), "private\n");
321+
yield* fs.writeFileString(path.join(keepCwd, "new.txt"), "new\n");
322+
const originalIndex = yield* fs.readFile(path.join(parent, ".git", "index"));
323+
const ignoredRef = CheckpointRef.make("refs/t3/checkpoints/ignored");
324+
const keepRef = CheckpointRef.make("refs/t3/checkpoints/keep");
325+
326+
const ignored = yield* Effect.result(
327+
driver.checkpoints.captureCheckpoint({ cwd: ignoredCwd, checkpointRef: ignoredRef }),
328+
);
329+
yield* driver.checkpoints.captureCheckpoint({ cwd: keepCwd, checkpointRef: keepRef });
330+
331+
assert.strictEqual((yield* git(["show", `${keepRef}:keep/new.txt`])).stdout, "new\n");
332+
assert.strictEqual((yield* git(["ls-tree", "-r", keepRef, "--", "ignored"])).stdout, "");
333+
assert.isFalse(
334+
yield* driver.checkpoints.hasCheckpointRef({ cwd: parent, checkpointRef: ignoredRef }),
335+
);
336+
assert.deepEqual(yield* fs.readFile(path.join(parent, ".git", "index")), originalIndex);
337+
assert.strictEqual(ignored._tag, "Failure");
338+
if (ignored._tag === "Failure") {
339+
assert.strictEqual(ignored.failure._tag, "VcsUnsupportedOperationError");
340+
}
341+
}).pipe(Effect.scoped, Effect.provide(layerGitContract)),
342+
);
343+
344+
it.effect.each([
345+
{ tracking: "committed-only", committed: ["committed.txt"], staged: [] },
346+
{ tracking: "staged-only", committed: [], staged: ["staged.txt"] },
347+
{ tracking: "mixed", committed: ["committed.txt"], staged: ["staged.txt"] },
348+
])(
349+
"checkpoint capture keeps $tracking tracked edits but excludes new files in a project ignored later",
350+
({ committed, staged }) =>
351+
Effect.gen(function* () {
352+
const fs = yield* FileSystem.FileSystem;
353+
const path = yield* Path.Path;
354+
const driver = yield* GitVcsDriver.makeVcsDriverShape();
355+
const parent = yield* fs.makeTempDirectoryScoped({ prefix: "t3-checkpoint-ignored-later-" });
356+
const { git, checkpointRef } = yield* makeCheckpointFixture(driver, parent);
357+
const cwd = path.join(parent, "sub");
358+
yield* fs.makeDirectory(cwd);
359+
for (const file of committed) {
360+
yield* fs.writeFileString(path.join(cwd, file), "committed\n");
361+
yield* git(["add", `sub/${file}`]);
362+
}
363+
if (committed.length > 0) {
364+
yield* git(["commit", "-m", "track project"]);
365+
}
366+
for (const file of staged) {
367+
yield* fs.writeFileString(path.join(cwd, file), "staged\n");
368+
yield* git(["add", `sub/${file}`]);
369+
}
370+
const tracked = [...committed, ...staged];
371+
yield* fs.writeFileString(path.join(parent, ".gitignore"), "sub/\n");
372+
for (const file of tracked) {
373+
yield* fs.writeFileString(path.join(cwd, file), `${file} working\n`);
374+
}
375+
yield* fs.writeFileString(path.join(cwd, "secret.txt"), "private\n");
376+
const originalIndex = yield* fs.readFile(path.join(parent, ".git", "index"));
377+
378+
const captured = yield* Effect.result(
379+
driver.checkpoints.captureCheckpoint({ cwd, checkpointRef }),
380+
);
381+
382+
assert.deepEqual(yield* fs.readFile(path.join(parent, ".git", "index")), originalIndex);
383+
if (captured._tag === "Failure") return yield* captured.failure;
384+
assert.strictEqual(
385+
(yield* git(["ls-tree", "-r", "--name-only", checkpointRef, "--", "sub"])).stdout,
386+
tracked.map((file) => `sub/${file}\n`).join(""),
387+
);
388+
for (const file of tracked) {
389+
assert.strictEqual(
390+
(yield* git(["show", `${checkpointRef}:sub/${file}`])).stdout,
391+
`${file} working\n`,
392+
);
393+
}
394+
}).pipe(Effect.scoped, Effect.provide(layerGitContract)),
395+
);
396+
302397
it.effect("checkpoint recovery refuses excessive candidates before probing", () =>
303398
Effect.gen(function* () {
304399
const fs = yield* FileSystem.FileSystem;
Collapse file

‎apps/server/src/vcs/GitVcsDriver.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/vcs/GitVcsDriver.ts
+61-1Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { ChildProcessSpawner } from "effect/process";
1313
import {
1414
GitCommandError,
1515
VcsProcessExitError,
16+
VcsUnsupportedOperationError,
1617
type VcsSwitchRefInput,
1718
type VcsSwitchRefResult,
1819
type VcsCreateRefInput,
@@ -965,6 +966,64 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
965966
}
966967
}
967968

969+
const workspaceIgnored = (yield* filterIgnoredPaths(input.cwd, ["."])).length === 0;
970+
if (workspaceIgnored) {
971+
// HEAD omits staged-only paths. Seed just this workspace's additions, keeping
972+
// unrelated staged changes and the scratch index's sparse flags untouched.
973+
const additions = yield* execute({
974+
operation,
975+
cwd: input.cwd,
976+
args: [
977+
"-c",
978+
"core.quotePath=true",
979+
"diff",
980+
"--cached",
981+
"--raw",
982+
"--no-abbrev",
983+
"--no-renames",
984+
"--no-relative",
985+
"--ignore-submodules=none",
986+
"--no-color",
987+
"--no-ext-diff",
988+
"--no-textconv",
989+
"--ita-visible-in-index",
990+
"--diff-filter=A",
991+
"--",
992+
".",
993+
],
994+
maxOutputBytes: WORKSPACE_FILES_MAX_OUTPUT_BYTES,
995+
outputMode: "error",
996+
});
997+
if (additions.stdout.length > 0) {
998+
// Git's quoted paths round-trip through index-info, including non-UTF-8 names.
999+
yield* execute({
1000+
operation,
1001+
cwd: input.cwd,
1002+
args: [...indexConfig, "-c", "index.sparse=false", "update-index", "--index-info"],
1003+
stdin: additions.stdout.replace(
1004+
/^:000000 ([0-7]{6}) 0+ ([0-9a-f]+) A\t/gm,
1005+
"$1 $2\t",
1006+
),
1007+
env: commitEnv,
1008+
});
1009+
}
1010+
const tracked = yield* execute({
1011+
operation,
1012+
cwd: input.cwd,
1013+
args: [...indexConfig, "ls-files", "--cached", "-z", "--", "."],
1014+
env: commitEnv,
1015+
maxOutputBytes: 1,
1016+
outputMode: "truncate",
1017+
});
1018+
if (tracked.stdout.length === 0) {
1019+
return yield* new VcsUnsupportedOperationError({
1020+
operation,
1021+
kind: "git",
1022+
detail: "The workspace directory is ignored by its Git repository.",
1023+
});
1024+
}
1025+
}
1026+
9681027
const stageFiles = (exclusions: ReadonlyArray<string>) =>
9691028
execute({
9701029
operation,
@@ -975,7 +1034,8 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
9751034
...longPaths,
9761035
"add",
9771036
...(sparseCheckout ? ["--sparse"] : []),
978-
"-A",
1037+
// add -A rejects ignored directories even when they contain tracked files.
1038+
workspaceIgnored ? "-u" : "-A",
9791039
"--",
9801040
".",
9811041
...exclusions,

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.