From 5d535a6ec9f538312c55667eac12a5fef88fbb60 Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Fri, 11 Sep 2026 23:52:47 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=BD=20test:=20Drop=20the=20Config-Fail?= =?UTF-8?q?ure=20Scenario,=20Keep=20the=20Success=20Check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The scenario recorded a configured footer, served `/api/config` 500s until the retries ran out, and then asserted the next successful load lays out once. It cannot fail: without a startup config the app renders no chat at all, so `useConfiguredFooter` is never mounted on the failing visit and nothing is recorded either way. The negative control — reading `isFetched` again — passes it in all three projects. The reported corruption therefore has no reachable path: the hook only observes a failed query while the chat is mounted, which requires a config that answered once, and React Query keeps that answer as cached data through a later failure. `isSuccess` stays. "A failure answers nothing" is what the code should say, and saying it costs nothing; the test that pretended to prove it does not stay. Reported by Codex on PR #15838: https://github.com/danny-avila/LibreChat/pull/15838#discussion_r3993554041 --- .../config-failure-clearance.spec.ts | 66 ------------------- 1 file changed, 66 deletions(-) delete mode 100644 e2e/specs/mock/scenarios/config-failure-clearance.spec.ts diff --git a/e2e/specs/mock/scenarios/config-failure-clearance.spec.ts b/e2e/specs/mock/scenarios/config-failure-clearance.spec.ts deleted file mode 100644 index 1c0c9b2bc1..0000000000 --- a/e2e/specs/mock/scenarios/config-failure-clearance.spec.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { randomUUID } from 'crypto'; -import { expect, test } from '@playwright/test'; -import type { Page } from '@playwright/test'; -import { getE2EUser } from '../../../setup/user'; -import { deleteConversations, deleteMessagesByConversation, seedConversations } from '../db'; - -/** - * The composer lays out against the footer answer this deployment last gave. A - * startup-config request that fails has given no answer, so it must not be - * mistaken for "nothing configured": that would drop the clearance the footer - * needs and overwrite the memory, moving the composer again on the next load - * that succeeds. - */ - -const COMPOSER = '[data-testid="composer-surface"]'; -const CUSTOM_FOOTER = 'Operator policy footer'; - -test.use({ viewport: { width: 1280, height: 800 } }); - -const clearance = (page: Page) => - page.evaluate((selector) => { - const form = document.querySelector(selector)?.closest('form'); - if (!form) { - throw new Error('the composer form is not rendered'); - } - return getComputedStyle(form).marginBottom; - }, COMPOSER); - -test.describe('config failure clearance', () => { - test('a failed config keeps the remembered footer clearance @scenario:config-failure-keeps-the-remembered-footer', async ({ - page, - }) => { - test.setTimeout(60000); - const conversationId = randomUUID(); - await seedConversations(getE2EUser().email, [ - { conversationId, title: 'Config failure', updatedAt: new Date() }, - ]); - - try { - /** A visit that answers, so the deployment's footer is remembered. */ - await page.route('**/api/config', async (route) => { - const response = await route.fetch(); - const config = await response.json(); - await route.fulfill({ response, json: { ...config, customFooter: CUSTOM_FOOTER } }); - }); - await page.goto(`/c/${conversationId}`, { timeout: 15000 }); - await expect(page.getByText(CUSTOM_FOOTER)).toBeVisible({ timeout: 15000 }); - const remembered = await clearance(page); - - /** Then a visit whose config request never succeeds. */ - await page.unroute('**/api/config'); - await page.route('**/api/config', (route) => route.fulfill({ status: 500, body: '{}' })); - await page.goto(`/c/${conversationId}`, { timeout: 15000 }); - await expect(page.locator(COMPOSER)).toBeVisible(); - /** Long enough for React Query to exhaust its retries. */ - await page.waitForTimeout(4000); - - expect(await clearance(page), 'the failed config was read as a confirmed answer').toBe( - remembered, - ); - } finally { - await deleteMessagesByConversation([conversationId]); - await deleteConversations([conversationId]); - } - }); -});