summaryrefslogtreecommitdiffhomepage
path: root/src/core/chunks/trim.test.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-10-23 01:39:03 +0900
committerAdam Malczewski <[email protected]>2026-10-23 01:39:03 +0900
commit330d8e2ba81460ddd1ab1e9cb753fc1fbe5a4a62 (patch)
treefa3a11a100136f102d5ee26404cb2ec5192ce43a /src/core/chunks/trim.test.ts
parent511d415b4ec07d435ea73ab8e5421949392d922d (diff)
parent75680eac7071c6968eaa5470686ad102a82103db (diff)
downloaddispatch-web-330d8e2ba81460ddd1ab1e9cb753fc1fbe5a4a62.tar.gz
dispatch-web-330d8e2ba81460ddd1ab1e9cb753fc1fbe5a4a62.zip
Merge branch 'feature/fix-ongoing-chat-tool-calls' into dev
Diffstat (limited to 'src/core/chunks/trim.test.ts')
-rw-r--r--src/core/chunks/trim.test.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/chunks/trim.test.ts b/src/core/chunks/trim.test.ts
index 24c75fd..dcc1755 100644
--- a/src/core/chunks/trim.test.ts
+++ b/src/core/chunks/trim.test.ts
@@ -103,6 +103,19 @@ describe("trimTranscript", () => {
expect(next.accumulating).not.toBeNull();
});
+ it("does not count a late-join replay's duplicates of committed chunks", () => {
+ // An in-flight turn of 8 persisted chunks + its late-join replay (8 more
+ // provisional copies). Only 8 are rendered, so a limit of 10 keeps them all
+ // instead of unloading real history to make room for invisible duplicates.
+ const T = "turn";
+ const committed = chunks(1, 8).map((c) => ({ ...c, turnId: T }));
+ const state: TranscriptState = {
+ ...stateWith(committed),
+ provisional: committed.map((c) => ({ role: c.role, chunk: c.chunk, turnId: T })),
+ };
+ expect(trimTranscript(state, 10)).toBe(state);
+ });
+
it("drops oldest provisional when committed is exhausted", () => {
const base = stateWith(chunks(1, 2));
const provisional = Array.from({ length: 20 }, (_, i) => ({