From 87166539e8f6e0199532ffa05a5e268c8bda0faa Mon Sep 17 00:00:00 2001 From: Vito Sansevero Date: Fri, 30 Oct 2026 14:34:38 -0700 Subject: [PATCH] test(workspace): separate sidebar count reads from listing reads (#547) Visiting Overview re-reads the counts, so two specs recording listing requests also saw its limit=1 reads. They now record listings only. --- tests/browser/workspace-images.spec.mjs | 3 ++- tests/browser/workspace-library.spec.mjs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/browser/workspace-images.spec.mjs b/tests/browser/workspace-images.spec.mjs index b6cb2630..002b00c2 100644 --- a/tests/browser/workspace-images.spec.mjs +++ b/tests/browser/workspace-images.spec.mjs @@ -602,7 +602,8 @@ async function staleSourceRecovery(page, request, roots) { const pages = [], inspections = [], options = [], mutations = []; page.on('request', request => { const url = new URL(request.url()); - if (url.pathname.endsWith('/images/output')) pages.push(url); + // limit=1 is a sidebar count read (Overview re-reads it on a visit, #547), not a page of images. + if (url.pathname.endsWith('/images/output') && url.searchParams.get('limit') !== '1') pages.push(url); if (url.pathname.includes('/images/inspect/')) inspections.push(url); if (request.method() !== 'GET') mutations.push(url.pathname); }); diff --git a/tests/browser/workspace-library.spec.mjs b/tests/browser/workspace-library.spec.mjs index a2ba6187..65f121e7 100644 --- a/tests/browser/workspace-library.spec.mjs +++ b/tests/browser/workspace-library.spec.mjs @@ -176,7 +176,7 @@ test('failed library reads retry while late search responses cannot overwrite ne // D153 (#447): a Browse visit that still names the retired "Highest rated" sort opens the shelf on Recently added. test('a Library visit with the retired rating sort opens on Recently added',async({page})=>{ await page.goto(route);await expect(cards(page)).toHaveCount(3); - const sorts=[];page.on('request',item=>{const url=new URL(item.url());if(url.pathname==='/prompt_manager/library')sorts.push(url.searchParams.get('sort'));}); + const sorts=[];page.on('request',item=>{const url=new URL(item.url());if(url.pathname==='/prompt_manager/library'&&url.searchParams.get('limit')!=='1')sorts.push(url.searchParams.get('sort'));});// limit=1 is a sidebar count read, not the shelf await page.goto('/prompt_manager/workspace#/overview');await expect(page.locator('#workspace-main h1')).toHaveText('Overview'); await page.evaluate(async()=>{const {browseLibrary}=await import('/prompt_manager/js/workspace/library.mjs');browseLibrary({sort:'rating'});}); await expect(cards(page)).toHaveCount(3);