Skip to content

Commit c50b216

Browse files
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`
1 parent 6a604d8 commit c50b216

3 files changed

Lines changed: 16 additions & 13 deletions

File tree

‎apps/web/src/lib/providerReactQuery.test.ts‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,26 @@ describe("checkpointDiffQueryOptions", () => {
6262
cacheScope: "turn:abc",
6363
});
6464
const retry = options.retry;
65+
expect(typeof retry).toBe("function");
66+
if (typeof retry !== "function") {
67+
throw new Error("Expected retry to be a function.");
68+
}
6569

66-
expect(retry?.(1, new Error("Checkpoint turn count 2 exceeds current turn count 1."))).toBe(
67-
true,
68-
);
70+
expect(retry(1, new Error("Checkpoint turn count 2 exceeds current turn count 1."))).toBe(true);
6971
expect(
70-
retry?.(
72+
retry(
7173
11,
7274
new Error("Filesystem checkpoint is unavailable for turn 2 in thread thread-1."),
7375
),
7476
).toBe(true);
7577
expect(
76-
retry?.(
78+
retry(
7779
12,
7880
new Error("Filesystem checkpoint is unavailable for turn 2 in thread thread-1."),
7981
),
8082
).toBe(false);
81-
expect(retry?.(2, new Error("Something else failed."))).toBe(true);
82-
expect(retry?.(3, new Error("Something else failed."))).toBe(false);
83+
expect(retry(2, new Error("Something else failed."))).toBe(true);
84+
expect(retry(3, new Error("Something else failed."))).toBe(false);
8385
});
8486

8587
it("backs off longer for checkpoint-not-ready errors", () => {
@@ -91,12 +93,16 @@ describe("checkpointDiffQueryOptions", () => {
9193
cacheScope: "turn:abc",
9294
});
9395
const retryDelay = options.retryDelay;
96+
expect(typeof retryDelay).toBe("function");
97+
if (typeof retryDelay !== "function") {
98+
throw new Error("Expected retryDelay to be a function.");
99+
}
94100

95-
const checkpointDelay = retryDelay?.(
101+
const checkpointDelay = retryDelay(
96102
4,
97103
new Error("Checkpoint turn count 2 exceeds current turn count 1."),
98104
);
99-
const genericDelay = retryDelay?.(4, new Error("Network failure"));
105+
const genericDelay = retryDelay(4, new Error("Network failure"));
100106

101107
expect(typeof checkpointDelay).toBe("number");
102108
expect(typeof genericDelay).toBe("number");

‎apps/web/src/session-logic.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ describe("deriveTurnDiffSummaries", () => {
497497
expect(summaries[0]?.files[0]?.kind).toBe("modified");
498498
expect(summaries[0]?.files[0]?.additions).toBe(1);
499499
expect(summaries[0]?.files[0]?.deletions).toBe(1);
500-
expect("unifiedDiff" in (summaries[0] as Record<string, unknown>)).toBe(false);
500+
expect(summaries[0]).not.toHaveProperty("unifiedDiff");
501501
});
502502

503503
it("includes completed turns even when no fileChange tool events were emitted", () => {

‎apps/web/src/session-logic.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,6 @@ function mergeTurnDiffFileChange(
506506
if (existing.kind === undefined && incoming.kind !== undefined) {
507507
existing.kind = incoming.kind;
508508
}
509-
if (existing.diff === undefined && incoming.diff !== undefined) {
510-
existing.diff = incoming.diff;
511-
}
512509
if (existing.additions === undefined && incoming.additions !== undefined) {
513510
existing.additions = incoming.additions;
514511
}

0 commit comments

Comments
 (0)