diff options
| author | Adam Malczewski <[email protected]> | 2026-10-21 15:36:54 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-10-21 15:36:54 +0900 |
| commit | ac43e92d174ed1f081c387944e9044643ee9efc2 (patch) | |
| tree | 3110ac7c1fa722ad6c092200ea02aead5384b5d3 /src/core/chunks/reducer.test.ts | |
| parent | e9786bf1dbf258b68f793870d02378c390939d3d (diff) | |
| download | dispatch-web-ac43e92d174ed1f081c387944e9044643ee9efc2.tar.gz dispatch-web-ac43e92d174ed1f081c387944e9044643ee9efc2.zip | |
fix(review-followup-fee): recover omitted chat payloads through history
Diffstat (limited to 'src/core/chunks/reducer.test.ts')
| -rw-r--r-- | src/core/chunks/reducer.test.ts | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/core/chunks/reducer.test.ts b/src/core/chunks/reducer.test.ts index ae0aa73..22b94d4 100644 --- a/src/core/chunks/reducer.test.ts +++ b/src/core/chunks/reducer.test.ts @@ -1053,7 +1053,7 @@ describe("turnId provenance on live chunks", () => { }); describe("foldEvent — additive wire compatibility", () => { - it.each(["turn-ended", "future-event"])("preserves transcript identity for %s", (type) => { + it.each(["future-event"])("preserves transcript identity for %s", (type) => { const state = foldEvent(foldEvent(initialState(), turnStart("t1")), textDelta("t1", "partial")); const before = structuredClone(state); const event = { type, conversationId: "c1", turnId: "t1", reason: "sealed" }; @@ -1061,3 +1061,27 @@ describe("foldEvent — additive wire compatibility", () => { expect(state).toEqual(before); }); }); + +describe("foldEvent — authoritative turn terminal", () => { + it.each([ + "sealed", + "aborted", + "error", + "rejected", + ] as const)("ends generation on %s", (reason) => { + const before = foldEvent( + foldEvent(initialState(), turnStart("t1")), + textDelta("t1", "partial"), + ); + const next = foldEvent(before, { + type: "turn-ended", + conversationId: "c1", + turnId: "t1", + reason, + }); + expect(next.generating).toBe(false); + expect(next.accumulating).toBeNull(); + expect(selectChunks(next).map((c) => c.chunk)).toEqual([{ type: "text", text: "partial" }]); + expect(before.accumulating?.text).toBe("partial"); + }); +}); |
