Skip to content

Commit 6cd8ff4

Browse files
committed
test(ai): expect the preserved UI message id in the createdAt round-trip
`should preserve createdAt for assistant segments and tool results` asserted an exact `toEqual` on the model messages without an `id`, so it broke on `main` once #1066 started stamping `uiMessage.id` onto every model message a UI message fans out into. The two changes landed independently: #1066 merged first, but #1069's branch predated it and was not re-tested before merge, so the conflict only appeared after both were on `main`. Fix the expectation rather than the converter. Propagating the id is the intended behaviour from #1066 -- a single UI message can fan out into several model messages and persistence needs the shared identity -- so dropping it would revert that feature and break its own tests.
1 parent f328b82 commit 6cd8ff4

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

packages/ai/tests/message-converters.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,6 +1334,7 @@ describe('Message Converters', () => {
13341334

13351335
expect(modelMessages).toEqual([
13361336
{
1337+
id: 'msg-1',
13371338
role: 'assistant',
13381339
content: 'Checking inventory.',
13391340
toolCalls: [
@@ -1346,6 +1347,7 @@ describe('Message Converters', () => {
13461347
createdAt,
13471348
},
13481349
{
1350+
id: 'msg-1',
13491351
role: 'tool',
13501352
content: '{"ok":true}',
13511353
toolCallId: 'tc-1',

0 commit comments

Comments
 (0)