Commit Graph
6839 Commits
Author SHA1 Message Date
Oleg Isonen 668bbc2ec7 Leave headroom in the slowest E2E shards 2026-11-16 01:58:14 +00:00
Oleg Isonen 005e408efb Spread E2E work within the ten fixed shards 2026-11-16 01:49:38 +00:00
Oleg Isonen 958c4ad061 Use spare capacity in the existing E2E shards 2026-11-16 01:41:51 +00:00
Oleg Isonen 5e160f4bd6 Combine shard 1 Preview startup and shorten shard 2 saves 2026-11-16 01:34:14 +00:00
Oleg Isonen ad4eded7f9 Reuse shard 9 setup pages and shorten style saves 2026-11-16 01:28:52 +00:00
Oleg Isonen b89c68acf0 Run Preview authoring in its build process 2026-11-16 01:27:00 +00:00
Oleg Isonen 4b8e74d14a Require asset drag autoscroll in shard 4 2026-11-16 01:25:33 +00:00
Oleg Isonen a125ea504a Reduce shard 4 browser setup and asset drag work 2026-11-16 01:21:35 +00:00
Oleg Isonen 08aa6c492e Shorten shard 10 setup and rich text reloads 2026-11-16 01:20:52 +00:00
Oleg Isonen 005f4992a6 Reuse E2E pages and confirm saved navigator changes 2026-11-16 01:17:07 +00:00
Oleg Isonen eacb24ea79 Remove temporary shard 6 timing markers 2026-11-16 01:05:07 +00:00
Oleg Isonen dbb365e5e5 Reuse workflow pages in shard 6 project setup 2026-11-16 01:00:32 +00:00
Oleg Isonen 493f6518ad Temporarily measure shard 6 Preview cleanup on CI 2026-11-16 00:52:48 +00:00
Oleg Isonen 7bb66916b9 Reduce shard 4 and 6 Builder sessions and saves 2026-11-16 00:52:45 +00:00
Oleg Isonen 634ffb002f Trim cold E2E build setup and slow shard paths 2026-11-16 00:38:20 +00:00
Oleg Isonen 83abffabb8 Reduce E2E shard work and remove duplicate CI discovery 2026-11-16 00:22:20 +00:00
Oleg Isonen c0572f35c2 Cut repeated E2E authoring and overlap shard setup with build wait 2026-11-16 00:03:14 +00:00
Oleg Isonen 253d63562c perf: Reduce Builder E2E reloads and fix artifact lookup 2026-11-15 23:49:58 +00:00
Oleg Isonen 1b41123a2a perf: Share E2E production Previews across scenarios 2026-11-15 23:43:36 +00:00
Oleg Isonen 692d2978ac fix: Wait for MDX asset save instead of project sync 2026-11-15 23:32:58 +00:00
Oleg Isonen d872c11406 perf: Reuse E2E projects and Preview builds 2026-11-15 23:27:08 +00:00
Oleg Isonen 6ea7321b7f perf: Reuse Builder build for test-only changes 2026-11-15 23:13:59 +00:00
Oleg Isonen 88102ad3ee fix: Restore Chromium fallback in E2E 2026-11-15 23:04:57 +00:00
Oleg Isonen 588bd990f7 perf: Cut repeated Builder E2E setup 2026-11-15 23:00:28 +00:00
Oleg Isonen 56a8cdb64c perf: Speed up large Navigator E2E checks 2026-11-15 21:47:53 +00:00
Oleg Isonen d5424aa6b1 perf: Measure Builder data load before canvas insertion 2026-11-15 21:25:12 +00:00
Oleg Isonen 46cb28be69 perf: Reuse generated resources Preview for static binding 2026-11-15 19:58:07 +00:00
Oleg Isonen de54665a1d perf: Share managed Form callback Preview 2026-11-15 19:47:14 +00:00
Oleg Isonen baeaab904f perf: Measure and trim Builder E2E setup (#6699)
Builder E2E still misses the three-minute target. The latest warm
ten-shard run passed, but shard 6 took 4:29 from runner start to
completion. This PR remains a draft.

The ten shard jobs took 2:21–4:29. Their test phases took 1:20–3:31 and
their test durations summed to about 4,018 seconds across 136 tests. At
three Playwright workers per shard, that is a 2:14 average lower bound
before roughly 45–60 seconds of runner setup; some shards have much more
work than average. The latest managed Form consolidation passed on shard
7, but that shard still took 4:06. Shard 5 ranged from 4:40 to 3:20
across two warm runs with no shard 5 code change, so a single run is not
evidence of a stable speedup.

This branch caches the compiled Builder for E2E-only changes and commits
the schema snapshot so shards do not repeat migrations. The separate
Supabase migration job still applies all migrations. Each shard now
restores the compiled Builder cache directly. A warm run confirmed the
artifact wait and download were skipped; a miss run confirmed the
fallback. New runners still restore pnpm, Playwright, and Builder
caches, and start a database.

Related Form redirect, Email, feedback, resource, and managed delivery
outcomes now use fewer generated production Previews while retaining
named steps and assertions. Three generated resource tests now share one
project and Preview; the combined test passed in 52 seconds on CI versus
three prior tests of about 76–79 seconds each. The newest managed Form
test combines navigation, two Action delivery, and multipart upload in
one Preview and passed both locally and in CI.

Four workers per shard were tested and reverted: full E2E rose from 4:46
to 5:32, with 57–64% CPU scheduling pressure on several shards and zero
memory pressure. In the latest shard 7 run, seven generated Preview
startups summed to 200 seconds across parallel tests. Repeated Builder
canvas startup and saves dominate other shards. Caching and small test
consolidations are insufficient for the target; the remaining work needs
a test architecture that keeps production Preview and real Builder
coverage while avoiding full compilation or reload for every behavior
case.

### Status

- [x] Measure per-test, key phase, and runner CPU/memory times.
- [x] Cache compiled Builder inputs and commit a schema snapshot while
retaining the full migration check.
- [x] Keep dashboard UI creation coverage while using faster setup in
unrelated tests.
- [x] Fix the MCP Preview redirect observation race with a regression
test.
- [x] Consolidate related redirect, Email, feedback, resource, and
managed Form outcomes while retaining assertions.
- [x] Verify formatting, Builder typecheck, focused local tests, and the
latest warm ten-shard CI run.
- [ ] Diagnose and eliminate intermittent Chromium startup failures
beyond the concurrent Email binding case.
- [ ] Run managed Form callback protocol and browser checks against one
production Preview.
- [ ] Cut repeated Builder and production Preview work enough for every
shard to finish within three minutes.
- [ ] Verify cold and warm ten-shard CI runs under three minutes.

No user-facing documentation or fixture bundle changes are needed.
2026-11-15 20:38:14 +01:00
Oleg Isonen 82bd484b9d fix: Make publish diagnostics selectable and align static export status (#6703)
Warnings and publish logs should be easy to select, and static export
should show the same kind of result alert as site publish. This PR fixes
those Builder behaviors without changing the publish pipeline.

## Checklist

- [x] Make warning text selectable while keeping finding details on a
separate link. Publish-log text remains selectable, with collapsibles
and copy buttons unchanged.
- [x] Show static-export success and failure in result alerts that open
the matching Diagnostics tab; remove the redundant status icon while
keeping button progress.
- [x] Notify the user if a static-export audit rejection arrives after
the Export popover closes; keep the inline-only notice while it is open.
- [x] Preserve a persisted static-build failure indicator after Builder
reload, without linking to session-only diagnostics.
- [x] Add regression tests for both cases and verify 197 publish tests,
Builder typecheck, root lint, formatting, and diff checks locally. Each
new test failed without its fix and passed afterward.
- [x] Update the authoritative static-export guide to explain what
remains after reload.
- [x] Confirm the main workflow, PR lint, submodule check, and approved
visual regression pass on the final commit.

No database or package contract changes. Wrangler telemetry is a
separate SaaS publish-job setting and is not changed here. No local
screenshots were taken, as previously requested. The intended visual
changes were reviewed from CI screenshots and approved.

A live staging publish/log read across this Builder PR and SaaS #684
remains unverified because the staging account reached its daily publish
limit. No quota was changed.

Replaces #6702.

Closes #6701
2026-11-15 20:27:18 +01:00
Oleg Isonen 896a383e32 feat: show publish logs in Builder, CLI, and MCP (#6690)
Staging work for publish diagnostics. This PR pairs with
webstudio-is/webstudio-saas#681. No production release is authorized.

## What changes

People can open Diagnostics from a domain or static export to see
warnings, errors, and publishes from the current Builder session. Each
publish has its own collapsible report and copy control. A failed
publish keeps a short reason and links to its own log when that publish
was accepted. Builder, CLI, and MCP use the same publish reference and
log access path.

Status and logs stay separate. Builder keeps session reports in memory,
and Edge retrieves available output from the current publish runner.
Reloading Builder loses session reports. An unavailable log does not
change publish success or failure. Log pages still require runner
retrieval and transfer through Edge and Builder; there is no Webstudio
log archive in this PR.

The UI now keeps publish state in its owning component, with separate
site and static actions, focused diagnostics views, and one domain
status control. Both actions share completion handling while retaining
their different request and download behavior. Late best-effort checks
cannot erase a final rejection. A new rejected request does not make an
older publish look like its log. Site errors stay scoped to the selected
domains. The existing site and asset publish paths are unchanged.

## Checklist

- [x] Keep confirmed session success ahead of stale Build timeout during
popover reconciliation; cover an old Build timestamp.
- [x] Retry a temporarily pending or failed publish-log read before
marking it unavailable; cover session behavior.
- [x] Verify CI on the rebased PR head and confirm review threads remain
resolved.
- [x] Let a matching session's confirmed result clear stale pending
controls for site and static; cover success and failure.
- [x] Remove redundant static-export loading icon while keeping the
export button's pending state and diagnostics access.
- [x] Prefer confirmed runner success over a timeout inferred from a
stale matching Build; cover site and static publishes.
- [x] Keep MCP publish input valid when a target union is converted to
tool JSON Schema; cover both the adapter and real CLI contract.
- [x] Finish an accepted publish by its build ID even if another publish
becomes the project's latest; cover site and static behavior.
- [x] Review docs impact, verify local checks and CI, and reply to the
new review threads.

- [x] Keep current validation findings ahead of an older publish success
notice; cover rejected requests and manual validation.
- [x] Scope accepted-publish status errors to the domains in that
publish; cover another domain's Diagnostics.
- [x] Make success, warning, and error publish notices distinct and
readable in dark mode; use the existing PanelBanner variants and leave
light mode unchanged.\n- [x] Review documentation impact and run focused
tests, typecheck, lint, and CI for these fixes. The publishing guide
needs no wording change.

- [x] Resolve the four Builder review comments and push the focused fix.
- [x] Split Diagnostics into findings, detail, publish history, and
dialog shell without new copy or icons.
- [x] Keep Warnings and Errors separate from Publish logs; preserve
current-session history, log copying, and access checks.
- [x] Consolidate site/static flow and quota reads; narrow UI access to
flow internals.
- [x] Preserve completed findings, final rejection, target/domain
isolation, and accepted-build log links across both completion orders.
- [x] Review the remaining publish UI; share the duplicated domain
status control and leave cohesive baseline domain/export UI in place.
- [x] Review authoritative publishing docs for this UI change.
- [x] Correct the guide's statement that all validation errors block the
request; the approved wording is in the publishing guide.
- [x] Audit names introduced by this PR against their runtime values and
existing repository terminology; fix misleading local names without
changing stored or public contracts.
- [x] Review docs impact of naming-only changes and verify tests, types,
lint, and CI. Docs need no change; 179 publish tests, Builder typecheck,
root lint, formatting, diff checks, and all non-visual CI on the
previous commit passed. Visual approval remains open.
- [x] Remove single-use publish hooks; keep their state/effects in the
owning component and test behavior through that component.
- [x] Split site and static publish actions into clear component-owned
flows without the target-discriminated publish function.
- [x] Review docs impact of the structural change. No user-facing copy
or behavior changed, so no further docs change is needed.
- [x] Verify migrated tests, coverage, Builder core tests, typecheck,
lint, formatting, and package boundaries.
- [x] Simplify publish component tests: share the tRPC test transport
and use named Diagnostics options without losing behavior coverage.
- [x] Replace the global fetch test stub with a scoped tRPC request
interceptor for publish component tests.
- [x] Simplify publish component tests again: share only reusable
browser setup and interactions, remove duplicate scenarios and
incidental assertions, and preserve behavior coverage.
- [x] Review `trpc-interface` package exports and packed-package
consumers. Keep the explicit source subpaths; no manifest change is
needed.
- [x] Review every test changed in this PR for avoidable module mocking;
replace only clear cases without reducing behavior coverage.
- [x] Update and validate the global testing skill with the decision
learned from that review.
- [x] Re-run focused tests and relevant checks for the module-mock
cleanup.
- [x] Finish non-visual CI on the current commit.
- [x] Audit Builder-wide global fetch replacements and no-request spies;
keep injected fakes and valid narrow spies.
- [x] Replace backend-style global fetch stubs and the Storybook fixture
override with scoped request handlers.
- [x] Preserve success, HTTP/network failure, abort, cleanup, and
no-request coverage with red/green checks.
- [x] Run focused and broader Builder tests, typecheck, lint,
formatting, and package-boundary checks for the fetch-test cleanup.
- [x] Review docs impact of the test-only cleanup; no user-facing
documentation changes are needed.
- [x] Make user database tests verify ownership filters, inserted
values, and workspace linkage.
- [x] Make patch-service tests prove the intended patch was applied and
remove vacuous cases.
- [x] Add focused DomainCheckbox integration coverage while keeping
useful helper cases.
- [x] Make publish test transport fail on unexpected requests and
distinguish protocol errors from network failures.
- [x] Remove duplicate permission cases and run selected DOM-free tests
in Node.
- [x] Review documentation impact and run relevant red/green, test,
type, lint, and config checks.
- [x] Show the latest successful site publish and static export in their
popovers with a See logs link to the Publish tab.
- [x] Cover success, new-attempt reset, Free-plan access, and both flows
in component tests.
- [x] Review publishing docs and verify focused tests, types, lint,
formatting, and diff.

- [x] Review the three expected visual differences and approve the CI
rerun; visual regression passed on a0c2ca73f.

## Verification

Local: 177 publish tests passed after simplifying the component suites.
Two duplicate scenarios were removed; the dedicated suites still cover
network failures, paged logs, plan changes, and stale responses. The
latest test cleanup removes 174 net lines. Builder production code is
unchanged. The earlier test cleanup removed 135 net lines across seven
files. Coverage increased from 84.2% statements / 83.3% branches to
88.63% / 86.98%. Builder core passed 1,698 tests with one skip. Builder
typecheck, root lint, package-boundary check, formatting, and diff
checks passed. Representative migrated tests were shown failing when
project scoping, late-check isolation, session eviction, validation
reset, or static download behavior was temporarily broken, then passing
after restoration.

The current commit passed the main workflow, lint, and submodule checks.
Visual approval remains open for three previously identified story
differences. The prior visual report had the same three known story
differences; baseline approval remains open. The visual approval gate
remains open for the previously identified story differences; no new
local Storybook capture was run at the user's request. The agent
evaluation suite remains 8/9 because of an unrelated Form-authoring
failure; baselines were not changed.

The Builder-wide test cleanup replaces 11 global fetch stubs and one
Storybook override. It keeps two narrow no-send spies for a pure preview
function. Focused checks passed (43 Node tests, 16 browser tests,
typecheck, lint, formatting, package boundaries). Full local core and
app runs each had one failure in an unchanged test; the app test passed
alone, and the core failure reproduced in its unchanged file. CI will
provide the full-matrix check. Local request-interception work remains;
no product behavior changes.


A follow-up review checked all 30 changed test files for module mocks.
Two unnecessary wrappers were removed: the resource-preview call counter
and the cross-origin guard fake. The real HTTP boundary and a cross-site
request now carry those assertions. The narrow Email preview exception
fake remains because malformed real inputs do not reach that catch
reliably; seven older Preview-route mocks remain tied to auth, database,
protected fetch, and environment setup. This test-only follow-up passed
41 focused tests, Builder typecheck, targeted lint/formatting, diff
checks, and independent review. The global testing skill was updated and
validated outside this repository. The previous commit's complete main
CI passed; the visual baseline approval gate remains open.

Commit d340a5225 is pushed to `pub.staging`. It strengthens the user,
patch, permission, checkbox, and publish-transport tests; it also shows
successful site publishes and static exports in a shared notice with
**See logs**. A newer attempt hides an older success, and static export
does not claim “Downloaded” without a download filename. The publishing
and export guides describe the new notices. New behavior assertions
failed before their fixes and passed afterward. The latest local Builder
core run passed 1,755 tests (one skipped); 82 focused browser tests,
Builder typecheck, root lint, formatting, and diff checks also passed.
No fixture inputs or outputs changed. Visual checks were not run locally
at the user's request.

The current visual gate passed on run 43725523044 after reviewing the
two Diagnostics stories and the Activity icon. Earlier notes about
pending visual approval describe previous commits.

Commit cae33d877e fixes the two current Builder review findings and adds
a dark-mode edge to success, warning, and error banners without changing
light mode. The new rejection and domain-scope tests failed before their
fixes and passed afterward. Local checks passed: 185 publish tests, 287
design-system tests, Builder and design-system typechecks, lint,
formatting, package boundaries, and diff checks. Main CI and the
approved visual rerun passed. The first visual run failed on the same
three previously reviewed light-theme differences; no new dark-theme
screenshot was taken at the user's request.\n\nCommit db5984eb95 fixes
two later review findings. MCP now permits branch fields at the root of
a composed tool schema; the target branches and API still validate
values. Completion uses the accepted build's job status when another
build becomes the project's latest. The new focused tests failed before
the fixes and passed afterward. Local checks passed: 189 publish tests,
146 MCP adapter tests, 74 CLI MCP tests, relevant typechecks, lint,
formatting, package boundaries, and generated MCP docs. Main CI and the
approved visual regression run passed on b15eebaab3. The initial
unapproved visual run showed only the three previously reviewed
differences.\n\nLive staging MCP smoke check: the CLI started a staging
publish, its job succeeded, and `get-publish-log` returned one complete
page (6,077 characters) in the same MCP session. No log text or share
token was saved in the PR.

The stale-Build regression failed before a04d6c287c and passed
afterward. All 193 publish tests, Builder typecheck, formatting,
targeted lint, and diff checks pass. The refreshed popover trusts a
matching confirmed session result but still clears a retained failure
when the Build reports `PUBLISHED`.

Main CI and the approved visual rerun passed on a04d6c287c. The initial
visual run showed only the same three previously reviewed differences.
All review threads are resolved.

## Before release

- Verify a live staging publish once both staging PRs are deployed.
- Release and pin the existing Builder contract package before removing
the temporary copied contract in the SaaS PR. Local packed-package
typecheck, Worker bundle, and tests passed; registry installation is not
yet verified.
- Production deployment and package publication remain user-run steps.

Ref #3550
Closes #6693
2026-11-15 17:55:45 +01:00
Oleg Isonen 23c81d64c9 perf: Speed up Builder E2E tests (#6689)
Builder E2E still takes too long. The goal is all 145 cases under 3
minutes end to end, with exactly ten shards and the same UI, MCP, and
generated Preview checks. This PR has not met that goal.

### Measured results
- Initial green CI run: 9m43s from build start to the last shard;
slowest test step 439s.
- Best green run after replacing repeated UI project setup: about 5m35s;
slowest test step 250s.
- Best green run (393e51c): about 4m59s; slowest test step 201s. The
two-file rebalance reduced the prior green run by about 50s. The
3-minute goal remains unmet.
- Latest green run (de2f4ed): about 5m56s; slowest test step 257s. All
ten shards and required workflows passed. The preceding green run took
about 6m09s, showing substantial run-to-run variation.
- The 119 content-mode project setup calls fell from 599s to 23.5s of
aggregate worker time by using the app's dev login and project creation
API. The sum of shard test steps fell from 2,178s to 1,721s in the first
run with this change. Per-shard wall time still varies substantially
between runs.
- The shared build takes about 85s, including roughly 30s of setup and
51s of Builder compilation. During tests, the four-CPU shard runners
showed 27–52% CPU scheduling pressure and 0% memory pressure; peak
memory was unavailable.

### Changes
- Cache the test schema and share one Builder build artifact across ten
shards. Shard setup overlaps the build; each shard still starts an
isolated database.
- Keep real MCP and browser sessions alive for repeated Preview
submissions, and reuse generated Previews where checks can share one.
- Give independent cases separate projects and run them within the
existing shard workers. Keep exactly ten shards.
- Create content-mode fixture projects through the app's normal login
and project API, using its CSRF token. Dedicated UI project creation
remains in the Builder project fixture.
- Capture managed Form responses before fast redirects discard their
bodies. Fix drag targeting and unique drag fixture IDs.
- Report CPU and memory pressure for every shard. Allow the MCP browser
startup enough time under CI load. An earlier shard rebalance worsened
the run and was reverted; a measured two-file rebalance improved the
slowest shard without changing test logic.

### Verification and remaining work
Focused local runs passed for a single project, three projects sharing
one session, a paid-plan MCP project, and the MCP Preview form case.
Builder and Vision typechecks, lint, formatting, the ten-shard matrix
check, and Vision regression tests passed. All required workflows passed
on de2f4ed. The latest review fix also passed all 63 Vision tests,
Vision typecheck, lint, and formatting locally.

- [x] Profile the full suite and measure complete ten-shard CI runs.
- [x] Remove repeated UI project setup from the shared fixture.
- [x] Measure CPU and memory pressure in CI.
- [ ] Reduce Builder interactions, generated Preview work, and build
time enough to finish under 3 minutes.
- [x] Resolve five review threads and verify the affected paths.
- [x] Check authoritative Builder documentation; these test harness and
capture fixes do not change user-facing behavior or documentation.

CI still checks out and installs dependencies, builds Builder, uploads
and downloads its artifact, starts a database for each shard, and runs
real browsers and generated production Previews. Warm caches remove
downloads and schema generation, but do not remove setup, compilation,
browser work, or cache transfers. No product behavior or authoritative
documentation changed.
2026-11-15 17:10:10 +01:00
Oleg Isonen 207686a0d9 fix: Keep checkbox size stable on hover (#6698)
The checkbox’s hover border becomes visible over its transparent resting
border, making it look larger. This PR removes that hover border change
while preserving fixed dimensions, the dark-mode fill from #6697, and
the keyboard focus indicator.

- [x] Remove the hover border color change from the shared Checkbox.
- [x] Add a focused browser check that measures unchanged dimensions on
real hover.
- [x] Update the existing contrast test to expect the unchanged
transparent hover border; keep the focus indicator check.
- [x] Verify the old hover-border expectation fails and the updated
tests pass. Full design-system browser suite passes (288 tests).
- [x] Run focused browser tests, typecheck, lint, formatting, and diff
checks.
- [x] Review `docs/`; this internal visual adjustment needs no
documentation update.
2026-11-15 17:01:53 +01:00
Oleg Isonen 2969494b1e fix: Improve dark mode checkbox contrast (#6697)
The share popover’s checkboxes blend into dark backgrounds. The shared
Checkbox now uses a lighter fill in dark mode and keeps its existing
border treatment. Light mode stays unchanged.

- [x] Improve dark-mode checkbox fill using existing theme colors.
- [x] Preserve light-mode fill and original hover/focus borders.
- [x] Keep disabled checked and indeterminate marks visible against the
dark fill.
- [x] Add browser coverage for light/dark, checked, disabled, hover, and
focus states; verify the regression test fails before the fix.
- [x] Run focused design-system and Builder browser tests, both
typechecks, lint, formatting, and diff checks.
- [x] Review `docs/`; this visual change needs no documentation update.

CI note: Main workflow, lint, and submodule checks passed on the
previous revision. Visual regression exceeded its 7-minute timeout. The
updated revision is running CI now; focused browser tests pass locally.
2026-11-15 16:25:51 +01:00
Oleg Isonen 57e3a7e785 fix: remove Wrangler isbot import warning (#6695)
Wrangler warned that the generated Cloudflare server bundle checked for
an `isbot` default export that does not exist. The Cloudflare template
now uses the named export directly and keeps bot rendering behavior
intact.

No user-facing documentation changes are needed; this only changes the
generated Cloudflare server entry.

## Checklist
- [x] Trace the generated import to Remix's built-in Cloudflare entry
and use the supported `isbot` export.
- [x] Regenerate the Cloudflare fixture from the template.
- [x] Verify the Cloudflare production build no longer emits the
warning.
- [x] Run the focused prebuild test, fixture typecheck, lint,
formatting, and diff checks.
- [ ] Review the final diff and worktree for unrelated changes.
- [ ] Verify all required CI checks for the latest commit.

## Verification
- Cloudflare Remix production build passed.
- Wrangler Pages Functions build passed with unrelated, unbuilt
workspace packages externalized; the `isbot` warning was absent.
- Focused prebuild test, fixture typecheck, lint, formatting, and `git
diff --check` passed.
2026-11-15 14:59:01 +01:00
Oleg Isonen cdca13c755 fix: improve screenshot diagnostics and CSS validation (#6696)
## What changed

- Report a safe generated script path and line number, plus the saved
screenshot artifact, when a page exception makes screenshot capture
fail. Private routes and non-script files are omitted.
- Generate parenthesized `all` media conditions without extra wrapping
so publish validation accepts single and compound conditions.

## Verification

- CSS engine tests: 12 passed
- Publish validation tests: 54 passed
- Screenshot CDP tests: 62 passed
- MCP preview tests: 50 passed
- Typechecks, lint, and formatting passed

Fixes #6671
Fixes #6691
2026-11-15 14:58:05 +01:00
Oleg Isonen 35e77d845f fix: Omit 404 canonicals and ignore console logs in screenshots (#6685)
Generated 404 pages currently include a default canonical link in their
server response. Screenshot capture also fails when a page calls
`console.error`, even if Chrome reports no uncaught exception and the
PNG was saved.

This PR omits the default canonical on 404 pages and reserves screenshot
failure for uncaught page exceptions. It keeps the existing exception
and route-error checks.

Ref #6672
Ref #6671

## Tasks
- [x] Recheck the final diff for removable code and rerun focused checks
before merge.
- [x] Reproduce the 404 canonical in the reported published project and
add a regression that fails before the fix.
- [x] Test successful, dynamic 404, and generic 404 generated responses.
- [x] Check the reported published screenshot pages and confirm
`console.error` is distinct from an uncaught exception.
- [x] Update screenshot regression fixtures so navigation tests still
use real exceptions.
- [x] Review and correct the affected canonical documentation.
- [x] Run fixture generation and inspect its diff; retain only the two
generated route changes caused by this fix.
- [x] Run focused tests, full screenshot tests, full CLI prebuild tests,
MCP preview tests, typechecks, lint, formatting, and the CLI build.
- [x] Run the approved full Luna/low agent evaluations and record the
failures below.
- [x] Review the staged diff and push the fix.
- [x] Monitor required CI after the final simplification and resolve any
review comments.

## Verification
- CLI prebuild: 153 passed.
- Screenshot browser: 60 passed.
- MCP preview: 50 passed.
- CLI and vision typechecks, lint, formatting, CLI build, and fixture
pipeline passed.
- The new 404 and console-error tests failed for the expected reasons
before their fixes and passed afterward.
- Full Luna/low agent evaluations: 6 of 9 fixtures passed. The agents
missed native form mode, design-input, and Markdown references task
requirements. Baseline comparison was disabled because stored baselines
use a different model and reasoning effort. No baseline was changed.

## Limits
The reported 404 page did not regain a canonical after hydration in my
production browser check; the confirmed defect was in its initial HTML
response. The regression test covers generated HTTP responses, not
browser hydration. #6672 remains open for hydration verification. #6671
remains open for sanitized exception details, saved-artifact metadata,
and Windows timeout recovery.
2026-11-15 12:24:07 +00:00
Oleg Isonen b153fb3890 fix: Persist nested MDX heading edits (#6692)
Editing a heading inside a nested MDX template appeared in the canvas
but was lost after refreshing the Builder. Explicit line breaks in
copied headings also disappeared when text editing began, including in
Design mode outside Content Blocks.

This PR keeps Markdown block structure when serializing edits inside
nested named templates, preserves inline formatting inside headings, and
keeps existing `br` instances through text editing. Self-closing
template instances continue using their defaults.

Ref #6306

## Checklist
- [x] Reproduce the heading edit and refresh failure in the shared
project.
- [x] Add regression coverage for a heading nested through multiple
templates and verify it survives serialization and reload.
- [x] Add regression coverage for inline formatting in a self-closing
heading template; confirmed the test failed before the fix.
- [x] Preserve explicit `br` instances when entering and saving text
editing in either Builder mode; confirmed the test failed before the
fix.
- [x] Review the authoritative Content Block documentation; the existing
guidance already covers this behavior, so no documentation change is
needed.
- [x] Run the relevant tests, Builder typecheck, lint, and formatting
checks.
- [x] Review the final diff and worktree for unrelated changes.
- [x] Wait for the PR Builder compatibility endpoint before fixture
sync; fixture sync passed on Ubuntu and Windows.
- [x] Verify all GitHub checks for the latest commit.

## Verification
- Text editor interop and component tests: 21 passed.
- Builder typecheck, focused lint, formatting, and `git diff --check`
passed.
- The new line-break regression failed before the fix and passed after
it.
- Latest CI passed: Main workflow, visual regression, lint, and staging
fixtures on Ubuntu and Windows.
2026-11-15 11:07:56 +01:00
Oleg Isonen ab82a5b634 fix: Load marketplace thumbnails without scanning copied assets (#6688)
Marketplace items fail to load in Builder because the thumbnail lookup
times out. It filters by asset ID alone, and project copies reuse those
IDs. In production, 39 thumbnail IDs match about 113,000 asset rows
across projects. Database logs identify this exact PostgREST query as
the canceled statement.

## Change
- Fetch thumbnail names by exact asset and marketplace project pairs.
This lets PostgreSQL use the existing composite asset index for each
thumbnail.
- Fetch only the fields needed for thumbnail names, and match each
result to its own project.
- Keep the marketplace view and database schema unchanged.

## Checklist
- [x] Add a regression test that fails for the old lookup and copied
asset IDs.
- [x] Fetch thumbnails by exact project and asset pairs.
- [x] Run targeted tests, Builder typecheck, lint, and formatting
checks.
- [x] Review Builder docs. No update is needed because behavior and
instructions are unchanged.
- [x] Review CI results for the final commit.
- [ ] Required CI green. Visual regression is blocked by a repeatable,
unrelated color picker screenshot difference.

## Verification
- The new regression test failed against the old lookup and passes with
the paired filter. All six marketplace tests pass.
- A read-only production query using the current 39 thumbnail IDs and 40
project IDs took about 14 ms for the broad asset lookup and 1.7 ms for
exact pairs in a warm-cache comparison. The broad query returned 1,000
rows at its PostgREST limit; exact pairs returned 39. Query times vary
with load.
- The production Postgres log records 63 statement timeouts for the old
Asset query in the last 24 hours. The earliest visible event is November
12 at 12:33 UTC; this is only the available log window, not the
first-ever failure.
- All 39 thumbnails exist in their own marketplace projects. The
marketplace view still loads the 40 item records; this fix removes only
the broad asset lookup. The paired filter URL grows with the number of
marketplace items.
- Builder typecheck, targeted oxlint, oxfmt, and git diff checks pass.
No fixture inputs or outputs are affected. Agent evaluations were not
run because this does not change agent-facing behavior.
- [Main CI
workflow](https://github.com/webstudio-is/webstudio/actions/runs/43421159979)
passed all 23 jobs. [Visual
regression](https://github.com/webstudio-is/webstudio/actions/runs/43421159955)
failed on a 0.043% difference in the Design System color picker story
and failed identically on retry. This PR changes only the marketplace
server query and its test.
2026-11-13 16:03:40 +01:00
Oleg Isonen 26408a274e fix: Open projects with cyclic page folders (#6687)
Projects with a saved page-folder cycle currently fail to open. Loading
now repairs the cycle in memory and keeps its folders reachable. New
folder cycles are still rejected on save.

Closes #6686

## Change
- Visit the root folder first to preserve existing page paths. Remove
only child links that close a cycle.
- Visit detached folder trees before isolated cycles. Attach a repaired
tree at its top folder so its pages remain visible.
- Use one shared migration for current, serialized, and legacy page
data. Loading does not write to the database; a normal save persists the
repaired tree.
- This adds 49 net non-test lines. The folder traversal is needed
because the existing asset-folder repair handles database parent links
and writes to a different store.

## Checklist
- [x] Add regression tests for connected, detached, and self-referencing
cycles in current, serialized, and legacy data. Confirm they fail before
the fix and pass after it.
- [x] Confirm new cycles remain rejected on save.
- [x] Import the linked project's saved pages into an isolated local
Builder project and open the Pages panel. The recovered folder appears.
- [x] Review Builder docs. No update is needed: page-folder controls and
normal behavior do not change.
- [x] Review and simplify the repair. The final helper is seven lines
shorter and handles a cycle below a detached parent folder.
- [ ] Complete CI review for the final commit.

## Verification
- Passed: project-migrations tests, typecheck, and build; project-build
page tests and typecheck; Builder load-router tests and typecheck;
project build-patch tests; SDK page-schema tests; repository lint;
formatting and diff checks; fixture pipeline and a later fixture build.
- The linked project's saved page data has 23 pages after legacy
migration and two folders, including one self-reference. A local Builder
E2E opened those pages and displayed the repaired folder. Other site
content was synthetic because the share token cannot export the complete
build.
- Fixture sync pulled an unrelated remote change into two generated
files. Those changes were stashed and excluded from this PR.
- The approved full `pnpm evaluations` rerun exited 1: seven agent cases
passed, two failed in unrelated form or guidance checks, and baselines
were missing or incompatible. No evaluation files are included.
- The production project still returns HTTP 500 until this change is
deployed.
2026-11-13 01:24:41 +01:00
Oleg Isonen d08dbcf827 fix: Improve Advanced styles feedback and search (#6682)
Trying to change a source heading in Advanced styles now explains that
the heading identifies a style source. The centered Styles editor opens
the shared search controls from a header button.

### What changed

- Give protected source headings their own near-cursor message and
screen-reader announcement. Read-only declarations keep their existing
explanation.
- Keep search state and navigation with the shared style block editor.
The centered editor shows the controls in a popover, and Cmd/Ctrl+F
opens search from either editor.
- Start the centered search empty whenever the dialog opens. Local
declarations remain editable while searching.

### Checklist

- [x] Fix popover width, dialog-wide search shortcut, and query reset on
close
- [x] Show centered editor search in a header popover
- [x] Replace vague “mixed” names with StyleBlockEditor and style source
names
- [x] Clarify editor state and callback names
- [x] Use one style block editor for inline and centered views

- [x] Reproduce and fix source-heading feedback in inline and centered
editors
- [x] Reuse the inline search controls in the centered dialog popover
- [x] Verify navigation, Local editing during search, and empty search
on reopen
- [x] Review documentation impact: the existing Advanced guide already
describes search in the code editor; no wording change is needed
- [x] Run focused browser tests, Builder typecheck, lint, format, and
diff checks
- [x] Inspect the centered dialog in light and dark Storybook views
- [x] Required CI checks

### Verification

The 21 focused editor browser tests pass. New behavior tests failed
before the changes and passed afterward. Builder typecheck, focused
lint, formatting, and diff checks pass. The code cleanup also passed the
29 style block formatting tests. No fixture inputs or generated files
changed.

All required CI checks passed. One end-to-end shard initially failed
because Chromium did not start in its MCP fixture; that shard passed on
retry. The visual comparison showed only the intended search icon in the
centered editor header and passed after approval. Storybook screenshots
for the popover were skipped at the user's request.

### Known limitation

The existing shared SearchField has no explicit screen-reader name. This
PR reuses it unchanged in both views; adding new accessible copy needs
approval.

The header-click request in this issue was already merged in #6668.

Closes #6659
2026-11-12 15:47:50 +01:00
Oleg Isonen 9883a20742 feat: Show token suggestions on focus and reach Add more by keyboard (#6681)
Focusing the style source input now shows the available Tokens and Tag
style without an extra keypress. If the user closes that list with
Escape, it stays closed until they type or press an arrow key. Arrow
navigation in a style source menu can now reach the Add more input.

Ref #5657

### Implementation
- Open the existing combobox when its input receives focus. Focus on an
adjacent source button does not open it.
- Include Add more in the existing menu keyboard order, then move focus
into its input.
- No saved data, API, or migration changes. The production UI change is
seven net lines; it reuses the combobox and menu behavior.

### Checklist
- [x] Open suggestions on input focus and keep Escape behavior.
- [x] Reach Add more with arrow keys and type in it.
- [x] Add regression tests. Both new tests failed before the fix and
passed afterward.
- [x] Review documentation impact. Existing Style panel and Tag styles
guidance remains accurate; no docs change is needed for these keyboard
interactions.
- [x] Review fixture impact. No fixture input or generated output is
affected.
- [x] Verify: 13 focused tests, Builder typecheck, targeted lint and
formatting, and Storybook interactions in both themes.
- [x] Resolve review: moving focus from the input to a source button no
longer selects a highlighted suggestion. The regression test failed
before the fix and passes now.
- [x] Required CI checks pass on the latest commit.
2026-11-12 15:10:23 +01:00
Oleg Isonen 1910a267bb perf: Avoid rebuilding Navigator on first selection (#6680)
Selecting the first item on a large page rebuilt the whole Navigator,
even though the root was already open. On a 2,000-item test page, that
caused about 14,000 Navigator DOM mutations and recreated drag handlers
for every row.

The Navigator now expands only ancestors that can actually be collapsed.
The root stays out of the expanded set. A regression assertion confirms
that the first child selection keeps the existing flat tree.

The recurring selection still takes about 0.55 seconds in this synthetic
test. Its Navigator update touches only two rows, so this PR does not
claim to resolve that remaining cost or the full end-to-end report.

Ref #6678

## Plan and checks

- [x] Reproduce the first-selection tree rebuild and locate its cause.
- [x] Skip the always-expanded root when revealing selected ancestors.
- [x] Confirm the regression test fails before and passes after the fix.
- [x] Run nearby Navigator tests, Builder typecheck, formatting, and
lint.
- [x] Review documentation impact: the Navigator guide needs no change
for this internal performance fix.
- [x] Confirm required CI checks pass.
2026-11-12 14:57:03 +01:00
Oleg Isonen 6ecd460326 fix: Release custom domains after their last project link is removed (#6676)
Removing a custom domain currently leaves Cloudflare routing active.
This change releases the hostname before detaching its last project
connection. Failed Cloudflare cleanup keeps the connection so the user
can retry.

Ref #6674
Depends on webstudio-is/webstudio-saas#679, already deployed to
production.

No database migration is required. Concurrent additions, verification,
and removals of the same hostname remain outside this fix; there is no
shared lock across requests. Existing orphaned production hostnames
require separate approved cleanup.

## Checklist

- [x] Remove the migration, schema additions, SQL tests, and operation
locking.
- [x] Preserve last-connection cleanup, retry behavior, and shared
hostnames.
- [x] Verify regression tests, typecheck, lint, and formatting.
- [x] Review documentation impact: existing removal instructions remain
accurate; no user-facing copy change.
- [x] Push the simplified change and complete CI.
- [ ] Verify with a real custom hostname.

Local verification: 35 domain tests, domain typecheck, repository lint,
formatting, and diff checks passed. Five regression cases fail against
the original implementation. All CI jobs passed, including all ten
browser shards and visual regression. No fixture inputs or outputs
changed. No development or production database migrations were run. Live
hostname verification remains pending.
2026-11-12 14:38:25 +01:00
Oleg Isonen 8454113d31 fix: Restore Tag selectors and speed up selection (#6679)
The Builder was stalling when selecting instances because Tag selector
resolution repeatedly scanned and parsed project styles for every
displayed property. This PR indexes that data when styles change, reuses
style source suggestions, and avoids an unnecessary stylesheet rebuild
on multi-selection. It also restores the documented `:hover .button` and
`:hover > .icon` selectors, fixes their editing preview, and adds sharp
light and dark Tag styles screenshots.

Ref #5657
Closes #6678

### Plan and tools
- [x] Reproduce the selector rejection in shared validator and runtime
tests.
- [x] Restore one shared validation path for new and saved selectors.
Keep CSS parsing through css-tree.
- [x] Update Tag styles and States and selectors docs, navigation emoji,
and paired Storybook screenshots.
- [x] Measure the instance selection slowdown and remove repeated full
scans while preserving source order.
- [x] Audit the full selection path and reuse existing style indexes in
state matching and style controls.
- [x] Avoid redundant Tag CSS rebuild on multi-selection and test that
real preview styles still clear.
- [x] Fix descendant state previews for Token, Local, and Tag styles;
verify live Tag editing.
- [x] Run targeted tests, typechecks, lint, formatting, and inspect both
screenshot themes.
- [ ] Monitor PR checks and address failures.
- [ ] Approve the new Storybook baseline after user review.

Verification: CSS data 62 tests; project build styles 167 tests; Builder
style panel/model 113 targeted tests; canvas selection and styles 89
targeted tests; CSS data/project build/Builder typechecks; lint;
formatting. A local benchmark with 5,100 styles, 5,001 instance
selections, and 100 property reads fell from 99 ms to 6 ms for reads
after the second fix, plus 6 ms to build indexes when data changed. The
original repeated style scan measured 716 ms for 100 reads with no
instance selection map. These measure the affected calculation, not
total Builder selection time. Two older selection-time style scans
remain and cost about 0.1 ms each per 5,100 declarations in a synthetic
Node scan; their output ordering needs a separate check before changing
them. Previewing an unrelated Token or Local edit still rebuilds the Tag
stylesheet, an editing-time cost outside the reported selection path. No
fixture inputs or generated fixture bundles changed. Agent evaluations
were not run because they require separate approval.
2026-11-12 00:25:24 +01:00
Oleg Isonen ae5834867f fix: Match Share popover surface backgrounds (#6675)
## What changed

The Share popover’s saved-link rows used the page background while the
popover title used the floating surface. The rows now inherit the
popover surface, and the Storybook example includes the actual Share
title used in the Builder.

## Plan and todos

1. [x] Remove the saved-link row background override so it inherits the
popover surface.
2. [x] Update the Share popover story to include the real title.
3. [x] Review the Share popover in light and dark themes.
4. [x] Run focused tests, Builder typecheck, lint, formatting, and diff
checks.
5. [x] Review product documentation; no documentation change is needed
for this visual fix.

## Verification

- Share project browser tests: 11 passed.
- Builder typecheck passed.
- Focused lint, formatting, and diff checks passed.
- Reviewed Storybook captures in light and dark mode.

The change removes one production CSS declaration.
2026-11-11 20:58:11 +01:00
Oleg Isonen b0d7cc2e7b fix: Show scoped Tag colors on selected descendants (#6677)
When an H2 gets its color from a Tag selector on its container,
selecting the H2 can show black in the Style panel. The panel now shows
the matching color. A Token or Local style on the H2 can still override
the container's Tag selector.

## Plan and progress

- [x] Reproduce the selected H2 showing the container color instead of
its nested Tag color.
- [x] Give descendant Tag selectors the intended CSS specificity in
Builder and published CSS.
- [x] Include matching ancestor Tag declarations in the Style panel's
color calculation.
- [x] Cover the selected H2 and regular and atomic CSS output with
focused tests.
- [x] Review documentation impact and update the Tag styles and
selectors guides.
- [x] Match the panel's competing ancestor Tag rules to CSS breakpoint
and stylesheet order.
- [x] Match the editing preview's selector specificity to the saved
rule.
- [x] Use the descendant separator directly when detecting nested
selectors.
- [x] Allow the same supported selector forms in Tag, Token, and Local
sources.
- [x] Match global Tag descendant styles in the editing preview and
Style panel.
- [x] Document nested Tag selector examples in the Tag styles guide.
- [x] Explain supported selectors in Add more while its input is
focused.
- [x] Review and simplify nested state matching; preserve the entered
selector text.
- [x] Consolidate cascade declaration lookup and reuse the validated
selector parse result.
- [x] Align Builder and MCP selector entry with one validation rule;
preserve saved selectors.
- [x] Fix nested-selector source badges and preserve valid instance
selection.
- [x] Keep descendant conditions scoped to the matched element during
inheritance.
- [x] Match saved nested selectors regardless of tag casing or leading
whitespace.
- [ ] Verify both fixes, resolve review threads, and review CI.

The panel model needs ancestor matching because it computes styles
without querying the rendered element. The complete PR adds about 195
net non-test lines. The added work covers selector entry, active nested
states, and matching Tag rules in the panel; the saved CSS output
already supported nested tags. CSS generation uses `:where()` around the
container selector so the nested tag can override the global tag style
while the H2's own Token can override the nested tag style. No stored
data changes.

Checks passed locally: focused Builder style source, active state, panel
model, and canvas preview tests; CSS data and runtime tests; Builder,
CSS data, and project-build typechecks; lint, formatting, and `git diff
--check`. The focused Add more menu was checked in Storybook in both
themes. CI passed for commit `838cf4293f`; CI for `224f11e274` is
pending. The full Builder app suite was started but stopped after it
stopped producing results; the two affected suites passed independently.
This follow-up adds 67 net non-test lines to track matching states by
instance and match saved descendant selectors using the shared parser.
No fixture inputs or generated fixture outputs changed.

Ref #5657
2026-11-11 20:52:01 +01:00
Oleg Isonen 2b9ce760bb feat: Add global styles with Tag styles (#6666)
## What this adds

A developer can style an HTML tag once and have that style apply across
every page, including content imported into Content Blocks. The selected
element's matching **Tag style** appears first in Style Sources. Its
chip is temporary; its saved styles remain global.

## Plan and todos

1. [x] Add a distinct `tag` style source with a fixed tag and ID. Create
it on the first edit, without a migration or instance attachment.
2. [x] Emit Tag style CSS in the canvas and published output after
presets and before instance styles. Keep normal CSS specificity and
source order. Include global styles when collecting page assets.
3. [x] Show only the selected element's Tag style in the picker. Keep
its temporary chip first and fixed, and identify it in the property
source tooltip.
4. [x] Support scoped descendant tag selectors in ordinary tokens, while
limiting Tag styles to states of their own tag.
5. [x] Regenerate the runtime contract and cover CSS output, selector
validation, runtime updates, and style provenance with focused tests.
6. [x] Revalidate and version the eight stored fixture bundles for the
renamed source type, then rerun fixture checks.
7. [x] Use the raw lowercase tag name as the Tag style label, use a
singular picker heading, and fix scoped tag-state preview so only
matching descendants are highlighted.
8. [x] Let Global root select and edit the `html` Tag style with the
same temporary, fixed-first behavior as other tags.
9. [x] Name the feature Tag styles in the UI and code, and replace the
draft-only saved type and ID.
10. [x] Rebase onto `main`, keep the publish CSS validation integration
working, and move the PR to `5657.staging`.
11. [x] Review the new PR's CI and staging deployment.
12. [x] Make Tag styles discoverable through MCP, verify the existing
edit path, and add focused coverage.
13. [x] Update Tag styles product docs and add paired light/dark
screenshots.
14. [x] Pin the visual regression runner to supported Ubuntu and review
the visual diff.
15. [x] Make the selected Tag style source distinct from unselected
tokens in dark mode, review both themes, and refresh documentation
screenshots.
16. [x] Copy and paste Tag styles through the style source menu, merging
declarations into the matching tag with pasted values winning.
17. [x] Copy and paste Local styles into the selected instance’s Local
source, merge with pasted declarations winning, and share one
source-transfer command pair with Tag styles.
18. [x] Adjust the compact MCP schema size budget for the new source
type input, then rerun the CLI schema test and CI.
19. [x] Add Tag style to the shared design-system style-source color and
label variants, and use its shared color in the Builder.
20. [x] Restore the style source and input colors from `main`; use the
Slot global color for Tag styles in Builder and design-system variants;
refresh and review paired documentation screenshots.
21. [x] Monitor CI for `aba723fc0a` to completion.
22. [x] Address the four canvas cascade and live-preview review
comments, add focused regression coverage, and verify the Builder and
published CSS agree.
23. [x] Review documentation impact and monitor CI for the review fixes.
24. [x] Normalize the HTTP client paste-style-source result for Token
clipboard data, preserve paste-design-token, and verify both response
shapes.
25. [x] Use `tag` for Style panel items and verify the picker and menu.
26. [x] Check CI for the Style panel rename.
27. [x] Use `tag` across saved Tag style records, Builder items, and CLI
and MCP inputs and results. Keep existing Tag style IDs and the CSS
clipboard format.
28. [x] Regenerate runtime contracts and MCP docs, refresh fixture
bundle versions, and verify the updated schema, CSS, and transfers.
29. [x] Check CI for the saved style source rename.
30. [x] Fix Select option descriptions clipping in narrow menus, allow
wrapped descriptions to grow vertically, and review documentation impact
(no docs update needed).
31. [x] Fix marketplace consent checkbox vertical alignment and keep
checked and unchecked dimensions identical; add both states to Storybook
and review documentation impact (no docs update needed).
32. [x] Resolve Tag-style review comments for selected-state cascade
preview, active-state discovery, and html Tag CSS-variable clipboard
dependencies.
33. [x] Describe Copy for Tag styles, disable copying empty sources, and
keep the style source menu width stable while descriptions change.
34. [x] Increase the splash screen logo-to-progress gap by 8px in total.
35. [x] Align the style source menu to the chip’s left edge when space
allows, and determine Copy availability from all saved declarations.
36. [x] Keep arrow-key navigation inside the open style source menu so
it does not toggle the combobox.
37. [x] Move focus left and right across source chips, input, and Local
at the matching caret boundaries.
38. [x] Preserve instance-style precedence while previewing ephemeral
Tag-state edits.

39. [x] Synchronize temporary Tag style selection to the canvas so saved
Tag-state previews render.

40. [x] Keep the selected Tag style in autocomplete and ensure keyboard
events reach the combobox once.

41. [x] Show a 1px keyboard focus outline one pixel outside each style
source chip, and open the focused source’s menu with Arrow Down.

42. [x] Preserve Tag-state preview precedence across breakpoints and
include matching Tag states without requiring the temporary chip.

43. [x] Rename the autocomplete section labels to “Tag” and “Tokens.”

44. [x] Return focus to the input when Escape closes a style source
menu.

45. [x] Rename Tag style color recipe and design-system variant keys
from `tagStyle` to `tag`.

46. [x] Review and simplify style-source changes while preserving
keyboard behavior.
47. [x] Simplify style source menu alignment offset arguments to
numbers.

48. [x] Import React’s `KeyboardEvent` type directly without an alias.

## Deferred and blocked

- **Agent evaluations:** Repository guidance requires separate approval
before running them.

## Technical choices and compatibility

Tag styles use the same global purple and contrasting text as Slot
outlines. The style source field, inactive chips, and their hover
behavior match `main`; the earlier neutral color experiments in this PR
are superseded.

Tag styles are saved with `type: "tag"` and an ID such as
`tag-style:button`. Projects from released versions need no migration.
Draft development records with `type: "tagStyle"` are incompatible with
this revision. They emit CSS even when no instance uses them. Ordinary
tokens still need an instance selection and can target descendants such
as `.card p`. The CSS cascade decides conflicts; there is no custom
priority rule.

Token, Tag, and Local styles share the existing `copy-design-token` and
`paste-design-token` MCP/CLI commands. Copy accepts `styleSourceId` and
`sourceType` (`token`, `tag`, or `local`). The older `tokenId` input
remains valid. The CSS clipboard payload identifies the source type on
paste. Tokens still create a numbered copy. Tag styles merge into the
matching global tag, and Local styles merge into the selected instance’s
Local source, creating it when needed. Pasted declarations win for
matching properties, states, and breakpoints. All three share asset and
breakpoint transfer.

The original Tag style feature added about 435 net non-test lines. This
follow-up reuses the Token transfer path for Tag and Local styles and
adds no new MCP/CLI commands. Older clients that do not recognize the
new source type may need to update before editing a project that
contains Tag styles.

## Verification

- Imported React’s `KeyboardEvent` type directly; no alias is needed.
Oxfmt and `git diff --check` passed.
- Replaced `Pick<DOMRect, "left">` alignment-helper inputs with
`number`, and updated the existing focused assertion. Oxfmt and `git
diff --check` passed; tests were not run locally.
- Style-source simplification reviewed by a Sol medium subagent:
consolidated duplicate input arrow checks, removing 13 non-test lines.
Oxfmt and `git diff --check` passed; tests were not run locally.
- On `2a11120b69`: renamed Tag color recipe and Label/NestedIconLabel
variant keys from `tagStyle` to `tag` without changing colors. The focus
outline is 1px, offset outside the chip. Oxfmt and `git diff --check`
passed; CI is running.
- On `80803a5094`: moved the source chip focus outline one pixel outside
its bounds and return focus to the input when Escape closes its menu.
Oxfmt and `git diff --check` passed. Tests were not run locally; CI is
running.
- On `55681dda89`: formatted the keyboard handler with Oxfmt after CI
caught the line wrap; `pnpm dlx oxfmt@0.58.0` and `git diff --check`
passed. Tests were not run locally.
- On `3b00225d33`: arrow navigation now traverses source chips in both
directions, with the input between global sources and Local. `git diff
--check` passed; local tests were not run. No documentation update is
needed.
- On `256ad1e797`: increased the splash logo-to-progress distance by
another 4px (8px total from the original spacing). `git diff --check`
passed. No documentation or tests changed.
- On `4167ba4b85`: moved the keyboard focus ring from the inner label
button to the full source chip edge. `git diff --check` passed; local
formatting was unavailable because this worktree has no installed
`oxfmt` executable. No documentation or tests changed.
- On `4167ba4b85`: moved the keyboard focus ring from the inner label
button to the full source chip edge. `git diff --check` passed;
formatting was unavailable because this worktree has no installed
`oxfmt` executable. No docs or tests are affected.
- Passed on `3b4a2bc3ce`: style-source input tests (10), formatting, and
diff checks. The autocomplete section labels now read “Tag” and
“Tokens.”
- Passed on `bb2c60d3e4`: canvas style tests (65), formatting, and diff
checks. Tag state previews use lower selector specificity than instance
styles across breakpoints, and matching Tag states participate even when
the temporary Tag chip is absent. The full Builder typecheck uses a
local shared dependency tree with unrelated stale color-variable
declarations; CI is rerunning.
- Passed on `7bac6f25cb`: style-source input tests (10), formatting, and
diff checks. Keyboard focus now has a visible ring, and Arrow Down opens
the focused source menu, including on an unselected source.
- Passed on `11df83f889`: style-source input tests (10), formatting, and
diff checks. Arrow-key autocomplete now retains the selected Tag style
ahead of Tokens; the combobox key handler runs once per input event. The
local Builder typecheck has only the pre-existing shared color-variable
declaration errors; CI is rerunning.
- Passed on `10060fac6c`: sync-store tests (15), formatting, and diff
checks. Temporary Tag style selection now synchronizes to the canvas for
saved-state previews.
- Passed on `b775384f2f`: Builder canvas/style-source tests (75),
formatting, and diff checks. Ephemeral Tag-state edits now respect the
effective source reported by the style model when an instance
declaration overrides them. CI is running.

- Passed on `87d5f0529e`: style source input/menu tests (12),
formatting, and diff checks. Arrow-key focus moves between the input,
last global source, and Local source; open menu arrow keys no longer
bubble to the outer combobox. CI is running.

- Passed on `1e34af257f`: Builder style source menu tests (10),
formatting, and diff checks. Menu aligns to the chip’s left edge, with
viewport collision handling retained. Copy availability now checks saved
declarations across states and breakpoints. CI is running.

- Passed on `699bd8ee81`: formatting and diff checks. Increased the
logo-to-progress gap by 4px using the next spacing token. CI is running.

- Passed on `af8affb589`: style source menu browser tests (6),
formatting, and diff checks. Copy now has a focused description, is
disabled without declarations, and the menu keeps its 176px width when
the description changes. CI is running.

- Passed on `1485781bca`: focused HTTP-client tests (52), project-build
token-transfer tests (27), and Builder canvas tests (67); formatting and
diff checks passed. CI is running. Local HTTP-client typecheck passed.
Project-build and Builder typechecks could not complete because the
temporary shared `node_modules` links resolved workspace packages
incompletely; errors were missing package exports/dependencies and color
variable declarations.

- Passed on `bae690edc4` (with Select fix `b1e49b1cfd`): checkbox
browser regression (both states remain 14×14 px and align to the first
label line), design-system and Builder typechecks, focused lint and
formatting, and diff check. Reviewed the checked and unchecked Storybook
example in light and dark themes. Docs review found no user-facing
documentation change needed; no fixture inputs or outputs are affected.

- Passed on `b1e49b1cfd`: the focused Select description browser
regression passed in light and dark themes (2 tests); design-system and
Builder typechecks, focused lint and formatting, and diff check passed.
Reviewed the narrow Select dropdown story in both themes; the
description wraps without clipping. Docs review found no user-facing
documentation update needed.

- CI on `ba274d0dec` passed, including Linux and Windows fixture sync
and builds, staging and development deployments, and all ten Builder
browser shards. Shard 6 passed on retry after Chromium failed to start
in the original run. The approved visual rerun passed after comparison
with `6f2404d987` confirmed all 272 story results and all 549
screenshots were identical.

- Passed on `ba274d0dec`: focused SDK (14), project-build (353), Builder
(78), CLI (168), protocol (15), and HTTP-client (51) tests. Builder,
SDK, project-build, protocol, CLI, and MCP docs typechecks passed. The
HTTP-client typecheck passed with an unrelated local test edit excluded.
The SDK test for `type: "tag"` failed with the earlier schema and passed
with the updated schema. Generated contracts and MCP docs, focused lint
and formatting, package boundaries, and diff check passed. All eight
validated bundles use `bundle-1u9ug3c`, and all eight local fixture
builds passed.
- CI on `6f2404d987`: 34 latest checks passed and 4 were skipped,
including all ten Builder browser shards and the approved visual
comparison. The five previously approved visual differences had
identical screenshots.

- Passed on `6f2404d987`: 16 focused Builder browser tests, Builder
typecheck, focused lint and formatting, package boundaries, and diff
check. Only the Style panel item value changes. No documentation,
fixture, clipboard, or saved project changes.

- Passed on `aba723fc0a`: design-system and Builder type checks, focused
lint and formatting, package boundaries, and diff check. Restored main's
field and inactive source colors; Tag styles now use Slot's
`--background-accent-secondary` and matching foreground. Refreshed and
reviewed the paired light/dark source screenshots; the menu screenshots
were unchanged. All 51 check runs completed; the approved visual
comparison and all ten Builder browser shards passed. The earlier
unapproved visual comparison showed the intended color changes.
- Passed on `bd39fb09e5`: Builder typecheck, focused lint and format,
package boundaries, and diff check. The style source field keeps its
default 8% neutral fill while no longer following the theme
surface-contrast slider, so the track (4%), field (8%), chip hover
(about 10%), and selected Tag style (14% light / 22% dark) stay ordered.
The default-theme docs screenshots remain accurate; no documentation
text changed. All CI checks completed. The approved visual comparison
passed with the same six differences as the prior revision; all ten
Builder browser shards passed after two shards were retried for CI
Chromium startup errors.
- Passed on `5c782e8d09`: design-system and Builder type checks, focused
lint and formatting, package boundaries, and diff check. The shared Tag
color now drives the Builder chip and label variants. Documentation
review found no product behavior or screenshot change; the palette story
now shows Tag. All 49 CI check runs completed: the approved visual rerun
and all ten Builder browser shards passed. The initial unapproved visual
comparison reported the expected story changes before approval.
- Passed on `091dea695c`: Builder and design-system type checks, lint,
package boundaries, formatting, and Storybook inspection of idle, hover,
and selected sources in both themes. Refreshed the light docs
screenshot; the dark idle screenshot is unchanged.
- On `53826757d6`, CI completed: 43 passed, 5 skipped, and one
superseded visual run was cancelled. The approved visual check and all
ten Builder browser shards passed.
- Passed on `53826757d6`: design-system and Builder type checks, lint,
package boundaries, formatting, and paired light/dark Storybook
inspection. The light screenshot is unchanged; the dark screenshot was
refreshed.
- Passed on `50bc57eb70`: the focused 11-test CLI schema file,
formatting, and diff checks. The MCP handshake is 224,046 bytes with the
three source type options; the budget is now 224,500 bytes.
- Passed on `3c38222811`: focused runtime (270), Builder (3), CLI (5),
and HTTP client (51) tests; five package type checks; lint; package
boundaries; generated API and docs checks. The paired light/dark
screenshots were reviewed. Local fixture inputs and outputs are
unchanged by this follow-up.
- Passed: workspace type checks, lint, package boundaries, generated
contract regeneration, focused SDK/CSS-data/runtime/Builder tests,
token-transfer and copy/paste tests, all local fixture builds, and
fixture bundle tests.
- Passed: CLI prebuild suite (152 tests) and the 54-test publish
validation file after fixing its fixture.
- Blocked: remote fixture sync reports a bundle-version mismatch against
the development API. Agent evaluations require separate approval.

- Passed on `38d1705f8a`: Builder app, project-build, CLI, core, and
package CI suites; all ten Builder browser shards; Linux and Windows
fixture checks; visual regression; and staging/development builds. Oxfmt
and `git diff --check` passed locally. Local Vitest was unavailable
because this worktree has no installed `node_modules`.

Ref #5657

- Rebased onto `main` at `0589b18ce` and moved to `5657.staging`.
Focused checks, five package type checks, generated API, lint,
formatting, and package boundaries passed locally. On `9e38ff743b`, 38
CI checks passed, one was skipped, and visual regression found the
intended Tag style color change. Staging deployment and all ten browser
test shards passed. A focused Tag style story and paired light/dark
documentation screenshots were reviewed.
- MCP discovery and edit support passed focused project-build, protocol,
CLI, type, lint, and generated-doc checks locally. The missing runtime
cutover and HTTP client entries were fixed; both package suites now pass
on the latest commit.
- Tag styles docs now explain global application, temporary source
selection, states, and CSS cascade. Two paired screenshots show the
source and states menu; Storybook rendering, Builder typecheck,
formatting, and relative links passed. Visual regression now passes on
Ubuntu 24.04 with the reviewed change approved.

- On `a8a3c27423`, all 44 CI checks completed: 39 passed and 5 were
skipped. Visual regression and all ten Builder browser shards passed.

Replaces #6663.

- Review fixes on `f9af16d063`: canvas root presets now yield to `html`
Tag styles; responsive Tag styles no longer displace instance styles in
the style model; selected Tag states and descendant selectors update
during live edits. The existing Tag styles documentation needs no change
for these bug fixes. Builder focused tests (133), SDK CSS tests (11),
Builder typecheck, lint, formatting, and diff checks passed locally.
Each new regression test was verified against the old behavior. No
fixture inputs or outputs changed. CI completed on `f9af16d063`: 35
latest checks passed and 3 were skipped, including all ten Builder
browser shards and the approved visual check.
49. [x] Move the Tag and Token focus outline to the chip edge; no
documentation update is needed.
50. [x] Return focus to the style source input when Escape closes its
autocomplete; no documentation update is needed.
51. [x] Return focus to the style source input when Escape closes a
source chip menu; no documentation update is needed.
52. [x] Add a regression test that Escape in a style source chip menu
returns focus to the input; no documentation update is needed.
53. [x] Avoid duplicating an html Tag's own variables as root
dependencies when copying it.
54. [x] Exclude descendant selectors from active-state matching.
55. [x] Preserve Tag state preview specificity over base styles and
instance state precedence during saved and ephemeral previews.
56. [x] Restore the style source dropdown's default Radix placement from
main; remove the custom chip offset.
2026-11-11 02:41:53 +01:00
Oleg Isonen 112505e854 fix: Restore whole section header toggle (#6668)
Clicking a Style panel section title expands or collapses it again. The
chevron-only click target made the rest of the header inert.

This restores the full-width trigger in the shared section header.
Separate header controls and clickable property labels keep their own
actions. Other sections using this shared header regain the same click
target.

### Checklist

- [x] Restore whole-header toggling while preserving separate controls
- [x] Review documentation impact: the Style panel guide does not
describe a specific click target
- [x] Check the diff for unrelated changes and whitespace errors
- [x] Pin the visual-regression runner to an Ubuntu version supported by
the installed Playwright
- [x] Required CI checks

### Verification

`git diff --check`, PR lint, submodule checks, visual regression, and
the full main workflow passed, including all ten Builder end-to-end
shards. The first visual-regression run stopped before screenshots
because Playwright 1.50.1 cannot install Chromium on Ubuntu 26.04; the
pinned Ubuntu 24.04 run passed. Local tests and Storybook were not run.

Ref #6659
Ref #6638
2026-11-10 23:12:46 +01:00
Oleg Isonen 89ca46cd7f fix: Improve floating surface and menu selection contrast (#6670)
## Problem

Autocomplete suggestions were hard to distinguish in dark mode.
Dropdowns and dialogs did not have a clear depth order, and Select
opened against its trigger.

## Result

Floating surfaces become slightly darker in light mode and lighter in
dark mode. Select opens 4 px below its control. Highlighted rows, intent
colors, and disabled states remain distinguishable on the new surfaces.

The theme still uses nine live inputs. Shared color recipes and a
smaller CSS reader replace repeated calculations and authoring-policy
checks. Missing references, cycles, duplicate definitions, and selector
ownership are still checked during type generation. Components keep the
same generated semantic color types.

## Plan and todos

1. [x] Define floating surface levels from the existing theme colors for
both modes.
2. [x] Apply them to dialogs, menus, nested menus, popovers, commands,
canvas controls, arrows, and borders.
3. [x] Keep highlighted menu, command, and inset-list rows visible.
4. [x] Remove the Builder spacing popover's base-background override.
5. [x] Add Storybook examples for dropdown over dialog, canvas toolbar,
and badge.
6. [x] Add a 4 px gap to the shared Select used by Position and Display.
7. [x] Check primary, secondary, accent, error, and status contrast on
floating levels.
8. [x] Document the palette rule in the design-system color guide.
9. [x] Review the selected light and dark stories listed in earlier
validation. This was not an exhaustive UI-state audit.
10. [x] Run design-system tests, relevant typechecks, lint, formatting,
package boundaries, and diff checks.
11. [x] Fix the audit's text, destructive-control, style-source,
disabled-hover, and vivid-theme contrast failures.
12. [x] Review product documentation and fixture impact.
13. [ ] Monitor CI for the current commit and complete visual-difference
approval.
14. [x] Replace floating-only intent colors with shared semantic colors.
15. [x] Make InsetList selection follow its actual containing surface.
16. [x] Consolidate color recipes and contrast-pair definitions while
preserving rendered colors.
17. [x] Simplify CSS parsing and verify all nine theme controls in both
modes.
18. [x] Remove redundant declaration collection while retaining exact
validation behavior.
19. [x] Reproduce and fix the Grid generator contrast and CSS value
footer reports in real Storybook compositions, cover missing
open/hover/selected states in both modes, and record actual audit
coverage and remaining gaps.
20. [ ] Audit every Builder, Dashboard, and design-system interface in
light and dark mode: inventory components and reachable states, render
all stories, exercise
hover/focus/active/selected/disabled/open/error/loading/empty states,
add missing compositions, inspect screenshots and actual contrast, and
publish findings with evidence and unresolved coverage gaps.
21. [x] Soften floating-surface contrast in light and dark themes, align
the Grid generator's preview outline with its grid lines, and verify
focused stories, regression checks, and documentation impact.
22. [x] Make shared popover headers and bodies use one background color,
check Grid settings and other callers in both themes, add regression
coverage, and review documentation impact.
23. [x] Reduce the shared Grid generator and selector line contrast in
both themes, keep the preview outline matched, verify visibility and
Storybook states, and review documentation impact.

## Validation

Palette-refactor validation below applies to `07d11239f5`. The Storybook
coverage follow-up is `e38d25537d`.

- All 284 design-system tests passed, plus design-system typecheck,
focused lint, formatting, and diff checks.
- A Chromium comparison found identical rendered RGBA values for 1,312
samples across both modes and 16 theme configurations before and after
the recipe refactor.
- All 50 contrast contracts remain. The new theme-control checks cover
every generated public theme input in both modes.
- Deliberate temporary mutations confirmed the new checks fail when the
protected behavior breaks.
- Independent Astra reviews found no new defects. The final cleanup
matched exact outputs or errors for 167 valid and invalid parser inputs.
- Current parsed source output and generated token types are unchanged.
- Earlier Builder typechecks and package-boundary checks passed. This
refactor changes no public component API.
- No fixture inputs or generated fixture bundles are affected. The
design-system README was updated; the product Craft documentation still
matches the behavior.

The latest commit removes 342 net implementation lines, excluding tests
and documentation. The color parser is 152 lines, the stylesheet 253,
and the contrast helper 127. CSS still performs all runtime color
calculation; the parser supports type generation and Storybook.

All non-visual CI checks passed for this commit. The visual-regression
job was cancelled before producing its comparison report, so visual CI
is not complete. The visual approval label has not been applied.

## Visual coverage correction

The previous palette tests and selected screenshots did not establish
that every Builder interface and state had been inspected. The Grid
generator had no direct story, and the CSS fragment story did not open
the dialog or render its shortcut footer. Both reported defects were
reproduced in new open stories in light and dark mode. Both fixes are
verified locally and included in `e38d25537d`. Grid open, selected,
hover, preset-hover, and keyboard-focus states were captured; the CSS
dialog was captured normal and maximized in both modes. The grid's
weakest measured outline contrast is 3.176:1, up from about 1.1:1
against the panel. The footer no longer paints a base-surface strip
inside the floating dialog.

All 11 focused browser tests, Builder typecheck, six-file lint,
formatting, and diff checks passed. Temporary old-style mutations made
all four new light/dark regression cases fail; restoring the fixes made
them pass. Independent review found no remaining defects in these fixes.
Runtime code grows by five net lines; stories add 110 lines, including
shared-store setup and restoration for repeatable rendering. No fixture
bundles or product documentation are affected.

The follow-up adds 217 story cases, including actual dialogs, canvas
overlays, collection and resource loading/error states, confirmations,
and editor states. Stories use real components and local HTTP responses.
Builder and design-system typechecks, focused lint, formatting, and diff
checks pass. No published-project fixture inputs or generated bundles
are affected.

The broader contrast audit remains in progress. Its source inventory
covers 416 JSX interface files; the current Storybook scope is 427
stories in both themes. Render captures and interaction-state probes are
tracked separately. Confirmed remaining problems include error-page
heading contrast, collaborator labels, grid guides over different canvas
colors, position dots, keyboard hints, pressed secondary labels, editor
punctuation, and color-picker unit labels/surfaces. These findings are
not fixed by this commit. Task 20 remains open until the remaining
interactions and evidence review are complete.

CI for `bd1d6349bc` is running; task 13 remains open pending required
checks and visual review.

## Contrast follow-up

Floating surfaces are softer in both themes, especially light mode,
while keeping the intended light and dark surface directions. The Grid
preview outline matches its internal lines except during visible
keyboard focus. New browser regressions failed before the fix and pass
afterward in both modes. Storybook captures of the open Grid generator
and dialog with dropdown were reviewed in light and dark mode.
Design-system tests (284), focused Builder tests (2), both package
typechecks, focused lint, formatting, and diff checks pass. The Craft
docs and design-system color guide still describe this behavior; no
documentation or fixture input/output changes are needed. These changes
are included in `5558d2ab12`, and task 21 is complete.

## Popover surface follow-up

The Style panel passes its primary section background and sticky header
setting into portalled Grid settings. The shared floating panel now
marks its surface, and Builder sections inside it use the same floating
background as the panel title and body. The Grid settings Storybook
story reproduces the real Style panel context. New light and dark
browser regressions failed before the fix and pass afterward. Reviewed
Grid settings, a plain FloatingPanel, and a titled Popover in both
modes; direct Popover keeps its raised surface. Design-system tests
(284), focused Builder tests (4), both package typechecks, focused lint,
formatting, and diff checks pass. No product documentation or fixture
inputs/outputs change. These changes are included in `6839897bb2`, and
task 22 is complete.

## Grid line contrast follow-up

The shared Grid line mix is reduced from 75% to 60%
foreground-secondary. In Chromium, gray selector and preset-cell borders
now measure 2.323:1 in light mode and 2.550:1 in dark mode against their
cell fills, down from 3.134:1 and 3.415:1. The preview line measures
2.803:1 and 2.964:1 against its surrounding body surface; its outer
outline uses the exact same color. Selected and hover focus-color cues
remain unchanged. These gray strokes are softer and remain visible, but
their cell-border ratios are below the Craft guide's 3:1 target for
meaningful non-text graphics. The focused browser regressions failed
before the edit and pass afterward in both themes. Grid generator and
selector Storybook states were reviewed in light and dark mode. Builder
typecheck, focused lint, formatting, and diff checks pass. Product
documentation and fixture inputs/outputs are unaffected. This change is
included in `bd1d6349bc`, and task 23 is complete.
2026-11-10 23:10:16 +01:00