Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
Speed up frontend validation and remove low-value tests (#9974)
Josh Corbettea1056bd8166
diff --git a/.github/workflows/frontend-checks.yml b/.github/workflows/frontend-checks.ymlindex ee9ba1d47d..ebf7961c8b 100644--- a/.github/workflows/frontend-checks.yml+++ b/.github/workflows/frontend-checks.yml@@ -60,6 +60,7 @@ jobs:files_yaml: |webv2:- '.github/workflows/frontend-checks.yml'+ - '.github/workflows/frontend-tests.yml'- '.nvmrc'- '.github/actions/install-frontend-deps/**'- 'invokeai/frontend/webv2/**'@@ -72,10 +73,5 @@ jobs:- name: lintif: ${{ steps.changed-files.outputs.webv2_any_changed == 'true' || inputs.always_run == true }}- run: 'pnpm run lint'- shell: bash-- - name: build- if: ${{ steps.changed-files.outputs.webv2_any_changed == 'true' || inputs.always_run == true }}- run: 'pnpm run build'+ run: 'pnpm run lint:code'shell: bashdiff --git a/.github/workflows/frontend-tests.yml b/.github/workflows/frontend-tests.ymlindex dec0120e82..d19d96cf91 100644--- a/.github/workflows/frontend-tests.yml+++ b/.github/workflows/frontend-tests.yml@@ -60,6 +60,7 @@ jobs:files_yaml: |webv2:- '.github/workflows/frontend-tests.yml'+ - '.github/workflows/frontend-checks.yml'- '.nvmrc'- '.github/actions/install-frontend-deps/**'- 'invokeai/frontend/webv2/**'@@ -97,7 +98,7 @@ jobs:- name: release completion gatesif: ${{ steps.changed-files.outputs.webv2_any_changed == 'true' || inputs.always_run == true }}- run: 'pnpm check:release'+ run: 'pnpm check:release:tests'shell: bashenv:WEBV2_PERF_REFERENCE_DIR: ${{ steps.perf-ref.outputs.cache-matched-key != '' && 'artifacts/perf-reference' || '' }}diff --git a/invokeai/frontend/webv2/AGENTS.md b/invokeai/frontend/webv2/AGENTS.mdindex c657e3473b..b29403c8e8 100644--- a/invokeai/frontend/webv2/AGENTS.md+++ b/invokeai/frontend/webv2/AGENTS.md@@ -57,4 +57,6 @@ No Python backend: `pnpm dev:mock` serves the app against the in-repo mock backe- Use real IndexedDB, Web Locks, focus, pointer, rendering where mocks cannot prove correctness.- Droppable enabled only after drag start: drag through dnd-kit mouse sensors with `dragWithMouse` (`@platform/browser/mouseDrag.testing`). Single-jump drags such as `userEvent.dragAndDrop` miss it.-Focused checks during development. `check:release` before code-milestone readiness: lint, all tests, architecture performance/build, project-file journeys, accessibility. Docs-only changes: formatting and link review, no application tests. Architecture inventories and performance reports stay in ignored `artifacts/`, never committed.+Unit tests cache transformed modules between runs in ignored `node_modules/.vitest-cache`.++Focused checks during development. `check:release` before code-milestone readiness: lint, all tests, architecture performance/build, project-file journeys, accessibility. CI splits completion between `lint:code` and `check:release:tests`; together they run each gate once. Routine browser performance checks take two resource observations per fixture; `test:performance:browser:profile` and baseline updates use full timing sampling. Docs-only changes: formatting and link review, no application tests. Architecture inventories and performance reports stay in ignored `artifacts/`, never committed.diff --git a/invokeai/frontend/webv2/package.json b/invokeai/frontend/webv2/package.jsonindex 8cc729ef6b..06e74d5c2d 100644--- a/invokeai/frontend/webv2/package.json+++ b/invokeai/frontend/webv2/package.json@@ -7,10 +7,12 @@"#architecture/source-analysis": "./src/architecture/tsSourceAnalysis.ts"},"scripts": {- "architecture:check": "vitest run --config vitest.config.mts src/architecture/dependencyPolicy.test.ts src/architecture/workbenchOwnership.test.ts src/architecture/architectureWorkflow.test.ts src/architecture/canvasSeamOwnership.test.ts src/architecture/tsSourceAnalysis.test.ts src/architecture/secureContextApis.test.ts src/architecture/axeAudits.test.ts src/architecture/typographyPolicy.test.ts && node --experimental-strip-types scripts/write-workbench-ownership-inventory.mjs && node --experimental-strip-types scripts/write-contract-caller-matrix.mjs && node --experimental-strip-types scripts/write-canvas-import-matrix.mjs",+ "architecture:check": "vitest run --config vitest.config.mts src/architecture/dependencyPolicy.test.ts src/architecture/workbenchOwnership.test.ts src/architecture/architectureWorkflow.test.ts src/architecture/canvasSeamOwnership.test.ts src/architecture/tsSourceAnalysis.test.ts src/architecture/secureContextApis.test.ts src/architecture/axeAudits.test.ts src/architecture/typographyPolicy.test.ts && pnpm run architecture:inventory",+ "architecture:inventory": "node --experimental-strip-types scripts/write-workbench-ownership-inventory.mjs && node --experimental-strip-types scripts/write-contract-caller-matrix.mjs && node --experimental-strip-types scripts/write-canvas-import-matrix.mjs","build": "pnpm run lint && vite build",- "check:architecture": "pnpm run lint && pnpm run test:all && pnpm run test:performance:architecture && pnpm run test:project-files:browser",- "check:release": "pnpm run check:architecture && pnpm run test:accessibility:browser",+ "check:architecture": "pnpm run lint:code && pnpm run test:all && pnpm run architecture:inventory && pnpm run test:performance:architecture && pnpm run test:project-files:browser",+ "check:release": "pnpm run lint:code && pnpm run check:release:tests",+ "check:release:tests": "pnpm run test:all && pnpm run architecture:inventory && pnpm run test:performance:architecture && pnpm run test:project-files:browser && pnpm run test:accessibility:browser","dev": "vite dev","dev:host": "vite dev --host","dev:mock": "node scripts/dev-mock.mjs",@@ -19,7 +21,8 @@"format:write": "oxfmt --write .","i18n:report": "node scripts/i18n-report.mjs","i18n:report:verbose": "node scripts/i18n-report.mjs --verbose",- "lint": "pnpm run format:check && pnpm run lint:oxc && pnpm run lint:tsc && pnpm run architecture:check",+ "lint": "pnpm run lint:code && pnpm run architecture:check",+ "lint:code": "pnpm run format:check && pnpm run lint:oxc && pnpm run lint:tsc","lint:oxc": "oxlint --react-plugin --import-plugin --jsx-a11y-plugin --deny-warnings .","lint:oxc:fix": "oxlint --react-plugin --import-plugin --jsx-a11y-plugin --fix .","lint:tsc": "pnpm run theme:typegen && tsc --noEmit",@@ -35,6 +38,7 @@"test:fixtures": "node --test scripts/mock-backend-fixtures.test.mjs scripts/preview-server.test.mjs scripts/run-project-file-journey.test.mjs scripts/locale-assets-plugin.test.mjs","test:performance:architecture": "pnpm run test:performance:build && pnpm run test:performance:browser","test:performance:browser": "node scripts/measure-architecture-performance.mjs",+ "test:performance:browser:profile": "node scripts/measure-architecture-performance.mjs --profile","test:performance:browser:update-baseline": "node scripts/measure-architecture-performance.mjs --update-baseline","test:performance:build": "pnpm run test:performance:contracts && vite build && node --experimental-strip-types scripts/check-architecture-performance.mjs","test:performance:build:update-baseline": "pnpm run test:performance:contracts && vite build && node --experimental-strip-types scripts/check-architecture-performance.mjs --update-baseline",diff --git a/invokeai/frontend/webv2/performance/README.md b/invokeai/frontend/webv2/performance/README.mdindex 3c204b7f8b..b6af3f186a 100644--- a/invokeai/frontend/webv2/performance/README.md+++ b/invokeai/frontend/webv2/performance/README.md@@ -5,7 +5,13 @@ Paths relative to the webv2 package. `pnpm test:performance:architecture` runs t| Gate | Command | Baseline | Checks || ------- | ------------------------------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- || Build | `pnpm test:performance:build` | `performance/architecture-baseline.json` | Per-route bytes, request counts, source-owner sets; sources a route must not load eagerly; direct-importer budgets for barrels and hubs |-| Browser | `pnpm test:performance:browser` | `performance/browser-baseline.json` | Each route in Chromium against the mock backend: script requests, source-owner sets, required widgets, timing samples |+| Browser | `pnpm test:performance:browser` | `performance/browser-baseline.json` | Each route in Chromium against the mock backend: script requests, source-owner sets, required widgets, repeated resource observations |++## Resource checks and timing profiles++The routine browser gate visits each fixture twice in fresh browser contexts. Both observations run the complete journey, required/inactive-widget checks, and semantic-ready waits. Resource budgets use the maximum of each metric; fixture counts and script source owners must agree between observations. Successful routine runs do not record traces or report timing statistics. On failure, the gate attempts one diagnostic trace for the failing fixture and retains the original failure.++`pnpm test:performance:browser:profile` runs the full sampling plan from `performance/architecture-fixtures.json`: one warmup, one unscored trace, and five scored observations per fixture. Use it after the performance build for timing investigation and traces of every route. Baseline updates always use this plan, as does the routine command when the checked-in timing policy enables enforcement. Full profiles report timing medians and variance; routine reports identify `mode: resources` and omit those fields. Resource reference files contain only resource measurements and work with either mode.## Byte budgets@@ -25,8 +31,9 @@ Reference modes:## Running+- CI splits `check:release` between `lint:code` in the checks job and `check:release:tests` in the tests job. Architecture tests run in the complete unit suite; inventories are generated once and the performance build serves all subsequent browser journeys.- `check:release` stops at the first failing gate; later gates did not run. In CI logs the failure sits at the tail, after passing test summaries.-- Browser gate measures timing and binds ports 4176 and 4177 (`INVOKEAI_PERFORMANCE_PORT`, `INVOKEAI_PERFORMANCE_BACKEND_PORT`). One performance gate per machine, nothing else building or testing.+- Browser gate binds ports 4176 and 4177 (`INVOKEAI_PERFORMANCE_PORT`, `INVOKEAI_PERFORMANCE_BACKEND_PORT`). One performance gate per machine, nothing else building or testing.- One failing sample on a busy machine can be noise, "did not request required widgets" included. Rerun once on a quiet machine. Fails again: regression.## Fixing failures@@ -55,7 +62,7 @@ Locale strings count: `en.json` is part of each route's `otherAssetRawBytes`. Ne### Finding a new startup request-Build `main` in a separate worktree; compare hash-stripped `dist/assets/*.js` names with the branch build. Names only in the branch build that also appear in the route trace (`artifacts/architecture-performance/traces/<fixture>-<profile>.zip`, `trace.network` URLs) are the extra requests. `dist/.vite/chunk-sources.json` maps chunks to sources; `vite build --minify false` keeps `//#region` module markers.+Build `main` in a separate worktree; compare hash-stripped `dist/assets/*.js` names with the branch build. Names only in the branch build that also appear in the route trace (`artifacts/architecture-performance/traces/<fixture>-<profile>.zip`, `trace.network` URLs) are the extra requests. Run `pnpm test:performance:browser:profile` to collect traces for passing routes. `dist/.vite/chunk-sources.json` maps chunks to sources; `vite build --minify false` keeps `//#region` module markers.## Remediation ticketsdiff --git a/invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs b/invokeai/frontend/webv2/scripts/measure-architecture-performance.mjsindex 3e519526dd..db8c46b325 100644--- a/invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs+++ b/invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs@@ -13,7 +13,8 @@ import {createBrowserReference,isBudgetFailure,loadPerformanceReference,- createBrowserSamplePlan,+ createBrowserRunPlan,+ summarizeBrowserSamples,PERFORMANCE_GUIDE,summarizeBrowserResources,validateBrowserBaseline,@@ -32,12 +33,11 @@ const manifest = JSON.parse(await readFile(resolve(root, 'dist/.vite/manifest.jsconst chunkSourceManifest = validateChunkSourceManifest(JSON.parse(await readFile(resolve(root, 'dist/.vite/chunk-sources.json'), 'utf8')));-const sampleConfig = {+const fullSampleConfig = {scoredSamples: fixtures.scoredSamples,traceSamples: fixtures.traceSamples,warmups: fixtures.warmups,};-const samplePlan = createBrowserSamplePlan(sampleConfig);const getScriptLabel = (source, chunk) => {const widgetId = getWidgetId(source);@@ -65,33 +65,28 @@ const origin = `http://127.0.0.1:${String(port)}`;const backendPort = Number(process.env.INVOKEAI_PERFORMANCE_BACKEND_PORT ?? 4177);const backendOrigin = `http://127.0.0.1:${String(backendPort)}`;const updateBaseline = process.argv.includes('--update-baseline');+const baseline = JSON.parse(await readFile(baselinePath, 'utf8'));+if (!updateBaseline) {+ validateBrowserBaseline(baseline, fixtures);+}+if (!updateBaseline && JSON.stringify(baseline.sampling) !== JSON.stringify(fullSampleConfig)) {+ throw new Error(+ `Browser sampling configuration changed. Expected ${JSON.stringify(baseline.sampling)}, received ${JSON.stringify(fullSampleConfig)}.`+ );+}+const {+ mode,+ sampling: sampleConfig,+ samples: samplePlan,+} = createBrowserRunPlan({+ sampling: fullSampleConfig,+ timingPolicy: baseline.timingPolicy,+ profile: process.argv.includes('--profile'),+ updateBaseline,+});const referenceDir = process.env[PERFORMANCE_REFERENCE_DIR_VARIABLE] || null;const referenceLabel = process.env[PERFORMANCE_REFERENCE_LABEL_VARIABLE] || null;-const median = (values) => {- const sorted = [...values].sort((left, right) => left - right);- const middle = Math.floor(sorted.length / 2);-- if (sorted.length % 2 === 0) {- return ((sorted[middle - 1] ?? 0) + (sorted[middle] ?? 0)) / 2;- }- return sorted[middle] ?? 0;-};--const summarizeVariance = (values) => {- const mean = values.reduce((total, value) => total + value, 0) / values.length;- const variance = values.reduce((total, value) => total + (value - mean) ** 2, 0) / Math.max(1, values.length - 1);- const standardDeviation = Math.sqrt(variance);-- return {- coefficientOfVariation: mean === 0 ? 0 : standardDeviation / mean,- maximum: Math.max(...values),- mean,- minimum: Math.min(...values),- standardDeviation,- };-};-const getRequestedScriptLabels = (scripts) =>new Set([...scripts].map((request) => scriptLabelByPath.get(request) ?? request));@@ -210,8 +205,6 @@ const getScriptSourceOwners = (scripts) => {return [...owners].sort();};-const getZeroResourceSummary = () => Object.fromEntries(BROWSER_RESOURCE_METRIC_KEYS.map((key) => [key, 0]));-const createSourceOwnerSets = (routes) => {const sets = {};const setIdByFingerprint = new Map();@@ -239,11 +232,6 @@ const createSourceOwnerSets = (routes) => {return { routeSetIds, sets };};-const getMaximumResourceSummary = (samples, key) =>- Object.fromEntries(- BROWSER_RESOURCE_METRIC_KEYS.map((metric) => [metric, Math.max(...samples.map((sample) => sample[key][metric]))])- );-/** Wait for main-thread idle between switches so the next sample excludes the previous switch's work. */const settleMainThread = (page) =>page.evaluate(@@ -618,96 +606,58 @@ preview.stderr.on('data', (chunk) => {});let browser;+const captureFailureTrace = async (fixture) => {+ if (mode !== 'resources') {+ return;+ }+ try {+ await runSample(browser, fixture, { index: 0, kind: 'trace' });+ } catch (error) {+ // Diagnostics must never replace the original gate failure.+ process.stderr.write(`Diagnostic trace for ${fixture.id}/${fixture.stateProfile} failed: ${String(error)}\n`);+ }+};try {await waitForPreview();browser = await chromium.launch({ headless: true });const routeReports = [];for (const fixture of fixtures.routes) {- const scoredSamples = [];+ const observedSamples = [];let traceSample = null;- let stableProfileCounts = null;- let stableScriptSourceOwners = null;-- for (const sample of samplePlan) {- let result;- try {- result = await runSample(browser, fixture, sample);- } catch (error) {- throw new Error(- `${fixture.id}/${fixture.stateProfile} ${sample.kind} sample ${String(sample.index)} failed: ${- error instanceof Error ? error.message : String(error)- }`- );- }- if (sample.kind === 'trace') {- traceSample = result;- }- if (sample.kind !== 'scored') {- continue;- }-- stableProfileCounts ??= result.profileCounts;- stableScriptSourceOwners ??= result.scriptSourceOwners;- const stableValues = [- ['profile counts', stableProfileCounts, result.profileCounts],- ['script source owners', stableScriptSourceOwners, result.scriptSourceOwners],- ];- for (const [label, expected, received] of stableValues) {- if (JSON.stringify(expected) !== JSON.stringify(received)) {+ try {+ for (const sample of samplePlan) {+ let result;+ try {+ result = await runSample(browser, fixture, sample);+ } catch (error) {throw new Error(- `${fixture.id}/${fixture.stateProfile} ${label} were unstable between scored samples.\nExpected ${JSON.stringify(- expected- )}\nReceived ${JSON.stringify(received)}`+ `${sample.kind} sample ${String(sample.index)} failed: ${error instanceof Error ? error.message : String(error)}`);}+ if (sample.kind === 'trace') {+ traceSample = result;+ }+ if (sample.kind === 'scored' || sample.kind === 'resource') {+ observedSamples.push(result);+ }}-- scoredSamples.push({- activatedResources: result.activatedResources,- resources: result.resources,- timing: result.timing,+ routeReports.push({+ ...summarizeBrowserSamples(observedSamples, mode),+ id: fixture.id,+ owner: fixture.owner,+ readyMark: fixture.readyMark,+ remediationTicket: fixture.remediationTicket,+ stateProfile: fixture.stateProfile,+ traceSample,});+ } catch (error) {+ await captureFailureTrace(fixture);+ throw new Error(+ `${fixture.id}/${fixture.stateProfile} ${error instanceof Error ? error.message : String(error)}`+ );}-- const timingKeys = [- 'domContentLoadedMs',- 'layoutAckMs',- 'layoutReturnSwitchMs',- 'layoutSwitchMs',- 'loadMs',- 'longestTaskMs',- 'projectSwitchMs',- 'routeReadyMs',- ];- const timingValues = (key) => scoredSamples.map((sample) => sample.timing[key]);- routeReports.push({- activatedResources:- scoredSamples.length > 0- ? getMaximumResourceSummary(scoredSamples, 'activatedResources')- : getZeroResourceSummary(),- domContentLoadedMedianMs: median(timingValues('domContentLoadedMs')),- id: fixture.id,- layoutAckMedianMs: median(timingValues('layoutAckMs')),- layoutReturnSwitchMedianMs: median(timingValues('layoutReturnSwitchMs')),- layoutSwitchMedianMs: median(timingValues('layoutSwitchMs')),- loadMedianMs: median(timingValues('loadMs')),- longestTaskMaxMs: Math.max(...timingValues('longestTaskMs')),- owner: fixture.owner,- profileCounts: stableProfileCounts,- projectSwitchMedianMs: median(timingValues('projectSwitchMs')),- rawSamples: scoredSamples,- readyMark: fixture.readyMark,- remediationTicket: fixture.remediationTicket,- resources:- scoredSamples.length > 0 ? getMaximumResourceSummary(scoredSamples, 'resources') : getZeroResourceSummary(),- routeReadyMedianMs: median(timingValues('routeReadyMs')),- scriptSourceOwners: stableScriptSourceOwners ?? [],- stateProfile: fixture.stateProfile,- traceSample,- variance: Object.fromEntries(timingKeys.map((key) => [key, summarizeVariance(timingValues(key))])),- });}// Written before any check so a failing main still records what it measured for the next PR.@@ -744,6 +694,7 @@ try {uncoveredRoutes: [],}: null,+ mode,routes: routeReports,sampling: sampleConfig,schemaVersion: 2,@@ -794,7 +745,6 @@ try {await writeFile(baselinePath, `${JSON.stringify(baseline, null, 2)}\n`);await writeFile(artifactPath, `${JSON.stringify(report, null, 2)}\n`);} else {- const baseline = validateBrowserBaseline(JSON.parse(await readFile(baselinePath, 'utf8')), fixtures);const { routes: expectedRoutes, uncovered: uncoveredRoutes } = applyBrowserReference(baseline.routes, reference);if (report.reference) {report.reference.uncoveredRoutes = uncoveredRoutes;@@ -813,13 +763,6 @@ try {);}const failures = [];- if (JSON.stringify(baseline.sampling) !== JSON.stringify(sampleConfig)) {- failures.push(- `Browser sampling configuration changed. Expected ${JSON.stringify(baseline.sampling)}, received ${JSON.stringify(- sampleConfig- )}.`- );- }for (const route of routeReports) {const expected = expectedRoutes.find((candidate) => candidate.id === route.id && candidate.stateProfile === route.stateProfile@@ -833,14 +776,18 @@ try {`${route.id}/${route.stateProfile} semantic-ready mark changed from ${expected.readyMark} to ${route.readyMark}.`);}- failures.push(- ...checkBrowserRouteBudget(- route,- expected,- baseline.timingPolicy,- baseline.scriptSourceOwnerSets[expected.scriptSourceOwnerSet]- )+ const routeFailures = checkBrowserRouteBudget(+ route,+ expected,+ baseline.timingPolicy,+ baseline.scriptSourceOwnerSets[expected.scriptSourceOwnerSet]);+ failures.push(...routeFailures);+ if (routeFailures.length > 0) {+ await captureFailureTrace(+ fixtures.routes.find((fixture) => fixture.id === route.id && fixture.stateProfile === route.stateProfile)+ );+ }}for (const expected of baseline.routes) {if (!routeReports.some((route) => route.id === expected.id && route.stateProfile === expected.stateProfile)) {@@ -856,6 +803,7 @@ try {`${JSON.stringify({artifactPath,+ mode,routes: routeReports.map((route) => ({activatedResources: route.activatedResources,id: route.id,diff --git a/invokeai/frontend/webv2/scripts/performance-budgets.mjs b/invokeai/frontend/webv2/scripts/performance-budgets.mjsindex 9f620313c4..555523124e 100644--- a/invokeai/frontend/webv2/scripts/performance-budgets.mjs+++ b/invokeai/frontend/webv2/scripts/performance-budgets.mjs@@ -787,6 +787,98 @@ export const createBrowserSamplePlan = ({ scoredSamples, traceSamples, warmups }];};+// Routine checks need repeated resource observations, but only full profiles can compare timings.+export const createBrowserRunPlan = ({ sampling, timingPolicy, profile = false, updateBaseline = false }) => {+ const fullPlan = createBrowserSamplePlan(sampling);+ if (profile || updateBaseline || timingPolicy.enforce) {+ return { mode: 'profile', sampling, samples: fullPlan };+ }+ return {+ mode: 'resources',+ sampling: { resourceSamples: 2 },+ samples: [+ { index: 0, kind: 'resource' },+ { index: 1, kind: 'resource' },+ ],+ };+};++const median = (values) => {+ const sorted = [...values].sort((left, right) => left - right);+ const middle = Math.floor(sorted.length / 2);++ if (sorted.length % 2 === 0) {+ return ((sorted[middle - 1] ?? 0) + (sorted[middle] ?? 0)) / 2;+ }+ return sorted[middle] ?? 0;+};++const summarizeVariance = (values) => {+ const mean = values.reduce((total, value) => total + value, 0) / values.length;+ const variance = values.reduce((total, value) => total + (value - mean) ** 2, 0) / Math.max(1, values.length - 1);+ const standardDeviation = Math.sqrt(variance);++ return {+ coefficientOfVariation: mean === 0 ? 0 : standardDeviation / mean,+ maximum: Math.max(...values),+ mean,+ minimum: Math.min(...values),+ standardDeviation,+ };+};++export const summarizeBrowserSamples = (samples, mode) => {+ const first = samples[0];+ for (const sample of samples.slice(1)) {+ for (const key of ['profileCounts', 'scriptSourceOwners']) {+ if (JSON.stringify(first[key]) !== JSON.stringify(sample[key])) {+ throw new Error(+ `${key} were unstable between observed samples.\nExpected ${JSON.stringify(first[key])}\nReceived ${JSON.stringify(sample[key])}`+ );+ }+ }+ }+ const maximumResources = (key) =>+ Object.fromEntries(+ BROWSER_RESOURCE_METRIC_KEYS.map((metric) => [metric, Math.max(...samples.map((sample) => sample[key][metric]))])+ );+ const resources = {+ activatedResources: maximumResources('activatedResources'),+ profileCounts: first.profileCounts,+ rawSamples: samples.map(({ activatedResources, resources, timing }) => ({+ activatedResources,+ resources,+ ...(mode === 'profile' ? { timing } : {}),+ })),+ resources: maximumResources('resources'),+ scriptSourceOwners: first.scriptSourceOwners,+ };+ if (mode !== 'profile') {+ return resources;+ }+ const timingKeys = [+ 'domContentLoadedMs',+ 'layoutAckMs',+ 'layoutReturnSwitchMs',+ 'layoutSwitchMs',+ 'loadMs',+ 'longestTaskMs',+ 'projectSwitchMs',+ 'routeReadyMs',+ ];+ const values = (key) => samples.map((sample) => sample.timing[key]);+ return {+ ...resources,+ ...Object.fromEntries(+ timingKeys+ .filter((key) => key !== 'longestTaskMs')+ .map((key) => [key.replace(/Ms$/, 'MedianMs'), median(values(key))])+ ),+ longestTaskMaxMs: Math.max(...values('longestTaskMs')),+ variance: Object.fromEntries(timingKeys.map((key) => [key, summarizeVariance(values(key))])),+ };+};+export const summarizeBrowserResources = (resources) => {const uniqueResources = [...new Map(resources.map((resource) => [resource.path, resource])).values()];const sum = (kind) =>diff --git a/invokeai/frontend/webv2/scripts/performance-budgets.test.mjs b/invokeai/frontend/webv2/scripts/performance-budgets.test.mjsindex 61bfdbae83..5b4bfd6bde 100644--- a/invokeai/frontend/webv2/scripts/performance-budgets.test.mjs+++ b/invokeai/frontend/webv2/scripts/performance-budgets.test.mjs@@ -22,6 +22,8 @@ import {referenceIncompatibility,validatePerformanceReference,createBrowserSamplePlan,+ createBrowserRunPlan,+ summarizeBrowserSamples,measureRouteBuild,summarizeBrowserResources,validateArchitectureBaseline,@@ -317,6 +319,90 @@ describe('browser performance sampling and policy', () => {assert.equal(new Set(plan.map((sample) => sample.index)).size, plan.length);});+ it('uses repeated resource observations routinely and full sampling for profiles, updates, and timing enforcement', () => {+ const baseline = createBrowserBaseline();+ const routine = createBrowserRunPlan(baseline);+ assert.equal(routine.mode, 'resources');+ assert.deepEqual(+ routine.samples.map((sample) => sample.kind),+ ['resource', 'resource']+ );+ for (const options of [+ { profile: true },+ { updateBaseline: true },+ { timingPolicy: { ...baseline.timingPolicy, enforce: true } },+ ]) {+ const full = createBrowserRunPlan({ ...baseline, ...options });+ assert.equal(full.mode, 'profile');+ assert.deepEqual(full.sampling, baseline.sampling);+ assert.deepEqual(+ full.samples.map((sample) => sample.kind),+ ['warmup', 'trace', 'scored', 'scored', 'scored', 'scored', 'scored']+ );+ }+ });++ it('keeps worst observed resource costs and structural failures in both modes without reporting routine timings', () => {+ const baseline = createBrowserBaseline();+ const expected = baseline.routes[0];+ const owners = baseline.scriptSourceOwnerSets[expected.scriptSourceOwnerSet];+ const first = {+ activatedResources: { ...expected.activatedResourceBaseline, requestCount: 1 },+ profileCounts: { images: 1 },+ resources: { ...expected.resourceBaseline, scriptRawBytes: 1_000_000 },+ scriptSourceOwners: [...owners, 'source:unexpected.ts'],+ timing: {+ domContentLoadedMs: 100,+ layoutAckMs: 0,+ layoutReturnSwitchMs: 0,+ layoutSwitchMs: 0,+ loadMs: 110,+ longestTaskMs: 40,+ projectSwitchMs: 0,+ routeReadyMs: 120,+ },+ };+ const second = {+ ...first,+ activatedResources: expected.activatedResourceBaseline,+ resources: { ...expected.resourceBaseline, scriptRequestCount: 2 },+ };+ for (const mode of ['resources', 'profile']) {+ const summary = summarizeBrowserSamples([first, second], mode);+ assert.equal(summary.resources.scriptRawBytes, 1_000_000);+ assert.equal(summary.resources.scriptRequestCount, 2);+ assert.equal(summary.activatedResources.requestCount, 1);+ const reference = createBrowserReference([{ ...expected, ...summary }]);+ assert.equal(validatePerformanceReference(reference, 'browser reference'), reference);+ const restored = applyBrowserReference(baseline.routes, reference);+ assert.equal(restored.routes[0].resourceBaseline.scriptRawBytes, 1_000_000);+ assert.equal(restored.routes[0].resourceBaseline.scriptRequestCount, 2);++ const failures = checkBrowserRouteBudget({ ...expected, ...summary }, expected, baseline.timingPolicy, owners);+ for (const failure of [+ 'scriptRawBytes',+ 'scriptRequestCount',+ 'activated requestCount',+ 'source-owner set changed',+ ]) {+ assert.ok(+ failures.some((message) => message.includes(failure)),+ failures.join('\n')+ );+ }+ assert.equal('variance' in summary, mode === 'profile');+ assert.equal('routeReadyMedianMs' in summary, mode === 'profile');+ assert.equal('timing' in summary.rawSamples[0], mode === 'profile');+ if (mode === 'profile') {+ assert.equal(summary.routeReadyMedianMs, 120);+ assert.equal(summary.longestTaskMaxMs, 40);+ }+ }+ for (const changed of [{ profileCounts: { images: 2 } }, { scriptSourceOwners: owners }]) {+ assert.throws(() => summarizeBrowserSamples([first, { ...second, ...changed }], 'resources'), /unstable/);+ }+ });+it('prevents timing enforcement without a stable runner', () => {const baseline = createBrowserBaseline();baseline.timingPolicy.enforce = true;diff --git a/invokeai/frontend/webv2/scripts/run-accessibility-journeys.mjs b/invokeai/frontend/webv2/scripts/run-accessibility-journeys.mjsindex d70677d2bb..f7deb627f0 100644--- a/invokeai/frontend/webv2/scripts/run-accessibility-journeys.mjs+++ b/invokeai/frontend/webv2/scripts/run-accessibility-journeys.mjs@@ -429,6 +429,13 @@ const runKeyboardJourney = async (browser) => {const previewTrigger = centerViewTrigger(page, 'Preview');await previewTrigger.focus();+ await previewTrigger.press('ControlOrMeta+k');+ await paletteDialog.waitFor();+ await expectFocused(paletteInput, 'Opening the Workbench palette should focus its search field.');+ await paletteInput.press('Escape');+ await paletteDialog.waitFor({ state: 'hidden' });+ await expectFocused(previewTrigger, 'Closing the Workbench palette should restore the keyboard origin.');+await previewTrigger.press('Enter');// Compose keeps Preview and Gallery as its center views; Canvas lives under "Add to center".diff --git a/invokeai/frontend/webv2/src/app/workbenchPorts.test.tsx b/invokeai/frontend/webv2/src/app/workbenchPorts.test.tsxdeleted file mode 100644index dbd0d5843c..0000000000--- a/invokeai/frontend/webv2/src/app/workbenchPorts.test.tsx+++ /dev/null@@ -1,26 +0,0 @@-import { LivePreviewFollowProvider } from '@workbench/widgets/preview/livePreviewFollow';-import { describe, expect, it } from 'vitest';--import { GalleryUiAdapterProvider } from './GalleryUiAdapter';-import { GenerationUiAdapterProvider } from './GenerationUiAdapter';-import { ModelsUiAdapterProvider } from './ModelsUiAdapter';-import { QueueUiAdapterProvider } from './QueueUiAdapter';-import { UpscaleUiAdapterProvider } from './UpscaleUiAdapter';-import { VideoUiAdapterProvider } from './VideoUiAdapter';-import { workbenchUiPortProviders } from './workbenchPorts';-import { WorkflowUiAdapterProvider } from './WorkflowUiAdapter';--describe('workbench UI port composition', () => {- it('composes every feature adapter once in stable provider order', () => {- expect(workbenchUiPortProviders).toEqual([- LivePreviewFollowProvider,- ModelsUiAdapterProvider,- QueueUiAdapterProvider,- GalleryUiAdapterProvider,- GenerationUiAdapterProvider,- UpscaleUiAdapterProvider,- VideoUiAdapterProvider,- WorkflowUiAdapterProvider,- ]);- });-});diff --git a/invokeai/frontend/webv2/src/architecture/architectureWorkflow.test.ts b/invokeai/frontend/webv2/src/architecture/architectureWorkflow.test.tsindex 131c9a0b4c..dece4f4a4c 100644--- a/invokeai/frontend/webv2/src/architecture/architectureWorkflow.test.ts+++ b/invokeai/frontend/webv2/src/architecture/architectureWorkflow.test.ts@@ -38,10 +38,66 @@ describe('architecture workflow', () => {const completion = jobs['frontend-webv2-tests'].steps.find((step: { run?: string }) =>step.run?.startsWith('pnpm check:'));- expect(completion.run).toBe('pnpm check:release');+ expect(completion.run).toBe('pnpm check:release:tests');expect(completion.env.WEBV2_PERF_REFERENCE_DIR).toContain('steps.perf-ref.outputs.cache-matched-key');});+ it('runs each completion gate once locally and across the frontend CI jobs', () => {+ const sources = import.meta.glob(+ ['../../package.json', '../../../../../.github/workflows/{frontend-checks,frontend-tests}.yml'],+ { eager: true, import: 'default', query: '?raw' }+ ) as Record<string, string>;+ const scripts = JSON.parse(sources['../../package.json']!).scripts as Record<string, string>;+ const expand = (command: string): string[] =>+ command.split(' && ').flatMap((part) => {+ const script = /^pnpm (?:run )?([\w:-]+)$/.exec(part)?.[1];+ return script ? expand(scripts[script]!) : [part];+ });+ const workflows = Object.entries(sources).filter(([path]) => path.endsWith('.yml'));+ const ci = workflows.flatMap(([, source]) => {+ const jobs = parse(source).jobs as Record<string, { steps: { run?: string }[] }>;+ return Object.values(jobs).flatMap((job) => job.steps.flatMap((step) => (step.run ? expand(step.run) : [])));+ });+ const gates = [+ /^oxfmt --check /,+ /^oxlint /,+ /^tsc --noEmit$/,+ /^vitest run --config vitest.config.mts$/,+ /^vitest run --config vitest.browser.config.mts$/,+ /^node --test scripts\/mock-backend-fixtures.test.mjs/,+ /^node --test scripts\/performance-budgets.test.mjs$/,+ /^vite build$/,+ /scripts\/write-workbench-ownership-inventory.mjs$/,+ /scripts\/write-contract-caller-matrix.mjs$/,+ /scripts\/write-canvas-import-matrix.mjs$/,+ /scripts\/check-architecture-performance.mjs$/,+ /scripts\/measure-architecture-performance.mjs$/,+ /scripts\/run-project-file-journey.mjs$/,+ /scripts\/run-accessibility-journeys.mjs$/,+ ];+ for (const [name, commands] of [+ ['local release', expand('pnpm check:release')],+ ['CI', ci],+ ] as const) {+ for (const gate of gates) {+ expect(+ commands.filter((command) => gate.test(command)),+ `${name}: ${String(gate)}`+ ).toHaveLength(1);+ }+ // Architecture tests are part of the complete unit run, not a second targeted invocation.+ expect(commands.filter((command) => command.startsWith('vitest run --config vitest.config.mts'))).toHaveLength(1);+ }+ for (const [path, source] of workflows) {+ const job = Object.values(parse(source).jobs)[0] as { steps: { with?: { files_yaml?: string } }[] };+ const filter = job.steps.find((step) => step.with?.files_yaml)?.with?.files_yaml ?? '';+ const patterns = Object.values(parse(filter) as Record<string, string[]>).flat();+ for (const [workflowPath] of workflows) {+ expect(patterns, path).toContain(workflowPath.replace('../../../../../', ''));+ }+ }+ });+it('installs dependencies in the package that owns each frontend and generation gate', () => {const sources = import.meta.glob([diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerPopover.browser.test.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerPopover.browser.test.tsxindex 4fdc7acc0b..41a2069726 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerPopover.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerPopover.browser.test.tsx@@ -162,15 +162,13 @@ const MultiAddHost = ({ initialSelection }: { initialSelection: GalleryPickerSelconst OPEN_DIALOG = '[role="dialog"][data-state="open"]';-const settle = async () => {- for (let round = 0; round < 6; round += 1) {- await act(async () => {- await new Promise((resolve) => {- requestAnimationFrame(() => setTimeout(resolve, 0));- });+/** Let ResizeObserver and virtualizer layout work finish before checking that a scroll position stayed put. */+const finishLayout = () =>+ act(async () => {+ await new Promise((resolve) => {+ requestAnimationFrame(() => setTimeout(resolve, 0));});- }-};+ });/** A host without a workbench (the Launchpad): no Gallery widget scope to seed from or reveal. */const launchpadHost: GalleryHost = { galleryValues: {}, notifications, projectName: '' };@@ -208,17 +206,19 @@ const openPicker = async (picker?: React.ReactElement, options?: { withoutWorkbeconst trigger = await renderPicker(picker, options);await act(() => trigger.click());- await settle();-- const dialog = document.querySelector<HTMLElement>(OPEN_DIALOG);-- if (!dialog) {- throw new Error('picker did not open');- }- // The view is lazy-loaded on first open.- await vi.waitFor(() => expect(dialog.querySelector('input:not([type="file"])')).not.toBeNull(), { timeout: 10_000 });- await settle();+ // The view is lazy-loaded on first open; wait for its actual ready/error UI and measured grid.+ const dialog = await vi.waitFor(+ () => {+ const opened = document.querySelector<HTMLElement>(OPEN_DIALOG);+ expect(opened).not.toBeNull();+ expect(opened!.querySelector('input:not([type="file"])')).not.toBeNull();+ expect(opened!.querySelector('[aria-busy="true"]')).toBeNull();+ expect(opened!.querySelector('[role="option"][data-item-key], [role="alert"]')).not.toBeNull();+ return opened!;+ },+ { timeout: 10_000 }+ );return { dialog, trigger };};@@ -261,7 +261,6 @@ const getColumnCount = (dialog: HTMLElement) => {const pressKey = async (target: HTMLElement, key: string) => {await act(() => target.dispatchEvent(new KeyboardEvent('keydown', { bubbles: true, key })));- await settle();};const typeSearch = async (input: HTMLInputElement, value: string) => {@@ -271,7 +270,6 @@ const typeSearch = async (input: HTMLInputElement, value: string) => {setter?.call(input, value);input.dispatchEvent(new Event('input', { bubbles: true }));});- await settle();};beforeEach(() => {@@ -309,10 +307,10 @@ describe('GalleryPickerPopover', () => {await vi.waitFor(() => expect(document.activeElement).toBe(input));expect(dialog.getAttribute('aria-label')).toBe('Choose image');- expect(getOptions(dialog)).toHaveLength(6);- expect(getActiveOption(dialog)).toBe(getOption(dialog, 'image:b.png'));+ await vi.waitFor(() => expect(getOptions(dialog)).toHaveLength(6));+ await vi.waitFor(() => expect(getActiveOption(dialog)).toBe(getOption(dialog, 'image:b.png')));expect(getOption(dialog, 'image:b.png').getAttribute('aria-selected')).toBe('true');- expect(getStatus(dialog)).toBe('widgets.gallery.picker.itemCount');+ await vi.waitFor(() => expect(getStatus(dialog)).toBe('widgets.gallery.picker.itemCount'));const activeTab = dialog.querySelector<HTMLElement>('[role="tab"][aria-selected="true"]');@@ -335,16 +333,16 @@ describe('GalleryPickerPopover', () => {expect(columns).toBeGreaterThanOrEqual(3);await pressKey(input, 'ArrowLeft');- expect(getActiveOption(dialog)).toBe(getOption(dialog, 'image:a.png'));+ await vi.waitFor(() => expect(getActiveOption(dialog)).toBe(getOption(dialog, 'image:a.png')));await pressKey(input, 'ArrowDown');- expect(getActiveOption(dialog)?.dataset.itemKey).toBe(`image:${ORDER[columns]}`);+ await vi.waitFor(() => expect(getActiveOption(dialog)?.dataset.itemKey).toBe(`image:${ORDER[columns]}`));await pressKey(input, 'ArrowUp');await pressKey(input, 'ArrowRight');await pressKey(input, 'ArrowRight');- expect(getActiveOption(dialog)).toBe(getOption(dialog, 'video:c.mp4'));- expect(getStatus(dialog)).toBe('widgets.gallery.picker.unsupportedVideo');+ await vi.waitFor(() => expect(getActiveOption(dialog)).toBe(getOption(dialog, 'video:c.mp4')));+ await vi.waitFor(() => expect(getStatus(dialog)).toBe('widgets.gallery.picker.unsupportedVideo'));await pressKey(input, 'Enter');expect(onPick).not.toHaveBeenCalled();@@ -357,16 +355,15 @@ describe('GalleryPickerPopover', () => {it('keeps the highlight on its item when an insert shifts the listing', async () => {const { dialog } = await openPicker();- expect(getActiveOption(dialog)).toBe(getOption(dialog, 'image:b.png'));+ await vi.waitFor(() => expect(getActiveOption(dialog)).toBe(getOption(dialog, 'image:b.png')));// Another client adds a newer image, so the refetched listing moves every item one slot along.dogItems.unshift(image('new.png'));try {await act(() => queryClient!.invalidateQueries());await vi.waitFor(() => expect(getOption(dialog, 'image:new.png')).toBeDefined());- await settle();- expect(getActiveOption(dialog)).toBe(getOption(dialog, 'image:b.png'));+ await vi.waitFor(() => expect(getActiveOption(dialog)).toBe(getOption(dialog, 'image:b.png')));await pressKey(getSearchInput(dialog), 'Enter');expect(onPick).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({ name: 'b.png' }));@@ -429,9 +426,8 @@ describe('GalleryPickerPopover', () => {inserted = 1;await act(() => queryClient!.invalidateQueries());await vi.waitFor(() => expect(dialog.querySelector('[role="option"][aria-setsize="2391"]')).not.toBeNull());- await settle();- expect(getActiveOption(dialog)?.dataset.itemKey).toBe('image:adopted-2389.png');+ await vi.waitFor(() => expect(getActiveOption(dialog)?.dataset.itemKey).toBe('image:adopted-2389.png'));await pressKey(input, 'Enter');expect(onPick).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({ name: 'adopted-2389.png' }));});@@ -456,7 +452,9 @@ describe('GalleryPickerPopover', () => {// Walk up into the first page: the row just left behind, on the second page, stays in view.while (activeIndex() >= 60) {+ const nextIndex = activeIndex() - columns;await pressKey(input, 'ArrowUp');+ await vi.waitFor(() => expect(activeIndex()).toBe(nextIndex));}const belowIndex = activeIndex() + columns;@@ -469,6 +467,8 @@ describe('GalleryPickerPopover', () => {});observer.observe(dialog, { attributes: true, childList: true, subtree: true });await pressKey(input, 'ArrowLeft');+ await finishLayout();+ await vi.waitFor(() => expect(dialog.querySelector('[role="listbox"]')?.getAttribute('aria-busy')).toBeNull());observer.disconnect();expect(activeIndex()).toBe(belowIndex - columns - 1);@@ -510,8 +510,8 @@ describe('GalleryPickerPopover', () => {expect(scrolledTop).toBeGreaterThan(0);await vi.waitFor(() => expect(dialog.querySelector('[role="option"][aria-setsize="601"]')).not.toBeNull());- await settle();+ await finishLayout();expect(viewport!.scrollTop).toBe(scrolledTop);});@@ -530,7 +530,7 @@ describe('GalleryPickerPopover', () => {const { dialog } = await openPicker();- expect(getActiveOption(dialog)?.dataset.itemKey).toBe('image:shifted-0.png');+ await vi.waitFor(() => expect(getActiveOption(dialog)?.dataset.itemKey).toBe('image:shifted-0.png'));let viewport: HTMLElement | null = getActiveOption(dialog)!.parentElement;while (viewport && viewport.scrollHeight <= viewport.clientHeight) {@@ -542,17 +542,17 @@ describe('GalleryPickerPopover', () => {viewport!.scrollTop = getActiveOption(dialog)!.getBoundingClientRect().height * 4;viewport!.dispatchEvent(new Event('scroll'));});- await settle();+ await finishLayout();const scrolledTop = viewport!.scrollTop;expect(scrolledTop).toBeGreaterThan(0);inserted = 1;await act(() => queryClient!.invalidateQueries());await vi.waitFor(() => expect(dialog.querySelector('[role="option"][aria-setsize="601"]')).not.toBeNull());- await settle();// The highlight moved one slot along with its item, which stays scrolled out of view.expect(getSearchInput(dialog).getAttribute('aria-activedescendant')).toMatch(/-slot-1$/);+ await finishLayout();expect(viewport!.scrollTop).toBe(scrolledTop);});@@ -579,22 +579,19 @@ describe('GalleryPickerPopover', () => {inserted = 1;await act(() => queryClient!.invalidateQueries());await vi.waitFor(() => expect(dialog.querySelector('[role="option"][aria-setsize="601"]')).not.toBeNull());- await settle();- expect(getActiveOption(dialog)?.dataset.itemKey).toBe('image:moved-0.png');+ await vi.waitFor(() => expect(getActiveOption(dialog)?.dataset.itemKey).toBe('image:moved-0.png'));// Scroll the highlight out of view, then step back onto slot 0, where it was placed before the insert.await act(() => {viewport!.scrollTop = getActiveOption(dialog)!.getBoundingClientRect().height * 4;viewport!.dispatchEvent(new Event('scroll'));});- await settle();expect(viewport!.scrollTop).toBeGreaterThan(0);await pressKey(getSearchInput(dialog), 'ArrowLeft');- await settle();- expect(getActiveOption(dialog)?.dataset.itemKey).toBe('image:moved-new.png');- expect(viewport!.scrollTop).toBe(0);+ await vi.waitFor(() => expect(getActiveOption(dialog)?.dataset.itemKey).toBe('image:moved-new.png'));+ await vi.waitFor(() => expect(viewport!.scrollTop).toBe(0));});it('keeps the highlight in view when the column count changes', async () => {@@ -620,18 +617,18 @@ describe('GalleryPickerPopover', () => {await vi.waitFor(() =>expect(getComputedStyle(getActiveOption(dialog)!.parentElement!).gridTemplateColumns).not.toBe(columnsBefore));- await settle();- const option = getActiveOption(dialog)!.getBoundingClientRect();let viewport: HTMLElement | null = getActiveOption(dialog)!.parentElement;while (viewport && viewport.scrollHeight <= viewport.clientHeight) {viewport = viewport.parentElement;}- const bounds = viewport!.getBoundingClientRect();-- expect(option.top).toBeGreaterThanOrEqual(bounds.top - 1);- expect(option.bottom).toBeLessThanOrEqual(bounds.bottom + 1);+ await vi.waitFor(() => {+ const option = getActiveOption(dialog)!.getBoundingClientRect();+ const bounds = viewport!.getBoundingClientRect();+ expect(option.top).toBeGreaterThanOrEqual(bounds.top - 1);+ expect(option.bottom).toBeLessThanOrEqual(bounds.bottom + 1);+ });});it('shows and retries a failed uncached page within the current listing', async () => {@@ -685,7 +682,6 @@ describe('GalleryPickerPopover', () => {await act(() =>getSearchInput(dialog).dispatchEvent(new KeyboardEvent('keydown', { bubbles: true, key: 'Escape' })));- await settle();expect(document.querySelector(OPEN_DIALOG)).toBeNull();expect(onPick).not.toHaveBeenCalled();@@ -711,16 +707,18 @@ describe('GalleryPickerPopover', () => {await typeSearch(getSearchInput(dialog), 'cat');expect(mocks.listItems).toHaveBeenCalledWith(expect.objectContaining({ boardId: 'dogs', searchTerm: 'cat' }));- expect(getOptions(dialog).map((option) => option.dataset.itemKey)).toEqual(['image:cat.png']);- expect(getActiveOption(dialog)).toBe(getOption(dialog, 'image:cat.png'));- expect(getStatus(dialog)).toBe('widgets.gallery.picker.matchCount');+ await vi.waitFor(() =>+ expect(getOptions(dialog).map((option) => option.dataset.itemKey)).toEqual(['image:cat.png'])+ );+ await vi.waitFor(() => expect(getActiveOption(dialog)).toBe(getOption(dialog, 'image:cat.png')));+ await vi.waitFor(() => expect(getStatus(dialog)).toBe('widgets.gallery.picker.matchCount'));// With text in the field, Left/Right belong to the caret.const leftKey = new KeyboardEvent('keydown', { bubbles: true, cancelable: true, key: 'ArrowLeft' });await act(() => getSearchInput(dialog).dispatchEvent(leftKey));expect(leftKey.defaultPrevented).toBe(false);- expect(getActiveOption(dialog)).toBe(getOption(dialog, 'image:cat.png'));+ await vi.waitFor(() => expect(getActiveOption(dialog)).toBe(getOption(dialog, 'image:cat.png')));});it('does not let Enter pick stale slots while a different board page is loading', async () => {@@ -747,7 +745,6 @@ describe('GalleryPickerPopover', () => {const input = getSearchInput(dialog);await act(() => dialog.querySelector<HTMLButtonElement>('[aria-expanded]')?.click());- await settle();await act(() => getBoardRow(dialog, 'Cats')?.click());await vi.waitFor(() => expect(mocks.listItems).toHaveBeenCalledWith(expect.objectContaining({ boardId: 'cats' })));@@ -757,7 +754,6 @@ describe('GalleryPickerPopover', () => {expect(getOptions(dialog).some((option) => option.dataset.itemKey === 'image:b.png')).toBe(true);await act(() => resolveCats?.({ items: [image('cat.png', 'cats')], itemIndices: [0], offset: 0, total: 1 }));- await settle();await vi.waitFor(() => expect(getOption(dialog, 'image:cat.png')).toBeDefined());});@@ -770,7 +766,6 @@ describe('GalleryPickerPopover', () => {expect(assetsTab?.textContent).not.toContain('common.assets');await act(() => assetsTab?.click());- await settle();expect(mocks.listItems).toHaveBeenCalledWith(expect.objectContaining({ boardId: 'dogs', galleryView: 'assets' }));});@@ -787,7 +782,9 @@ describe('GalleryPickerPopover', () => {expect(getOption(dialog, 'image:a.png').getAttribute('aria-disabled')).toBe('true');expect(getOption(dialog, 'image:a.png').getAttribute('aria-selected')).toBe('true');expect(getOption(dialog, 'image:b.png').getAttribute('aria-selected')).toBe('false');- expect(getStatus(dialog)).toBe('widgets.gallery.picker.remainingCount · widgets.gallery.picker.itemCount');+ await vi.waitFor(() =>+ expect(getStatus(dialog)).toBe('widgets.gallery.picker.remainingCount · widgets.gallery.picker.itemCount')+ );expect(dialog.textContent).toContain('common.done');await act(() => getOption(dialog, 'image:a.png').click());@@ -813,12 +810,11 @@ describe('GalleryPickerPopover', () => {await typeSearch(input, 'cat');await act(() => boardButton?.click());- await settle();expect(boardButton?.getAttribute('aria-expanded')).toBe('true');- expect(getOptions(dialog)).toHaveLength(0);+ await vi.waitFor(() => expect(getOptions(dialog)).toHaveLength(0));expect(input.value).toBe('');- expect(getStatus(dialog)).toBe('widgets.gallery.picker.boardCount');+ await vi.waitFor(() => expect(getStatus(dialog)).toBe('widgets.gallery.picker.boardCount'));expect(getBoardRow(dialog, 'Dogs')?.getAttribute('aria-current')).toBe('true');expect(getBoardRow(dialog, 'Cats')).toBeDefined();@@ -830,16 +826,17 @@ describe('GalleryPickerPopover', () => {await pressKey(input, 'ArrowDown');const firstRow = getBoardsRegion(dialog)?.querySelector('button');- expect(document.activeElement).toBe(firstRow);+ await vi.waitFor(() => expect(document.activeElement).toBe(firstRow));await pressKey(firstRow as HTMLElement, 'ArrowUp');- expect(document.activeElement).toBe(input);+ await vi.waitFor(() => expect(document.activeElement).toBe(input));await act(() => getBoardRow(dialog, 'widgets.gallery.uncategorized')?.click());- await settle();expect(boardButton?.getAttribute('aria-expanded')).toBe('false');expect(mocks.listItems).toHaveBeenCalledWith(expect.objectContaining({ boardId: 'none' }));- expect(getOptions(dialog).map((option) => option.dataset.itemKey)).toEqual(['image:loose.png']);+ await vi.waitFor(() =>+ expect(getOptions(dialog).map((option) => option.dataset.itemKey)).toEqual(['image:loose.png'])+ );expect(galleryCommands.selectBoard).not.toHaveBeenCalled();});@@ -887,7 +884,6 @@ describe('GalleryPickerPopover', () => {value: [new File(['image'], 'fresh.png', { type: 'image/png' })],});await act(() => fileInput?.dispatchEvent(new Event('change', { bubbles: true })));- await settle();expect(mocks.uploadGalleryImage).toHaveBeenCalledWith(expect.any(File), 'dogs', expect.anything());expect(onPick).toHaveBeenCalledExactlyOnceWith(legacyGeneratedImageToGalleryItem(uploaded));@@ -907,8 +903,8 @@ describe('GalleryPickerPopover', () => {value: [new File(['video'], 'clip.mp4', { type: 'video/mp4' })],});await act(() => fileInput?.dispatchEvent(new Event('change', { bubbles: true })));- await settle();+ await vi.waitFor(() => expect(dialog.querySelector('[aria-busy="true"]')).toBeNull());expect(mocks.uploadGalleryVideo).toHaveBeenCalledOnce();expect(onPick).not.toHaveBeenCalled();expect(document.querySelector(OPEN_DIALOG)).not.toBeNull();@@ -918,9 +914,7 @@ describe('GalleryPickerPopover', () => {const { dialog } = await openPicker();await act(() => dialog.querySelector<HTMLButtonElement>('[aria-expanded]')?.click());- await settle();await act(() => getBoardRow(dialog, 'widgets.gallery.uncategorized')?.click());- await settle();const openButton = [...dialog.querySelectorAll<HTMLButtonElement>('button')].find((button) =>button.textContent?.includes('widgets.gallery.picker.openGallery')@@ -977,7 +971,7 @@ describe('GalleryPickerPopover', () => {expect(dialog.querySelector('[role="listbox"]')).toBeNull();expect(input.getAttribute('aria-controls')).toBeNull();// A count of a list that never loaded would read as an empty board.- expect(getStatus(dialog)).toBe('');+ await vi.waitFor(() => expect(getStatus(dialog)).toBe(''));await pressKey(input, 'Enter');expect(onPick).not.toHaveBeenCalled();@@ -986,26 +980,25 @@ describe('GalleryPickerPopover', () => {retry?.focus();await act(() => retry?.click());- await settle();+ await vi.waitFor(() => expect(getOptions(dialog)).toHaveLength(6));expect(dialog.querySelector('[role="alert"]')).toBeNull();- expect(getOptions(dialog)).toHaveLength(6);// The Retry that held focus is gone; the search field, which drives the grid, takes it back.- expect(document.activeElement).toBe(input);+ await vi.waitFor(() => expect(document.activeElement).toBe(input));});it('shows a failed search as that search failing, not the previous results, and recovers with Retry', async () => {const { dialog } = await openPicker();const input = getSearchInput(dialog);- expect(getOptions(dialog)).toHaveLength(6);+ await vi.waitFor(() => expect(getOptions(dialog)).toHaveLength(6));mocks.listItems.mockImplementationOnce(() => {throw new Error('Service Unavailable');});await typeSearch(input, 'cat');await vi.waitFor(() => expect(dialog.querySelector('[role="alert"]')).not.toBeNull());- expect(getOptions(dialog)).toEqual([]);+ await vi.waitFor(() => expect(getOptions(dialog)).toEqual([]));expect(dialog.querySelector('[aria-busy="true"][role="listbox"]')).toBeNull();await pressKey(input, 'Enter');@@ -1014,9 +1007,10 @@ describe('GalleryPickerPopover', () => {await act(() =>dialog.querySelector<HTMLButtonElement>('button[aria-label="widgets.gallery.retryLoadingItems"]')?.click());- await settle();- expect(getOptions(dialog).map((option) => option.dataset.itemKey)).toEqual(['image:cat.png']);+ await vi.waitFor(() =>+ expect(getOptions(dialog).map((option) => option.dataset.itemKey)).toEqual(['image:cat.png'])+ );expect(mocks.listItems).toHaveBeenLastCalledWith(expect.objectContaining({ searchTerm: 'cat' }));});@@ -1036,18 +1030,19 @@ describe('GalleryPickerPopover', () => {const listbox = dialog.querySelector<HTMLElement>('[role="listbox"]');expect(listbox?.getAttribute('aria-busy')).toBe('true');- expect(getOptions(dialog)).toHaveLength(6);+ await vi.waitFor(() => expect(getOptions(dialog)).toHaveLength(6));expect(input.getAttribute('aria-activedescendant')).toBeNull();await act(() => getOption(dialog, 'image:a.png').click());await pressKey(input, 'Enter');expect(onPick).not.toHaveBeenCalled();- expect(getStatus(dialog)).not.toBe('widgets.gallery.picker.matchCount');+ await vi.waitFor(() => expect(getStatus(dialog)).not.toBe('widgets.gallery.picker.matchCount'));await act(() => deliver());- await settle();- expect(dialog.querySelector('[role="listbox"]')?.getAttribute('aria-busy')).toBeNull();- expect(getOptions(dialog).map((option) => option.dataset.itemKey)).toEqual(['image:cat.png']);+ await vi.waitFor(() => expect(dialog.querySelector('[role="listbox"]')?.getAttribute('aria-busy')).toBeNull());+ await vi.waitFor(() =>+ expect(getOptions(dialog).map((option) => option.dataset.itemKey)).toEqual(['image:cat.png'])+ );// A search that failed keeps showing its failure while it is retried; the placeholder does not return.mocks.listItems.mockImplementationOnce(() => {@@ -1060,16 +1055,16 @@ describe('GalleryPickerPopover', () => {await act(() =>dialog.querySelector<HTMLButtonElement>('button[aria-label="widgets.gallery.retryLoadingItems"]')?.click());- await settle();expect(dialog.querySelector('[role="alert"]')?.getAttribute('aria-busy')).toBe('true');expect(dialog.querySelector('[role="listbox"]')).toBeNull();- expect(getOptions(dialog)).toEqual([]);+ await vi.waitFor(() => expect(getOptions(dialog)).toEqual([]));await act(() => deliver());- await settle();+ await vi.waitFor(() =>+ expect(getOptions(dialog).map((option) => option.dataset.itemKey)).toEqual(['image:cat.png'])+ );expect(dialog.querySelector('[role="alert"]')).toBeNull();- expect(getOptions(dialog).map((option) => option.dataset.itemKey)).toEqual(['image:cat.png']);});});diff --git a/invokeai/frontend/webv2/src/features/queue/runtime.test.ts b/invokeai/frontend/webv2/src/features/queue/runtime.test.tsindex 6dc5b9ed38..076a8aac69 100644--- a/invokeai/frontend/webv2/src/features/queue/runtime.test.ts+++ b/invokeai/frontend/webv2/src/features/queue/runtime.test.ts@@ -3615,19 +3615,30 @@ describe('queue runtime retries', () => {claimItemDelivery.mockRejectedValueOnce(new Error('Failed to fetch'));const tab = openCanvasTab(server);- tab.runtime.start();- emitReruns(tab, [99]);- tab.emit(- 'queue_item_status_changed',- completedEvent(99, buildQueueItemOrigin('run-gone', tab.project.id), 'canvas')- );-- await vi.waitFor(() => expect(claimItemDelivery).toHaveBeenCalledTimes(2), { timeout: 6_000 });- await settleEvents();- expect(stagedItemIds(tab)).toEqual([]);+ // Advance delivery/refresh timeouts without running recurring sweep and renewal intervals.+ vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout', 'Date'] });+ try {+ tab.runtime.start();+ emitReruns(tab, [99]);+ tab.emit(+ 'queue_item_status_changed',+ completedEvent(99, buildQueueItemOrigin('run-gone', tab.project.id), 'canvas')+ );- await tab.runtime.dispose();- }, 10_000);+ await vi.advanceTimersByTimeAsync(0);+ expect(claimItemDelivery).toHaveBeenCalledTimes(1);+ expect(stagedItemIds(tab)).toEqual([]);+ await vi.runOnlyPendingTimersAsync();+ expect(claimItemDelivery).toHaveBeenCalledTimes(2);+ expect(stagedItemIds(tab)).toEqual([]);+ } finally {+ try {+ await tab.runtime.dispose();+ } finally {+ vi.useRealTimers();+ }+ }+ });it('stages a Canvas rerun that finishes while this tab is still freeing the run lock it gave up', async () => {const queueItem: QueueItem = { ...createPendingQueueItem(), backendItemIds: [88], status: 'running' };@@ -3747,33 +3758,42 @@ describe('queue runtime retries', () => {const other = openCanvasTab(server);const completed = completedEvent(99, buildQueueItemOrigin(adopting.run.id, other.project.id), 'canvas');- for (const tab of [adopting, other]) {- tab.runtime.start();- tab.emit('queue_items_retried', retriedEvent([{ item_id: 99, source_item_id: 41 }]));+ // Advance delivery/refresh timeouts without running recurring sweep and renewal intervals.+ vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout', 'Date'] });+ try {+ for (const tab of [adopting, other]) {+ tab.runtime.start();+ tab.emit('queue_items_retried', retriedEvent([{ item_id: 99, source_item_id: 41 }]));+ }+ // The run claims its rerun as soon as its tab holds it, long before the rerun finishes.+ await vi.advanceTimersByTimeAsync(0);+ expect(server.claims.get(99)?.claimant).toMatch(/^run:/);+ other.emit('queue_item_status_changed', completed);+ await vi.advanceTimersByTimeAsync(0);+ expect(server.claimItemDelivery).toHaveBeenCalledWith(99, 'claim', expect.stringMatching(/^tab:/));+ expect(+ vi.mocked(server.claimItemDelivery).mock.calls.filter(([, , claimant]) => claimant.startsWith('tab:'))+ ).toHaveLength(1);+ expect(stagedItemIds(other)).toEqual([]);+ adopting.emit('queue_item_status_changed', completed);++ await vi.advanceTimersByTimeAsync(0);+ expect(stagedImageNames(adopting)).toContain('rerun-99.png');+ expect(server.claims.get(99)?.isDelivered).toBe(true);+ // Only now let the other browser's pending retry observe the run's confirmation.+ await vi.runOnlyPendingTimersAsync();+ expect(+ vi.mocked(server.claimItemDelivery).mock.calls.filter(([, , claimant]) => claimant.startsWith('tab:'))+ ).toHaveLength(2);+ expect(stagedItemIds(other)).toEqual([]);+ } finally {+ try {+ await Promise.all([adopting.runtime.dispose(), other.runtime.dispose()]);+ } finally {+ vi.useRealTimers();+ }}- // The run claims its rerun as soon as its tab holds it, long before the rerun finishes.- await vi.waitFor(() => expect(server.claims.get(99)?.claimant).toMatch(/^run:/));- other.emit('queue_item_status_changed', completed);- await vi.waitFor(() =>- expect(server.claimItemDelivery).toHaveBeenCalledWith(99, 'claim', expect.stringMatching(/^tab:/))- );- adopting.emit('queue_item_status_changed', completed);-- await vi.waitFor(() => expect(stagedImageNames(adopting)).toContain('rerun-99.png'));- expect(server.claims.get(99)?.isDelivered).toBe(true);- await vi.waitFor(- () =>- expect(- vi.mocked(server.claimItemDelivery).mock.calls.filter(([, , claimant]) => claimant.startsWith('tab:'))- ).toHaveLength(2),- { timeout: 6_000 }- );- await settleEvents();- expect(stagedItemIds(other)).toEqual([]);-- await adopting.runtime.dispose();- await other.runtime.dispose();- }, 10_000);+ });it('keeps the claim of a rerun its run is still waiting on', async () => {vi.useFakeTimers({ toFake: ['setInterval'] });diff --git a/invokeai/frontend/webv2/src/platform/react/composeProviders.test.tsx b/invokeai/frontend/webv2/src/platform/react/composeProviders.test.tsxindex f734df0402..182039e089 100644--- a/invokeai/frontend/webv2/src/platform/react/composeProviders.test.tsx+++ b/invokeai/frontend/webv2/src/platform/react/composeProviders.test.tsx@@ -45,20 +45,4 @@ describe('composeProviders', () => {expect(markup).toBe('plain children');});-- it('returns one stable component identity per call, so a module-scope composition is render-stable', () => {- const Composed = composeProviders([FirstProvider, SecondProvider, ThirdProvider]);-- // The single composed reference renders identically every time it is used.- const renderOnce = () =>- renderToStaticMarkup(- <Composed>- <Probe />- </Composed>- );- expect(renderOnce()).toBe(renderOnce());-- // Render-time composition creates a new type and remounts the subtree.- expect(composeProviders([FirstProvider, SecondProvider, ThirdProvider])).not.toBe(Composed);- });});diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/ToastContrast.browser.test.tsx b/invokeai/frontend/webv2/src/platform/ui/theme/ToastContrast.browser.test.tsxindex 2b3adc1ead..ab3096eea4 100644--- a/invokeai/frontend/webv2/src/platform/ui/theme/ToastContrast.browser.test.tsx+++ b/invokeai/frontend/webv2/src/platform/ui/theme/ToastContrast.browser.test.tsx@@ -76,12 +76,9 @@ describe('toast contrast', () => {return `rgb(${mixed.join(' ')})`;};- it.each(- THEMES.flatMap((theme) => (['error', 'info', 'success', 'warning'] as const).map((type) => [theme.id, type]))- )(- 'keeps %s %s toast buttons readable at rest, hovered and focused, with fills from the toast itself',- async (themeId, type) => {- applyThemeToRoot(themeId);+ it.each(['error', 'info', 'success', 'warning'] as const)(+ 'keeps %s toast buttons readable at rest, hovered and focused in every theme',+ async (type) => {host = document.createElement('div');document.body.append(host);root = createRoot(host);@@ -91,14 +88,11 @@ describe('toast contrast', () => {<AppToaster /></ChakraProvider>);- });- await act(() => {createActionToast({actions: [{ label: 'Retry', onClick: () => {} },{ label: 'Show in Gallery', onClick: () => {} },],- // Success toasts expire after 2s; a loaded machine can take longer to hover every button.duration: Infinity,title: 'Saved',type,@@ -108,39 +102,60 @@ describe('toast contrast', () => {.poll(() => document.querySelectorAll('[data-part="root"][data-scope="toast"] button').length).toBe(3);const toastRoot = document.querySelector<HTMLElement>('[data-part="root"][data-scope="toast"]')!;- const surface = getComputedStyle(toastRoot).backgroundColor;- // The toast's own trigger fill, resolved the way the buttons resolve it.- const probe = document.createElement('span');- probe.style.background = 'var(--toast-trigger-bg)';- toastRoot.append(probe);- const triggerFill = getComputedStyle(probe).backgroundColor;- probe.remove();const buttons = [...toastRoot.querySelectorAll<HTMLButtonElement>('button')].filter((button) => button.textContent);+ // Compare settled palettes, independently of theme and pointer transition durations.+ for (const element of [toastRoot, ...buttons]) {+ element.style.transition = 'none';+ }+ // Resolve each theme's trigger token in the toast's status scope.+ const probe = document.createElement('span');+ probe.style.background = 'var(--toast-trigger-bg)';+ toastRoot.append(probe);- for (const button of buttons) {- const label = button.textContent;- const text = getComputedStyle(button).color;-- expect(getContrastRatio(text, surface, 1), `${label} at rest`).toBeGreaterThanOrEqual(4.5);+ for (const theme of THEMES) {+ applyThemeToRoot(theme.id);+ const surface = getComputedStyle(toastRoot).backgroundColor;+ for (const button of buttons) {+ expect(+ getContrastRatio(getComputedStyle(button).color, surface, 1),+ `${theme.id} ${button.textContent} at rest`+ ).toBeGreaterThanOrEqual(4.5);+ }+ }+ // Hold each real CSS state while changing themes, rather than repeating pointer setup for every palette.+ for (const button of buttons) {await userEvent.hover(button);- await expect- .poll(() => getComputedStyle(button).backgroundColor, { message: `${label} hover fill` })- .toBe(triggerFill);- expect(getContrastRatio(text, flatten(triggerFill, surface), 1), `${label} hovered`).toBeGreaterThanOrEqual(- 4.5- );+ for (const theme of THEMES) {+ applyThemeToRoot(theme.id);+ const surface = getComputedStyle(toastRoot).backgroundColor;+ const triggerFill = getComputedStyle(probe).backgroundColor;+ const label = `${theme.id} ${button.textContent}`;+ await expect+ .poll(() => getComputedStyle(button).backgroundColor, { message: `${label} hover fill` })+ .toBe(triggerFill);+ expect(+ getContrastRatio(getComputedStyle(button).color, flatten(triggerFill, surface), 1),+ `${label} hovered`+ ).toBeGreaterThanOrEqual(4.5);+ }await userEvent.unhover(button);button.focus();await userEvent.keyboard('{Shift>}{/Shift}');- expect(getComputedStyle(button).outlineStyle, `${label} focus ring`).toBe('solid');- expect(- getContrastRatio(getComputedStyle(button).outlineColor, surface, 1),- `${label} focus ring`- ).toBeGreaterThanOrEqual(3);+ for (const theme of THEMES) {+ applyThemeToRoot(theme.id);+ const label = `${theme.id} ${button.textContent}`;+ expect(button.matches(':focus-visible'), `${label} keyboard focus`).toBe(true);+ expect(getComputedStyle(button).outlineStyle, `${label} focus ring`).toBe('solid');+ expect(+ getContrastRatio(getComputedStyle(button).outlineColor, getComputedStyle(toastRoot).backgroundColor, 1),+ `${label} focus ring`+ ).toBeGreaterThanOrEqual(3);+ }+ button.blur();}});diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/__fixtures__/legacyTokenBaseline.json b/invokeai/frontend/webv2/src/platform/ui/theme/__fixtures__/legacyTokenBaseline.jsondeleted file mode 100644index 642f61e1bd..0000000000--- a/invokeai/frontend/webv2/src/platform/ui/theme/__fixtures__/legacyTokenBaseline.json+++ /dev/null@@ -1,290 +0,0 @@-{- "classic": {- "bg": "oklch(18.8% 0.014 264.4)",- "bg.subtle": "oklch(23.8% 0.016 264.35)",- "bg.muted": "oklch(28.8% 0.018 264.3)",- "bg.panel": "oklch(28.8% 0.018 264.3)",- "bg.emphasized": "oklch(34% 0.02 264.3)",- "bg.inset": "oklch(18.8% 0.014 264.4)",- "bg.hover": "color-mix(in oklab, color-mix(in oklab, oklch(77.738% 0.1 231.76) 55%, oklch(96% 0.006 264.5)) 10%, transparent)",- "bg.error": "color-mix(in oklab, oklch(70.61% 0.0841 19.38) 14%, oklch(23.8% 0.016 264.35))",- "bg.success": "color-mix(in oklab, oklch(79.8% 0.1132 141.63) 14%, oklch(23.8% 0.016 264.35))",- "bg.warning": "color-mix(in oklab, oklch(76.62% 0.0612 62.9) 14%, oklch(23.8% 0.016 264.35))",- "fg": "oklch(96% 0.006 264.5)",- "fg.muted": "oklch(73.5% 0.019 264.4)",- "fg.subtle": "oklch(57.5% 0.026 264.3)",- "fg.grid": "oklch(38.5% 0.022 264.3)",- "fg.error": "oklch(70.61% 0.0841 19.38)",- "fg.success": "oklch(79.8% 0.1132 141.63)",- "fg.warning": "oklch(76.62% 0.0612 62.9)",- "border": "oklch(39% 0.022 264.3)",- "border.subtle": "oklch(39% 0.022 264.3)",- "border.muted": "oklch(39% 0.022 264.3)",- "border.emphasized": "oklch(44% 0.024 264.3)",- "border.error": "oklch(70.61% 0.0841 19.38)",- "gray.contrast": "oklch(18.8% 0.014 264.4)",- "gray.fg": "oklch(96% 0.006 264.5)",- "gray.subtle": "oklch(36% 0.021 264.3)",- "gray.muted": "oklch(34% 0.02 264.3)",- "gray.emphasized": "oklch(44% 0.024 264.3)",- "gray.solid": "oklch(96% 0.006 264.5)",- "gray.focusRing": "oklch(77.738% 0.1 231.76)",- "gray.border": "oklch(44% 0.024 264.3)",- "brand.solid": "oklch(92.041% 0.2103 116.59)",- "brand.contrast": "oklch(18.8% 0.014 264.4)",- "brand.fg": "oklch(92.041% 0.2103 116.59)",- "brand.subtle": "color-mix(in oklab, oklch(92.041% 0.2103 116.59) 16%, oklch(23.8% 0.016 264.35))",- "brand.muted": "color-mix(in oklab, oklch(92.041% 0.2103 116.59) 26%, oklch(23.8% 0.016 264.35))",- "brand.emphasized": "color-mix(in oklab, oklch(92.041% 0.2103 116.59) 36%, oklch(23.8% 0.016 264.35))",- "brand.focusRing": "oklch(77.738% 0.1 231.76)",- "brand.border": "oklch(92.041% 0.2103 116.59)",- "accent.solid": "oklch(77.738% 0.1 231.76)",- "accent.contrast": "oklch(18.8% 0.014 264.4)",- "accent.fg": "oklch(77.738% 0.1 231.76)",- "accent.subtle": "color-mix(in oklab, oklch(77.738% 0.1 231.76) 16%, oklch(23.8% 0.016 264.35))",- "accent.muted": "color-mix(in oklab, oklch(77.738% 0.1 231.76) 26%, oklch(23.8% 0.016 264.35))",- "accent.emphasized": "color-mix(in oklab, oklch(77.738% 0.1 231.76) 36%, oklch(23.8% 0.016 264.35))",- "accent.focusRing": "oklch(77.738% 0.1 231.76)",- "accent.border": "oklch(77.738% 0.1 231.76)"- },- "light": {- "bg": "oklch(96% 0.0038 264)",- "bg.subtle": "oklch(99.4% 0.002 264)",- "bg.muted": "oklch(97% 0.003 264)",- "bg.panel": "oklch(97% 0.003 264)",- "bg.emphasized": "oklch(93.5% 0.005 264)",- "bg.inset": "oklch(96% 0.0038 264)",- "bg.hover": "color-mix(in oklab, color-mix(in oklab, oklch(54.615% 0.2152 262.88) 55%, oklch(22.5% 0.013 264)) 10%, transparent)",- "bg.error": "color-mix(in oklab, oklch(55.509% 0.1707 24.62) 14%, oklch(99.4% 0.002 264))",- "bg.success": "color-mix(in oklab, oklch(53% 0.15 150) 14%, oklch(99.4% 0.002 264))",- "bg.warning": "color-mix(in oklab, oklch(60% 0.13 72) 14%, oklch(99.4% 0.002 264))",- "fg": "oklch(22.5% 0.013 264)",- "fg.muted": "oklch(45% 0.017 264)",- "fg.subtle": "oklch(63% 0.014 264)",- "fg.grid": "oklch(88.5% 0.0075 264)",- "fg.error": "oklch(55.509% 0.1707 24.62)",- "fg.success": "oklch(53% 0.15 150)",- "fg.warning": "oklch(60% 0.13 72)",- "border": "oklch(90.5% 0.0065 264)",- "border.subtle": "oklch(90.5% 0.0065 264)",- "border.muted": "oklch(90.5% 0.0065 264)",- "border.emphasized": "oklch(84% 0.0095 264)",- "border.error": "oklch(55.509% 0.1707 24.62)",- "gray.contrast": "oklch(96% 0.0038 264)",- "gray.fg": "oklch(22.5% 0.013 264)",- "gray.subtle": "oklch(95.5% 0.005 264)",- "gray.muted": "oklch(93.5% 0.005 264)",- "gray.emphasized": "oklch(84% 0.0095 264)",- "gray.solid": "oklch(22.5% 0.013 264)",- "gray.focusRing": "oklch(54.615% 0.2152 262.88)",- "gray.border": "oklch(84% 0.0095 264)",- "brand.solid": "oklch(92.041% 0.2103 116.59)",- "brand.contrast": "oklch(22.5% 0.013 264)",- "brand.fg": "color-mix(in oklab, oklch(92.041% 0.2103 116.59) 50%, oklch(22.5% 0.013 264))",- "brand.subtle": "color-mix(in oklab, oklch(92.041% 0.2103 116.59) 16%, oklch(99.4% 0.002 264))",- "brand.muted": "color-mix(in oklab, oklch(92.041% 0.2103 116.59) 26%, oklch(99.4% 0.002 264))",- "brand.emphasized": "color-mix(in oklab, oklch(92.041% 0.2103 116.59) 36%, oklch(99.4% 0.002 264))",- "brand.focusRing": "oklch(54.615% 0.2152 262.88)",- "brand.border": "oklch(92.041% 0.2103 116.59)",- "accent.solid": "oklch(54.615% 0.2152 262.88)",- "accent.contrast": "oklch(100% 0 0)",- "accent.fg": "oklch(54.615% 0.2152 262.88)",- "accent.subtle": "color-mix(in oklab, oklch(54.615% 0.2152 262.88) 16%, oklch(99.4% 0.002 264))",- "accent.muted": "color-mix(in oklab, oklch(54.615% 0.2152 262.88) 26%, oklch(99.4% 0.002 264))",- "accent.emphasized": "color-mix(in oklab, oklch(54.615% 0.2152 262.88) 36%, oklch(99.4% 0.002 264))",- "accent.focusRing": "oklch(54.615% 0.2152 262.88)",- "accent.border": "oklch(54.615% 0.2152 262.88)"- },- "osakaJade": {- "bg": "oklch(16.5% 0.015 184)",- "bg.subtle": "oklch(18.5% 0.017 184)",- "bg.muted": "oklch(21% 0.021 184)",- "bg.panel": "oklch(21% 0.021 184)",- "bg.emphasized": "oklch(25.5% 0.026 183)",- "bg.inset": "oklch(16.5% 0.015 184)",- "bg.hover": "color-mix(in oklab, color-mix(in oklab, oklch(72% 0.105 195) 55%, oklch(92% 0.028 178)) 10%, transparent)",- "bg.error": "color-mix(in oklab, oklch(69.5% 0.147 33) 14%, oklch(18.5% 0.017 184))",- "bg.success": "color-mix(in oklab, oklch(78% 0.15 155) 14%, oklch(18.5% 0.017 184))",- "bg.warning": "color-mix(in oklab, oklch(80% 0.12 78) 14%, oklch(18.5% 0.017 184))",- "fg": "oklch(92% 0.028 178)",- "fg.muted": "oklch(70.5% 0.036 180)",- "fg.subtle": "oklch(53% 0.037 181)",- "fg.grid": "oklch(34.5% 0.035 182)",- "fg.error": "oklch(69.5% 0.147 33)",- "fg.success": "oklch(78% 0.15 155)",- "fg.warning": "oklch(80% 0.12 78)",- "border": "oklch(28.5% 0.03 183)",- "border.subtle": "oklch(28.5% 0.03 183)",- "border.muted": "oklch(28.5% 0.03 183)",- "border.emphasized": "oklch(36.5% 0.038 182)",- "border.error": "oklch(69.5% 0.147 33)",- "gray.contrast": "oklch(16.5% 0.015 184)",- "gray.fg": "oklch(92% 0.028 178)",- "gray.subtle": "oklch(28.5% 0.032 182)",- "gray.muted": "oklch(25.5% 0.026 183)",- "gray.emphasized": "oklch(36.5% 0.038 182)",- "gray.solid": "oklch(92% 0.028 178)",- "gray.focusRing": "oklch(72% 0.105 195)",- "gray.border": "oklch(36.5% 0.038 182)",- "brand.solid": "oklch(81% 0.145 165)",- "brand.contrast": "oklch(17% 0.028 175)",- "brand.fg": "oklch(81% 0.145 165)",- "brand.subtle": "color-mix(in oklab, oklch(81% 0.145 165) 16%, oklch(18.5% 0.017 184))",- "brand.muted": "color-mix(in oklab, oklch(81% 0.145 165) 26%, oklch(18.5% 0.017 184))",- "brand.emphasized": "color-mix(in oklab, oklch(81% 0.145 165) 36%, oklch(18.5% 0.017 184))",- "brand.focusRing": "oklch(72% 0.105 195)",- "brand.border": "oklch(81% 0.145 165)",- "accent.solid": "oklch(72% 0.105 195)",- "accent.contrast": "oklch(16.5% 0.024 195)",- "accent.fg": "oklch(72% 0.105 195)",- "accent.subtle": "color-mix(in oklab, oklch(72% 0.105 195) 16%, oklch(18.5% 0.017 184))",- "accent.muted": "color-mix(in oklab, oklch(72% 0.105 195) 26%, oklch(18.5% 0.017 184))",- "accent.emphasized": "color-mix(in oklab, oklch(72% 0.105 195) 36%, oklch(18.5% 0.017 184))",- "accent.focusRing": "oklch(72% 0.105 195)",- "accent.border": "oklch(72% 0.105 195)"- },- "mono": {- "bg": "oklch(18.22% 0 0)",- "bg.subtle": "oklch(20.019% 0 0)",- "bg.muted": "oklch(22.213% 0 0)",- "bg.panel": "oklch(22.213% 0 0)",- "bg.emphasized": "oklch(27.274% 0 0)",- "bg.inset": "oklch(18.22% 0 0)",- "bg.hover": "color-mix(in oklab, color-mix(in oklab, oklch(68.622% 0 0) 55%, oklch(93.1% 0 0)) 10%, transparent)",- "bg.error": "color-mix(in oklab, oklch(71.115% 0.0934 19.64) 14%, oklch(20.019% 0 0))",- "bg.success": "color-mix(in oklab, oklch(76% 0.06 150) 14%, oklch(20.019% 0 0))",- "bg.warning": "color-mix(in oklab, oklch(79% 0.07 80) 14%, oklch(20.019% 0 0))",- "fg": "oklch(93.1% 0 0)",- "fg.muted": "oklch(71.547% 0 0)",- "fg.subtle": "oklch(53.824% 0 0)",- "fg.grid": "oklch(32.897% 0 0)",- "fg.error": "oklch(71.115% 0.0934 19.64)",- "fg.success": "oklch(76% 0.06 150)",- "fg.warning": "oklch(79% 0.07 80)",- "border": "oklch(28.908% 0 0)",- "border.subtle": "oklch(28.908% 0 0)",- "border.muted": "oklch(28.908% 0 0)",- "border.emphasized": "oklch(34.846% 0 0)",- "border.error": "oklch(71.115% 0.0934 19.64)",- "gray.contrast": "oklch(18.22% 0 0)",- "gray.fg": "oklch(93.1% 0 0)",- "gray.subtle": "oklch(28.908% 0 0)",- "gray.muted": "oklch(27.274% 0 0)",- "gray.emphasized": "oklch(34.846% 0 0)",- "gray.solid": "oklch(93.1% 0 0)",- "gray.focusRing": "oklch(68.622% 0 0)",- "gray.border": "oklch(34.846% 0 0)",- "brand.solid": "oklch(93.1% 0 0)",- "brand.contrast": "oklch(18.22% 0 0)",- "brand.fg": "oklch(93.1% 0 0)",- "brand.subtle": "color-mix(in oklab, oklch(93.1% 0 0) 16%, oklch(20.019% 0 0))",- "brand.muted": "color-mix(in oklab, oklch(93.1% 0 0) 26%, oklch(20.019% 0 0))",- "brand.emphasized": "color-mix(in oklab, oklch(93.1% 0 0) 36%, oklch(20.019% 0 0))",- "brand.focusRing": "oklch(68.622% 0 0)",- "brand.border": "oklch(93.1% 0 0)",- "accent.solid": "oklch(68.622% 0 0)",- "accent.contrast": "oklch(18.22% 0 0)",- "accent.fg": "oklch(68.622% 0 0)",- "accent.subtle": "color-mix(in oklab, oklch(68.622% 0 0) 16%, oklch(20.019% 0 0))",- "accent.muted": "color-mix(in oklab, oklch(68.622% 0 0) 26%, oklch(20.019% 0 0))",- "accent.emphasized": "color-mix(in oklab, oklch(68.622% 0 0) 36%, oklch(20.019% 0 0))",- "accent.focusRing": "oklch(68.622% 0 0)",- "accent.border": "oklch(68.622% 0 0)"- },- "ultradark": {- "bg": "oklch(0% 0 0)",- "bg.subtle": "oklch(11.5% 0.003 250)",- "bg.muted": "oklch(14.5% 0.003 250)",- "bg.panel": "oklch(14.5% 0.003 250)",- "bg.emphasized": "oklch(19% 0.004 250)",- "bg.inset": "oklch(0% 0 0)",- "bg.hover": "color-mix(in oklab, color-mix(in oklab, oklch(80.623% 0.1248 228.24) 55%, oklch(89% 0.008 250)) 10%, transparent)",- "bg.error": "color-mix(in oklab, oklch(71.161% 0.1812 22.84) 14%, oklch(11.5% 0.003 250))",- "bg.success": "color-mix(in oklab, oklch(76.5% 0.16 150.5) 14%, oklch(11.5% 0.003 250))",- "bg.warning": "color-mix(in oklab, oklch(79.5% 0.13 80) 14%, oklch(11.5% 0.003 250))",- "fg": "oklch(89% 0.008 250)",- "fg.muted": "oklch(66.5% 0.007 250)",- "fg.subtle": "oklch(47% 0.006 250)",- "fg.grid": "oklch(24% 0.004 250)",- "fg.error": "oklch(71.161% 0.1812 22.84)",- "fg.success": "oklch(76.5% 0.16 150.5)",- "fg.warning": "oklch(79.5% 0.13 80)",- "border": "oklch(21% 0.004 250)",- "border.subtle": "oklch(21% 0.004 250)",- "border.muted": "oklch(21% 0.004 250)",- "border.emphasized": "oklch(27% 0.005 250)",- "border.error": "oklch(71.161% 0.1812 22.84)",- "gray.contrast": "oklch(0% 0 0)",- "gray.fg": "oklch(89% 0.008 250)",- "gray.subtle": "oklch(21.8% 0.004 250)",- "gray.muted": "oklch(19% 0.004 250)",- "gray.emphasized": "oklch(27% 0.005 250)",- "gray.solid": "oklch(89% 0.008 250)",- "gray.focusRing": "oklch(80.623% 0.1248 228.24)",- "gray.border": "oklch(27% 0.005 250)",- "brand.solid": "oklch(93.444% 0.19 125.56)",- "brand.contrast": "oklch(15% 0.004 250)",- "brand.fg": "oklch(93.444% 0.19 125.56)",- "brand.subtle": "color-mix(in oklab, oklch(93.444% 0.19 125.56) 16%, oklch(11.5% 0.003 250))",- "brand.muted": "color-mix(in oklab, oklch(93.444% 0.19 125.56) 26%, oklch(11.5% 0.003 250))",- "brand.emphasized": "color-mix(in oklab, oklch(93.444% 0.19 125.56) 36%, oklch(11.5% 0.003 250))",- "brand.focusRing": "oklch(80.623% 0.1248 228.24)",- "brand.border": "oklch(93.444% 0.19 125.56)",- "accent.solid": "oklch(80.623% 0.1248 228.24)",- "accent.contrast": "oklch(17.416% 0.0256 235.84)",- "accent.fg": "oklch(80.623% 0.1248 228.24)",- "accent.subtle": "color-mix(in oklab, oklch(80.623% 0.1248 228.24) 16%, oklch(11.5% 0.003 250))",- "accent.muted": "color-mix(in oklab, oklch(80.623% 0.1248 228.24) 26%, oklch(11.5% 0.003 250))",- "accent.emphasized": "color-mix(in oklab, oklch(80.623% 0.1248 228.24) 36%, oklch(11.5% 0.003 250))",- "accent.focusRing": "oklch(80.623% 0.1248 228.24)",- "accent.border": "oklch(80.623% 0.1248 228.24)"- },- "catppuccinMocha": {- "bg": "oklch(18.28% 0.0204 284.2)",- "bg.subtle": "oklch(21.55% 0.0254 284.06)",- "bg.muted": "oklch(24.29% 0.0304 283.91)",- "bg.panel": "oklch(24.29% 0.0304 283.91)",- "bg.emphasized": "oklch(32.4% 0.0319 281.98)",- "bg.inset": "oklch(18.28% 0.0204 284.2)",- "bg.hover": "color-mix(in oklab, color-mix(in oklab, oklch(76.64% 0.1113 259.88) 55%, oklch(87.87% 0.0426 272.28)) 10%, transparent)",- "bg.error": "color-mix(in oklab, oklch(75.56% 0.1297 2.76) 14%, oklch(21.55% 0.0254 284.06))",- "bg.success": "color-mix(in oklab, oklch(85.77% 0.1092 142.72) 14%, oklch(21.55% 0.0254 284.06))",- "bg.warning": "color-mix(in oklab, oklch(82.37% 0.1015 52.63) 14%, oklch(21.55% 0.0254 284.06))",- "fg": "oklch(87.87% 0.0426 272.28)",- "fg.muted": "oklch(68.65% 0.0374 274.73)",- "fg.subtle": "oklch(61.76% 0.0367 276)",- "fg.grid": "oklch(40.37% 0.032 280.15)",- "fg.error": "oklch(75.56% 0.1297 2.76)",- "fg.success": "oklch(85.77% 0.1092 142.72)",- "fg.warning": "oklch(82.37% 0.1015 52.63)",- "border": "oklch(40.37% 0.032 280.15)",- "border.subtle": "oklch(40.37% 0.032 280.15)",- "border.muted": "oklch(40.37% 0.032 280.15)",- "border.emphasized": "oklch(47.65% 0.034 278.64)",- "border.error": "oklch(75.56% 0.1297 2.76)",- "gray.contrast": "oklch(18.28% 0.0204 284.2)",- "gray.fg": "oklch(87.87% 0.0426 272.28)",- "gray.subtle": "oklch(36.4% 0.0319 281.06)",- "gray.muted": "oklch(32.4% 0.0319 281.98)",- "gray.emphasized": "oklch(47.65% 0.034 278.64)",- "gray.solid": "oklch(87.87% 0.0426 272.28)",- "gray.focusRing": "oklch(76.64% 0.1113 259.88)",- "gray.border": "oklch(47.65% 0.034 278.64)",- "brand.solid": "oklch(78.71% 0.1187 304.77)",- "brand.contrast": "oklch(18.28% 0.0204 284.2)",- "brand.fg": "oklch(78.71% 0.1187 304.77)",- "brand.subtle": "color-mix(in oklab, oklch(78.71% 0.1187 304.77) 16%, oklch(21.55% 0.0254 284.06))",- "brand.muted": "color-mix(in oklab, oklch(78.71% 0.1187 304.77) 26%, oklch(21.55% 0.0254 284.06))",- "brand.emphasized": "color-mix(in oklab, oklch(78.71% 0.1187 304.77) 36%, oklch(21.55% 0.0254 284.06))",- "brand.focusRing": "oklch(76.64% 0.1113 259.88)",- "brand.border": "oklch(78.71% 0.1187 304.77)",- "accent.solid": "oklch(76.64% 0.1113 259.88)",- "accent.contrast": "oklch(18.28% 0.0204 284.2)",- "accent.fg": "oklch(76.64% 0.1113 259.88)",- "accent.subtle": "color-mix(in oklab, oklch(76.64% 0.1113 259.88) 16%, oklch(21.55% 0.0254 284.06))",- "accent.muted": "color-mix(in oklab, oklch(76.64% 0.1113 259.88) 26%, oklch(21.55% 0.0254 284.06))",- "accent.emphasized": "color-mix(in oklab, oklch(76.64% 0.1113 259.88) 36%, oklch(21.55% 0.0254 284.06))",- "accent.focusRing": "oklch(76.64% 0.1113 259.88)",- "accent.border": "oklch(76.64% 0.1113 259.88)"- }-}diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/__tokenResolve.ts b/invokeai/frontend/webv2/src/platform/ui/theme/__tokenResolve.tsindex 1d82def608..6198cc79ef 100644--- a/invokeai/frontend/webv2/src/platform/ui/theme/__tokenResolve.ts+++ b/invokeai/frontend/webv2/src/platform/ui/theme/__tokenResolve.ts@@ -60,65 +60,3 @@ export const resolveToken = (sys: TokenSystem, theme: string, tokenName: string)}return value;};--/** Resolve every token across every theme → { [theme]: { [token]: value } }. */-export const resolveAll = (sys: TokenSystem, tokens: readonly string[]): Record<string, Record<string, string>> => {- const out: Record<string, Record<string, string>> = {};- for (const theme of THEMES) {- out[theme] = {};- for (const token of tokens) {- out[theme][token] = resolveToken(sys, theme, token);- }- }- return out;-};--/** The frozen public color-token contract — every name a component/recipe may consume. */-export const CONSUMER_TOKENS = [- 'bg',- 'bg.subtle',- 'bg.muted',- 'bg.panel',- 'bg.emphasized',- 'bg.inset',- 'bg.hover',- 'bg.error',- 'bg.success',- 'bg.warning',- 'fg',- 'fg.muted',- 'fg.subtle',- 'fg.grid',- 'fg.error',- 'fg.success',- 'fg.warning',- 'border',- 'border.subtle',- 'border.muted',- 'border.emphasized',- 'border.error',- 'gray.contrast',- 'gray.fg',- 'gray.subtle',- 'gray.muted',- 'gray.emphasized',- 'gray.solid',- 'gray.focusRing',- 'gray.border',- 'brand.solid',- 'brand.contrast',- 'brand.fg',- 'brand.subtle',- 'brand.muted',- 'brand.emphasized',- 'brand.focusRing',- 'brand.border',- 'accent.solid',- 'accent.contrast',- 'accent.fg',- 'accent.subtle',- 'accent.muted',- 'accent.emphasized',- 'accent.focusRing',- 'accent.border',-] as const;diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/system.test.ts b/invokeai/frontend/webv2/src/platform/ui/theme/system.test.tsindex 02ebf658a7..b959911801 100644--- a/invokeai/frontend/webv2/src/platform/ui/theme/system.test.ts+++ b/invokeai/frontend/webv2/src/platform/ui/theme/system.test.ts@@ -1,7 +1,6 @@import { describe, expect, it } from 'vitest';-import legacyBaseline from './__fixtures__/legacyTokenBaseline.json';-import { CONSUMER_TOKENS, resolveToken, THEME_SELECTORS, THEMES, type TokenSystem } from './__tokenResolve';+import { resolveToken, THEME_SELECTORS, THEMES, type TokenSystem } from './__tokenResolve';import { progressCircleSlotRecipe } from './recipes';import { system } from './system';import { THEMES as THEME_DEFINITIONS } from './themes';@@ -17,18 +16,6 @@ const lightnessOf = (oklch: string): number => {return Number(match[1]);};-describe('color token contract — legacy-value gate', () => {- // Pin semantic-token values against __fixtures__/legacyTokenBaseline.json.- for (const theme of THEMES) {- for (const token of CONSUMER_TOKENS) {- it(`${theme}: ${token} is unchanged`, () => {- const expected = (legacyBaseline as Record<string, Record<string, string>>)[theme][token];- expect(resolveToken(sys, theme, token)).toBe(expected);- });- }- }-});-describe('ramp + mapping structure', () => {it('resolves every registered theme (a theme missing from THEME_SELECTORS would skip the gate)', () => {expect(Object.keys(THEME_SELECTORS)).toEqual(THEME_DEFINITIONS.map((theme) => theme.id));diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/engine.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/engine.test.tsindex e257044e1e..327c87a54f 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/engine.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/engine.test.ts@@ -1033,11 +1033,7 @@ describe('createCanvasEngine', () => {expect(engine.viewport.getViewport().getZoom()).toBe(1);expect(engine.stores.activeTool.get()).toBe('view');expect(engine.stores.viewportReady.get()).toBe(false);- expect(engine.surface.attach).toBe(engine.surface.attach);- expect(engine.viewport.getViewport).toBe(engine.viewport.getViewport);expect(engine.tools.setTool).toBeTypeOf('function');- expect(engine.history.undo).toBe(engine.history.undo);- expect(engine.lifecycle.beginCooldown).toBe(engine.lifecycle.beginCooldown);expect(engine.edits.tryAcquire).toBeTypeOf('function');engine.lifecycle.dispose();});diff --git a/invokeai/frontend/webv2/src/workbench/palette/WorkbenchCommandPalette.lazy.browser.test.ts b/invokeai/frontend/webv2/src/workbench/palette/WorkbenchCommandPalette.lazy.browser.test.tsdeleted file mode 100644index 7268e22db3..0000000000--- a/invokeai/frontend/webv2/src/workbench/palette/WorkbenchCommandPalette.lazy.browser.test.ts+++ /dev/null@@ -1,11 +0,0 @@-import { describe, expect, it } from 'vitest';--import { loadWorkbenchCommandPaletteDialog } from './WorkbenchCommandPalette';--describe('Workbench command-palette lazy boundary', () => {- it('loads the real workbench dialog module in the browser', async () => {- const module = await loadWorkbenchCommandPaletteDialog();-- expect(module.default).toEqual(expect.any(Function));- });-});diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasBottomOverlay.test.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasBottomOverlay.test.tsxindex ec43b5a8f9..8065856191 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasBottomOverlay.test.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasBottomOverlay.test.tsx@@ -3,23 +3,9 @@ import { system } from '@theme/system';import { renderToStaticMarkup } from 'react-dom/server';import { describe, expect, it } from 'vitest';-import {- BOTTOM_OVERLAY_LAYOUT,- BOTTOM_OVERLAY_STACK_LAYOUT,- BOTTOM_STAGING_SLOT_LAYOUT,- CanvasBottomOverlay,-} from './CanvasBottomOverlay';+import { CanvasBottomOverlay } from './CanvasBottomOverlay';describe('CanvasBottomOverlay', () => {- it('allocates only the canvas widget inset and allows the stack to shrink', () => {- expect(BOTTOM_OVERLAY_LAYOUT).toMatchObject({ bottom: '2', minH: '0', overflow: 'hidden', top: '2' });- expect(BOTTOM_OVERLAY_STACK_LAYOUT).toMatchObject({ h: 'full', minH: '0', overflow: 'hidden' });- });-- it('spans the staging slot across the canvas so its thumbnail strip can scroll', () => {- expect(BOTTOM_STAGING_SLOT_LAYOUT).toMatchObject({ flexShrink: '0', minW: '0', w: 'full' });- });-it('forwards root props and ref-compatible attributes', () => {const markup = renderToStaticMarkup(<ChakraProvider value={system}>diff --git a/invokeai/frontend/webv2/src/workbench/workbenchStore.test.ts b/invokeai/frontend/webv2/src/workbench/workbenchStore.test.tsindex d3d7cf63df..f6ba94af00 100644--- a/invokeai/frontend/webv2/src/workbench/workbenchStore.test.ts+++ b/invokeai/frontend/webv2/src/workbench/workbenchStore.test.ts@@ -63,12 +63,10 @@ describe('createWorkbenchStore', () => {configureLogging({ ...DEFAULT_LOGGING_CONFIG, level: 'trace' });});- it('exposes stable capability interfaces and initializes snapshot metadata', () => {+ it('initializes snapshot metadata', () => {const store = createWorkbenchStore();const snapshot = store.getSnapshot();- expect(store.commands).toBe(store.commands);- expect(store.queries).toBe(store.queries);expect(snapshot.hasHydrated).toBe(false);expect(snapshot.projects).toHaveLength(1);});diff --git a/invokeai/frontend/webv2/vitest.config.mts b/invokeai/frontend/webv2/vitest.config.mtsindex acfb52c53a..8159f61a47 100644--- a/invokeai/frontend/webv2/vitest.config.mts+++ b/invokeai/frontend/webv2/vitest.config.mts@@ -7,6 +7,7 @@ export default mergeConfig(viteConfig,defineConfig({test: {+ fsModuleCache: true,exclude: ['src/**/*.browser.test.{ts,tsx}'],include: ['src/**/*.test.{ts,tsx}'],},