From 99cffb4de7e8b30cc5ad275cd753bd5cb0f02191 Mon Sep 17 00:00:00 2001 From: Tianyi Cui <53024+tianyicui@users.noreply.github.com> Date: Sun, 6 Sep 2026 12:56:13 +0800 Subject: [PATCH] test(client): construct immutable multi-block system fixture The system message content is readonly. Build a replacement fixture value for the multi-block extraction test instead of assigning into a readonly message property. Preserve the exact behavioral assertion without weakening production types or adding a cast that hides mutation. Validation: aggregate client build exposed TS2540 at the mutation; all seven system prompt interpretation tests pass with immutable fixture construction. --- .../ui-conversation/tests/system-prompt.client.spec.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/client/ui-conversation/tests/system-prompt.client.spec.ts b/packages/client/ui-conversation/tests/system-prompt.client.spec.ts index 0e83bb0fed..59dc87e293 100644 --- a/packages/client/ui-conversation/tests/system-prompt.client.spec.ts +++ b/packages/client/ui-conversation/tests/system-prompt.client.spec.ts @@ -73,8 +73,10 @@ describe('loaded system surface interpretation', () => { it('extracts text blocks once and treats an empty initial node as no prompt', () => { const event = system(1, 'A') if (event.type !== 'system/message') throw new Error('expected system event') - event.data.message.content = [{ type: 'text', text: 'A' }, { type: 'text', text: 'B' }] - expect(inspectSystemPrompt(undefined, event).effective?.text).toBe('AB') + const multiBlock = { ...event, data: { ...event.data, message: { + ...event.data.message, content: [{ type: 'text' as const, text: 'A' }, { type: 'text' as const, text: 'B' }], + } } } + expect(inspectSystemPrompt(undefined, multiBlock).effective?.text).toBe('AB') expect(inspectSystemPrompt(undefined, system(2, '')).effective).toBeUndefined() }) })