From 5ff6b3cdc5db2db49770b8f938d40f365f362b03 Mon Sep 17 00:00:00 2001 From: mektpoy Date: Tue, 20 Oct 2026 22:21:37 +0800 Subject: [PATCH] test(ui-chat): pin the owner page branch-refusal notice A refused branch now reports itself on the owner's own page: the Chat injection writes the notice on the addressed Session and the composer bar renders it as an alert, so the owner-visible change has an assertion at both seams. --- packages/client/ui-chat/tests/apply-inject.client.spec.tsx | 5 ++++- .../client/ui-conversation/tests/input-bar.client.spec.tsx | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/client/ui-chat/tests/apply-inject.client.spec.tsx b/packages/client/ui-chat/tests/apply-inject.client.spec.tsx index 67c539e099..58d5a6f75f 100644 --- a/packages/client/ui-chat/tests/apply-inject.client.spec.tsx +++ b/packages/client/ui-chat/tests/apply-inject.client.spec.tsx @@ -294,7 +294,7 @@ describe('Chat inject API', () => { await b.runtime.dispose() }) - it('states why a refused branch failed, on the Session it was asked of', async () => { + it('states why a refused branch failed on the owner page, on the Session it was asked of', async () => { /** The notice the addressed Session's composer bar consumes, as the page would show it. */ const noticeOf = (sessionId: SessionId): string | undefined => { const entry = b.runtime.slots.entries('conversation.composer.bar')[0] @@ -305,6 +305,9 @@ describe('Chat inject API', () => { return composer.hooks.notices.getSnapshot()?.text } const b = await bench() + // This page presents the owner's own browser session: the notice is an owner-visible change, not + // only a served-page one. + expect(b.runtime.ctx.remoteAccess.owner).toBe(true) const { injected } = b.chatViewApi(b.rootReference) // The Host's own message reaches the reader with the stable code beside it, and the Session it was // asked of is the one that shows it. diff --git a/packages/client/ui-conversation/tests/input-bar.client.spec.tsx b/packages/client/ui-conversation/tests/input-bar.client.spec.tsx index a5e0ceaeb8..fde3e177e4 100644 --- a/packages/client/ui-conversation/tests/input-bar.client.spec.tsx +++ b/packages/client/ui-conversation/tests/input-bar.client.spec.tsx @@ -1959,6 +1959,13 @@ describe('strips and variants', () => { } }) + it('announces a refused branch from the machine store as an alert', () => { + const { view, shell } = bench() + // The Chat page reports a refused branch through this store; the bar renders the new copy. + act(() => { shell.notify('error', '未能完成分支:fork child rename failed') }) + expect(view.getByRole('alert').textContent).toContain('未能完成分支:fork child rename failed') + }) + it('renders an information notice from the machine store as a status strip', () => { const { view, shell } = bench() act(() => { shell.notify('info', '命令完成了') })