fix: recover session submissions and failed turn settlement
This commit is contained in:
@@ -11,8 +11,19 @@ import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import { beginTurn, endTurn, isTurnRunning } from "../src/server/turn-liveness.ts";
|
||||
import { subscribe, type ServerEvent } from "../src/core/events.ts";
|
||||
import { rememberTurnFailure, settledTurnResponse } from "../src/server/turn-runs.ts";
|
||||
|
||||
describe("turn liveness registry", () => {
|
||||
it("retains a late-attach failure notice until the next accepted begin", async () => {
|
||||
const id = "chat_failure_notice_unit";
|
||||
rememberTurnFailure(id, "The reply could not be saved.");
|
||||
assert.match(await settledTurnResponse(id).text(), /The reply could not be saved\./);
|
||||
assert.match(await settledTurnResponse(id).text(), /The reply could not be saved\./, "reading does not consume the notice");
|
||||
assert.equal(beginTurn(id), true);
|
||||
assert.doesNotMatch(await settledTurnResponse(id).text(), /"type":"error"/);
|
||||
endTurn(id);
|
||||
});
|
||||
|
||||
it("begin/end round trip; a second begin is rejected until the turn ends", () => {
|
||||
const id = "chat_liveness_unit";
|
||||
assert.equal(isTurnRunning(id), false, "initially idle");
|
||||
|
||||
Reference in New Issue
Block a user