From eec79aece60052a14789d4cdb2a3cd76321d5452 Mon Sep 17 00:00:00 2001 From: qwen-code-dev-bot Date: Thu, 10 Sep 2026 08:22:02 +0000 Subject: [PATCH] fix(web-shell): unbreak brand probe and version-tooltip test assertions (#11535) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The workspace provider's loading test asserted the cold-start request list as exactly ['GET /capabilities'], but the brand feature (#11244) added a once-per-client GET /brand probe, and the mock's catch-all throw also scheduled the provider's 2s brand retry. Answer the probe with a 404 — the response that settles it without a retry — and include it in the expected list (twice under StrictMode, which mounts twice). The sidebar brand tests asserted the version tooltip at the default 260px width, but the version row only renders above the 344px compact footer breakpoint (#6522/#11453). Mount those two cases at 360px, the same convention as WebShellSidebar.footer-version.test.tsx. Both failures were deterministic on main since #11244 merged and red every post-merge Test (ubuntu-latest) run since, including d8baa8730f. Co-authored-by: Qwen-Coder --- .../WorkspaceSessionProvider.loading.test.tsx | 10 +++++++++- .../components/sidebar/WebShellSidebar.brand.test.tsx | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/web-shell/client/components/WorkspaceSessionProvider.loading.test.tsx b/packages/web-shell/client/components/WorkspaceSessionProvider.loading.test.tsx index fb54b0fe5e6..87c8f97f9ce 100644 --- a/packages/web-shell/client/components/WorkspaceSessionProvider.loading.test.tsx +++ b/packages/web-shell/client/components/WorkspaceSessionProvider.loading.test.tsx @@ -178,6 +178,10 @@ it.each( return json({ v: 1, workspaceCwd: '/work/a', skills: [] }); if (url.pathname.endsWith('/git')) return json({ v: 1, isGitRepository: false }); + // The provider probes GET /brand once per client; a 404 settles it + // without scheduling the 2s retry, so nothing leaks past this test. + if (url.pathname.endsWith('/brand')) + return new Response('not found', { status: 404 }); throw new Error(`Unexpected request: ${url.pathname}`); }), ); @@ -196,7 +200,11 @@ it.each( ); root.render(strictMode ? {tree} : tree); }); - expect(calls).toEqual(['GET /capabilities']); + expect(calls).toEqual( + strictMode + ? ['GET /capabilities', 'GET /brand', 'GET /brand'] + : ['GET /capabilities', 'GET /brand'], + ); expect(observeLiveStateSupport).not.toHaveBeenCalled(); await act(async () => { releaseCapabilities(); diff --git a/packages/web-shell/client/components/sidebar/WebShellSidebar.brand.test.tsx b/packages/web-shell/client/components/sidebar/WebShellSidebar.brand.test.tsx index 09224d9e444..08eb9130e05 100644 --- a/packages/web-shell/client/components/sidebar/WebShellSidebar.brand.test.tsx +++ b/packages/web-shell/client/components/sidebar/WebShellSidebar.brand.test.tsx @@ -97,6 +97,8 @@ vi.mock('../../session-catalog/session-catalog-hooks', () => ({ useSessionCatalogQueries: vi.fn(() => []), })); +const SIDEBAR_WIDTH_STORAGE_KEY = 'qwen-code-web-shell-sidebar-width'; + const { I18nProvider } = await import('../../i18n'); const { BrandProvider } = await import('../../brandContext'); const { WebShellSidebar } = await import('./WebShellSidebar'); @@ -196,6 +198,7 @@ describe('sidebar brand', () => { // `""` means "use the built-in name" on the settings surface, so a host // that builds its prop the same way must not get an empty sidebar row and // a version tooltip reading " v1.2.3". + window.localStorage.setItem(SIDEBAR_WIDTH_STORAGE_KEY, '360'); renderSidebar({ name: '' }); expect(container.textContent).toContain('Qwen Code'); @@ -205,6 +208,7 @@ describe('sidebar brand', () => { }); it('names the version tooltip after the brand', () => { + window.localStorage.setItem(SIDEBAR_WIDTH_STORAGE_KEY, '360'); renderSidebar({ name: 'QiuQiu Code' }); expect(