mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-16 06:06:18 -08:00
* perf(tooling): compositing probe, report command and route-wide clip-mask guard Make the instrument that found the dashboard's clip masks part of the repository: `src/performance/compositing-probe.ts` reads the layer tree over CDP (bounds in device pixels, compositing reasons and owner nodes, waiting for Blink's layer debug info), classifies synthesized clip masks (no owner node and no compositing reason) and reads the renderer's `cc/tile_memory` from a memory-infra dump. `pnpm run perf:compositing` seeds one profile against the Xtream mock on a dedicated port, serves the artwork from memory, fixes the window at 1600x1000 and records tile and image memory, layer counts, the largest layers, masks and tile warnings for Live TV, the movie and series details, the dashboard (idle, crossfade, scrolled) and settings into dist/performance/compositing/<timestamp>/summary.json and a console table. Both helpers have node:test coverage in the performance harness. The dashboard-only compositing E2E becomes `compositing.e2e.ts` and guards Live TV, a movie detail, a series detail and the dashboard in one launch, with the backdrop-filtered controls confirmed as composited layers on the dashboard and the movie detail. The rule now lives where it triggers: a Rendering Cost section in the theme/style skill, a validation line in the UI design skill, a context map row, and a Compositing budget section in the performance journeys contract (budget, mask mechanism, instruments, why megabytes are evidence rather than a ratchet). Validation map and README mention the command. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * perf(tooling): sample the dashboard idle reading with rotation paused The hero advances after 8 s, so a 9 s wait sampled the next slide one second into its zoom (backdrop scale 1.116 instead of 1.1, the previous slide's tiles still pooled): 224 MB read as idle, 122 MB with rotation paused and the zoom and tile pool settled. The warning delta and its checkpoint are now taken at one boundary after the sampling, so a "tile memory limits exceeded" line logged while the layers or the dump are read counts for that route instead of for none. The report's test artifacts go under dist/test-results like the other configs'. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * perf(tooling): retry a memory dump that carries no renderer tile memory One reading of seven came back without `cc/tile_memory`: the dump's trace events reach the buffer shortly after the request resolves, and a process can skip a dump it is busy for. The capture now waits briefly before ending the trace and retries up to three times before a reading stays null. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * perf(tooling): run the compositing report with motion enabled With the OS set to reduced motion the hero neither rotates nor renders its pause button, so the report's click timed out before the summary was written. The report now emulates `prefers-reduced-motion: no-preference`, which also keeps the idle and crossfade readings on the same animation set on every machine. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * perf(tooling): sample the crossfade frozen, count split stderr lines, drop stale layer samples Review findings on the pushed head, plus the CI failure: - A layer that vanished between the LayerTree snapshot and its reasons query was kept with empty reasons; without an owner node it would pass for a synthesized mask. Such a snapshot is now discarded and retaken. - The crossfade reading sampled layers, owners and memory across the 700 ms fade, so the row depended on how long the sampling took. The page's animations are frozen 300 ms into the fade while the reading is taken, resumed afterwards, and the incoming slide's zoom is allowed to finish before the scrolled reading. - A stderr chunk can end mid-line; the warning counter now keeps the unfinished line for the next chunk. - The mock server's launch spec lists the new Playwright config. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
138 lines
5.5 KiB
TypeScript
138 lines
5.5 KiB
TypeScript
import {
|
|
addXtreamPortal,
|
|
clickCategoryByNameExact,
|
|
clickFirstGridListCard,
|
|
closeElectronApp,
|
|
defaultXtreamPassword,
|
|
defaultXtreamUsername,
|
|
expect,
|
|
goToDashboard,
|
|
launchElectronApp,
|
|
openWorkspaceSection,
|
|
resetMockServers,
|
|
test,
|
|
waitForXtreamWorkspaceReady,
|
|
} from './electron-test-fixtures';
|
|
import {
|
|
addCurrentDetailToFavorites,
|
|
goBackFromDetail,
|
|
toggleFavoriteForChannel,
|
|
} from './dashboard-e2e-flows';
|
|
import {
|
|
collectCompositedLayers,
|
|
describeLayerSize,
|
|
findOversizedClipMasks,
|
|
measureContentArea,
|
|
routeDeterministicArtwork,
|
|
} from './performance/compositing-probe';
|
|
import {
|
|
fetchXtreamLiveFixture,
|
|
fetchXtreamSeriesFixture,
|
|
fetchXtreamVodFixture,
|
|
getXtreamTitle,
|
|
} from './portal-mock-fixtures';
|
|
|
|
test.describe('Compositing budget', () => {
|
|
// A `border-radius` on the content scroller made Blink clip every
|
|
// composited effect inside it (the rail chevrons' and hero controls'
|
|
// backdrop filters, running animations) through a synthesized mask layer
|
|
// the size of the whole content area: ~24 MB of tile memory each at 2x,
|
|
// a dozen on the dashboard, which took the renderer past Chromium's tile
|
|
// budget ("tile memory limits exceeded") and left blank tiles while
|
|
// scrolling. The corner is painted instead (workspace shell contract).
|
|
// Blink synthesizes the masks while layerizing, before any GPU work:
|
|
// under `--disable-gpu` (the Linux CI launch, software compositing and
|
|
// raster) the controls are still composited and the old radius still
|
|
// produced seven masks, so the check guards the same path everywhere.
|
|
test('synthesizes no content-area-sized clip masks on the dashboard, the detail pages and Live TV', async ({
|
|
dataDir,
|
|
request,
|
|
}) => {
|
|
test.setTimeout(120_000);
|
|
await resetMockServers(request, ['xtream']);
|
|
const credentials = {
|
|
password: defaultXtreamPassword,
|
|
username: defaultXtreamUsername,
|
|
};
|
|
const live = await fetchXtreamLiveFixture(request, credentials);
|
|
const vod = await fetchXtreamVodFixture(request, credentials);
|
|
const series = await fetchXtreamSeriesFixture(request, credentials);
|
|
const app = await launchElectronApp(dataDir);
|
|
const page = app.mainWindow;
|
|
|
|
try {
|
|
await routeDeterministicArtwork(page);
|
|
const cdp = await app.electronApp.context().newCDPSession(page);
|
|
const clipMasks = async () => {
|
|
const area = await measureContentArea(page);
|
|
const layers = await collectCompositedLayers(cdp, page);
|
|
return {
|
|
backdropFilterLayers: layers.filter((layer) =>
|
|
layer.reasons.includes('BackdropFilter')
|
|
).length,
|
|
masks: findOversizedClipMasks(layers, area).map(
|
|
describeLayerSize
|
|
),
|
|
};
|
|
};
|
|
|
|
await addXtreamPortal(page);
|
|
await waitForXtreamWorkspaceReady(page);
|
|
await openWorkspaceSection(page, 'Live TV');
|
|
await clickCategoryByNameExact(page, live.categoryName);
|
|
await toggleFavoriteForChannel(page, getXtreamTitle(live.items[0]));
|
|
await expect(
|
|
page.getByTestId('channel-item').first()
|
|
).toBeVisible();
|
|
expect((await clipMasks()).masks, 'Live TV').toEqual([]);
|
|
|
|
await page
|
|
.getByRole('link', { exact: true, name: 'Movies' })
|
|
.click();
|
|
await clickCategoryByNameExact(page, vod.categoryName);
|
|
await clickFirstGridListCard(page);
|
|
await expect(
|
|
page.locator('app-content-hero .hero__backdrop-image')
|
|
).toBeVisible({ timeout: 20_000 });
|
|
await addCurrentDetailToFavorites(page);
|
|
const movie = await clipMasks();
|
|
// The detail actions' ghost surfaces are backdrop-filtered.
|
|
expect(movie.backdropFilterLayers, 'movie detail').toBeGreaterThan(
|
|
0
|
|
);
|
|
expect(movie.masks, 'movie detail').toEqual([]);
|
|
await goBackFromDetail(page);
|
|
|
|
await page
|
|
.getByRole('link', { exact: true, name: 'Series' })
|
|
.click();
|
|
await clickCategoryByNameExact(page, series.categoryName);
|
|
await clickFirstGridListCard(page);
|
|
await expect(page.locator('app-content-hero')).toBeVisible({
|
|
timeout: 20_000,
|
|
});
|
|
await addCurrentDetailToFavorites(page);
|
|
expect((await clipMasks()).masks, 'series detail').toEqual([]);
|
|
|
|
await goToDashboard(page);
|
|
await expect(page.getByTestId('dashboard-hero')).toBeVisible({
|
|
timeout: 20_000,
|
|
});
|
|
await expect(
|
|
page.getByTestId('dashboard-xtream-recently-added-rail')
|
|
).toBeVisible({ timeout: 20_000 });
|
|
const dashboard = await clipMasks();
|
|
// The composited effects this guards: every rail has two
|
|
// backdrop-filtered chevrons, the hero its controls. Without this
|
|
// the mask check would pass on a page with nothing to clip.
|
|
expect(dashboard.backdropFilterLayers, 'dashboard').toBeGreaterThan(
|
|
0
|
|
);
|
|
expect(dashboard.masks, 'dashboard').toEqual([]);
|
|
await cdp.detach();
|
|
} finally {
|
|
await closeElectronApp(app);
|
|
}
|
|
});
|
|
});
|