From 4cad8090034a91cbffe47e8b6308f61e374ae0d2 Mon Sep 17 00:00:00 2001 From: localai-org-maint-bot Date: Wed, 19 Aug 2026 08:45:59 +0200 Subject: [PATCH] fix(ci): test stale chunks in split bundle (#11595) The V8 coverage build inlines every dynamic import, so the stale chunk tests cannot intercept a page chunk. Run those tests against the normal code-split bundle and exclude them from the inlined coverage pass. Assisted-by: Codex:gpt-5 Co-authored-by: localai-org-maint-bot <306269227+localai-org-maint-bot@users.noreply.github.com> --- .github/workflows/tests-ui-e2e.yml | 2 ++ Makefile | 11 +++++++++-- core/http/react-ui/e2e/stale-chunk-recovery.spec.js | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests-ui-e2e.yml b/.github/workflows/tests-ui-e2e.yml index 759377f90..1a170fcf3 100644 --- a/.github/workflows/tests-ui-e2e.yml +++ b/.github/workflows/tests-ui-e2e.yml @@ -52,6 +52,8 @@ jobs: run: | sudo apt-get update sudo apt-get install -y build-essential libopus-dev + - name: Run stale chunk recovery tests + run: PATH="$PATH:$HOME/go/bin" make test-ui-stale-chunk # Builds an instrumented UI bundle, runs the Playwright specs, and fails # if line coverage regressed beyond the jitter tolerance (the gate is # in `make test-ui-coverage-check`). PLAYWRIGHT_CHROMIUM_PATH is unset diff --git a/Makefile b/Makefile index 6b813586e..c68cd5522 100644 --- a/Makefile +++ b/Makefile @@ -103,7 +103,7 @@ COVERAGE_E2E_LABELS?=!real-models COVERAGE_EXCLUDE_RE?=grpc/proto/.*[.]pb[.]go -.PHONY: all test test-coverage test-coverage-baseline test-coverage-check test-backend-cpp test-build-scripts test-ui test-ui-coverage-baseline test-ui-coverage-check build vendor lint lint-all +.PHONY: all test test-coverage test-coverage-baseline test-coverage-check test-backend-cpp test-build-scripts test-ui test-ui-stale-chunk test-ui-coverage-baseline test-ui-coverage-check build vendor lint lint-all all: help @@ -1517,6 +1517,13 @@ test-ui: build-mock-backend protogen-go $(GOCMD) build -o tests/e2e-ui/ui-test-server ./tests/e2e-ui cd core/http/react-ui && sh $(CURDIR)/scripts/ensure-playwright-browser.sh && bunx playwright test $(PLAYWRIGHT_WORKERS_FLAG) +## The stale-chunk specs need the production code-split bundle. The V8 coverage +## bundle below inlines dynamic imports to keep every page in its denominator. +test-ui-stale-chunk: build-mock-backend protogen-go + cd core/http/react-ui && bun install && bun run build + $(GOCMD) build -o tests/e2e-ui/ui-test-server ./tests/e2e-ui + cd core/http/react-ui && sh $(CURDIR)/scripts/ensure-playwright-browser.sh && bunx playwright test --grep @production-chunks --workers=1 + ## React UI code coverage from the Playwright e2e suite. Builds a ## NON-instrumented bundle with source maps (COVERAGE_V8=true), re-embeds it ## into the ui-test-server (the dist is //go:embed'ed at compile time), runs the @@ -1532,7 +1539,7 @@ test-ui-coverage: build-mock-backend protogen-go $(GOCMD) build -o tests/e2e-ui/ui-test-server ./tests/e2e-ui && \ ( cd core/http/react-ui && rm -rf .nyc_output coverage && \ sh $(CURDIR)/scripts/ensure-playwright-browser.sh && \ - PW_V8_COVERAGE=1 bunx playwright test $(PLAYWRIGHT_WORKERS_FLAG) && bun run coverage:report ) + PW_V8_COVERAGE=1 bunx playwright test --grep-invert @production-chunks $(PLAYWRIGHT_WORKERS_FLAG) && bun run coverage:report ) ## UI coverage baseline (committed) and the strict gate that compares against ## it — the React mirror of test-coverage-baseline / test-coverage-check. diff --git a/core/http/react-ui/e2e/stale-chunk-recovery.spec.js b/core/http/react-ui/e2e/stale-chunk-recovery.spec.js index 90487823d..5877d9c43 100644 --- a/core/http/react-ui/e2e/stale-chunk-recovery.spec.js +++ b/core/http/react-ui/e2e/stale-chunk-recovery.spec.js @@ -12,7 +12,7 @@ import { test, expect } from './coverage-fixtures.js' // error instead of reloading forever. const HOME_CHUNK = /\/assets\/Home-[^/]*\.js(\?.*)?$/ -test.describe('Stale chunk recovery', () => { +test.describe('@production-chunks Stale chunk recovery', () => { test('a 404 on a page chunk recovers on its own', async ({ page }) => { let served404 = 0 await page.route(HOME_CHUNK, route => {