Drop merged unified diffs from turn summaries
- Stop propagating `diff` when merging turn file changes in session logic - Update tests to assert required retry callbacks are functions before invoking - Replace fragile unifiedDiff key check with `not.toHaveProperty`
This commit is contained in:
1 parent
6a604d8c75
commit
c50b216bbd
3 files changed
+16
-13
No files matched your search
@@ -62,24 +62,26 @@ describe("checkpointDiffQueryOptions", () => {
|
||||
cacheScope: "turn:abc",
|
||||
});
|
||||
const retry = options.retry;
|
||||
expect(typeof retry).toBe("function");
|
||||
if (typeof retry !== "function") {
|
||||
throw new Error("Expected retry to be a function.");
|
||||
}
|
||||
|
||||
expect(retry?.(1, new Error("Checkpoint turn count 2 exceeds current turn count 1."))).toBe(
|
||||
true,
|
||||
);
|
||||
expect(retry(1, new Error("Checkpoint turn count 2 exceeds current turn count 1."))).toBe(true);
|
||||
expect(
|
||||
retry?.(
|
||||
retry(
|
||||
11,
|
||||
new Error("Filesystem checkpoint is unavailable for turn 2 in thread thread-1."),
|
||||
),
|
||||
).toBe(true);
|
||||
expect(
|
||||
retry?.(
|
||||
retry(
|
||||
12,
|
||||
new Error("Filesystem checkpoint is unavailable for turn 2 in thread thread-1."),
|
||||
),
|
||||
).toBe(false);
|
||||
expect(retry?.(2, new Error("Something else failed."))).toBe(true);
|
||||
expect(retry?.(3, new Error("Something else failed."))).toBe(false);
|
||||
expect(retry(2, new Error("Something else failed."))).toBe(true);
|
||||
expect(retry(3, new Error("Something else failed."))).toBe(false);
|
||||
});
|
||||
|
||||
it("backs off longer for checkpoint-not-ready errors", () => {
|
||||
@@ -91,12 +93,16 @@ describe("checkpointDiffQueryOptions", () => {
|
||||
cacheScope: "turn:abc",
|
||||
});
|
||||
const retryDelay = options.retryDelay;
|
||||
expect(typeof retryDelay).toBe("function");
|
||||
if (typeof retryDelay !== "function") {
|
||||
throw new Error("Expected retryDelay to be a function.");
|
||||
}
|
||||
|
||||
const checkpointDelay = retryDelay?.(
|
||||
const checkpointDelay = retryDelay(
|
||||
4,
|
||||
new Error("Checkpoint turn count 2 exceeds current turn count 1."),
|
||||
);
|
||||
const genericDelay = retryDelay?.(4, new Error("Network failure"));
|
||||
const genericDelay = retryDelay(4, new Error("Network failure"));
|
||||
|
||||
expect(typeof checkpointDelay).toBe("number");
|
||||
expect(typeof genericDelay).toBe("number");
|
||||
|
||||
@@ -497,7 +497,7 @@ describe("deriveTurnDiffSummaries", () => {
|
||||
expect(summaries[0]?.files[0]?.kind).toBe("modified");
|
||||
expect(summaries[0]?.files[0]?.additions).toBe(1);
|
||||
expect(summaries[0]?.files[0]?.deletions).toBe(1);
|
||||
expect("unifiedDiff" in (summaries[0] as Record<string, unknown>)).toBe(false);
|
||||
expect(summaries[0]).not.toHaveProperty("unifiedDiff");
|
||||
});
|
||||
|
||||
it("includes completed turns even when no fileChange tool events were emitted", () => {
|
||||
|
||||
@@ -506,9 +506,6 @@ function mergeTurnDiffFileChange(
|
||||
if (existing.kind === undefined && incoming.kind !== undefined) {
|
||||
existing.kind = incoming.kind;
|
||||
}
|
||||
if (existing.diff === undefined && incoming.diff !== undefined) {
|
||||
existing.diff = incoming.diff;
|
||||
}
|
||||
if (existing.additions === undefined && incoming.additions !== undefined) {
|
||||
existing.additions = incoming.additions;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user