From 3a46bd67985136d0ba90dd9225f5ce65140cf71c Mon Sep 17 00:00:00 2001 From: Chinesezjc Date: Thu, 13 Aug 2026 20:56:05 +0800 Subject: [PATCH] test(web): assert the whole turn/end reason in the Cordis lifecycle The assertion compared a rebuilt object that carried only reason.kind, so a failing turn reported "expected { kind: 'error' }" with no payload. TurnEndReasonMap is merge-extensible and several variants carry the only record of why the turn ended: error holds LlmFailure (message, code) and aborted holds its TurnEndCancelCause. Compare the reason itself. completed declares kind as its only field, so the passing path is unchanged, and any failure prints the full variant payload without a per-variant branch. --- apps/web/tests/cordis-tool-round.e2e.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/web/tests/cordis-tool-round.e2e.ts b/apps/web/tests/cordis-tool-round.e2e.ts index a702a7f1ea..7d1d6ab3b5 100644 --- a/apps/web/tests/cordis-tool-round.e2e.ts +++ b/apps/web/tests/cordis-tool-round.e2e.ts @@ -47,8 +47,7 @@ function assertCompleteCordisLifecycle(events: readonly SessionEvent[]): void { (event): event is Extract => event.type === 'turn/end', ) const reason = turnEnd?.data.reason - const reasonSummary = { kind: reason?.kind } - expect(reasonSummary).toEqual({ kind: 'completed' }) + expect(reason).toEqual({ kind: 'completed' }) const calls = events.filter( (event): event is Extract => event.type === 'tool/call',