fix(checkpoint): pulls and rebases no longer flood a turn's changed files (#17161)

Co-authored-by: Dylan Zahn <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-10-09 19:09:46 -07:00
1 parent e858ddb656
commit f3a69c70c6
12 files changed
+390 -37

No files matched your search

@@ -48,6 +48,7 @@ function makeProjection(): ProjectionCheckpointContext {
function layerFor(input: {
readonly projection: Effect.Effect<ProjectionCheckpointContext, OrchestratorProjectionError>;
readonly diffCheckpoints?: CheckpointStore.CheckpointStore["Service"]["diffCheckpoints"];
readonly authoredPaths?: ReadonlySet<string>;
}) {
return CheckpointDiffQuery.layer.pipe(
Layer.provide(
@@ -57,6 +58,7 @@ function layerFor(input: {
}),
Layer.mock(CheckpointStore.CheckpointStore)({
diffCheckpoints: input.diffCheckpoints ?? (() => Effect.succeed("diff")),
listAuthoredPaths: () => Effect.succeed(input.authoredPaths ?? null),
}),
),
),
@@ -93,6 +95,34 @@ it.effect("computes V2 run diffs from projected checkpoint scopes", () => {
}).pipe(Effect.provide(layer));
});
it.effect("leaves Git imports out of large turn diffs", () => {
const ownPaths = Array.from({ length: 1_000 }, (_, index) => `src/module-${index}/file.ts`);
const diffCheckpoints = vi.fn((input: CheckpointStore.DiffCheckpointsInput) =>
Effect.succeed(
input.format === "numstat"
? [...ownPaths, "upstream.ts"].map((path) => `1\t0\t${path}\0`).join("")
: (input.filePaths ?? ["all"]).join("\n"),
),
);
const layer = layerFor({
projection: Effect.succeed(makeProjection()),
diffCheckpoints,
authoredPaths: new Set(ownPaths),
});
return Effect.gen(function* () {
const query = yield* CheckpointDiffQuery.CheckpointDiffQuery;
yield* query.getFullThreadDiff({ threadId, toTurnCount: 2 });
const patchPaths = diffCheckpoints.mock.calls
.map(([call]) => call)
.filter((call) => call.format !== "numstat")
.map((call) => call.filePaths ?? ["all"]);
assert.isAbove(patchPaths.length, 1);
assert.sameMembers(patchPaths.flat(), ownPaths);
}).pipe(Effect.provide(layer));
});
it.effect("preserves the typed missing-thread error contract", () => {
const layer = layerFor({
projection: Effect.fail(new OrchestratorProjectionError({ threadId })),
@@ -31,6 +31,31 @@ import {
type CheckpointServiceError,
} from "./Errors.ts";
import * as CheckpointStore from "./CheckpointStore.ts";
import { isGitImport, parseTurnDiffFilesFromNumstat, type TurnDiffFileSummary } from "./Diffs.ts";
// Windows limits a command line to 32,767 characters. Leave room for the rest of git's arguments.
const MAX_PATHSPEC_CHARS = 24_000;
/** Splits files into pathspec lists that each fit on one git command line. Renames keep both paths together. */
function batchFilePaths(files: ReadonlyArray<TurnDiffFileSummary>) {
const batches: string[][] = [];
let batch: string[] = [];
let length = 0;
for (const file of files) {
const paths = file.previousPath === undefined ? [file.path] : [file.previousPath, file.path];
// Each pathspec also carries a `:(top,literal)` prefix and a separator.
const size = paths.reduce((total, path) => total + path.length + 16, 0);
if (batch.length > 0 && length + size > MAX_PATHSPEC_CHARS) {
batches.push(batch);
batch = [];
length = 0;
}
batch.push(...paths);
length += size;
}
if (batch.length > 0) batches.push(batch);
return batches;
}
/** Service tag for checkpoint diff queries. */
export class CheckpointDiffQuery extends Context.Service<
@@ -182,15 +207,40 @@ export const make = Effect.gen(function* () {
});
}
const diff = yield* checkpointStore
.diffCheckpoints({
cwd: toScope.cwd,
fromCheckpointRef,
toCheckpointRef: toCheckpoint.ref,
fallbackFromToHead: false,
ignoreWhitespace,
})
.pipe(Effect.withSpan("checkpoint.turnDiff.diffCheckpoints"));
const comparison = {
cwd: toScope.cwd,
fromCheckpointRef,
toCheckpointRef: toCheckpoint.ref,
fallbackFromToHead: false,
ignoreWhitespace,
};
// Leave out files that a pull, merge, or rebase brought in, matching the turn's file summary.
// Filtering is optional: when it cannot run, the complete diff still loads.
const authoredPaths = yield* checkpointStore
.listAuthoredPaths(comparison)
.pipe(Effect.orElseSucceed(() => null));
const files =
authoredPaths === null
? []
: yield* checkpointStore.diffCheckpoints({ ...comparison, format: "numstat" }).pipe(
Effect.map(parseTurnDiffFilesFromNumstat),
Effect.orElseSucceed(() => []),
);
const retainedFiles = files.filter((file) => !isGitImport(file, authoredPaths));
// Select retained paths before generating a patch, so imported bulk cannot exhaust its output limit.
const diff =
retainedFiles.length === files.length
? yield* checkpointStore
.diffCheckpoints(comparison)
.pipe(Effect.withSpan("checkpoint.turnDiff.diffCheckpoints"))
: (yield* Effect.forEach(
batchFilePaths(retainedFiles),
(filePaths) =>
checkpointStore
.diffCheckpoints({ ...comparison, filePaths })
.pipe(Effect.withSpan("checkpoint.turnDiff.diffCheckpoints")),
{ concurrency: 4 },
)).join("");
const turnDiff = buildTurnDiffResult(input, diff);
if (!isTurnDiffResult(turnDiff)) {
@@ -57,15 +57,22 @@ function writeTextFile(
function git(
cwd: string,
args: ReadonlyArray<string>,
options: { readonly committedAt?: string; readonly allowNonZeroExit?: boolean } = {},
): Effect.Effect<string, VcsError, VcsProcess.VcsProcess> {
return Effect.gen(function* () {
const process = yield* VcsProcess.VcsProcess;
const result = yield* process.run({
const vcsProcess = yield* VcsProcess.VcsProcess;
const result = yield* vcsProcess.run({
operation: "CheckpointStore.test.git",
command: "git",
cwd,
args,
timeoutMs: 10_000,
...(options.committedAt === undefined
? {}
: { env: { ...process.env, GIT_COMMITTER_DATE: options.committedAt } }),
...(options.allowNonZeroExit === undefined
? {}
: { allowNonZeroExit: options.allowNonZeroExit }),
});
return result.stdout.trim();
});
@@ -371,12 +378,12 @@ it.layer(layerTest)("CheckpointStore.layer", (it) => {
);
const expectedFiles = [
{ path: "binary.bin", additions: 0, deletions: 0 },
{ path: "copied.txt", additions: 0, deletions: 0 },
{ path: "copied.txt", previousPath: "copy-source.txt", additions: 0, deletions: 0 },
{ path: "copy-source.txt", additions: 1, deletions: 0 },
{ path: "deleted.txt", additions: 0, deletions: 1 },
{ path: "empty.txt", additions: 0, deletions: 0 },
{ path: addedPath, additions: 2, deletions: 0 },
{ path: renamedPath, additions: 1, deletions: 1 },
{ path: renamedPath, previousPath: "rename-old.txt", additions: 1, deletions: 1 },
].toSorted((left, right) => left.path.localeCompare(right.path));
expect(firstSummary).toEqual(expectedFiles);
@@ -441,5 +448,122 @@ it.layer(layerTest)("CheckpointStore.layer", (it) => {
]);
}),
);
it.effect("limits a diff to repository paths from a subdirectory workspace", () =>
Effect.gen(function* () {
const tmp = yield* makeTmpDir();
yield* initRepoWithCommit(tmp);
const fileSystem = yield* FileSystem.FileSystem;
const cwd = NodePath.join(tmp, "app");
yield* fileSystem.makeDirectory(cwd);
const checkpointStore = yield* CheckpointStore.CheckpointStore;
const threadId = ThreadId.make("checkpoint-file-paths-subdirectory");
const refs = {
cwd,
fromCheckpointRef: checkpointRefForThreadTurn(threadId, 0),
toCheckpointRef: checkpointRefForThreadTurn(threadId, 1),
};
yield* checkpointStore.captureCheckpoint({ cwd, checkpointRef: refs.fromCheckpointRef });
yield* writeTextFile(NodePath.join(cwd, "kept.txt"), "kept\n");
yield* writeTextFile(NodePath.join(tmp, "README.md"), "# hidden\n");
yield* checkpointStore.captureCheckpoint({ cwd, checkpointRef: refs.toCheckpointRef });
const patch = yield* checkpointStore.diffCheckpoints({
...refs,
ignoreWhitespace: false,
filePaths: ["app/kept.txt"],
});
expect(patch).toContain("+kept");
expect(patch).not.toContain("hidden");
}),
);
});
describe("listAuthoredPaths", () => {
it.effect("leaves out paths that only a merged upstream changed", () =>
Effect.gen(function* () {
const tmp = yield* makeTmpDir();
yield* initRepoWithCommit(tmp);
const checkpointStore = yield* CheckpointStore.CheckpointStore;
const threadId = ThreadId.make("checkpoint-authored-paths");
const refs = {
cwd: tmp,
fromCheckpointRef: checkpointRefForThreadTurn(threadId, 0),
toCheckpointRef: checkpointRefForThreadTurn(threadId, 1),
};
const commitBeforeTurn = (file: string, contents: string) =>
Effect.gen(function* () {
yield* writeTextFile(NodePath.join(tmp, file), contents);
yield* git(tmp, ["add", "."]);
yield* git(tmp, ["commit", "-m", file], { committedAt: "2020-01-01T00:00:00Z" });
});
yield* git(tmp, ["checkout", "-b", "upstream"]);
yield* commitBeforeTurn("upstream.txt", "upstream\n");
yield* commitBeforeTurn("shared.txt", "upstream\n");
yield* git(tmp, ["checkout", "-"]);
yield* commitBeforeTurn("shared.txt", "ours\n");
yield* checkpointStore.captureCheckpoint({
cwd: tmp,
checkpointRef: refs.fromCheckpointRef,
});
yield* checkpointStore.captureCheckpoint({ cwd: tmp, checkpointRef: refs.toCheckpointRef });
expect(yield* checkpointStore.listAuthoredPaths(refs)).toBeNull();
// The turn merges upstream, fixes the conflict by taking upstream, and edits one more file.
yield* git(tmp, ["merge", "upstream", "--no-edit"], { allowNonZeroExit: true });
yield* writeTextFile(NodePath.join(tmp, "shared.txt"), "upstream\n");
yield* git(tmp, ["commit", "-am", "merge upstream"]);
yield* writeTextFile(NodePath.join(tmp, "README.md"), "# edited\n");
yield* checkpointStore.captureCheckpoint({ cwd: tmp, checkpointRef: refs.toCheckpointRef });
const numstat = yield* checkpointStore.diffCheckpoints({
...refs,
ignoreWhitespace: false,
format: "numstat",
});
expect(parseTurnDiffFilesFromNumstat(numstat).map((file) => file.path)).toEqual([
"README.md",
"shared.txt",
"upstream.txt",
]);
expect(yield* checkpointStore.listAuthoredPaths(refs)).toEqual(
new Set(["README.md", "shared.txt"]),
);
}),
);
it.effect("leaves out paths that only a rebase onto upstream brought in", () =>
Effect.gen(function* () {
const tmp = yield* makeTmpDir();
yield* initRepoWithCommit(tmp);
const checkpointStore = yield* CheckpointStore.CheckpointStore;
const threadId = ThreadId.make("checkpoint-authored-paths-rebase");
const refs = {
cwd: tmp,
fromCheckpointRef: checkpointRefForThreadTurn(threadId, 0),
toCheckpointRef: checkpointRefForThreadTurn(threadId, 1),
};
const commitBeforeTurn = (file: string) =>
Effect.gen(function* () {
yield* writeTextFile(NodePath.join(tmp, file), `${file}\n`);
yield* git(tmp, ["add", "."]);
yield* git(tmp, ["commit", "-m", file], { committedAt: "2020-01-01T00:00:00Z" });
});
yield* git(tmp, ["checkout", "-b", "upstream"]);
yield* commitBeforeTurn("upstream.txt");
yield* git(tmp, ["checkout", "-"]);
yield* commitBeforeTurn("feature.txt");
yield* checkpointStore.captureCheckpoint({
cwd: tmp,
checkpointRef: refs.fromCheckpointRef,
});
yield* git(tmp, ["rebase", "upstream"]);
yield* checkpointStore.captureCheckpoint({ cwd: tmp, checkpointRef: refs.toCheckpointRef });
expect(yield* checkpointStore.listAuthoredPaths(refs)).toEqual(new Set(["feature.txt"]));
}),
);
});
});
@@ -40,6 +40,14 @@ export interface DiffCheckpointsInput {
readonly fallbackFromToHead?: boolean;
readonly ignoreWhitespace: boolean;
readonly format?: "patch" | "numstat";
/** Limits the diff to these exact paths. An empty list yields an empty diff. */
readonly filePaths?: ReadonlyArray<string>;
}
export interface ListAuthoredPathsInput {
readonly cwd: string;
readonly fromCheckpointRef: CheckpointRef;
readonly toCheckpointRef: CheckpointRef;
}
export interface DeleteCheckpointRefsInput {
@@ -87,6 +95,19 @@ export class CheckpointStore extends Context.Service<
input: DiffCheckpointsInput,
) => Effect.Effect<string, CheckpointStoreError>;
/**
* List paths changed by work done after the "from" checkpoint: uncommitted
* edits at either checkpoint, commits made after "from", and commits that
* left HEAD. Commits a pull, merge, or rebase brought in are older than
* "from", so their paths are not listed.
*
* Returns null when HEAD did not move or a checkpoint does not record HEAD.
* Then every changed path belongs to the turn.
*/
readonly listAuthoredPaths: (
input: ListAuthoredPathsInput,
) => Effect.Effect<ReadonlySet<string> | null, CheckpointStoreError>;
/**
* Delete the provided checkpoint refs.
*
@@ -150,6 +171,13 @@ export const make = Effect.gen(function* () {
return yield* checkpoints.diffCheckpoints(input);
});
const listAuthoredPaths: CheckpointStore["Service"]["listAuthoredPaths"] = Effect.fn(
"listAuthoredPaths",
)(function* (input) {
const checkpoints = yield* resolveCheckpoints("CheckpointStore.listAuthoredPaths", input.cwd);
return yield* checkpoints.listAuthoredPaths(input);
});
const deleteCheckpointRefs: CheckpointStore["Service"]["deleteCheckpointRefs"] = Effect.fn(
"deleteCheckpointRefs",
)(function* (input) {
@@ -166,6 +194,7 @@ export const make = Effect.gen(function* () {
hasCheckpointRef,
restoreCheckpoint,
diffCheckpoints,
listAuthoredPaths,
deleteCheckpointRefs,
});
});
+6 -4
View File
@@ -15,7 +15,7 @@ describe("parseTurnDiffFilesFromNumstat", () => {
]);
});
it("uses destination paths for renames and copies", () => {
it("preserves both paths for renames and copies", () => {
const numstat = [
"0\t0\t",
"src/old.ts",
@@ -29,8 +29,8 @@ describe("parseTurnDiffFilesFromNumstat", () => {
expect(parseTurnDiffFilesFromNumstat(numstat)).toEqual([
{ path: "other.ts", additions: 1, deletions: 0 },
{ path: "src/copied.ts", additions: 2, deletions: 1 },
{ path: "src/new.ts", additions: 0, deletions: 0 },
{ path: "src/copied.ts", previousPath: "src/source.ts", additions: 2, deletions: 1 },
{ path: "src/new.ts", previousPath: "src/old.ts", additions: 0, deletions: 0 },
]);
});
@@ -46,7 +46,9 @@ describe("parseTurnDiffFilesFromNumstat", () => {
const path = " café\tline\r\nname.txt ";
const numstat = `3\t2\t\0old\tname\n.txt\0${path}\0`;
expect(parseTurnDiffFilesFromNumstat(numstat)).toEqual([{ path, additions: 3, deletions: 2 }]);
expect(parseTurnDiffFilesFromNumstat(numstat)).toEqual([
{ path, previousPath: "old\tname\n.txt", additions: 3, deletions: 2 },
]);
expect(parseTurnDiffFilesFromNumstat(`1\t0\t${path}\0`)).toEqual([
{ path, additions: 1, deletions: 0 },
]);
+20
View File
@@ -1,5 +1,6 @@
export interface TurnDiffFileSummary {
readonly path: string;
readonly previousPath?: string;
readonly additions: number;
readonly deletions: number;
}
@@ -15,8 +16,10 @@ export function parseTurnDiffFilesFromNumstat(numstat: string): ReadonlyArray<Tu
if (!counts) continue;
let path = record.slice(counts[0].length);
let previousPath: string | undefined;
if (path.length === 0) {
// Renames and copies use two more records: the source and destination.
previousPath = records[index + 1];
path = records[index + 2] ?? "";
index += 2;
}
@@ -24,6 +27,7 @@ export function parseTurnDiffFilesFromNumstat(numstat: string): ReadonlyArray<Tu
files.push({
path,
...(previousPath === undefined ? {} : { previousPath }),
additions: counts[1] === "-" ? 0 : Number(counts[1]),
deletions: counts[2] === "-" ? 0 : Number(counts[2]),
});
@@ -31,3 +35,19 @@ export function parseTurnDiffFilesFromNumstat(numstat: string): ReadonlyArray<Tu
return files.toSorted((left, right) => left.path.localeCompare(right.path));
}
/**
* True when Git brought this file in and no work in the range touched it.
* `authoredPaths` comes from `CheckpointStore.listAuthoredPaths`; null means nothing was imported.
* A rename stays visible when either side was authored, because the summary shows it as one file.
*/
export function isGitImport(
file: TurnDiffFileSummary,
authoredPaths: ReadonlySet<string> | null,
): boolean {
return (
authoredPaths !== null &&
!authoredPaths.has(file.path) &&
(file.previousPath === undefined || !authoredPaths.has(file.previousPath))
);
}
@@ -277,6 +277,7 @@ it.layer(layerProjectionStoreTest)("CheckpointCaptureServiceV2", (it) => {
IdAllocator.layer,
NodeCrypto.layer,
Layer.mock(CheckpointStore.CheckpointStore)({
listAuthoredPaths: () => Effect.succeed(null),
isGitRepository: () => Effect.succeed(true),
captureCheckpoint: () => Effect.void,
hasCheckpointRef: () =>
@@ -219,6 +219,7 @@ it.effect("resolves the thread baseline after a second root run replaces scope o
getCheckpointContext: () => Effect.succeed(context),
}),
Layer.mock(CheckpointStore.CheckpointStore)({
listAuthoredPaths: () => Effect.succeed(null),
diffCheckpoints: (input) => {
assert.equal(input.cwd, "/prepared-repo");
assert.equal(input.fromCheckpointRef, checkpointRefs[0]);
@@ -19,7 +19,7 @@ import * as KeyedLock from "@t3tools/shared/KeyedLock";
import * as Layer from "effect/Layer";
import * as Schema from "effect/Schema";
import { parseTurnDiffFilesFromNumstat } from "../checkpointing/Diffs.ts";
import { isGitImport, parseTurnDiffFilesFromNumstat } from "../checkpointing/Diffs.ts";
import * as CheckpointStore from "../checkpointing/CheckpointStore.ts";
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
@@ -440,33 +440,49 @@ export const layer: Layer.Layer<
}).pipe(Effect.as(false)),
),
);
const refs = {
cwd: input.scope.cwd,
fromCheckpointRef: previousCheckpointRef,
toCheckpointRef: checkpointRef,
};
// A pull or rebase can change thousands of files the turn did not write.
// Keep only the files the turn's own work touched.
const files = previousExists
? yield* checkpointStore
.diffCheckpoints({
cwd: input.scope.cwd,
fromCheckpointRef: previousCheckpointRef,
toCheckpointRef: checkpointRef,
? yield* Effect.all([
checkpointStore.diffCheckpoints({
...refs,
fallbackFromToHead: false,
ignoreWhitespace: false,
format: "numstat",
})
.pipe(
Effect.map((diff) =>
parseTurnDiffFilesFromNumstat(diff).map((file) => ({
}),
checkpointStore.listAuthoredPaths(refs).pipe(
Effect.catch((cause) =>
Effect.logWarning("orchestration V2 checkpoint authored paths failed", {
scopeId: input.scope.id,
checkpointRef,
cause: String(cause),
}).pipe(Effect.as(null)),
),
),
]).pipe(
Effect.map(([diff, authoredPaths]) =>
parseTurnDiffFilesFromNumstat(diff)
.filter((file) => !isGitImport(file, authoredPaths))
.map((file) => ({
path: file.path,
kind: "modified",
additions: file.additions,
deletions: file.deletions,
})),
),
Effect.catch((cause) =>
Effect.logWarning("orchestration V2 checkpoint diff summary failed", {
scopeId: input.scope.id,
checkpointRef,
cause: String(cause),
}).pipe(Effect.as([])),
),
)
),
Effect.catch((cause) =>
Effect.logWarning("orchestration V2 checkpoint diff summary failed", {
scopeId: input.scope.id,
checkpointRef,
cause: String(cause),
}).pipe(Effect.as([])),
),
)
: [];
return makeCheckpoint({
+63 -1
View File
@@ -1049,10 +1049,18 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
}
const message = `t3 checkpoint ref=${input.checkpointRef}`;
// HEAD is the parent so listAuthoredPaths can see how HEAD moved between checkpoints.
const commitTreeResult = yield* execute({
operation,
cwd: input.cwd,
args: [...durableWrite, "commit-tree", treeOid, "-m", message],
args: [
...durableWrite,
"commit-tree",
treeOid,
...(headExists ? ["-p", "HEAD"] : []),
"-m",
message,
],
env: commitEnv,
});
const commitOid = commitTreeResult.stdout.trim();
@@ -1157,6 +1165,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
diffCheckpoints: Effect.fn("GitVcsDriver.checkpoints.diffCheckpoints")(function* (input) {
const operation = "GitVcsDriver.checkpoints.diffCheckpoints";
if (input.filePaths?.length === 0) return "";
yield* Effect.annotateCurrentSpan({
"checkpoint.cwd": input.cwd,
"checkpoint.from_ref": input.fromCheckpointRef,
@@ -1202,6 +1211,10 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
...(input.ignoreWhitespace ? ["--ignore-all-space"] : []),
`${fromRevision}^{commit}`,
`${input.toCheckpointRef}^{commit}`,
// Paths are repository-relative, while cwd can be a subdirectory.
...(input.filePaths
? ["--", ...input.filePaths.map((file) => `:(top,literal)${file}`)]
: []),
],
allowNonZeroExit: true,
maxOutputBytes: CHECKPOINT_DIFF_MAX_OUTPUT_BYTES,
@@ -1221,6 +1234,55 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
return result.stdout;
}),
listAuthoredPaths: Effect.fn("GitVcsDriver.checkpoints.listAuthoredPaths")(function* (input) {
const operation = "GitVcsDriver.checkpoints.listAuthoredPaths";
const heads = yield* execute({
operation,
cwd: input.cwd,
args: [
"log",
"--no-walk=unsorted",
"--format=%P %ct",
`${input.fromCheckpointRef}^{commit}`,
`${input.toCheckpointRef}^{commit}`,
],
});
// Each line is "<parent> <committer time>". The parent is the HEAD at capture.
const [fromLine = "", toLine = ""] = heads.stdout.trimEnd().split("\n");
const [startHead = "", capturedAt = ""] = fromLine.split(" ");
const [endHead = ""] = toLine.split(" ");
if (startHead === "" || endHead === "" || startHead === endHead) {
return null;
}
const listPaths = (args: ReadonlyArray<string>) =>
execute({
operation,
cwd: input.cwd,
args: [...args, "--name-only", "-z", "--no-renames", "--no-ext-diff"],
maxOutputBytes: CHECKPOINT_DIFF_MAX_OUTPUT_BYTES,
outputMode: "error",
}).pipe(Effect.map((result) => result.stdout.split("\0")));
// Remerge diff lists a merge's paths only where the result differs from Git's
// automatic merge, so a merge keeps its conflict fixes and drops clean upstream changes.
const pathLists = yield* Effect.all(
[
listPaths(["diff", startHead, `${input.fromCheckpointRef}^{commit}`]),
listPaths(["diff", endHead, `${input.toCheckpointRef}^{commit}`]),
listPaths(["log", "--format=", "--diff-merges=remerge", `${endHead}..${startHead}`]),
listPaths([
"log",
"--format=",
"--diff-merges=remerge",
`--since=@${capturedAt}`,
`${startHead}..${endHead}`,
]),
],
{ concurrency: "unbounded" },
);
return new Set(pathLists.flat().filter((path) => path.length > 0));
}),
deleteCheckpointRefs: Effect.fn("GitVcsDriver.checkpoints.deleteCheckpointRefs")(
function* (input) {
yield* Effect.forEach(
+11
View File
@@ -32,6 +32,14 @@ export interface VcsDiffCheckpointsInput {
readonly fallbackFromToHead?: boolean;
readonly ignoreWhitespace: boolean;
readonly format?: "patch" | "numstat";
/** Limits the diff to these exact paths. An empty list yields an empty diff. */
readonly filePaths?: ReadonlyArray<string>;
}
export interface VcsListAuthoredPathsInput {
readonly cwd: string;
readonly fromCheckpointRef: CheckpointRef;
readonly toCheckpointRef: CheckpointRef;
}
export interface VcsDeleteCheckpointRefsInput {
@@ -48,6 +56,9 @@ export interface VcsCheckpointOps {
input: VcsRestoreCheckpointInput,
) => Effect.Effect<boolean, VcsError>;
readonly diffCheckpoints: (input: VcsDiffCheckpointsInput) => Effect.Effect<string, VcsError>;
readonly listAuthoredPaths: (
input: VcsListAuthoredPathsInput,
) => Effect.Effect<ReadonlySet<string> | null, VcsError>;
readonly deleteCheckpointRefs: (
input: VcsDeleteCheckpointRefsInput,
) => Effect.Effect<void, VcsError>;
+7
View File
@@ -3,6 +3,13 @@
T3 Code integrates with GitHub, GitLab, Forgejo, Gitea, Bitbucket, and Azure DevOps to clone and publish
repositories, create pull requests, and review changes.
## Review turn changes
A turn's changed files and diff show only the turn's own work. When a turn pulls, merges, or
rebases, the files Git brought in are left out. A file stays in the list when the turn edited it,
committed it, or fixed a conflict in it. Use the branch comparison to review everything that changed
against your base branch. Restore still returns the complete saved workspace.
## Connect an account
Install Git and configure authentication on the machine running your T3 Code server. For a remote