Commit Graph
2590 Commits
Author SHA1 Message Date
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 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 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 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 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 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
Oleg IsonenandCodex f30bdb7679 fix: Keep malformed styles from blocking publish (#6665)
Malformed saved CSS can stop a site from publishing. This restores
Vite's stylesheet pipeline with Lightning CSS and lets publishing
continue when generated CSS is invalid.

## What changed

- Save validation uses the shared CSS parser for touched declarations
and now rejects malformed style state selectors. The CSS editor already
reports malformed pasted declarations and omits them from saved styles.
- Publish skips older malformed declarations and warns without including
their values.
- Generated CSS is imported by Remix, React Router, and Vike, so Vite
processes the stylesheet and emits its asset.
- Before Vite runs, the CLI checks generated CSS with Lightning CSS and
esbuild. If the stylesheet cannot build, it warns and uses preset and
font CSS; if that also fails, it uses an empty stylesheet.
- The domain publish check parses the current project CSS and shows a
warning without blocking publish. The parser catches the malformed cases
reproduced with Lightning CSS and esbuild; the CLI's compiler check
remains the final guard. It skips malformed declarations just as the CLI
does. The early check reads assets and generates and parses CSS once
more per validation. Content Block styles created during publishing and
static template publishing are covered by the CLI fallback, but not by
this early warning.
- The temporary hashed public stylesheet path and its larger fixture
size allowances are removed. The direct PostCSS dependency remains
removed.

## Checklist

- [x] Restore Vite CSS imports with Lightning CSS in every site
template.
- [x] Keep malformed CSS from failing publish and warn when fallback CSS
is used.
- [x] Test the reported escaped property in React Router and Cloudflare
Remix builds.
- [x] Test malformed CSS recovery in React Router and Vike builds.
- [x] Verify the prerendered Vike page links to the generated CSS asset.
- [x] Regenerate fixtures and review the diff.
- [x] Review documentation impact: the existing publishing guide needs
no change for this warning in the publish flow.
- [x] Run CLI typecheck, lint, formatting, package boundaries, CLI
build, and frozen lockfile check.
- [x] Confirm CSS compiler failure cases with focused tests.
- [x] Validate CSS-affecting inputs at save, including style states that
bypass the editor picker.
- [x] Warn in domain pre-publish validation when current project CSS
fails compiler checks.
- [x] Verify pasted CSS diagnostics and save behavior in the editor.
- [x] Review the new diff and rerun relevant tests, typechecks, and
Builder build.
- [x] Remove the Builder runtime's native Lightning CSS dependency and
test the known compiler failure cases with CSS-tree.
- [x] Verify staging Builder and CLI workflows for the latest commit.
- [ ] Verify a site publish on staging with a project compatible with
this branch. The first attempt used a project with a style source type
this branch cannot read.
- [x] Reject CSS-tree recoverable parse errors in declaration validation
and add a regression test.
- [x] Keep project-build within its existing package entrypoints and
rerun the affected checks.
- [x] Monitor required PR checks to completion.

## Verification

Local: affected tests, four package typechecks, Builder and CLI builds,
root lint, formatting, package boundaries, and frozen lockfile check
passed. The fixture pipeline passed for the earlier commit; this commit
changes no fixture inputs or outputs. The new invalid-declaration
regression test failed when its filter was removed, then passed when
restored. The incomplete `rgb()` parser test failed before the review
fix and passed afterward. Full css-data and project-build test suites
passed. The Builder runtime uses CSS-tree for the early warning because
Vercel omitted Lightning CSS's native binary from the deployed function;
the CLI still runs Lightning CSS and esbuild during publishing. The
replacement staging deployment, fixture checks, both CLI R2 workflows,
main workflow, and all required PR checks passed.

Staging publish attempt: CLI sync stopped at `build.styleSources[520]`
before CSS generation. This branch accepts only `token` and `local`
sources; open PR #6663 adds `tagStyle` and the CSS generation it needs.
The failing record could not be read directly with the available share
token, so the exact saved type remains unconfirmed. Use a project
without Tag styles, or test a combined integration branch after an
explicit scope decision.

Replaces #6662.

---------

Co-authored-by: Codex <codex@users.noreply.github.com>
2026-11-09 18:02:11 +01:00
Oleg Isonen 1b9ae61fa1 feat: Copy and paste tokens across projects (#6660)
Closes #5727

Copy a design token from its menu and paste it into another project or
the style source input. Paste creates and attaches a new numbered token
(for example, `Button copy 1`). It carries all breakpoint styles,
referenced CSS variables, images, and fonts, and creates missing
breakpoints. MCP offers the same copy and paste commands; `instanceId`
attaches the token when supplied.

The clipboard format is CSS with one `@webstudio/token-css/v1` comment.
The old JSON format is removed. HTML and CSS use the same Webstudio
pragma parser, and token CSS reuses the existing CSS declaration parser.
Builder and MCP share token copy, parsing, paste, fragment asset import,
and asset reference remapping. The latest cleanup also reuses the
existing copy-name helper.

Repeated Builder pastes reuse the existing content-hash asset
deduplication path, including SVG and fonts. The source bytes still
download and hash on each paste. MCP downloads and uploads asset bytes
on each paste, using the upload path's deduplication; both projects must
use the same Webstudio origin for assets.

- [x] Implement CSS token copy and paste in Builder and MCP, including
selection attachment and numbered names.
- [x] Preserve breakpoint styles, variable dependencies, image and font
assets, and missing breakpoints.
- [x] Detect token CSS pasted into the style source input.
- [x] Remove the JSON transfer format and update Builder and MCP
documentation.
- [x] Reuse CSS parsing, asset transfer, naming, and existing upload
deduplication paths.
- [x] Resolve review findings, including shorthand variables and
selector state positions.
- [x] Verify focused tests, typechecks, lint, formatting, package
boundaries, and the approved Storybook visual check.
- [x] Trace existing CSS editor and HTML paste flows; reuse their
parser, declaration mapper, and CSS variable reference collector.
- [x] Preserve breakpoint cascade order when copying equal media
conditions; add a regression and resolve the review thread.
- [x] Share CSS variable traversal between collection and renaming;
preserve nested fallbacks and resolve the review comment.
- [x] Discover and remap image URLs inside raw variable fallbacks; share
the CSS value traversal and resolve the review comment.
- [x] Preserve fallback variables in mixed shorthands and custom
non-pixel breakpoint styles; add regressions and resolve review threads.
- [x] Preserve combined width and custom media conditions in token CSS;
add a regression and resolve the review thread.
- [x] Preserve range-syntax custom breakpoints in token CSS; add a
regression and resolve the review thread.
- [x] Preserve negated custom and width media conditions; add
regressions and resolve the review thread.
- [x] Preserve boolean operators between width conditions; add a
regression and resolve the review thread.
- [x] Monitor required CI checks for the latest commit.
- [x] Reuse the existing asset usage collector for copied token image
and font dependencies; verify token and asset usage tests.
- [x] Review documentation impact of this internal refactor (none; no
user-facing behavior or contract changed).

The reuse audit traced CSS editor, HTML paste, instance/page paste,
asset usage, and MCP from input to state change. Token copy now uses the
existing asset usage collector for image and variable-backed font
dependencies. CSS parsing, declaration mapping, variable traversal,
breakpoint matching, asset import/remapping, copy naming, and
Builder/MCP token mutation also have shared owners. Fragment insertion
may reuse tokens and merge overflow breakpoints; token paste must always
create a numbered copy and report overflow. The regex-based rename path
remains for arbitrary authored text; token transfer uses syntax-aware
rewriting to avoid changing text outside `var()`. The asset collector
refactor changes no user-facing behavior. The follow-up parser fixes
keep fallback variables, non-pixel breakpoint styles, and combined media
conditions, range syntax, negation, and width-condition operators intact
when copied. No documentation or fixture inputs changed. Focused token,
asset usage, HTML, and CSS parser tests, affected typechecks, lint,
formatting, package boundaries, and `git diff --check` passed. Agent
evaluations were offered and declined.
2026-11-09 15:10:49 +01:00
Oleg Isonen ee277769ff fix: Fix style panel layout border (#6661) 2026-11-07 12:03:52 +01:00
Oleg Isonen 44f0956579 fix: Address reported MCP failures and screenshot diagnostics (#6657)
A Form-only POST action was falsely reported as running when a page
renders. The security audit now uses the same resource-selection logic
as page generation, while still warning when the POST is also used for
page content. This PR also shows editors the actual Content-mode save
rejection instead of a misleading build-permission message. Patch
commits stop waiting after two minutes. A lost response leaves the
result uncertain and refreshes project state without resending the
patch; completed version conflicts retain the same-transaction
confirmation retry. Staging publish jobs now include the complete hosted
URL, so agents do not have to guess the publisher host. Screenshot
capture reports page JavaScript errors without including the page's
error text or script URL. SVG content edits now keep their image type
and dimensions; the reported HTTP 500 in #6615 remains unverified. It
does not change the shared-Slot rule that caused #6637.

Closes #6622
Closes #6620
Ref #6615
Ref #6637
Ref #6648
Ref #6635

The SVG revision fix changes one production line and reuses the existing
asset-type detector. Screenshot error detection stays tied to the active
page frame during navigation, so an outgoing page or embedded frame
cannot be blamed for the next capture. Script URLs are omitted because
their paths can contain private data or point to a logging call instead
of the fault.

## Tasks
- [x] Make timeout/reset commit handling safe when the original server
request may still be running; add a regression test.
- [x] Remove untrustworthy screenshot source locations; update
regression tests and PR claims.
- [x] Re-run focused checks, review the final diff, and monitor required
CI after the merge-safety fixes. All four required workflows passed on
`9d79ce052b`.
- [x] Reproduce the SVG revision type loss in #6615's workflow; preserve
image metadata and verify the uploaded bytes.
- [x] Keep the reported HTTP 500 open: the original asset was identified
from production data, but the failed PUT status/request ID is
unavailable, so this PR does not claim a fix.
- [x] Keep the approved generic screenshot error wording for #6635;
verify the focused test and required CI.
- [x] Reproduce #6635's missing JavaScript source location with a CDP
fixture, then remove path reporting after review found it could expose
private page data. Keep #6635 open for a safe diagnostic design.
- [x] Review documentation impact for the screenshot diagnostic. The
authoritative MCP guide documents screenshot inputs, not this error
output, so no docs change is needed.
- [x] Re-run focused tests, typechecks, and CI after the screenshot
change. All required CI workflows passed.
- [x] Reproduce #6620's initial connection reset and deadline failures,
then verify uncertain-commit handling without an unsafe resend.
- [x] Return the correct hosted staging URL for #6648; verify the
current origin against the reported project without republishing.
- [x] Check the other reports against production records and code paths;
keep unverified causes open rather than claim fixes.
- [x] Reproduce #6622 with a regression test that failed before the fix
and passed afterward.
- [x] Reuse the page-resource selection logic in the audit; cover an
independently rendered POST and a connected Content Block.
- [x] Reproduce the misleading Content-mode message with a failing test,
then preserve the specific reason after checking edit permission.
- [x] Review the authoritative docs; correct the native Form action
instructions and regenerate MCP docs.
- [x] Triage recent reporter issues: close #6634 as a duplicate of #6636
and #6630 as untestable without a project ID; keep the other
project/environment-specific reports open.
- [x] Run focused tests, typechecks, lint, package-boundary and
generated-doc checks. No fixture inputs or outputs changed.
- [x] Monitor required CI checks and fix failures. All workflows pass;
the visual test now hides its blinking editor caret.
- [x] Review the final diff and review threads. No unrelated files or
open review threads.
- [x] Run the approved full Luna/low agent evaluations and record the
failures below.

## Verification
- #6615: the SVG revision test failed before the one-line fix because
storage received `file` instead of `image`; it passes now with SVG
bytes, image metadata, and the same asset ID. All 314 asset-uploader
tests and its typecheck pass. Read-only production checks found the
original 4,292-byte SVG and later 4,457-byte replacement; both parse as
581×140 images, and no failed-update revision was saved. The original
HTTP 500 remains unreproduced, so #6615 stays open. No fixture inputs or
generated fixture outputs changed. The existing asset docs already cover
SVG editing; no docs change is needed.
- Audit: 41 tests pass (new test failed before the fix).
- SDK resource generation: 71 tests pass.
- Builder patch authorization: 10 tests pass (changed test failed before
the fix).
- Project-build, SDK, CLI, and Builder typechecks pass; lint and
package-boundary checks pass.
- Generated MCP docs are clean. All required CI workflows pass.
- #6620: the reset/deadline tests failed before the merge-safety fix and
pass now without a resend. HTTP client tests (50) and focused
project-session tests (55) pass, as do the Project Build, Vision, and
CLI typechecks, lint, and package boundaries. The patch request abort is
exercised with a simulated deadline; no production mutation was made.
- #6635: the published home page returned HTTP 200, produced a full-page
Chrome screenshot, and had no current page JavaScript error. A synthetic
Chrome page confirmed that both thrown exceptions and `console.error`
can yield a script URL, but the URL path is not safe or necessarily the
fault location. The capture now omits that URL while retaining
page-frame error detection. Focused Vision tests (60), CLI preview tests
(50), typechecks, lint, and package-boundary checks pass. The reported
page fault itself is not reproduced today, so the issue remains open.
- #6626: the reported published route now returns HTTP 404; the current
home page has no images and a full-page Chrome screenshot succeeds. This
does not recreate the image-heavy local preview or its DevTools
disconnect.
- #6648: the project’s reported staging builds are marked published; its
current `.wstd.io` origin returns HTTP 200, while `.wstd.work` returns
404. New staging URL tests failed before the change and pass after it,
including already-qualified and custom-only domains. Domain tests (17),
Builder API router tests (53), Domain and Builder typechecks, lint, and
generated API checks pass. The API still does not verify DNS at publish
time, so this issue remains open.
- Full Luna/low agent suite after the #6635 change: 6 of 9 fixtures
passed. Both Markdown blog fixtures again failed at screenshot
verification with `ENOENT`. The managed-Form authoring agent missed
template discovery, audit, and responsive evidence in this run; that
fixture passed in the previous run. The MDX fixture passed. The suite is
not claimed as green. Existing baselines use incompatible or missing
model settings and were not updated.

Connected MDX inside the same Form remains a conservative audit case:
the audit cannot inspect that document's resource references from
Builder state alone.
2026-11-06 21:41:06 +01:00
Oleg Isonen d9e3394c18 feat: Improve Advanced styles and CSS variables (#6638)
Closes #6470
Closes #4806
Closes #4392
Closes #4804
Closes #4616
Closes #4863
Closes #4912
Ref #1798

Advanced styles now uses a CSS block editor in the panel and a centered
editor. Local declarations are editable. Cascaded or inherited, preset,
and global declarations are grouped below them and are read-only. The
editor suggests properties and values, highlights search matches, shows
source details and color swatches, and previews valid local edits on the
canvas.

Keyframe CSS declarations use the reusable local block editor. The old
Add styles field, property-row editor, declaration menu actions, and
Navigator CSS Preview are removed.

### Delivery checklist

- [x] Edit and validate local CSS declarations, including shorthand
display and likely typo hints
- [x] Show other style sources with source colors, tooltips, and
read-only protection
- [x] Add search navigation, color swatches, and the centered editor
shortcut
- [x] Reuse the block editor for animation keyframes and preserve
transform controls
- [x] Preserve uploaded background layers when editing gradients or
reordering layers
- [x] Remove superseded editor and Navigator UI
- [x] Review and update the Style panel and Navigator guides
- [x] Remove the outdated CSS Preview sentence from the Builder anatomy
guide
- [x] Rename the stale Code view test title to match the Advanced editor
- [x] Regenerate fixtures and keep the Vercel build manifest through
regeneration
- [x] Resolve review threads and verify required CI

### Implementation notes

Styles remain stored as individual properties; equivalent shorthand text
is reconstructed for editing. Unknown property names become CSS
variables unless they resemble a known property, in which case the
editor warns and skips the typo. Editing is limited to the selected
local style block; read-only source groups remain visible for reference.
Existing uploaded image and hidden background layers are retained when
neighboring layers change. No schema migration is needed.

The Vercel manifest setting lives in the React Router template, so
fixture regeneration produces a clean worktree. The shared template also
generates the setting for the Docker fixture.

### Verification

On commit `7fb44d358`, both fixture checks, `check-size`, the main
workflow, all ten end-to-end shards, and the label-approved visual
comparison passed. The fixture regeneration, Vercel build, Builder
typecheck, focused lint, and formatting checks passed locally before the
final documentation and test-title cleanup; `git diff --check` passed
afterward. No local tests were run for the final cleanup, which changes
no behavior.
2026-11-06 12:52:33 +01:00
Oleg Isonen d4b5b328a4 fix: Resolve reproduced bugs reported on Discord (#6639)
## What this fixes

This PR fixes the bugs from #6633 that we could reproduce:

- Spacing reset no longer triggers canvas Delete; autocomplete selection
is readable in both themes.
- Breakpoint widths save on Enter or blur, without reordering while
someone types. Typed addresses no longer reuse an old history
suggestion.
- Redirect edits use saved project state, and unchanged old redirects do
not block unrelated edits. Client-side links now follow project
redirects, including sites with a custom 404 page. A new publish keeps
polling past an old failed build.
- Editors can open older projects and edit supported Markdown bindings
without changing protected styles or permissions. Older Code Text edits
now survive save, reload, and a later Builder visit; Editors cannot
replace Code Text bindings.
- Form writes are sent once per submission, even when a response fails.
Safe response redirects still work.
- Published pages and Builder Preview restore scroll without unwanted
smooth animation. Preview keeps smooth anchors, repeated anchors,
Back/Forward positions, and page entry animations.
- Large-page selection and paste avoid rerendering unchanged Navigator
rows and rescanning unchanged asset references. Keyboard focus now
follows a moved row when its new parent expands.

## Checklist

- [x] Third deep review: verify the pending legacy Editor permission and
remounted scroll-restoration fixes; simplify the 11 modified files and
deleted hook; demonstrate regression failures and passes.
- [x] Third review: review documentation and fixture impact; run
affected tests, typechecks, lint, formatting, and package boundaries.
- [x] Third review: commit only the pending changes, push to this PR,
review hosted results, and pass required CI.
- [x] Second deep review: check save permissions, redirects, scroll, and
UI state; fix reproduced problems and rerun affected checks.
- [x] Deep-review the full PR, simplify repeated code, fix verified
problems, and rerun affected checks.
- [x] Make project redirects work on client-side link clicks, including
sites with a custom 404 page; add a failing regression test, verify both
runtimes, and review documentation impact.
- [x] Reproduce the changed behaviors; show regression tests fail and
pass.
- [x] Check Editor, Preview, Navigator, Form, redirect, publish, and
theme behavior in focused tests and browser workflows.
- [x] Review the full diff for correctness, duplication, and needless
complexity. Simplify redirect validation and strengthen the cross-page
anchor test.
- [x] Inspect light and dark autocomplete screenshots and approve the
one intended new visual story.
- [x] Review documentation impact. Update the Form guide for uncertain
delivery responses; other changes restore expected behavior.
- [x] Complete independent review, package typechecks, lint, boundaries,
generated API/docs checks, and fixture build.
- [x] Run the approved full agent evaluation suite. Eight of nine
scenarios passed; the remaining evaluator and baseline limits are below.
- [x] Pass required CI on the earlier review commits; the third-review
head is tracked above.

## Implementation notes

Preview uses one navigation request between the Builder and canvas. It
records scroll before a page changes and restores it before entry
animations. Router keys are observed only in Preview. This adds 211 net
production lines because shorter approaches failed repeated anchors,
delayed navigation, and returns from Design. Navigator and focus changes
add 87 lines; the shared published-page hook adds 40. The earlier
cleanup added 427 net production lines; this review adds 43 net non-test
lines.

Legacy document bindings are normalized when loading a snapshot and
checking Editor capabilities. Older Code Text content is normalized on
reads without saving; the first edit removes its stale property in the
same version-checked save. Direct Editor patches cannot add or replace
Code Text expressions. Editor reads do not migrate the database.
Read-only bindings and template styles remain protected. No schema,
package, icon, or product copy changes are included.

The visual harness has an opt-in focus setting for the autocomplete
story. Its default blur behavior is unchanged. The test now mounts
scroll restoration after the route content, matching the production
Body; it checks an anchor found only on the destination page.

## Review follow-up

The review found two reproducible bugs. Older Code Text edited by an
Editor could be overwritten by the legacy `code` property on a later
Builder visit. A Navigator row moved into a collapsed parent could lose
keyboard focus. Both are fixed with regression tests. The review also
removed one duplicate parser, a repeated autocomplete color check, and
an unnecessary prop scan on page-only saves. The Remix scroll test now
mounts restoration in the same order as production.

The legacy Code Text test covers literal and expression content, direct
patch permissions, save retries, undo/redo, and Editor → reload →
Builder → reload. The local end-to-end test passed. The other focused
tests, affected package typechecks, lint, formatting, package
boundaries, generated API/docs checks, and fixture build passed. A
fixture sync picked up unrelated remote sitemap data; that generated
drift was removed from this PR. The full agent evaluation was not rerun
for this follow-up.

## Client-side redirects

The root loader now checks redirects when the path changes, even when a
custom 404 route matches. A generated yes/no flag in its own file avoids
extra navigation requests on projects without redirects; the browser
does not receive the redirect list. Projects with redirects pay for a
root-loader check on each path change. Query-only navigation keeps the
router's normal revalidation behavior. The new test reproduced the
custom-404 failure before the fix and passes afterward. Both React
Router and Remix templates, generated fixtures, typechecks, production
builds, and the redirect-settings browser test pass. Existing redirect
docs already describe this expected behavior, so no docs change is
needed.

## Performance

With 3,000 styled elements, median selection fell from 986 ms to 413 ms
in a controlled local browser test. Full page paste including save
measured 3.4 seconds afterward; the earlier run varied from 4 to 15
seconds, so that is not a reliable whole-paste speed multiplier.

Skipping an unchanged asset-reference rewrite reduced that isolated step
from 1,500 ms to 7 ms with 200 assets, 3,000 properties, and 12,000
styles. The browser still downloads and syncs project data, traverses
the tree, validates and imports assets, inserts content, renders, and
saves. Cross-project imports can still transfer assets.

## Second review follow-up

Changing a breakpoint from Min width to Max width (or back) now saves
the type and width together. A mixed Builder/Editor save now checks each
Editor change against the Builder changes before it, including older
Code Text bindings and changes to Content block boundaries. If an
earlier save fails, later entries do not run against a state that was
never saved.

A full page reload now restores its saved scroll position without
animating through the page. Client navigation still uses the existing
hook. The two early scripts add no network request; they run next to the
router's restore script, then restore the page's smooth-scroll setting.
A nonce on Body is passed to all three scripts. Rebuilding Editor
permissions costs a fresh scan only for mixed-permission batches;
all-Builder batches keep the fast path.

Focused checks passed: 40 patch authorization/save tests, five
breakpoint browser tests, two early-scroll browser tests, 12 router
navigation browser tests, four package typechecks, lint, formatting, and
diff checks. The real SSR test also passed with delayed hydration and a
nonce-only script policy, with no scroll animation or hydration warning.
The full agent evaluation was not rerun; the earlier 8/9 result and its
known evaluator limit remain unchanged. Documentation impact was
reviewed again; these changes restore expected behavior and need no new
user guide. On commit `b61c3aaf07`, the main workflow, all ten Builder
browser shards, lint, submodule checks, and the approved visual rerun
passed. The first visual comparison still records the already reviewed
autocomplete difference; its approval rerun passed.

## Third review follow-up

The pending changes close two Editor permission gaps. IDs hidden by
read-time Code Text normalization remain reserved, so an Editor cannot
reuse one to overwrite a protected saved prop. New Code Text accepts
literal content but cannot introduce expressions. A Builder can
deliberately replace a legacy prop and leave the replacement editable.

Scroll preparation now runs after the destination DOM is inserted and
before the router restores scroll. This preserves smooth anchors when
restoration remounts with a page. The shared component replaces the
separate hook. The navigation test now covers all six cases with and
without remounting, removing the duplicate remount setup. The patch adds
51 net non-test lines, close to the 50-line estimate; the extra state
records hidden saved IDs, and the extra component orders the three
layout effects.

Regression checks reproduced the hidden-ID overwrite, new expression
insertion, copied-prop ID reuse, and instant remounted anchor before the
fixes. They pass with the fixes. Local checks passed: all 2,677
project-build tests, 48 patch tests, the three SDK package suites
(including 219 SDK React tests with one existing skip and 46 React
Router tests), all five affected package typechecks, lint, formatting,
package boundaries, generated API/docs checks, and fixture regeneration.
Two Form tests timed out in the first parallel SDK run; both passed in
isolation, and the complete SDK suite passed with one worker.

Fixture regeneration used the existing local snapshots and downloaded
required assets; it produced no tracked fixture changes. Remote fixture
synchronization was not rerun. The Code Text, Content Block, share-link,
and Link docs already describe the intended behavior, so no docs change
is needed. The full agent evaluation was not rerun; its earlier 8/9
result and baseline limits still apply. A separate local model review
was unavailable. Hosted automatic code and security reviews completed on
`472dbc103e`; neither posted findings, and there are no unresolved
review threads.

Committed and pushed as `472dbc103e`. The [main
workflow](https://github.com/webstudio-is/webstudio/actions/runs/42071262279)
passed, including all ten Builder end-to-end shards, both
package/CLI/core/app environments, typechecks, lint, generated checks,
migrations, and size checks. Development preview fixture checks passed
on Ubuntu and Windows. The [visual approval
rerun](https://github.com/webstudio-is/webstudio/actions/runs/42071810156)
passed. Its initial run flagged only the previously approved
autocomplete story; all 267 stories were compared, with no other
differences. The story was unchanged by this commit, so its existing
approval was reapplied. The worktree is clean, and the remote branch
matches the local commit. The excluded issues and other worktrees were
not changed. No production deployment was initiated.

## Remaining follow-ups

- #6645: The measured asset-remapping slowdown is fixed here, but the
reported 30-second end-to-end paste remains unverified. Closed as not
planned until the reporter shares a reproducer.
- #6646: MCP can now inspect Global root defaults, but the reporter's
original AI run remains unverified.
- #5379: The broader proposal to remove the root grid remains open; this
PR fixes the narrower overflow bug #6070.
- #6644 was closed as not planned after local tests passed. The bad SSL
report and unrelated feature requests are outside this PR.

No shipped-fix announcement or production release is included.

## Verification

The previous commit passed the main workflow, all ten browser shards,
lint, submodule checks, and the approved visual rerun. The review commit
passed the main workflow, all ten Builder browser shards, lint,
submodule checks, and the visual-approval run. The initial visual check
flagged the already-reviewed new autocomplete story; the approval run
passed without a visual code change. An earlier browser run caught a
generated-file format change; the follow-up kept that format intact and
passed the same test. The full agent evaluation suite was not rerun for
this redirect follow-up; Oleg asked to run it once all remaining work is
fixed.

Local: 2,675 project-build tests, 1,522 Builder core tests (one existing
skip), 40 React Router tests, eight affected-package typechecks, lint,
format, boundaries, generated API/docs checks, and fixture build passed.
The earlier head also passed the Builder app, SDK, component, CLI,
Editor/Preview/Navigator browser tests. On the final commit, all ten
hosted browser groups, package and app checks, fixtures, migrations, and
the approved visual run passed. The first Builder core job hit its
seven-minute CI limit without an assertion failure; its single-job retry
passed. The first visual job listed the already reviewed new
autocomplete story; its approval rerun passed.

The complete Sol/high agent suite finished with **8/9 scenarios
passing**. The remaining native Form authoring evaluator rejects a plain
HTML action URL as though it were a managed Webstudio Action. That
fixture did not test actual browser submission, so no runtime claim is
made. The comparison gate remains non-green: five baselines use another
model and four fixtures have no accepted baseline. No baseline or
validator was changed to hide this.

The MCP Form result fix for #6640 is now included below. A fast redirect
no longer leaves MCP without the Form result. The older local source
failure helped reproduce this case.

Closes #6633
Closes #6640
Closes #2439
Closes #6642
Ref #6645
Closes #6641
Closes #6643
Ref #6644
Ref #6646
Closes #6647
Ref #5379
Closes #6070
Ref #980
Ref #4309
Ref #6573


### Consolidation of follow-up fixes

- [x] Include and verify the Resource body, expression Tab, and 404
starter fixes from #6649, #6651, and #6650.
- [x] Include and verify the root overflow, Navigator lag, and
asset-paste fixes from #6652, #6653, and #6654.
- [x] Include the Global root MCP inspection fix from #6655, with its
discoverable example.
- [x] Review `docs/` and fixture impact for the combined changes.
- [x] Pass final CI on the combined branch.
- [x] Close the superseded PRs after their changes were verified here.

The 30-second end-to-end paste report is closed in #6645 until the
reporter shares a reproducer. The original MCP agent outcome in #6646 is
still unverified. Oleg approved keeping the public MCP example. The fix
from #6656 is now included in this PR.

The combined branch passed 236 focused tests, Builder/SDK/project-build
typechecks, lint, formatting, package boundaries, generated API and
MCP-doc checks, and the fixture pipeline. The fixture sync fetched an
unrelated live-project change; rebuilding from the checked-in data
restored a clean worktree. All nine agent evaluation scenarios passed,
but the comparison gate remains non-green because saved baselines are
missing or use a different model. The [main
workflow](https://github.com/webstudio-is/webstudio/actions/runs/42090765144)
passed all jobs, including ten Builder browser shards. The [approved
visual
rerun](https://github.com/webstudio-is/webstudio/actions/runs/42091462930)
passed; its first run flagged only the already-reviewed new autocomplete
story. PRs #6649–#6655 were closed as superseded, with their changes
retained here.

### Final MCP Form consolidation

- [x] Include the tested MCP Form redirect fix from #6656 without
changing submission count or result limits.
- [x] Run focused Vision/CLI tests and review the combined diff.
- [x] Review `docs/` and fixture impact for this fix. The change is
limited to Vision's Form result capture and tests; no docs or fixture
update is needed.
- [x] Pass CI on the new combined head.
- [x] Close #6656 once its change is verified here.

The user clarified that all bug-fix PRs from this work should be one PR.
The MCP Form redirect fix belongs here too. The two Vision files match
#6656 exactly. All 121 Vision tests, Vision and CLI typechecks,
formatting, and the 59 focused Form capture tests passed. In the full
local CLI run, 1,304 tests passed and two unrelated tests failed under
parallel load; both passed in a single-worker rerun. The [main CI
run](https://github.com/webstudio-is/webstudio/actions/runs/42093902295)
passed, including all ten Builder browser shards. The [approved visual
run](https://github.com/webstudio-is/webstudio/actions/runs/42095225165)
passed. The initial visual run flagged only the previously approved
autocomplete story. #6656 is closed as superseded by this PR. No
production release was started.


### Large-project Navigator follow-up

- [x] Import the provided large project into an isolated local Builder
and measure selection-to-Style-Panel time with the tree expanded.
- [x] Measure Navigator scrolling and confirm whether the current scroll
path is native.
- [x] Fix only the reproduced bottlenecks, with regression checks that
fail before the change and pass afterward.
- [x] Review `docs/` and fixture impact; run focused tests, typecheck,
lint, and browser checks.
- [x] Open the fixed local Builder for Oleg's manual check, then pass
final CI.

This follows the original large-page Navigator report in #6641. The
separate 30-second paste report #6645 remains closed because it
describes a different action and has no paste reproduction yet.

The imported project has about 1,244 visible Navigator rows on the
measured page. With the tree expanded, selection took roughly 0.9–2.2
seconds before this change and roughly 0.5–1.3 seconds afterward in
local browser runs. Browser style recalculation fell from about 0.4–1.0
seconds to about 0.1–0.3 seconds per selection; times vary by run. The
Navigator now uses native scrolling and lets the browser skip layout for
rows off-screen. Horizontal wheel scrolling was restored and checked
after Oleg spotted a regression. A focused regression test failed before
the change and passes now. The Navigator tests, Builder typecheck, lint,
formatting, diff check, and local browser selection/vertical/horizontal
scrolling passed. The `docs/` guide and fixtures need no change because
the interaction stays the same. Oleg reports that performance feels good
in the local Builder. The [main CI
run](https://github.com/webstudio-is/webstudio/actions/runs/42103807815)
passed, including all ten Builder browser shards. One unrelated
design-system browser test timed out on the first run and passed on
retry. The [visual approval
run](https://github.com/webstudio-is/webstudio/actions/runs/42105155951)
passed after review of tiny Navigator text-pixel differences and the
previously approved autocomplete story. No production release was
started.


### Final review: Navigator drop marker

- [x] Reproduce the clipped marker with a focused regression test.
- [x] Keep the marker visible without losing off-screen-row performance.
- [x] Review `docs/` and fixture impact, run focused tests, typecheck,
lint, formatting, and browser checks.
- [x] Push this fix to the same PR and pass required CI.

The regression test failed before the fix (`auto` instead of `visible`)
and passed afterward. A sortable row now marks when it has a drop
target; only that row skips the off-screen containment rule, so its
marker can cross the row edge. Other rows retain containment. Navigator
and tree browser tests, both typechecks, lint, formatting, and diff
checks passed locally. The Navigator guide still describes the same
drag-and-drop behavior; no docs or fixture update is needed. This adds
two net non-test lines, matching the small-change estimate.


The [main CI
run](https://github.com/webstudio-is/webstudio/actions/runs/42109032555)
passed all 23 jobs. Two MCP Form browser shards first returned an
unexpected `unknown` form status, then passed on rerun without a code
change. The [visual approval
run](https://github.com/webstudio-is/webstudio/actions/runs/42109658799)
also passed. No production release was started.

### Drop marker color follow-up

- [x] Remove the white outline and white fill so the marker is blue with
a transparent center in both themes.
- [x] Add a browser regression check that fails before the fix and
passes after it.
- [x] Review `docs/` and fixture impact; run focused tests, typecheck,
lint, and formatting.
- [x] Push to this PR and pass required CI.

The old styles failed the new light/dark browser test because the line
had a white outline. After removing the outline and the white circle
backing, all 20 focused indicator/tree tests pass. Design-system
typecheck, lint, formatting, and diff checks pass. The Navigator guide
describes behavior, not marker colors, so docs need no update. No
fixture input or output changes.

The [main CI
run](https://github.com/webstudio-is/webstudio/actions/runs/42115118863)
passed all 23 jobs. Three MCP Form browser shards first returned an
unexpected `unknown` status and passed on rerun without a code change.
The [approved visual
run](https://github.com/webstudio-is/webstudio/actions/runs/42115696559)
passed after GitHub cancelled its first attempt. The intentional
indicator difference and the two previously reviewed Navigator text
differences were approved. No production release was started.

### MCP Form status follow-up

- [x] Review the old first-attempt failures and compare the new
first-pass Form CI results; the old reports did not expose which layer
failed.
- [x] Stop masking pre-submission browser errors as uncertain Form
outcomes; confirm the regression test fails before and passes after.
- [x] Review `docs/` and fixture impact; run focused tests and package
checks.
- [x] Push the fix to this PR and pass required CI.

The CLI had returned `unknown` for every browser error, including
startup failures before any Form submission. It now lets those errors
surface. The browser observer still returns `unknown` if a submission
may have happened, and neither path retries it. This removes 8 net
production lines. The regression test failed before the fix and passes
afterward. All 50 CLI preview tests and 59 Vision browser tests passed,
as did CLI/Vision typechecks, lint, formatting, and the diff check. No
docs or fixtures changed. The approved full agent evaluation ran: 8/9
scenarios passed; the existing managed-Form authoring `contactPage`
check failed, while the Form runtime scenario passed. The comparison
gate is also non-green because saved baselines are missing or
incompatible. Commit: `a2ff0822ad`. The intermittent CI cause still
needs a first-attempt check.

[Main CI on the new
head](https://github.com/webstudio-is/webstudio/actions/runs/42123770480)
passed all jobs, including all ten Builder browser shards on their first
attempt. The Form-heavy shards 1, 5, 6, 9, and 10 passed. The [approved
visual
run](https://github.com/webstudio-is/webstudio/actions/runs/42124446769)
passed; its initial run showed only the four previously reviewed UI
differences, none from this CLI-only patch. The older flaky `unknown`
results cannot be attributed to startup versus post-dispatch observation
from their logs, so this fix addresses a proven masking bug and adds
regression coverage, but does not prove every possible intermittent
observer failure is gone. No production release was started.
2026-11-06 00:19:21 +01:00
Oleg Isonen 6bfc8a80a7 feat: Allow owners to use Content mode (#6619)
A Free project owner could not switch to Content mode directly, but
could open a free Builder share link and use Content mode there. Owners
can now use the switch on any plan. Share-link visitors can use it only
when the project plan includes Content mode.

## Changes

- Keep Content visible in the mode menu. When it is unavailable, disable
it and show a Pro badge instead of the shortcut.
- Let project owners use Content mode on any plan.
- On Free projects, disable Content mode for every share-link
permission. A Content-only link opens in Preview; a Builder link still
opens in Design.

## Checklist

- [x] Keep the Content menu row visible and test its badge and shortcut.
- [x] Update the permission rule and tests for Free owners, Free share
links, and Pro share links.
- [x] Verify a Free Content-only link falls back to Preview mode.
- [x] Review Builder docs. The Modes guide already says owners can try
Content mode, and the Share links guide says Content-only links require
Pro. No copy change is needed.
- [x] Run focused tests, Builder typecheck, and lint after the
permission change.
- [x] Review the non-test diff for redundant code.
- [x] Set a paid plan only in E2E tests that open Content mode through
an Editor share link. Keep unrelated fixtures on their original plan.
- [x] Fix the Design-mode fallback for Free Content-only links and add a
regression test.
- [x] Confirm required CI checks pass on the latest commit.

## Verification

- Builder typecheck: passed.
- Oxlint on changed code: passed.
- Focused tests: 66 passed across mode, permission, and state suites.
The two new Design-entry cases failed before the fix.
- Latest-commit CI: Main workflow, Visual regression, Check submodules,
and Lint PR passed. Every E2E shard passed.
- Manual Storybook screenshots were not run because approval was not
received.

## Known limit

The Share dialog blocks Content-only links on Free plans. Token creation
and update do not enforce that plan limit on the server. This PR
controls which Builder mode a share-link visitor can enter; it does not
change token issuance.

Closes #6618
2026-10-28 23:36:18 +01:00
Oleg Isonen 283929bb49 fix: Make Form progress text editable (#6617)
A new Form’s Progress message shows “Submitting…”, but Builder cannot
edit that text because it sits directly beside the nested byte summary.
The template now gives the message its own Span. Adding an element to an
existing text container also wraps its existing text, using the same
guard for Builder and MCP insertion and Builder moves.

Closes #6616
Ref #6605
Ref #5992

## Plan

- [x] Reproduce the new Form structure through template, Builder, and
MCP insertion.
- [x] Give the submission text its own editable element while preserving
the bound summary.
- [x] Add Form regression tests, update docs, and verify the first
change.
- [x] Reproduce insertion into an existing text container through the
shared runtime and MCP.
- [x] Share destination-parent normalization across insertion and move,
preserving authored fragment internals and replace behavior.
- [x] Add regression coverage for editable text, rich text, undo, and
insertion results.
- [x] Review documentation impact of the shared guard.
- [x] Run targeted tests, typecheck, lint, and applicable broader
checks.
- [x] Confirm required CI for the final commit.

## Scope and compatibility

The guard acts on existing content in the destination parent when
inserting an element. It does not rewrite descendants inside the
inserted fragment, so intentionally mixed rich text remains as authored.
Indexed replacement wraps surviving text; full replacement leaves no old
wrappers. Generated spans and the parent rewrite are committed together,
so undo and redo restore the original structure. Existing saved Forms
keep their structure; no migration is included. The submission wording
and bound byte summary stay the same.

The shared runtime change adds 88 net non-test lines, above the 45–65
line estimate. The extra lines cover the two position formats used by
moves and insertions, atomic parent patching, indexed replacement,
generated ID checks, and insertion results. No schema, package, or
production data changes.

## Verification

Local: project-build 2,667 tests passed; Builder insertion 45 tests
passed; project-build and Builder typechecks passed; targeted oxlint,
oxfmt, and git diff checks passed. An independent Astra review found no
blocking defects. Agent evaluations require separate approval and were
not run. Required CI for the final commit passed: 35 successful checks
and one skipped check. Builder end-to-end shard 8 failed once during
generated Preview submission with status “unknown”; its targeted rerun
passed without source changes.
2026-10-28 19:26:29 +01:00
Oleg Isonen c9f6435aba fix: Allow ECMAScript module asset uploads (#6613)
A `.mjs` file currently fails to upload with HTTP 500, so the CLI
retries the same unsupported format and reports a retry-exhausted error.
This PR lets people upload ECMAScript modules as JavaScript assets.
Files with unsupported extensions now get HTTP 400 and the CLI does not
retry them.

Closes #6612

The existing asset-type registry now includes `.mjs` with the same MIME
type and editor as `.js`. Filename validation uses a typed error so the
Assets API can return 400 without inspecting error text. Transient
server failures still retain the existing retry. The upload still
transfers the file and checks its size and content; this change does not
remove those costs.

- [x] Reproduce the `.mjs` rejection locally and show new tests fail
before the fix.
- [x] Accept `.mjs` in upload detection, serving MIME lookup, and the
Assets panel Code filter.
- [x] Return HTTP 400 for unsupported extensions.
- [x] Stop the CLI after a non-retryable upload response. The regression
test failed with two requests before the fix and passes with one
afterward; HTTP 500 still retries.
- [x] Review documentation impact and add `.mjs` to the authoritative
Assets guide. The retry behavior needs no further docs change.
- [x] Verify fixture impact: no fixture asset has format `mjs`; no
generated fixture input or output changes.
- [x] Run focused tests (SDK 133, asset uploader 8, Builder Assets API
23), then full SDK (910) and asset-uploader (313) suites.
- [x] Run SDK, asset-uploader, Builder, project-build, and HTTP-client
typechecks; lint, package-boundary check, formatting, and diff check.
- [x] Verify required CI checks after the retry fix: main workflow
(including all ten Builder E2E shards), visual regression, staging
build, lint, and submodule checks passed.

The reporter’s exact package file was not available. The regression uses
a small valid `.mjs` file and verifies the same upload-validation path.
The full agent evaluation suite was not run, as requested; focused tests
were used instead.
2026-10-27 14:32:28 +01:00
Oleg Isonen 9a8ae2dc8f feat: Customize Form progress feedback (#6606)
Closes #6605

New Forms show editable feedback while Resource actions run. The
`formProgress` variable starts with `status: "idle"`, `loaded: 0`,
`total: 0`, and `files: []`. It becomes pending during submission, then
returns to idle. The existing `formState` still reports only initial,
success, or error.

The Progress container says “Submitting…” and adds measured
whole-request bytes when the total is known. Files include ID, field
name, name, size, and type. The browser cannot measure reliable per-file
transfer bytes in the single multipart request. The binding editor
suggests one example file to reveal those fields; the example never
enters the actual Form value. Saved Forms retain their existing bindings
and submission message.

## Checklist

- [x] Keep the existing Form outcome variable and add upload activity,
byte counts, and file details.
- [x] Show zero byte defaults on insertion, new submissions,
cancellation, and Preview reset without fake runtime files.
- [x] Suggest file fields in Form and Resource bindings while
evaluation, reset, rendering, and stored values use real data.
- [x] Preserve Builder Preview headers, authentication, response checks,
and cancellation.
- [x] Keep existing success/error feedback and saved-Form fallback.
- [x] Reset external progress when an active published Form unmounts.
- [x] Update Form, Variables, and MCP/CLI guides; clarify the older
screenshot and final-only simulation. Generated MCP docs check passes.
- [x] Audit Form and Variables docs against final progress behavior;
clarify the older Variables screenshot.
- [x] Cover lifecycle, transport, repeated submission, cancellation,
unmount, Preview, template, MCP binding/style, and editor completion
with focused tests.
- [x] Run relevant typechecks, lint, formatting, fixture generation, and
independent review.
- [x] Required CI checks pass on the latest commit.

## Verification

Local focused Form browser tests (25), Form template tests (12), Builder
Preview and Form context tests (14), and mounted editor example/reset
tests (6) pass. Builder, SDK React, SDK registry, and project-build
typechecks pass, as do lint, formatting, and fixture generation. The
fixture sync regenerated two unrelated linked-project site paths; those
outputs were restored before commit. Independent review found no
remaining issues. All latest-commit checks passed; E2E shard 9 passed on
a targeted rerun after its two Form tests also passed locally with 11
related tests.

This follow-up adds 162 net non-test lines, more than the initial
estimate. The extra code identifies the actual callback-bound variable
by ID, even when renamed, and gives autocomplete a separate example
scope so it cannot affect actual values. One provider covers Form fields
and Resource editors. No schema or package was added.

The existing Variables screenshot predates `formProgress`; its
explanatory text is current. The React Router fixture's built browser
client grew by 4 KiB on Linux CI (376 → 380 KiB), and its checked limit
matches that measured output. Multipart transfer remains one whole
request.

Browser submission supplies live progress. MCP can discover
`formProgress`, bind the Progress container, and style it; server
simulation reports final outcomes and does not measure browser uploads.
2026-10-26 14:38:12 +01:00
Oleg Isonen 59e0e1111f fix: Publish uploaded fonts used through CSS variables (#6604)
## What changes

Uploaded fonts used through CSS variables now reach the published site.
Previously Builder could render them, but publishing filtered them out
and emitted no `@font-face` rules. This fixes root font variables used
by body and heading tokens with either quote style. The asset manager
also protects those uploaded fonts from being deleted as unused.

Closes #6603

## Implementation

The published bundle follows variables used by `font-family`, parses
their values as font stacks, and handles nested variables without
looping on cycles. Asset usage now uses the same lookup, records each
referring style, and counts every uploaded weight in a family. Replacing
a font used through a variable is blocked because the variable value
cannot be rewritten by the current asset replacement path. Visitors
still download each font file that the page uses; this change makes
those files available rather than falling back to system fonts.

## Checklist

- [x] Reproduce missing font assets in a published project bundle.
- [x] Keep uploaded fonts referenced by root CSS variables and heading
tokens.
- [x] Verify both single and double quotes; exclude unrelated fonts.
- [x] Verify regression tests fail before the publishing fix and pass
afterward.
- [x] Keep fonts referenced through CSS variables out of the
unused-assets list and block deletion.
- [x] Protect every uploaded weight in a used family and block unsafe
font replacement.
- [x] Verify the asset-usage regression tests fail before each fix and
pass afterward.
- [x] Run targeted Builder, project-build, SDK CSS, and CLI prebuild
tests.
- [x] Run Builder, project-build, and CLI typechecks, lint, formatting,
and diff checks.
- [x] Review `docs/`: existing custom-font and CSS-variable guides
already describe the supported behavior; no text change is needed.
- [x] Check fixture inputs and outputs: no fixture contains font
variables, so regeneration is not needed.
- [x] Push the tested changes.
- [x] Monitor required CI checks and fix any failures.

- [x] Simplify font family collection and asset usage without changing
behavior.
- [x] Re-run focused tests, typechecks, and CI after the cleanup.

The cleanup removes a second per-style deduplication map. The collector
now reports each family once per declaration. Production code shrank by
four net lines; the remaining callback and variable map preserve each
style's usage and protect asset deletion and replacement.

- [x] Fix the fixtures diff check after submodule setup moves to current
main.
- [x] Verify the check still catches generated files and edits inside
the submodule.
- [x] Push the CI fix and monitor both PR and push workflows.

## Verification

- Before the publishing fix, both quote variants produced an empty font
asset list in the published bundle. Afterward, both include Inter and
Playfair Display while excluding an unused uploaded font.
- Asset usage tests failed before the follow-up fix for both quote
styles, repeated references, multiple uploaded faces in one family, and
unsafe replacement. They now pass.
- Project-build asset and style utility tests: 95 passed.
- Builder bundle tests: 11 passed.
- CLI prebuild tests: 141 passed.
- Builder, project-build, and CLI typechecks: passed.
- Changed-file lint, formatting, and `git diff --check`: passed.
- Local agent evaluations were not run because they require separate
approval.
- CI: Lint PR, Check submodules, Visual regression, and Main workflow
passed. One unrelated Form E2E test failed on its first run; shard 10
passed on rerun.
- Cleanup checks: 95 project-build tests, 11 Builder bundle tests, and
141 CLI prebuild tests passed. Project-build, Builder, and CLI
typechecks, changed-file lint, formatting, and diff checks passed.
- Cleanup CI: Lint PR, Check submodules, Visual regression, and Main
workflow passed; all ten Builder E2E shards passed.
- CI fix: a local Git reproducer confirmed pointer movement passes while
tracked changes in the parent or submodule fail. YAML parsing and `git
diff --check` passed. The staging push workflow, Linux and Windows
fixture jobs, and all PR checks passed.
2026-10-25 19:46:53 +01:00
Oleg Isonen 659e953869 fix: Preserve transitions and animation preview behavior (#6602)
Transition variables no longer get copied into unrelated timing fields.
Generated Text/Stagger animations use the saved `slidingWindow` prop,
while older `charWindow` configurations still work. Easing moves in the
expected direction. Windows preview-install reports include the process
failure code when available.

Closes #6598
Ref #6593
Ref #6599
Ref #6594

The animation runtime lives in [sdk-components-animation
#38](https://github.com/webstudio-is/sdk-components-animation/pull/38).
The private PR is merged; this PR points to its merged commit. #6593 was
tested on its exact saved project in headless Chromium and closed as not
reproducible; the confirmed prop leak is fixed here. #6594 was closed
after a documented local repro attempt; this PR improves the next
report.

## Work

- [x] Reproduce the transition bug; add regression coverage in parsing
and generated CSS.
- [x] Preserve unresolved `transition` shorthands for the browser to
resolve.
- [x] Keep old `charWindow` values working in Text and Stagger
animations, with a red/green regression test in the linked private PR.
- [x] Reproduce and fix the saved animation prop mismatch in generated
helpers.
- [x] Verify text/stagger easing in unit tests and Chromium/Firefox.
- [x] Add safe preview-install process details for future Windows
reports.
- [x] Update Builder property help and both animation docs pages.
- [x] Run focused animation tests, typecheck, lint, package build, and
animation fixture build after the compatibility fix.
- [x] Point the animation submodule to the merged #38 commit.
- [x] Verify required CI on the final commit (all workflows passed; one
unrelated E2E shard passed on rerun).
- [x] Find the production share token and build #6593’s exact project
with its reported 0.307.0 packages.
- [x] Compare intermediate scroll styles on #6593’s exact project.
Visible targets animate in both builds; the leaked attributes disappear
with this fix.

Known limit: the reported static-target symptom in #6593 and the Windows
environment in #6594 were not reproduced. The confirmed animation prop
leak and reporting gap are fixed, without claiming the unreproduced
symptoms are solved.
2026-10-25 19:12:25 +01:00
Oleg Isonen 9feb53248c feat: Explain an empty Content mode Navigator (#6601)
## Problem and result

A page without a Content Block leaves the Navigator blank in Content
mode. The approved warning now explains how a designer can make page
areas editable.

Closes #6600

## Checklist

- [x] Show the warning only when a selected page has no visible Content
Block in Content mode.
- [x] Keep the warning out of Design mode, loading states, and pages
with a Content Block.
- [x] Add a focused regression test; it failed on the missing warning
before the fix and passed afterward.
- [x] Keep the regression test independent of incidental warning copy.
- [x] Run the relevant Builder tests, typecheck, lint, formatting, and
diff review after the test update.
- [x] Review the authoritative `docs/` content. The Content Block guide
already explains how designers set up editable areas, so no
documentation change is needed.
- [x] Verify required CI checks to completion after the test update.

## Implementation notes

The Navigator uses its existing visible tree state and a warning
PanelBanner. No data model, migration, fixture, or generated output
changed. The shared Webstudio `AGENTS.md` was also updated locally to
discourage matching incidental UI copy in tests; that file is outside
this Git repository and is not part of this PR.

## Verification

- The revised test failed with the warning temporarily disabled and
passed when it was restored.
- Navigator browser tests: 22 passed.
- Builder typecheck, repository lint, changed-file formatting, and `git
diff --check`: passed.
- CI for commit `127344428a4f562a9d7e505088365b26517ed2f3`: 29 checks
passed, 7 skipped, none failed.
- Storybook screenshots were not run; they require separate permission
under the repository testing guide.
- No fixture input or output is affected. CI fixture checks passed on
Linux and Windows.
2026-10-25 12:11:52 +01:00
Oleg Isonen 2c7772c386 fix: Show actual query field types in Builder (#6597)
Boolean asset fields currently appear as text in the Builder query
editor. Comparing one with `true` then shows a false type warning. This
PR carries observed field types through the Assets OpenAPI schema into
the query definition used by Builder.

Closes #6596
Ref #6595

## Plan

- [x] Reproduce the type mismatch with a focused regression test.
- [x] Pass supported schema value types through the generated query
definition, preserving the existing string fallback for schemas without
field-type metadata.
- [x] Verify the Builder catalog uses the corrected definition and run
targeted tests, typechecks, and lint.
- [x] Review the authoritative `docs/` content for any needed
documentation update. Existing content-engine reference already
describes observed types; no copy change is needed. The two full Builder
query screenshots in #6595 need recapture after this fix reaches the
Builder.
- [x] Review the final diff and get an independent code review. The
reviewer found no blocking issues.
- [x] Confirm required CI checks pass.

## Implementation

The Assets schema groups field-path choices by their exact observed
types as well as compatible operators, and adds
`x-webstudio-field-types` to each group. The generic OpenAPI query
adapter carries that metadata through references and choices. Fields
from other OpenAPI documents without this metadata keep their previous
string fallback. No stored query data or database schema changes are
involved.

## Verification

- Regression tests failed before the fix: numeric and Boolean fields
were emitted as text; Builder warned on a valid Boolean `true` filter.
- `pnpm --filter @webstudio-is/query-builder test` — 40 passed.
- `pnpm --filter @webstudio-is/protocol test` — 92 passed, including the
API description size limit.
- Builder `asset-query-form.test.tsx` — 7 passed.
- Query-builder, protocol, and Builder typechecks passed; changed-file
oxlint and oxfmt checks passed.
- No fixture inputs or generated fixture outputs are affected.
- GitHub Actions: Lint PR, Check submodules, Visual regression, and Main
workflow all passed. One Builder E2E shard failed its first attempt in
two form-submission tests, then passed on a rerun of that shard; every
latest job is green.

## Follow-up

After the corrected full Builder is available, recapture the overview
and article query screenshots for #6595 in both themes.
2026-10-25 11:03:07 +01:00
Oleg Isonen 74af992644 docs: Restore screenshots in the Form guide (#6592)
The Form guide has five screenshot gaps on the published docs page.
GitBook shows the new text, but renders the screenshot blocks as empty
paragraphs.

This changes those blocks to the `figure > picture` markup used by
working docs pages. It also removes width attributes that are
unnecessary because the JPEGs already have the intended dimensions. The
light and dark images and their alt text stay the same.

Follow-up to #6591.

## Checklist

- [x] Compare the broken Form markup with working docs pages.
- [x] Update all five screenshot blocks.
- [x] Review documentation impact: only the Form guide needs a change.
- [x] Verify all ten image paths, dark-mode sources, alt text, and the
diff.
- [x] Get an independent review of the screenshot change.
- [x] Correct Form limits guidance using production Form and email
Worker evidence.
- [x] Diagnose and fix Builder E2E shard 5 form submission failure.
- [ ] Get an independent review of the follow-up changes.
- [ ] Confirm the screenshots render in GitBook after publication.

## Verification

- `git diff --check` passed for the screenshot and limits changes.
- Production probes confirmed the published 25 MiB boundary, Preview's
smaller Vercel ingress, the Worker's 7 MiB JSON boundary, and
approximate email rate limiting (56 accepted before four were limited).
- The 25 MiB outbound HTTP body check exists in code, but an end-to-end
request was blocked by an unrelated 502; the guide states it as
Webstudio's body-size check.
- A local HTML parser confirmed five figure/picture blocks and ten
existing assets.
- `oxfmt` does not check `docs/**`, which is excluded by repository
configuration.

GitBook rendering needs a published revision to confirm the fix. The
live page currently renders all five original picture blocks as empty
paragraphs; its text is current, so this is not a stale publication.

## CI status

The focused legacy Form query test passed locally (2 tests), and the
previously failing Builder E2E shard 5 passed on commit `5f4ee65bf`. The
test now allows 30 seconds for browser submission, matching the adjacent
managed Form test. Its success, HTTP response, payload, and delivery
assertions are unchanged. All other checks on that commit passed or were
still running when the docs copy correction was pushed.

CI for the latest commit `9934bc752` is running. The screenshot
rendering check still requires a published GitBook revision.
2026-10-24 16:13:27 +02:00
Oleg Isonen 0a4e3a48dd docs: Explain Form capabilities with focused screenshots (#6591)
## Summary

Explain what the Form component can do, with short chapters for actions,
email, uploads, search and filters, submission feedback, and Preview
testing.

- Replace the old guide with the reviewed text.
- Add five tightly cropped screenshots, each in light and dark themes.
- Update links from the Variables and Webhook Form guides to the new
sections.

## Checklist

- [x] Update the Form documentation and review its behavior claims
against the implementation.
- [x] Add five matching light/dark screenshot pairs with descriptive alt
text.
- [x] Verify 21 local links and anchors, all 10 image references,
formatting, and the final diff.
- [x] Fix the CI database port conflict in browser shard 2.
- [x] Re-run the shard 3 email tests locally with the CI build and
schema artifacts: 4/4 passed in 61 seconds.
- [x] Use sanitized CI diagnostics to investigate the MCP submit
failures, then remove all temporary diagnostic code.
- [x] Pin the MCP test fixture to installed Playwright Chromium and run
E2E shards with two workers.
- [x] Review documentation impact of CI changes: no additional docs are
needed.
- [x] Confirm required CI checks pass.

The CI follow-up keeps test setup stable: Docker assigns free PostgreSQL
and PostgREST host ports, the MCP test fixture uses the installed
Playwright Chromium, and each E2E shard uses two workers. Local startup
passed with port 55434 occupied; the focused email tests passed 4/4. The
final clean CI run passed all ten E2E shards, Main, Visual regression,
Lint PR, and Check submodules. Temporary diagnostics have been removed.
The exact cause of the earlier browser startup failures was not proven.
These CI changes do not change Form behavior.
2026-10-24 15:01:02 +02:00
Oleg Isonen dd99d27e5e fix: Stop returning unqueryable unpublish jobs (#6588)
Unpublish finishes in the request, but it returned a job ID that
`get-publish-job` could never find. It now returns the domains it
unpublished. A missing publish job also stays a normal not-found error
instead of suggesting a CLI update.

Closes #6578

## Changes
- Keep filename-based E2E shard discovery. Rebalance the files across
ten shards using measured CI times; each shard keeps its own test
environment and the same 12-minute safety timeout.
- Remove the fabricated unpublish job ID. `get-publish-job` remains for
publish jobs.
- Remove publish-only flags from the unpublish CLI and clarify CLI/MCP
guidance.
- Keep legacy optional server inputs for compatibility. The API input
contract does not change; clients that read the old `jobId` result need
to use `unpublishedDomains` instead.
- No database migration. Existing domain-removal behavior is unchanged,
including retention of other published domains.

## Checklist
- [x] Reproduced both reported failures with tests before the fix.
- [x] Reviewed the change for compatibility, redundant code, and
retained-domain behavior.
- [x] Updated the authoritative MCP docs and regenerated the CLI/MCP
docs.
- [x] Ran focused Builder, CLI, domain, and build tests; workspace
typecheck, lint, package-boundary, generated API, and generated-doc
checks.
- [x] Restore filename-based shard discovery and rebalance the files
across ten shards.
- [x] Verify every Chromium workflow test runs in exactly one shard and
update the E2E contributor docs. All 141 tests are assigned once across
the ten shards.
- [x] Verify parallel-safe long E2E files and the two-submission legacy
form test in CI.
- [x] Let independent slow E2E files run their tests concurrently; all
ten shard jobs passed.
- [ ] Confirm all E2E jobs finish in under five minutes. Eight did;
shard 1 took 5:10 and shard 4 took 6:32. Move the long Content-mode page
and shared-project bridge files to separate shards, then remeasure.
- [x] Required CI checks pass.

No live unpublish was run because it would change a published site.
Agent evaluations were not run; they require separate approval.
2026-10-23 18:59:44 +02:00
Oleg Isonen 75d710e759 fix: Let Editor links patch Content Block text and props (#6575)
Editor links with API access can edit text and editable props inside
Content Blocks through raw CLI/MCP patches. Builder and Viewer
permissions stay unchanged.

UI and API requests use the same Content-mode policy. The API keeps its
narrower text-and-props scope; page, asset, style, expression, and
structure changes remain blocked for raw Editor patches.

### Implementation

- Use the persistence patch engine for instance, prop, and style state
changes. Remove the separate instance patch interpreter and record
writes from permission validation.
- Check prop changes against the resulting state. Image dimensions work
even when their patches appear before the source patch.
- Move Image source, dimensions, and alt updates into the shared
runtime. Video source changes preserve its existing dimensions. The UI
no longer sends separate follow-up writes. Explicit overrides and
expression bindings are preserved.
- Separate capability discovery from transaction validation and move the
server permission adapter out of the router.
- Reject missing replacement targets and protected or renamed prop-ID
reuse. Keep template-copy protections.
- This refactor removes 19 non-test lines. It removes eager
whole-instance cloning, but the server still loads the project and
validates its content tree. Empty transactions skip that validation.

Closes #6573

### Checklist

- [x] Reproduce the Editor-token denial and add regression coverage
- [x] Keep Editor raw patches limited to text and editable props
- [x] Use the existing patch engine and test missing targets, immutable
input, and permission boundaries
- [x] Share media updates between UI and MCP; test atomic updates, patch
ordering, overrides, and bindings
- [x] Separate capability discovery, permission validation, and API
orchestration
- [x] Verify new regression tests fail with the relevant behavior
disabled, then pass after restoration
- [x] Run runtime tests, API/sync tests, typechecks, lint, formatter,
package-boundary, and generated-API checks
- [x] Run Content-mode E2E checks for templates, assets, page creation,
collaboration, and save/reload
- [x] Add a CLI MCP Editor-token save/reload E2E, including protected
template rejection
- [x] Return a structured forbidden error for rejected Editor MCP
content changes
- [x] Run the complete Luna/low evaluation suite; record failures below
- [x] Review documentation and fixture impact: no new API inputs, schema
changes, migrations, or fixture generation changes; existing guidance
remains applicable
- [x] Correct the project-package permission fixture to include its
owning instance and run all package tests
- [x] Cover repeated media source updates and bound namespace batches in
Editor requests
- [x] Preserve stale retry handling before Editor content validation,
with API regression coverage
- [x] Preserve expression-bound media metadata during source replacement
and test saved Content-mode output
- [x] Reuse batch merging so split prop payloads validate against their
final state; test split and combined forms
- [x] Push the refactor and verify required CI completes
- [ ] Deferred: reproduce the separate Builder UI report on a
session-free Editor link
- [ ] Deferred: confirm image-description editing expectations
separately

### Verification

- Full project-build suite: 2,597 tests passed. Focused permission/prop
run: 121 passed.
- All package tests (`pnpm test:packages`) passed after correcting the
project-package fixture. All 1,297 CLI tests passed.
- Builder API and sync authorization: 54 passed; settings-panel tests:
11 passed.
- Content-mode E2E: 9 passed, including setup, plus the earlier focused
Image replacement run.
- Builder/project-build typechecks, lint, formatting, package
boundaries, and generated-API checks passed. The CLI content-runtime
bundle test passed; no generated fixture output changed.
- Earlier full Luna/low evaluations: **7/9 passed**.
`managed-form-runtime-v1` failed `runtimeFormAction`; `markdown-blog-v1`
failed `blogRouteEvidence`. These checks also failed before this
refactor. MDX editing and Markdown-reference discovery passed. Baselines
for this model/effort were incompatible or missing and were not updated.
This suite is not fully green.

- Latest full Luna/low rerun after review fixes: **6/9 passed**. Form
runtime, blog authoring, and MDX editing failed; the MDX fixture passed
in the earlier run. Baselines were not updated. The evaluation suite
remains incomplete.

- Retry follow-up: all 59 API/router tests and 28 persistence patch
tests passed, along with Builder typecheck and lint. Older retries use
existing persistence handling; current and future versions remain
permission-checked.

- Bound-media follow-up: Image and Video source replacement preserves
expression-bound width/alt and still passes shared Content-mode
validation. Full runtime tests, typecheck, and lint passed after this
fix. The agent evaluation results above precede the final retry and
binding guards; those guards have dedicated regression coverage.

- Split-payload follow-up: reuse the existing batch merge helper before
permission validation. Combined and split media patches pass the same
final-state checks. Full runtime tests, 59 API tests, typechecks, and
lint passed. Agent evaluations were not repeated after this follow-up.

- CI passed on `1242ba8344`: all package, Builder, and CLI test jobs;
all six Builder E2E shards; visual regression; typecheck/lint;
generated-file checks; packaged SSG; size; migrations; and submodule
checks. Development deployment checks passed. All review threads are
resolved.

### Final review follow-up (2fbb30ffe6; CI passed)

- [x] Reject future base versions before saving; test an otherwise
allowed Editor patch
- [x] Preserve sequential patch behavior and test
authorization/persistence parity
- [x] Run focused tests, typechecks, lint, and review
documentation/fixture impact
- [x] Commit and push these follow-up fixes, then verify CI

Local follow-up verification: 2,600 project-build tests, 96 project
tests, and 60 API tests passed. Builder/project-build typechecks,
changed-file lint and formatting, package boundaries, and diff checks
passed. Regression tests failed without the fixes and passed with them.
The shared patch engine uses one Immer draft and supports namespace
replacement without mutating input. Net production change: 6 lines. No
documentation, fixture inputs/outputs, schemas, or generated contracts
changed. Browser E2E and agent evaluations were not rerun for this
follow-up; the race and patch-order cases are covered by deterministic
tests.


CI passed on `2fbb30ffe6`: all six Builder E2E shards,
package/CLI/Builder tests, typecheck/lint/generated checks, visual
regression, migrations, SSG build, size, and submodule checks. No new
blocking findings in the follow-up review. Agent evaluations were not
rerun; earlier limitations remain recorded above.

### Asset review follow-up

- [x] Reproduce and block asset-valued design-only props, retaining
matching Image metadata
- [x] Stop generating image metadata for Video source updates
- [x] Verify regression tests, documentation/fixture impact, and CI;
reply to both review threads

Asset follow-up `2ea28028c0`: shared metadata eligibility now checks
asset values and their matching Image source, including MDX
materialization. Video source edits do not generate Image-only metadata.
New and updated regression tests failed without the fixes and pass with
them. All 2,604 runtime tests, 60 API tests, 30 persistence tests, both
typechecks, lint, formatting, and package boundaries passed. No
documentation, schemas, or fixture data changes are needed. Agent
evaluations were not rerun. Both review threads have replies and are
resolved. CI passed on `2ea28028c0`, including all six E2E shards,
visual regression, package/CLI/Builder tests, typecheck/lint/generated
checks, migrations, SSG build, size, and submodules.

- [x] Reproduce repeated source updates without a saved source, coalesce
before ID assignment, and verify regression tests/CI

Final source follow-up `16c1c5f68e`: repeated instance/property updates
are coalesced before assigning IDs, replacing the later source-only
check. Both new Image/Video regression cases failed before the fix and
pass now. All 2,606 runtime tests, typecheck, and lint passed. CI passed
on this commit, including all six E2E shards and visual regression. No
documentation or fixture-data changes were needed; evaluations were not
rerun.


### Coverage audit

- [x] Audit changed behavior against assertions, including UI/API and
persistence boundaries
- [x] Add test assertions for identified coverage gaps; automatic CI
passed
- [x] Review documentation and fixture impact: no product documentation
change; one new SVG used only by browser E2E

Per request, no local tests or agent evaluations were run for this
audit. Automatic CI passed on `4591940169`, including package/API tests,
all six browser-test shards, visual regression, typechecks, lint, and
generated-file checks.

Coverage additions are pushed in `2371d9796a` and `4591940169`: check
actual text sent to persistence; duplicate ordinary props across
instances; rejected edits leaving capabilities reusable; merged patch
ordering and input immutability; accepted/rejected linked Image
dimensions in MDX templates; returned style/source/selection state; and
UI Image dimension changes followed by reload. The previous image E2E
used equal-sized files and could miss broken dimension synchronization.
Its new SVG has different dimensions. Production code is unchanged. No
tests or evaluations were run for this audit, as requested; no new pass
claim is made.

- [x] Inventory every changed/moved/removed production function and map
it to assertions
- [x] Add missing mixed-child and dependent-transaction coverage
- [x] Push inventory follow-up and inspect CI results

### Function-by-function coverage inventory

This inventories production functions changed, moved, or removed by this
PR. “Covered” means the named test asserts the behavior; it does not
claim every possible input or branch is covered. No local tests or
evaluations were run for this inventory.

| Function / handler | Assertions traced |
| --- | --- |
| `renderProperty` and its `onChange` callback | Content-mode props E2E
checks text, href, Image/Video source, alt, protected controls, and
reload. Asset E2E now changes dimensions from 120×80 to 240×160, then
replaces/reloads to 120×80. |
| `createContentModeCapabilitiesFromBuild` (moved unchanged) | API
“commits content-mode mutations with editor api tokens” and “limits
editor api patches to content instances and props” exercise conversion
from saved build data. |
| `assertContentOrBuildTransactions` | Editor vs Builder, design denial,
transaction/payload limits, all-or-nothing rejection; new exact
10-transaction boundary and dependent append-then-edit transactions. |
| `contentOrBuildMutation` | API semantic text edit asserts version,
authorization, actual saved text, unchanged outside content, and
unchanged input. |
| `build.patch` handler | API tests assert allowed text forms, denied
structure/styles/assets/expressions/outside roots, Viewer/no-API denial,
stale retries, current-version validation, and future-version CONFLICT
before persistence. |
| `getContentModePropNamesByTag` (moved unchanged) | Derives names by
tag and merges names for matching tags. |
| `getDefaultContentRootIds` (moved unchanged) | Default vs explicit
roots, Body selection, template exclusion. |
| `getContentModeFrontmatterBoundTargets` (moved unchanged) | Explicit
Body/frontmatter scope, read vs readwrite expressions, recursive
instances. |
| `getContentModeEditableInstanceIds` (moved unchanged) | Outside roots,
nested templates, missing references/roots, non-id children, cycles. |
| `getContentModeEditableInstanceRootIds` and its recursive `visit`
(moved unchanged) | Same traversal cases; transaction tests reject
moving content between roots and duplicate references. |
| `getInstancePropMetas` (moved unchanged) | Tag-derived props,
unknown/design-only/incompatible props, no generic HTML-attribute
permission bypass. |
| `getContentModeEditableStaticPropNames` (moved unchanged) | MDX
template tests assert exact editable names, primitive conversions, and
retained/ignored design-only props. |
| `getContentModePropEligibility` | Matching/missing/different asset
sources, protected asset props, exact primitive types, UI/transaction
parity, Image vs Video. |
| `isContentModeCopyableProp` (moved unchanged) | Editable/copyable
classification and content-mode copy-policy test. |
| `getContentModeCapabilities` | Editable IDs, roots, frontmatter
bindings, asset metadata; shared UI and transaction eligibility test. |
| `isContentModePropTransition` | Schema/id/owner/name checks, unknown
instance, protected existing props, permitted source type changes,
linked dimensions. |
| `validatePropPatches` | Add/replace/remove, new-then-update, missing
replacement target, protected ID reuse, copied template defaults,
final-state media patches in split/reversed order, failed-edit
immutability and retry. |
| `hasSameInstanceMetadata` | Whole-instance text replacement allowed;
tag/name changes and outside references rejected. |
| `validateStyleSourceSelectionPatch` | New content selection allowed;
existing/token misuse and dangling cleanup rejected; now asserts
resulting selection map. |
| `validateStyleSourcePatch` | New local source allowed; token,
duplicate/unused source and incomplete cleanup rejected; now asserts
resulting source map. |
| `validateStylePatch` | New local declarations allowed; existing design
styles, missing breakpoint and incomplete cleanup rejected; now asserts
resulting declaration map. |
| `validateMapChange` | Above three map paths, invalid patch targets,
resulting state and input immutability. |
| `validatePatchChange` | Instance/prop/style/asset/page paths and
rejected design namespaces through transaction tests. |
| `preservesNonTextChildren` and local `keepNonText` | Text-only changes
allowed; insertion/deletion/reordering of instance references and
expression changes denied; new mixed text/reference positional cases. |
| `applyContentModeTransaction` | Authorization/persistence parity,
split batches, empty transactions, scoped permissions, copy protections,
roots, cleanup, and immutable input on success/failure. |
| `materializeMdxAuthoredContent`, its `visit`, and `overlayChildren` |
MDX-source “round-trips an authored Asset Image through a styled
composite descendant” asserts src/width/height and styles after reload;
“serializes an Asset selected on an inserted Image template” asserts all
four linked props; nested and standalone component-permission tests
reject protected props. |
| `getMdxPropEligibility` | Template tests check allowed/ignored props,
aliases, incompatible types; new matching vs mismatched Image dimension
asset test exercises passed asset values. |
| `materializeMdxTemplates` | New linked-dimension test plus existing
copied-fragment, unchanged-input, authored-prop, diagnostic, and alias
tests. |
| `appendBuilderPatchChanges` | Mutation accumulator test asserts
sequential state and combined payload; merge test asserts ordering and
input preservation. |
| `mergeBuilderPatchChanges` | New repeated/interleaved namespace, empty
input, repeat-call and patch-array immutability assertions; permission
tests exercise split payload integration. |
| `getMediaAssetPropNames` | Image generates width/height/alt; Video and
unrelated components do not; explicit overrides and expression-bound
metadata retained. |
| `getPropIdsToDelete` | Image src removes dimensions; non-Image removes
only requested prop; resource cleanup and missing-instance cases. |
| `updateProps` | Atomic Image/Video updates, repeated sources
with/without saved props, overrides, bindings, original-state
preservation; new ordinary prop deduplication across names and
instances. |
| `getPatchParent` (type-only change) | Mutable nested patch and
missing-path tests. |
| `assertReplacePatchTargetsExistingPath` (type-only change) | Missing
target rejected; preceding add/root replacement makes later replacement
valid; preceding remove makes it invalid. |
| `applyBuilderNamespacePatches` | Sequential/root replacements, append
then edit, remove then replace, immutable state, permission/persistence
parity. |

Removed functions are covered through their replacements:
`shouldSyncMediaAssetProps` → shared `updateProps` plus UI E2E;
`assertContentOrBuildPayload` → transaction adapter;
`isContentModePropForInstance` → eligibility;
`isContentModePropPatchValue`/`validatePropPatch` → transition/batch
validation; `applyValidatedInstancePatch` → shared patch engine. No
behavior test is needed for import-only changes, type declarations,
public-entry exports, or regenerated metadata/docs; their callers and
contracts retain tests.

The original reporter-specific UI reproduction and image-description
product question remain separate limitations. This inventory does not
claim either is resolved.


### Latest review follow-up

- [x] Reject fresh prop IDs that shadow existing instance/property
records; cover protected bindings and valid edits
- [x] Coalesce updates in linear time while preserving last-update order
and input immutability
- [x] Check documentation/fixture impact, push, inspect CI, and reply to
both review threads


Review fixes pushed in `5dd03135e7`: 10 net production lines. Added
binding-shadow and batch-work regression assertions; no local tests or
evaluations were run, per request. Formatting and diff checks passed.
Documentation and generated fixture inputs/outputs are unchanged.
Automatic CI is pending.


- [x] Reject duplicate fresh props within the same transaction and test
split/combined batches
- [x] Preserve resource and parameter media bindings using the existing
dynamic-type check
- [x] Bound total Editor patches before validation; test the boundary
and unchanged Builder access


Review follow-up `d478446eb1`: all package, Builder, and CLI CI test
jobs and typecheck/lint/generated checks passed. Five addressed review
threads are resolved. Browser CI checks are still running. One newly
posted review about non-image assets assigned to Image sources remains
open pending the user's behavior choice. No local tests or agent
evaluations were run; local typechecks passed.


### Shared asset constraints

- [x] Reuse component file-control metadata and the UI MIME matcher in
shared property writes; preserve manually entered URLs and pending
uploads
- [x] Generate linked Image metadata only when the selected asset
supports it; cover legacy file-backed images
- [x] Add shared-runtime coverage for accepted/rejected Image and Video
assets, custom props, URLs, and atomic rejection
- [x] Review documentation, generated contracts, fixture impact, and
diff size; verify typechecks and CI (no local tests or evaluations, as
requested)


Shared asset follow-up `5f0054edd7`: property writes use the UI's
existing file-control `accept` metadata and MIME matcher. Known
incompatible assets are rejected with the approved message. Legacy image
files remain selectable without generating unsupported metadata. URLs,
custom asset props, and unresolved uploads keep their existing behavior.
Asset records are now loaded before CLI/MCP property writes; this may
require an asset-list request when not already loaded. This change does
not add asset-file downloads. Net handwritten production change: 24
lines. Builder/project-build typechecks, changed-file lint, formatting,
and diff checks passed. No local tests or evaluations were run.
Regression and runtime-entry tests were added; CI is pending. Reviewed
Image/Video docs: no guidance change needed. No fixture inputs or
generated fixture bundles changed; regenerated runtime contract metadata
only.

- [x] Keep Editor permission checks when a shared edit operation loads
assets; add an API regression test before final CI verification


Follow-up `d33b70e1c7` preserves Editor authorization when property
writes load assets. The API regression test asserts a valid Image source
reaches persistence, incompatible files are rejected, and
outside-content edits remain forbidden. This reuses the existing asset
loader and permission adapters (3 net production lines). CI found and
corrected an old session namespace expectation and a mistaken test
assumption: Video's existing unsupported `.mpg`/`.mpeg` accept entries
cause the shared matcher to allow all assets. This PR preserves that UI
behavior; it does not tighten Video formats. Total handwritten
production increase for this asset follow-up: 27 lines. Builder
typecheck/lint and server metadata generation passed; metadata output
was unchanged. CI is rerunning.


Final asset follow-up verification (`8b2efd8508`): all package, CLI,
Builder API/unit, and six browser E2E jobs passed, together with
lint/typechecks, generated checks, visual regression, migrations, size,
packaged SSG, and branch deployment. The direct API test now checks the
typed authorization cause, not an HTTP status that this test caller does
not map. All review threads are resolved. No local tests or agent
evaluations were run for this follow-up; CI provided execution coverage.
The separate Video filter limitation noted above remains unchanged.


### Shared write-boundary validation

- [x] Reuse one asset-property validator in UI/MCP property updates and
raw patch persistence, independent of permission level
- [x] Cover whole-property and field patches, component changes, invalid
metadata, final-state validation, unchanged legacy data, and stale
retries
- [x] Review documentation/fixture impact, typecheck and lint, then
verify CI; no local tests or evaluations per the earlier request

Expected change: about 70–90 net production lines. Patch saves load only
referenced asset metadata; no asset-file downloads.

Shared-save follow-up: 133 net production lines, above the initial
estimate because one save can replace an asset file and its references
together. The save validator reuses the asset writer’s canonical file
preparation rather than trusting client-declared asset types. It also
checks asset-only replacements, before folder or Build writes, while
leaving unchanged legacy references alone. Ordinary property writes load
only referenced asset metadata; asset-changing saves with references
additionally prepare the full asset map, then the writer repeats that
metadata preparation. No file contents are downloaded by the new check.
This does not change schemas, migrations, generated contracts,
documentation, or fixture inputs/outputs. Added regression coverage; no
local tests/evaluations were run, per the earlier request. Independent
Astra review found no remaining defect after the projection fix. CI
pending.

- [x] Fix selective UI sync loading to include asset-validation
dependencies; add selection regression coverage and rerun CI

The first browser run caught missing props/instances in selectively
loaded UI saves. Package/API tests passed but their fixtures provided
complete build rows. The development deployment succeeded; its
status-reporting step failed with GitHub HTTP 500.

Final verification on `a22d059717`: all package, CLI, Builder unit/API,
six browser shards, visual regression, typecheck/lint/generated checks,
migrations, size, packaged SSG, development deployment, and
Ubuntu/Windows deployment fixtures passed. Browser shard 3 passed on one
retry after a page-drag ordering assertion; the save/parsing errors were
fixed by loading the required fields. No local tests or evaluations were
run. The added persistence suite has 46 passing tests and runtime props
has 74; selective-sync tests now omit unselected fields. No unresolved
review threads. Total net production increase across this follow-up: 134
lines.


### Deep review follow-up

- [x] Make MDX linked-image validation independent of authored attribute
order; cover changed sources, mismatches, and the affected
materialization paths
- [x] Review DRY and diff size, documentation/fixture impact, and
independent review findings
- [x] Verify typechecks/lint and CI; no local tests or evaluations per
the earlier request

Review found that linked dimensions can be checked against the old
template source before the new source is applied. Fix should reuse the
shared eligibility rule with the final source, without another property
parser. Initial estimate: under 60 added non-test lines; revisit the
approach if it needs more.


Deep-review fix `f7c3d805a8`: apply Image sources before linked metadata
in all three MDX materialization paths, keeping original attribute
indexes for asset references. Reuses the existing eligibility checks and
parser; 23 net production lines. Regression cases cover source order,
changed sources, mismatched dimensions, and nested overlays. Independent
Astra review, project-build typecheck, focused lint, formatting, and
diff checks passed. No schema, documentation, generated contract, or
fixture-data changes. Local tests/evaluations have not run; focused-test
permission was requested. CI pending.


Final deep-review verification on `f7c3d805a8`: all package/CLI/Builder
test jobs, all six browser shards, visual regression,
typechecks/lint/generated checks, migrations, packaged SSG, size,
submodules, and development deployment/fixtures passed. CI ran 60
authored-content and 24 template-materialization tests successfully. No
local tests or evaluations ran; fail-before/pass-after was not executed
locally. All review threads are resolved and the worktree is clean. No
further actionable defect was found in the independent reviews. Known
remaining cost: asset-changing saves can prepare metadata twice;
removing that safely would expand this fix into persistence changes.


### Editor MCP browser E2E follow-up

`0ee978e465` adds a real CLI/MCP Editor-token round trip: insert content
into a Content Block, reload through a fresh CLI process, verify it in
the Builder canvas, and reject a protected template insertion without
changing the saved Build. A direct API denial now returns `FORBIDDEN`
instead of a generic internal error. The focused E2E and API tests,
typecheck, lint, formatting, and diff checks passed locally.
Fail-before/pass-after was verified by temporarily disabling Editor
fragment access, then restoring it. The full Luna/low evaluation run was
attempted but did not pass: the form-runtime fixture received 503
responses. The suite is not claimed green. CI for this push passed on
`0ee978e465`, including all six Builder E2E shards, package/CLI/Builder
tests, visual regression, typecheck/lint/generated checks, migrations,
size, SSG build, and submodules.


Live MCP permission probe against the branch deployment: Builder,
Editor, and Viewer role metadata matched their tokens. Editor content
text, rich text, fragment, link href, and compatible Image source edits
committed and survived a fresh MCP session. Outside-root,
protected-template, design-only prop, mismatched Image width, and
incompatible asset writes were denied without persistence. The updated
deployment returned structured `FORBIDDEN` for protected content writes
even when `contentMode` was false or omitted. Mixed valid/invalid writes
were atomic; stale Editor writes refreshed and retried. Viewer MCP could
not be exercised beyond the API gate because this Viewer token has API
access disabled. MDX frontmatter, token revocation, and UI-only
scenarios were not tested. A wrong-project token was rejected but
surfaced `INTERNAL_SERVER_ERROR`, which is a diagnostic-quality gap, not
an authorization bypass. The isolated probe page
`/codex-permission-probe-6575` remains: cleanup was stopped after a
concurrent-edit `CONFLICT`, to avoid deleting another session's work.


### Fixture-based parity follow-up

- [ ] Verify the full Content-mode UI/MCP parity matrix with an isolated
MDX/template/media/page fixture, excluding publishing and token/plan
changes
- [x] Fix the reproduced Editor MCP template/page-settings gap and cover
fail-before/pass-after routing
- [x] Verify a real CLI Editor-token create-from-template call, fresh
readback, Builder reload, allowed settings, and protected-setting
rejection
- [x] Update MCP guidance, review fixture impact, and verify required CI

The UI already allows an Editor to create a page from a template and
edit allowed page settings. MCP incorrectly required Builder permission,
and a separate MCP-only legacy Webhook Form copy guard blocked the
seeded template. Those restrictions are corrected. The server now
derives Content-mode page copying from Editor permission even when
`contentMode` is omitted or false; Builder copies retain their existing
behavior. Editor semantic commands use the server's shared Content-mode
validator, while raw Editor patches stay limited to text and editable
props. This adds a named server call and refetch for Editor semantic
edits; the existing initial project sync still occurs.

The new isolated E2E passed on `03e7ca6953`, including flag-free
template creation, settings edit, fresh CLI readback, Builder reload,
and a denied protected setting without a saved change. All required CI
passed on that commit: all six Builder E2E shards, package/CLI/Builder
tests, generated checks, typecheck/lint, visual regression, migrations,
packaged SSG, size, and submodules. Focused local runtime/API tests,
typechecks, lint, formatting, and generated-doc checks passed. Browser
E2E and full agent evaluations were not run locally; the requested
browser approval and a fresh evaluation approval were not received. The
full UI/MCP parity matrix remains open; Editor asset operations are a
separately identified gap, not claimed fixed here.


### Exploratory permission coverage follow-up

- [x] Inventory observed Builder/Editor/Viewer UI and MCP permission
scenarios against existing tests
- [x] Add fail-before/pass-after regression tests for confirmed
uncovered failures
- [x] Run focused tests, typechecks, lint, and fixture checks; verify
required CI
- [x] Record unsupported UI/MCP parity as open product work, without
calling the matrix complete

The UI share-link E2E already checks Viewer read-only controls, Editor
text editing, and Builder design controls. Existing MCP E2E checks
Editor content/template writes, page creation, asset upload, and
protected edits. This follow-up adds one real CLI/MCP flow with
API-enabled Viewer and Builder tokens: Viewer can list pages but cannot
create a page or asset folder or upload a file; Builder can change an
HTTP status setting that Editor cannot. The test checks the denied page
writes leave the build unchanged and the Builder setting survives
readback.

The run exposed two diagnostic bugs: local permission denial and REST
asset-upload denial reached MCP as generic failures. Both now retain
`FORBIDDEN`. Focused unit tests failed before these changes and pass
after; the full local browser/MCP test passes. The only non-test change
is three net lines. No fixture data, schemas, generated contracts, or
product docs changed. Local checks passed: 2,654 project-build tests, 48
HTTP-client tests, the focused Builder E2E (2 tests including setup),
affected typechecks, lint, formatting, and package boundaries.
`check:fixture-sizes` could not run locally because the SSG fixture's
built `dist/client` is absent; CI builds that fixture before checking
its size.

The full UI/MCP parity matrix remains open. In particular, Editor UI
asset update/replacement/duplication/deletion and collection-entry
creation still lack equivalent MCP support until the UI's collection
protections are enforced at the shared server boundary. Publishing and
token/plan changes were outside this test scope.

CI passed on `6490efc838`: all six Builder E2E shards,
package/CLI/Builder tests, visual regression, typecheck/lint/generated
checks, migrations, packaged SSG, size, and submodules. Shard 3 first
hit Playwright's 120-second limit under four-worker load; its logic
passed locally. The longer role flow now uses the same 240-second
per-test limit as other MCP E2E tests, and shard 3 passed in the final
run.

### Final UI/MCP parity audit

- [x] Trace Editor UI asset and folder actions through REST, runtime,
and persistence
- [x] Reproduce Editor MCP upload and folder-create denials; add
fail-before/pass-after permission tests
- [x] Add isolated Editor MCP upload/folder and UI folder-reload browser
regressions
- [x] Keep collection-sensitive asset/folder mutations Builder-only
until UI collection protections are shared at the server boundary
- [x] Review docs and fixture impact: MCP guidance is updated; no
fixture input or bundle changes
- [x] Restrict Editor folder saves to new IDs; test overwrite and delete
denials at both UI and API boundaries
- [x] Reject folder-add collisions at persistence and test the
mixed-writer/stale-snapshot case
- [x] Keep exact Editor folder retries authorized after a partial save;
add fail-before/pass-after coverage
- [x] Verify the new browser E2E in required CI
- [ ] Run the full Luna/low agent evaluations after fresh approval (not
granted for this follow-up)
- [x] Verify required CI for `6fd3beefc8`

The safe scope is small: the Assets REST upload path already authorizes
Editor tokens and enforces collection rules, but the MCP catalog
incorrectly required Builder access. Creating an ordinary asset folder
is available in the Editor UI, but the shared Content-mode save check
rejected it. Both now use Editor permission. The isolated browser tests
check fresh MCP readback and Builder reload; they have not run yet.

Further parity work remains open: Editor UI allows updates, replacement,
duplication, deletion, and collection-entry creation in cases MCP cannot
currently perform. These need the UI's collection protections enforced
at the shared server boundary before their MCP permits can be widened.
Raw Editor `apply-patch` stays text-and-props-only. This PR does not
claim the full matrix is complete.


Asset/folder follow-up `6fd3beefc8`: Editor semantic tools now share the
UI's edit permission for uploads and ordinary folder creation. Folder
saves reject same-ID changes, allow identical retries after a lost
response, and use insert for add-only persistence. The retry regression
failed before the fix and passes with JSON-normalized parent
IDs/timestamps. Independent Astra review found no remaining concrete
defect. Focused runtime (86), asset persistence (52), protocol (14), and
API/sync (71) tests passed; Builder/project-build/asset-uploader
typechecks, lint, package boundaries, formatting, generated API, and MCP
docs checks passed. Full project-build, protocol, and CLI suites passed
earlier in this follow-up; Builder core had resource-contention failures
but its affected tests passed in isolation. The new browser E2E and
agent evaluations were not run locally pending fresh approval; CI is
running them automatically.

CI passed on `6fd3beefc8`: all six Builder browser shards,
package/CLI/Builder tests, generated checks, typechecks, lint, visual
regression, migrations, packaged SSG, size, and submodules. The new
Editor MCP asset round trip and UI folder-reload tests ran in the
passing browser shards.
2026-10-23 14:40:26 +02:00
Oleg Isonen dabaeede02 fix: Hide deprecated components in Builder (#6576)
The Components panel now hides deprecated components by default. The
default-off `deprecatedComponents` feature flag shows all nine
registered deprecated components in a separate **Deprecated** section,
including Webhook Form and RemixForm. Webhook Form keeps its saved
component ID, icon, behavior, navigator label, and `w-webhook-form` CSS
class. The command picker continues to hide deprecated components.

## Checklist
- [ ] Document each feature flag beside its declaration using its
current behavior.
- [x] Keep Webhook Form metadata and picker guidance pointing to Form.
- [x] Preserve the generated `w-webhook-form` class without custom
`presetClassName` metadata.
- [x] Hide deprecated components from the Components panel by default;
show all nine eligible components in a dedicated Deprecated section
behind the default-off `deprecatedComponents` flag.
- [x] Keep deprecated components out of the command picker.
- [x] Add focused tests for default and flagged visibility, section
membership, exclusions, and template insertion data.
- [x] Review documentation impact. Existing Webhook Form docs describe
its default unavailability; the flag is for development, so no docs
change is needed.
- [x] Verify focused tests, typechecks, lint, and fixture generation.
The fixture pipeline passed; its unrelated live fixture path drift was
restored.
- [x] Update the Components panel E2E filter assertion for the flagged
deprecated section and verify the rerun.
- [x] Verify required CI on the latest head.

Focused tests: component catalog 16/16, Builder 3/3. Builder,
project-build, and feature-flags typechecks passed. Lint and the full
fixture pipeline passed. The new section tests failed as expected with
section creation temporarily disabled and passed after restoration.
Latest-head CI: Main workflow, Visual regression, Lint PR, and Check
submodules all passed, including all six Builder E2E shards.

Ref #4093
2026-10-21 21:06:41 +02:00
Oleg Isonen 534401c66b fix: keep publish progress after closing popover (#6570)
## Summary
- Show the existing validation success toast if validation finishes
after the Publish view closes or switches to Export. Keep it quiet while
the result is visible in Publish.
- Keep publish progress running when the popover closes. Reopening shows
a pending state without restarting the countdown and updates when
publishing finishes.
- Show a completion toast only after the Publish popover closes. Keep
errors and diagnostic findings visible across panel remounts.
- Continue polling a recovered pending build after the popover closes.
Ignore old status responses and superseded manual validation results.
- Keep a manual validation report and its “See issues” button available
after closing and reopening the Publish popover.

## Checklist
- [x] Consolidate publish progress and validation state. The PR's net
non-test change is down from +560 to +457 lines.
- [x] Cover the close/reopen validation result and suppress duplicate
publish-error toasts while Publish is open.
- [x] Run focused tests, Builder typecheck, lint, formatting, and
required CI after the simplification.
- [x] Show the existing validation success toast when validation
finishes outside the Publish view; suppress it while the inline result
is visible.
- [x] Prove the open and closed outcomes with a failing-then-passing
regression test.
- [x] Clear a persisted status error when a successful refresh finds no
build, while preserving request errors.
- [x] Prove the no-build case with a failing-then-passing regression
test and recheck docs, fixtures, and 55 focused tests, typecheck, lint,
formatting, and diff checks.
- [x] Show validation completion when the user switches to Export before
the result arrives, with a failing-then-passing regression test.
- [x] Resolve reviews and pass CI on commit 1b532637a7.
- [x] Cover countdown, completion, errors, remounts, recovery,
navigation, and stale responses with regression tests.
- [x] Keep manual validation findings and the report button visible
after closing and reopening the Publish popover.
- [x] Verify the new regression test fails before the fix and passes
after it.
- [x] Pass 37 targeted tests, Builder typecheck, lint, formatting, and
diff checks.
- [x] Review documentation impact and fixture inputs. The publishing
guide already covers validation reports; no fixture inputs or generated
outputs are affected.
- [x] Resolve all existing review threads.
- [x] Pass all CI workflows on commit 428dee3d35.
- [x] Preserve validated domain selection across popover remounts.
- [x] Ignore delayed diagnostics from superseded publish attempts.
- [x] Guard publish polling across A → B → A navigation.
- [x] Show a recovered failed build after a lost publish response.
- [x] Recheck reviews and CI on commit 51573cd848.
- [x] Suppress publish success toasts whenever the Publish popover is
open, including stale project completions and the Export view.
- [x] Verify both changed regression tests fail before the fix and pass
after it.
- [x] Recheck documentation impact and pass 38 targeted tests, Builder
typecheck, lint, formatting, and diff checks.
- [x] Suppress the validation success toast while the Publish popover
shows its validated state.
- [x] Recheck documentation impact and pass 38 focused tests, typecheck,
lint, formatting, and diff checks.
- [x] Restore validated domain selections through the visible checkbox
state and verify submitted domains match.
- [x] Recheck documentation impact and pass 51 focused tests, Builder
typecheck, lint, formatting, and diff checks.
- [x] Keep the visible checkbox selection in sync when validation
finishes after the popover reopens, without resetting a later user
change.
- [x] Resolve the late-validation review thread and pass CI on commit
3de717d993.

## Verification
- Commit 3d54f6c775 passed all four CI workflows, including all 19
main-workflow jobs and six Builder E2E shards. All review threads are
resolved.
- The close/reopen validation test failed before the fix and passes
after it. The adjusted stale-poll test failed when its ownership guard
was disabled and passed when restored. All 98 Publish feature tests,
Builder typecheck, oxlint, oxfmt, and diff checks pass locally. The
source changes do not affect documentation or fixture inputs.
- Commit 1b532637a7 passed Lint PR, Check submodules, Visual regression,
and Main workflow. All six Builder E2E shards passed. The fixture size
job passed on rerun after its first attempt failed because a React
Router fixture build could not find `build/client/.vite`. All review
threads are resolved.
- The Export regression failed before the fix and passes after it. All
38 focused tests, Builder typecheck, lint, formatting, and diff checks
pass locally. No documentation or fixture inputs are affected.
- The no-build regression test failed before the fix and passes after
it. It verifies that a request error remains visible. All 55 focused
tests and static checks pass locally; no documentation or fixture inputs
are affected.
- The validation toast regression test failed before the fix and passes
after it. All 54 focused tests, Builder typecheck, oxlint, oxfmt, and
diff checks pass locally. No documentation or fixture inputs are
affected.
- Commit 3de717d993 passed Lint PR, Check submodules, Visual regression,
and Main workflow. All six Builder E2E shards passed; shard 3 passed on
rerun after an unrelated Pages drag test failed its first attempt.
Review threads are resolved.
- The late-validation regression test failed before the controlled
checkbox update and passes after it. It checks visible state, submitted
domains, and selection after the report clears. All 51 focused tests,
Builder typecheck, lint, formatting, and diff checks passed.
- The reopened domain checkboxes and submitted form values now match.
The UI regression test failed before the fix and passes after it; it
also checks that toggling a restored checkbox changes the submitted
domains.
- The Validate action already shows “Validated” after success; the
redundant toast is removed. The existing action test covers that state.
- 38 targeted tests passed locally. Builder typecheck, oxlint, oxfmt,
and `git diff --check` passed.
- Commit 428dee3d35 passed all CI workflows, including visual regression
and six Builder end-to-end shards. Latest commit 51573cd848 passed lint,
submodule, visual regression, and the main workflow. All six Builder
end-to-end shards passed; shard 5 passed on rerun after an unrelated
Form feedback test failed, and shard 2 passed on rerun after GitHub
cancelled its first attempt.
2026-10-21 11:38:52 +02:00
Oleg Isonen bc7e58af84 fix: Stabilize Preview and MCP issue reports (#6572)
## Problem

A fresh iterative Preview can lose its rendered content on the first
client navigation with a React `useContext` error. MCP issue reports can
also miss the page or instance ID needed to locate a problem, and
concurrent tool calls can overwrite newer report context with an older
snapshot.

## Fix

- Have Vite scan generated routes before the first navigation. This
applies to the base React Router template and the Netlify and Cloudflare
overlays. It changes local iterative Preview, not saved project data or
production routing.
- Include up to three recent, validated tool targets in MCP issue
reports. A project-relative screenshot path is matched to its page ID;
the CLI does not store the path, full URL, token, or page content. It
cannot read the Builder's current UI selection, but includes an instance
ID when a tool call names one.
- Treat structured MCP error results as failures and serialize
report-state writes within a CLI session, so a concurrent older write
cannot replace a newer result.

The reporting work from #6574 is now included here. #6574 is superseded.

## Verification

- Reproduced #6569 twice with CLI 0.306.0 and a cold optimizer cache.
With the Vite change, a cold `/` → `/blog` navigation and direct article
load rendered without browser errors.
- The config assertion failed without the Vite entry and passed with it.
A proposed optimizer test also passed without the fix, so it was
removed; the real cold-navigation check remains the behavioral evidence.
- The new concurrent-write test passed with serialization and failed
when the queue was temporarily removed. All 106 focused CLI tests, CLI
typecheck, root lint, formatting, and generated API check passed on the
combined branch.
- Earlier checks of the same Preview and reporting code passed: 133
prebuild tests, 144 project-build MCP tests, protocol and Builder
reporting tests, affected typechecks, CLI build, generated docs, and CI
on the separate PRs.
- The fixture build passed without changing tracked files. The full
local fixture pipeline stopped at sync because the development server
returned bundle version `bundle-17o6sch` while this checkout expects
`bundle-1sh9iaz`. The combined commit passed Linux and Windows fixture
checks and all other required CI jobs.
- Full Luna/low agent evaluations were run earlier on the combined
branch: the latest run passed 8 of 9 fixture tasks, while the
managed-form assertion failed on an unrelated task. Saved baselines were
missing or incompatible, so the command failed overall. No baselines
changed. Evaluations were not rerun for this final concurrent-write
change.

## Checklist

- [x] Reproduce and fix the first-navigation Preview failure
- [x] Cover the base, Netlify, and Cloudflare templates and generated
fixtures
- [x] Include safe recent page and instance IDs in MCP issue reports
- [x] Treat structured MCP errors as failures
- [x] Serialize concurrent report-state writes and verify the regression
test fails without the queue
- [x] Review documentation impact: Preview usage and user guidance are
unchanged; no docs change
- [x] Run focused local checks and attempt the fixture pipeline
- [x] Confirm required CI passes on the final combined commit

Closes #6569
Ref #6571
2026-10-21 10:09:05 +02:00
Oleg Isonen 13eb7527ef fix: route deprecated Webhook Forms through Form backend (#6553)
Deprecated Webhook Forms reuse the existing Form execution pipeline
without teaching the modern backend about WebhookForm.

## User-facing behavior and how to test it
- Existing saved Webhook Forms keep their markup, action settings, and
success/error feedback. Submit a published Webhook Form and check both
outcomes.
- URL and Resource actions preserve configured methods, headers,
dependencies, body overrides, and the last submitted value for repeated
field names. Test a configured action and inspect the received request.
- Default owner notifications use the Email Worker, including submitted
files. Submit a Webhook Form without a custom action and inspect the
owner email and attachment.
- Configured Email actions validate recipients and retain threading
metadata. Test valid recipients and a rejected recipient limit.

## Implementation
- One deprecated Webhook Form adapter calls existing bot validation,
Email preparation, recipient validation, resource loading, and response
handling.
- Both generated route templates call that adapter. Both paths reuse an
internal resource-graph traversal helper; modern submission behavior is
unchanged.
- Root actions use the protected, uncached request override.
Dependencies reuse existing generated Assets and Resource caching
behavior.
- Keep reachable-resource filtering because Email preparation runs
before loading: unrelated Email settings must not break the selected
action.
- Remove dead `getDefaultActionResource` wiring from generated
templates.

## Verification
- Focused SDK tests: 116 passed (11 deprecated Webhook Form adapter and
105 modern submission, Email, and handler tests), including unrelated
resources, missing dependencies, cycles, Email preflight/threading, and
single-attempt Email failures.
- Resource generator tests: 26 passed.
- Full CLI prebuild suite: 139 passed after tracked fixture
regeneration; focused deprecated Webhook Form adapter tests: 9 passed.
- Repository fixture pipeline (`pnpm -r fixtures:build`) passed. All
tracked generated `getDefaultActionResource` references were removed,
and no Builder `N8N_FORM_EMAIL_HOOK` reference remains.
- Final MCP-generated local Preview E2E rerun: 3/3 passed.
- Focused saved Webhook Form custom-action E2E rerun: 2/2 passed (setup
and test), including a single POST through the protected test receiver
after Builder reload.
- SDK, CLI, and Builder typechecks, focused lint and formatting, and
`git diff --check` passed.
- Deprecated component picker regression test passed (2/2); verified it
fails when WebhookForm deprecation is disabled, then passes with
deprecation restored.
- Independent Astra review found no blocker, including the 62 generated
fixture changes. No production deployment or live secret change was
performed.
- Required staging CI checks passed on previous head `15635fc` (Main
workflow, visual regression, submodules, and lint). An unrelated
existing MCP success-redirect E2E assertion failed once in shard 5,
passed in a focused local rerun (2/2 including setup), then shard 5
passed on GitHub rerun without code changes.
- Terminology pass (`4a69ab573`): renamed the dedicated SDK adapter and
migration helper, updated both route templates and generated fixtures,
corrected the active identity migration marker comments, and
synchronized docs and test names. Focused tests passed: SDK 35, CLI
prebuild 12 plus 2 after final title change, MCP 7, migrations 8, React
browser 7, CLI docs 9. Seven affected package typechecks, fixture
builds, formatting, and `git diff --check` passed. That historical head
was superseded; latest-head CI results are recorded below.

- ResourceForm identity migration (`29a21edbb`): focused migration (23),
DB patch (25), project-build DB/session (93), Builder
API/import/auth/patch (60), React SDK (162), runtime/MCP (239), registry
(11), CLI evaluation (90), CLI session/sync (55), and protocol (15)
tests passed; full CLI prebuild (139) passed. Affected typechecks, lint,
formatting, and `git diff --check` passed. Independent Astra review
found no blocker. No deployment was performed.

- Prepublish Webhook Form warning (`25855e8f00`): audit checks every
non-draft published page and links nested/shared instances to the
correct page; modern ResourceForm, native forms, draft-only forms, and
orphans are excluded. Focused audit tests (13), Builder navigation tests
(6), project-build and Builder typechecks, lint, formatting, and `git
diff --check` passed. Independent Astra review found no blocker;
publishing remains nonblocking. No deployment was performed.

- ResourceForm test and CI expectation repair (`e1a527fbcc`): focused
React SDK (24), Builder preview/registry (38), project-build pages (1),
and CLI fixture API (8) tests passed; Remix and React Router targeted
browser suites, affected package typechecks, full formatting (3375
files), lint, and `git diff --check` passed. Astra review found no
blocker. Persisted identity and runtime exports were unchanged.

- Project bundle fixture repair (`70889ef27d`): eight bundles now carry
the current contract version; the two unmarked historical Form instances
in `webstudio-features` normalize to WebhookForm. Protocol fixture tests
(17), protocol typecheck, CLI fixture build, formatting, lint, and diff
check passed. Independent Astra review found no blocker.

- Story/MCP E2E CI repair (`483614e6c5`): SDK CLI story tests (7),
ResourceForm fragment tests (34), and focused local managed-form E2E (4
including setup) passed. SDK CLI and Builder typechecks, lint,
formatting, and diff check passed. Astra review found no blocker. The
initial local Preview build used an ignored stale React Router `lib`
artifact; rebuilding it restored the passing E2E run.
- Latest PR head `483614e6c5`: Main workflow [run
39317777032](https://github.com/webstudio-is/webstudio/actions/runs/39317777032)
passed, including all package matrices and six Builder E2E shards.
Visual regression [run
39317796922](https://github.com/webstudio-is/webstudio/actions/runs/39317796922),
submodules, and PR lint checks passed. The overlapping unapproved visual
run was cancelled by the approved rerun.

- Shared bot-value generator (`ecc4cad1e9`): SDK helper tests (3), React
Router WebhookForm/ResourceForm browser tests (5), SDK/Router/Remix
typechecks and builds, SDK browser-boundary check, formatting, and diff
check passed. Brave bypasses media queries, working media queries
produce a fresh timestamp per submission, and failed queries produce
`jsdom`; each managed/legacy submission has one bot field. Independent
Astra review found no blocker. Latest-head Main workflow [run
39325677117](https://github.com/webstudio-is/webstudio/actions/runs/39325677117)
passed, including all six Builder E2E shards; approved visual regression
[run
39325702835](https://github.com/webstudio-is/webstudio/actions/runs/39325702835),
submodules, and PR lint passed. The superseded visual run was cancelled
by the approved rerun.\n\n- Historical Form clipboard guard
(`e864283d1c`): instance/page transfer parsers reject ambiguous legacy
`Form` before asset import; direct fragment/page/folder mutations
preflight before changes. Canonical ResourceForm, WebhookForm, and
NativeForm remain accepted. Project-build tests (89), Builder paste
browser tests (69), both typechecks, focused lint/formatting, and diff
check passed. Independent Astra review found no blocker. Latest-head
Main workflow [run
39329184890](https://github.com/webstudio-is/webstudio/actions/runs/39329184890)
passed, including all six Builder E2E shards; approved visual regression
[run
39329562692](https://github.com/webstudio-is/webstudio/actions/runs/39329562692),
submodules, and PR lint passed. The earlier unapproved visual run
reported two expected story differences.\n\n## Compatibility notes
- Root HTTP actions reject private and same-origin destinations.
Dependencies retain their existing fetch/cache behavior.
- Routes retain the 25 MiB request limit. Shared execution applies bot
validation, a 10-second Resource timeout, and one retry for eligible
HTTP failures; an ambiguous failure can duplicate an HTTP action. Email
actions are not retried.
- Default email uses the Email Worker's sender, plain text, recipient
limits, and attachment limits instead of the legacy n8n HTML/basic-auth
path.
- Self-hosted sites need normal Email sender configuration. Direct
Builder draft Preview handling is outside this published-route change.
- Coordinate this CLI release with [SaaS PR
#669](https://github.com/webstudio-is/webstudio-saas/pull/669), which
removes the n8n helper and `N8N_FORM_EMAIL_HOOK` from new published-site
builds. Publish with a CLI artifact containing this adapter. Existing
deployed workers retain their bundled code and injected hook until
republished, so keep the actual n8n endpoint available while those sites
remain active.

## Implementation checklist
- [x] Align saved Webhook Form custom-action E2E with the protected
receiver and verify one submission.
- [x] Regenerate tracked published-site fixtures with the updated CLI
and confirm no `getDefaultActionResource` or `N8N_FORM_EMAIL_HOOK`
references remain in Builder source/config/fixtures.
- [x] Review authoritative `docs/` impact of removing the obsolete
Builder hook wiring; related deprecation and integration docs were
updated.
- [x] Route deprecated Webhook Form submissions through the shared
execution pipeline with one adapter.
- [x] Preserve configured actions, dependencies, repeated fields, body
overrides, and saved feedback.
- [x] Prepare and validate Email actions using existing shared logic.
- [x] Remove duplicated orchestration and dead generated context wiring.
- [x] Verify generated routes and MCP-generated Preview submissions.
- [x] Mark the Webhook Form component and its dedicated dependencies
visibly deprecated, while leaving shared Form infrastructure active.
- [x] Group Webhook Form-only SDK code for straightforward removal while
preserving public APIs and generated output.
- [x] Use deprecated terminology consistently for Webhook Form-only PR
code, and clarify the active identity migration marker.
- [x] Confirm required staging CI checks.
- [x] Use ResourceForm as the one active modern component identity
across Builder, SDK, runtime, templates, generated code, and docs.
- [x] Migrate historical Form, NativeForm, ResourceForm, and WebhookForm
identities in one idempotent pass using the historical pages marker.
- [x] Remove the marker from ordinary project and snapshot APIs while
preserving historical input readers.
- [x] Persist pages and instances together when a historical marked
project is saved, including a pages-only edit.
- [x] Verify migration, export/reimport, old CLI and server snapshots,
page-only save, generation, and affected typechecks.
- [x] Complete an independent architecture review before commit or push.

- [x] Warn at prepublish for deprecated Webhook Forms on published
pages, with a link to each affected element.
- [x] Verify modern ResourceForm is excluded and nested/shared Webhook
Forms navigate to the correct page.
- [x] Complete independent review, focused tests, and affected
typechecks before push.

- [x] Remove local `ResourceForm as Form` aliases from React SDK tests
and fixtures; use the canonical component name throughout.
- [x] Fix stale identity expectations found in CI and verify affected
tests/typechecks.
- [x] Complete independent review before push.

- [x] Refresh tracked project bundle fixtures to the current bundle
contract and canonical WebhookForm identity; verify protocol and
affected CLI flows.

- [x] Align SDK CLI story assertions and MCP E2E fragment fixtures with
the persisted ResourceForm component name; rerun affected checks.

- [x] Share one browser bot-value generator across ResourceForm
submission and deprecated Webhook Form wrappers, preserving field
ownership and behavior.
- [x] Verify bot timestamps, Brave/media failure handling, repeated
submissions, affected typechecks, and independent review before push.

- [x] Reject ambiguous historical `Form` clipboard fragments before any
insertion or transfer mutation, with clear recopy guidance; preserve
canonical ResourceForm action remapping.\n- [x] Verify
instance/page/template/folder paste regressions, independent review, and
latest-head CI.\n\n
- [x] Explain Email attachment size limits in the Email action UI and
give a useful error when the aggregate encoded attachments exceed the
local guard.
- [x] Check Preview and published behavior, boundary tests, and
authoritative Form docs; verify the focused change and get independent
review.

Ref #4093
- [x] Preserve safe email codes/messages through MCP, including local
attachment and upload limit errors.
- [x] Correct Form documentation for each enforced limit and verify
Preview/published/MCP paths.
- [x] Verify Builder SDK and MCP focused tests, typechecks, and
independent review before push.

- Email limits and failure copy (`6d215f3ec3`): the shared SDK checks 32
attachments and 7 MiB aggregate Base64 data before dispatch; the 25 MiB
multipart response and Email action guidance use approved copy. Managed
Email error codes pass through Form and MCP results with resource IDs,
while MCP still omits resource bodies. Form docs distinguish the Worker
7 MiB JSON cap from Cloudflare's 5 MiB complete message and
verified-destination exception, and correct the no-retry behavior.
Focused SDK tests 89, Builder API tests 44, UI browser tests 42,
SDK/Builder/CLI/docs typechecks, lint, formatting, and generated MCP
docs check passed. Astra found no blocker. No real email or production
deployment occurred.

- Latest Email limits head `6d215f3ec3`: Main workflow [run
39393037290](https://github.com/webstudio-is/webstudio/actions/runs/39393037290)
passed on rerun, including all six Builder E2E shards; approved visual
regression [run
39393456618](https://github.com/webstudio-is/webstudio/actions/runs/39393456618),
submodules, and PR lint passed. The initial unapproved visual run showed
the same two previously accepted story differences.

- [x] Address review: normalize previous-Builder `Form` instance patches
before persistence, preserve historical WebhookForm identity, and cover
marked/unmarked cases. Documentation impact reviewed: this restores
intended save behavior, so no user guide change is needed.

- Review finding follow-up (`ce05dd733a`): three Form identity patch
regressions passed red/green; full project build-patch tests 28/28,
project typecheck, lint, formatting, and diff check passed. Independent
Astra review found no blocker. Incoming PATCH `Form` is treated as the
immediately previous Builder's modern form alias; already stored
unmarked historical `Form` continues to migrate to WebhookForm. The old
patch protocol has no client-release identifier, so pre-October-14 live
clients adding new ambiguous IDs cannot be identified separately.

- Latest review-fix head `ce05dd733a`: Main workflow [run
39397337356](https://github.com/webstudio-is/webstudio/actions/runs/39397337356)
passed, including six E2E shards after a targeted shard-4 rerun for an
unrelated MDX slash-menu timeout. Approved visual regression [run
39397395206](https://github.com/webstudio-is/webstudio/actions/runs/39397395206),
submodules, and PR lint passed. The unapproved synchronize visual run
was cancelled by the approved rerun.
2026-10-21 00:25:55 +02:00
Oleg Isonen cdfef44a6a fix: Resolve recent content and CSS issues (#6567)
Closes #6554
Closes #6555
Closes #6557
Closes #6559
Closes #6560
Closes #6563
Ref #6558
Ref #6564

## Change
- Preserve `color-mix(... var(...))` in border shorthands, including
when width or style is omitted.
- Keep bound JSON-LD objects intact, generate valid conditional Content
Block JSX, accept truly empty content queries, and reject missing source
fields.
- Let custom Open Graph values replace defaults and avoid evaluating a
Content Block source in the server loader when it has no Resource
dependencies.
- Add bounded error type and request ID diagnostics to automatic MCP
reports. This helps investigate future #6558/#6564 occurrences; it does
not claim to fix those unreproduced write failures. The generated API
contract is updated.
- No persisted-data migration or new user-facing format is needed.

## Verification
- New border and missing-source regressions failed before their fixes
and pass afterward. Focused package tests, all eight affected package
typechecks, lint, generated-API and package-boundary checks pass on the
combined branch.
- `pnpm fixtures` completed. Its only differences were unrelated remote
fixture content (`/acme-test` → `/olegs-test`), excluded from this PR.
- Full local Luna/low agent evaluations: 8/9 fixtures passed.
`managed-form-runtime-v1` missed its action check, also seen on earlier
separate runs. Comparison baselines are incompatible or absent; none
were updated.
- Required CI is green after the simplification: main workflow
(including all Builder E2E shards), visual regression, submodules, and
PR lint.

## Checklist
- [x] Reproduce the six fixable reports and cover them with regressions.
- [x] Investigate #6558/#6564 and add safe diagnostics for future
reports.
- [x] Address and resolve all review comments on the three original PRs.
- [x] Review documentation impact: existing product docs describe the
intended behavior; report diagnostics are internal, so no docs update is
needed.
- [x] Critically review and simplify the combined diff; verify focused
tests and package checks.
- [x] Simplify recursive content-query evaluation state and verify its
regressions.
- [x] Required PR CI passes after the simplification.
2026-10-20 13:04:27 +02:00
Oleg Isonen fad586889a feat: Paste copied variables with keyboard (#6549)
## Summary

- Recognize copied variable payloads in the design mode keyboard paste
pipeline.
- Keep variable clipboard utilities in the shared copy/paste folder so
both the settings-panel feature and shared paste handling import from
shared code.

## Verification

- Oxfmt and Oxlint passed for the changed Builder files.
- All CI checks passed on the latest commit, including typecheck, tests,
E2E, and visual regression.
- Local Vitest and typecheck could not start because this checkout is
missing existing dependencies (`email-addresses`, `ipaddr.js`, `undici`,
and `tldts`).
2026-10-17 00:43:49 +02:00
Oleg Isonen 7953162dc3 fix: truncate long share link names (#6550)
## Summary
- Constrain share link names to the available row width
- Show an ellipsis when a name is too long

## Verification
- git diff --check
2026-10-17 00:05:33 +02:00
Oleg Isonen cb0cc5c125 fix: load inspected external resources in Builder (#6548)
## Summary
- Keep inspected Resource loads on the same URL + RequestInit fetch path
as ordinary loads. The Request object is retained only for exchange
inspection.
- Fix the Resource editor Refresh action for external APIs without
changing Builder's existing public-IP guarded Node transport.
- Add a refresh-button test, a deterministic inspected POST test, and
opt-in live GET checks for the Holy Redeemer API.

## Tests
- `pnpm --filter @webstudio-is/sdk exec vitest run
src/resource-loader.test.ts --reporter=dot` (60 passed)
- `pnpm --filter @webstudio-is/builder exec vitest run
app/builder/features/settings-panel/variable-editors/http-resource-refresh.test.tsx
--project core-browser-builder-settings --reporter=verbose` (1 passed)
- `WEBSTUDIO_LIVE_RESOURCE_GET=1 pnpm --filter @webstudio-is/builder
exec vitest run app/services/safe-resource-fetch.live.server.test.ts
--project core-server --reporter=verbose --silent=false` (3 passed;
normal and inspected GET returned 200)
- SDK and Builder typechecks; `oxlint` and `oxfmt --check` on changed
files

## Runtime note
The current Vercel Builder still uses its Node public-IP guarded
transport. A future Cloudflare Worker transport requires a separate
migration with `global_fetch_strictly_public` enabled; this PR does not
switch to unrestricted fetch.
2026-10-16 21:42:52 +02:00
Oleg Isonen 3f18f44456 fix: Align Form Action add button with panel headers (#6541)
## Change

Settings collapsibles now use `fullWidth` so right-side Builder Style
and Settings panel content owns its inline padding. Existing visual
insets are preserved, and Action explicitly owns its zero inset so its
header and action rows can span the section width.

- Forward `fullWidth` through `CollapsibleSectionWithAddButton`.
- Remove the `fullWidth` prop and padding wrapper from `StyleSection`;
all ten StyleSection callers own their content insets locally, including
Size's zero inset and full-width separator.
- Move Properties & attributes, diagnostics, individual Style panel
section insets into their own content.
- Keep normal property controls inset and let Action control its own
header, rows, error, and redirect spacing.
- Retain the earlier Form Action add-trigger and resource-row changes.
Action content starts below its full section header with a small gap.

## Implementation

- [x] Prevent overlap between the Action section header and its items:
start content below the full header with the existing 2px gap,
preserving row size and inset.

- [x] Review padding-only wrappers from the right-side Settings and
Style panel refactors. Apply padding directly to an existing Flex
container where possible and remove redundant Box wrappers.

- [x] Replace the Action dropdown hardcoded 180px minimum width with the
closest existing spacing token, `theme.spacing[26]` (176px; 4px
narrower).
- [x] Review documentation impact for the dropdown token change:
reviewed the Form action documentation; no update required.

- [x] Remove the `fullWidth` prop from `StyleSection`. Each individual
Style panel section content container explicitly owns its inline
padding: ordinary sections retain 12px and Size retains zero inset, with
existing gaps preserved.

- [x] Give CollapsibleSection content zero inline padding using the
existing `fullWidth` API for right-side Builder Style and Settings panel
sections. Each section explicitly owns its inline padding, preserving
current visual insets and allowing sections such as Action to control
alignment.

## Verification

- Action spacing: 13 focused Chromium browser tests, focused oxlint,
formatting, and `git diff --check` passed. Geometry asserts a 36px
header, 2px gap before the first item, button clearance, and unchanged
24px row height.

- Restored Page Settings to its original padding ownership; all 7
focused Page Settings Chromium tests, focused oxlint, and `git diff
--check` passed.

- Padding-wrapper follow-up: removed redundant Box wrappers around the
Navigation mode Flex and baseline Action header fixture; audited
right-side Settings and Style panel padding owners. 10 focused Action
Chromium tests, focused oxlint, and `git diff --check` passed.

- Dropdown token follow-up: 13 focused Action Chromium tests, focused
oxlint, and `git diff --check` passed. The browser assertion verifies
the 176px computed minimum width.

- 428 Style panel Chromium browser tests passed after moving padding
into individual sections.
- 43 focused Chromium browser tests passed: Action, PropsSection, page
settings, search, diagnostics, and request inspector.
- Builder TypeScript check, focused oxlint, and `git diff --check`
passed.
- Assert the Properties collapsible has zero inline padding while its
child owns its 12px inset; existing Action geometry checks pass.
2026-10-16 15:52:57 +02:00
Oleg Isonen c389cd3bb2 fix: classify errors with structured codes and types (#6539)
Invalid or revoked share links now return an actionable 401 response
instead of an unexpected server error. Missing project and workspace
records receive distinct responses at their lookup sites. Token,
project, and workspace lookups use `.maybeSingle()` and rely on database
uniqueness. Missing projects have an explicit `ProjectNotFoundError`;
the loader no longer interprets `PGRST116`.

The API preserves `UNAUTHORIZED` and `INVALID_AUTH_TOKEN` when
authorization fails during context creation, so CLI and MCP clients can
offer relinking guidance without inspecting error text. Tokens without
API access carry `API_ACCESS_DISABLED`.

A repository audit replaces error-message matching with typed errors,
stable codes, or structured diagnostics in CLI argument/configuration
handling, session conflicts, preview cleanup, import retries, domain
unpublishing, asset validation, JSX/expression diagnostics, CSS
validation, and publish diagnostics. `AGENTS.md` now explicitly
prohibits message-based error classification and recovery.

The existing build-permission preflight now advertises structured
import-error support. Clients upload assets before importing into older
servers that do not advertise it; newer servers keep selective retries
using structured missing-file details. The internal template-validation
error class remains outside public JSX bindings and input descriptions.

Shared Builder `parseError` normalizes tRPC and local validation errors,
so UI components only add display context instead of decoding transport
payloads.

Simplification removes three redundant error classes, catch-and-ignore
handlers, an unused formatter, and nested loader error handling.
Unpublishing an already unpublished domain succeeds after authorization.
CLI configuration failures use the existing shared error handling, and
plan parsing catches only JSON parsing failures.

Validation: affected suites passed (271 tests across 8 suites in the
latest simplification checks), affected package typechecks passed, and
lint, package-boundary checks, and `git diff --check` passed. The audit
replaced synthetic parser branches and private-method assertions with
actual tRPC round trips, PostgREST responses, and public VM behavior.
Controlled regressions confirmed that removing serialized validation
details and exposing the internal JSX error class both fail the revised
tests. Astra reviewed the production changes at medium effort; its
compatibility finding and the GitHub JSX-binding comment are fixed, and
follow-up review found no remaining substantive issues.
2026-10-16 12:14:57 +02:00
Oleg Isonen 33f7b350bc fix: Improve Form setup and email settings guidance (#6536)
## User-facing features and how to test them

- Project Settings → Emails → Reply to has an info tooltip explaining
how its display name is used in visitor confirmation subjects and
messages, and when “Site Owner” is shown. Test it by hovering or
focusing the info icon.
- When a Form has no resources available for its Action, clicking the
Action + button explains that a resource must first be created in
Variables. Test it with a Form that has no action-capable resources,
then create a resource and verify it can be added to the Action.
- Success redirect is shown inside the Action control only when Resource
actions are connected. Test by switching between navigation mode and a
Form with a Resource action; the redirect field should appear only for
Resource actions, and its saved value should return when a Resource
action is added again.
- The Action control no longer offers Disable/Enable. Connected Resource
actions run in their configured order. The Form Action model has no
`enabled` field; older saved JSON with that extra key is read as an
ordinary connected action.

## Verification

- Focused UI test for the Reply to tooltip.
- Focused UI test for the empty Action resource tooltip.
- Manually verify Success redirect visibility and value retention while
switching modes.
- Manually verify all connected Actions execute in order, including
older saved Actions carrying an ignored `enabled` key.


## Review follow-up

- Address all current open code review comments on this PR, verify the
fixes, and reply to each addressed thread before resolving it.

## CI repair follow-up

- Inspect the latest failing checks on this PR, fix the causes on the
existing branch, and verify the affected checks locally and in CI.

## Follow-up audit (2026-10-14)

- Audited head `8fb0b44`, all inline review threads and the PR
conversation. The earlier Reply to tooltip comment was answered and
resolved. Two P1 comments remained: required boolean `enabled`
validation in CLI evaluations, and execution of saved disabled actions.
- `builder-e2e (shard-6)` failed because Preview returned `Disabled`
between `First` and `Last` in the configured failure results test. The
failure matches the security review finding. `builder-e2e (shard-2)` was
still in progress at audit start; the staging deployment workflow was
cancelled.
- The follow-up filters saved disabled actions from execution and
restores boolean `enabled` validation in both CLI evaluations. Builder
labels saved disabled actions. Focused SDK (55), CLI (222), and Builder
(45) tests, plus all three affected package typechecks, passed locally.
- Pushed `7c2b90e082`; replied to both P1 review threads, then resolved
them. Its main CI run passed all 25 test/check jobs, including all six
Builder E2E shards and the previously failing shard 6.
- A later P2 review identified stale CLI/MCP guidance. Commit
`160a9d1707` corrects the source and generated docs; focused docs tests
(12) and CLI typecheck pass locally. Replied to and resolved that
thread. On this latest head, the main CI run completed successfully: 27
check jobs passed, including all six Builder E2E shards; one
visual-regression job was skipped. All three required checks passed. The
automatically triggered staging deployment workflow was cancelled under
the no-deployment instruction.


## Input type default follow-up

- Show `text` as selected in the Props panel for both the HTML `input`
element and the Input component when their `type` prop is unset,
matching their rendered default. Verify both variants in the Builder and
retain explicit type choices.


## Current review-thread follow-up (2026-10-14)

- Recheck every unresolved review thread against the current PR head,
make and validate any required fixes, and reply with the resolution
before closing each thread. Keep this work on the existing PR branch; do
not deploy.


## Input type metadata follow-up (2026-10-14)

- Move the unset input `type` display default into component/element
property metadata for both the Input component and native HTML `input`
element. Remove the Props-panel special case, keep the implicit default
out of saved props, and cover both variants with regression tests.
- Run focused checks, push the fix to this PR, and cancel any
automatically triggered staging deployment workflow. Do not deploy
manually.


## Props metadata selector simplification follow-up (2026-10-15)

- Refactor `$selectedInstancePropsMetas` after the input default
metadata change. Preserve the current metadata, ordering, and attribute
override behavior while simplifying the selector's structure and
abstraction boundaries.
- Run focused checks, commit and push to this PR branch. Cancel any
automatically triggered staging deployment; do not deploy manually.

## Latest review follow-up (2026-10-15)

- Audit the latest PR head, all unresolved inline review threads, and
general PR comments. Address actionable feedback on this branch, run
focused validation, then reply and resolve each addressed thread. Cancel
any automatically triggered staging deployment; do not deploy manually.


## Form Action model decision (2026-10-15)

- Remove the Form Action `enabled` field completely from the type,
serialization, validation, execution, fixtures, and current docs. Accept
older saved JSON containing that extra key by ignoring it, including
`enabled: false`; action presence and valid IDs determine execution.
- Update the CLI evaluation to assert intended action IDs and order
without using `enabled`. Address the latest P2 review finding against
this model. Run focused checks, push on this PR branch, and cancel any
automatic staging deployment. No manual deployment.


## Action control visual follow-up (2026-10-15)

- Match the Form Action plus button to the established Variables section
plus button style and implementation where appropriate. Keep the
existing icon.
- Give the Action resource dropdown a stable width comparable to the
Variables resource dropdown, including when available resource names are
short.
- Add focused UI coverage, validate locally, commit and push to this PR
branch, and cancel any automatic staging deployment. Do not deploy
manually.


## Action plus hover follow-up (2026-10-15)

- Match the Action `+` button's hover and focus styling exactly to the
plus buttons in panels such as Variables. Compare their actual
implementations, preserve the existing icon, and add focused UI coverage
where appropriate.
- Run focused checks, commit and push to this PR branch. Cancel and
confirm any automatically triggered staging workflow; do not deploy
manually.


## Current CI fix (2026-10-15)

- Inspect the latest check rollup and failing job logs on the current PR
head. Fix all current failures on this branch, run focused local
validation, push the changes, and monitor the new head until checks
complete.
- Cancel and confirm any automatically triggered staging deployment. Do
not deploy manually.
2026-10-15 17:25:22 +02:00
Oleg Isonen 59d4f00ce7 feat: new Form component, all features and improvements you dreamed of (#6485)
## User-facing features and how to test them

In Components → Forms, insert **Form (Beta)**. The existing Webhook Form
remains a separate component.

- **Insert a ready-to-use contact Form.** In Components → Forms, insert
**Form (Beta)**. It starts with accessible Name, Email, Subject,
Message, and optional Attachment fields; sends submitted field values
and uploaded files to the account holder; sends a customizable
confirmation to the visitor without attaching the submitted file; and
includes success and error feedback. The two Actions are named **Email
to owner** and **Email to visitor**. *(#3023, #5499)*
- **Use the contact Subject in both email subjects.** Owner and visitor
subjects bind the submitted Subject input; the visitor subject also
identifies the sender. Template and SDK tests pass.
- **Format submitted Form data readably in Email bindings.**
`formData.toString()` now renders labeled lines, nested values, and
uploaded filenames in any Email Resource expression, while excluding
passwords and internal Form fields. SDK and independent-bundle tests
pass. Published staging delivery is verified in Batch 7.
- **Choose Form actions.** Select the Form and open Properties &
Attributes → Action. Add up to ten visible HTTP, GraphQL, or Email
Resources; reorder, disable, or remove them. Submit and confirm enabled
actions run together. *(#5499)*
- **Send submitted fields and files.** Submit repeated fields and a file
input to an HTTP Resource. Check the received multipart fields, order,
filename, type, and bytes. Email Resources attach submitted files by
default; turn off **Attach submitted files** to omit them. *(#3023,
#5432)*
- **Make the visitor confirmation friendly and signed.** Inherited
content gets the approved friendly message and resolved sender name;
custom text remains intact. Email Request preview and delivery use the
same resolver. SDK and Builder preview tests cover defaults, custom
overrides, blank content, sender identity, and preview parity. Suggested
body:

  > Thank you for your message.
  >
  > We received it and will respond as soon as possible.
  >
  > Webstudio Team
- **Identify the sender in the visitor confirmation.** The resolved
sender name appears in the visitor subject and body. Focused tests pass.
- **Include source page context in the owner email.**
`browserInfo.pageUrl` is included in the owner message and the Email
Request preview. Focused SDK and Builder tests pass.
- **Use Form and visitor data.** In a Resource defined on the Form, bind
`formData` and `browserInfo` in its URL, headers, or body. Local MCP
Preview tests verify submitted fields, browser, and language. *(#5428)*
- **Use page and query values.** On a dynamic page with query
parameters, bind `system.params` and `system.search` in a Form Resource,
then navigate and submit. A query key with one value is a string;
repeated values are an ordered array. Confirm the current route values
are available after navigation. Text bindings render repeated values as
comma-joined strings. *(#5512, #3891)*
- **Use Navigation mode for search and filters.** Remove every Resource
from the new Form’s Action list. Its action becomes
`?__webstudio__=navigate`, and submitting named fields updates the URL
query and page Resources without a full page reload. Reconnect a
Resource to return to Resource submission mode
(`?__webstudio__=resources`). A plain Element with tag `form` keeps
native browser behavior.
- **Customize notification email.** In Project Settings → Emails, set
recipients, sender, and Reply to. In each Email Resource, choose project
recipients, custom addresses, or a visitor email input, and configure
its Reply to, subject, body, and attachment setting. Verify a
per-Resource override does not change another Form’s settings. *(#4414,
#4385, #5658)*
- **Choose Resource types from one ordered list.** In Variables → Type,
find REST resource, GraphQL resource, Assets resource, Email resource,
Sitemap resource, and Current date resource in that order. Confirm the
labels and order in the Type dropdown.
- **Inspect Resource requests and responses.** Open Variables → a
Resource → Edit variable. Use **Load data** on Request when no request
is shown; inspect HTTP request, response, and diagnostics. For Email,
load the request preview and confirm it does not send an email. After
submission, inspect saved HTTP and GraphQL exchanges without triggering
another request. *(#4093 related; new Form Resource inspector)*
- **Explain the Email Response before a submission.** Refresh builds the
local request preview without sending an email; the Response tab tells
users to submit the Form in Preview to see the Email Service response.
Focused inspector test passes.
- **Use action results in the Form.** Bind `formState`, `results`, and
`errors` in the success and error content. Submit successful and failing
actions and verify each result or error includes its action’s response
details in configured order. *(#5499)*
- **See submission feedback.** Submit a Form whose success or error
message is outside the viewport and confirm that message scrolls into
view. Repeat with feedback already visible, reduced motion, partial
failure, and a configured success redirect; visible feedback should not
move, and redirect should happen without scrolling first. *(#6487)*
- **Redirect after success.** Set Success redirect and submit both
successful and failing Forms. Only success follows the redirect.
*(#3530)*
- **Keep separate email threads.** Retries preserve a submission
reference, while separate submissions appear in separate Gmail
conversations; Batch 7 verifies both. *(#5018)*
- **Keep existing Webhook Forms.** Insert the existing Webhook Form and
verify its configured behavior remains intact. For its documented
query-binding fixes, verify route params and repeated search values
after navigation. *(#5512, #3891; #4093 and #5432 remain related legacy
issues)*

- **Keep native Form props out of the new Form editor:** The new Form
metadata hides generated rendered-tag HTML props such as `method`,
`encType`, `target`, and ARIA attributes, while its own Action, Success
redirect, and visibility controls remain. The legacy Webhook Form
behavior is unchanged. A Builder property-selector regression test
verifies this.

- **Allow up to 10 Form Actions:** The shared validator and Action
picker now allow up to 10 Resource actions, and the Form control
description reflects the limit. SDK tests accept 10 and reject 11; the
generated CLI prebuild rejection coverage passes (130 tests). SDK and
SDK Components typechecks, formatting, and diff checks pass.

- **Make the default Form ready to use without edits:** The inserted
contact Form has required Name, Email, Subject, and Message fields; its
project Email Action resolves the current project contact address or
account holder dynamically, with no personal data in the template; its
visitor Email Action has a confirmation subject and message; success and
error states give actionable feedback. `core-templates.test.tsx`
verifies fields, routing, and copy; focused registry tests and typecheck
pass.

- **Make the default Form usable as a contact form:** Its Email Actions
are named “Email to owner” and “Email to visitor.” The owner body binds
the complete submitted `formData` object rather than manually listing
fields, and an optional Attachment input sends its file only to the
owner. Email Resource expressions render `formData.toString()` as
readable labeled lines. The visitor receives a confirmation without
submitted files. Registry/template tests and MCP E2E verify the inserted
Form, owner message and attachment, visitor message, and Request
preview.

- **Format Form action errors clearly:** The default Form shows each
action error as a spaced bullet inside a red-tinted alert panel.
Registry template tests verify the alert and list structure; 8 template
tests pass.
- **Deprecate the existing Webhook Form before its next-PR removal:**
The component metadata and compatibility exports in the React, React
Router, and Remix packages are marked deprecated, and the guide says
removal is planned. Keep form submission helpers still used by
NativeForm active; remove legacy-only wrappers and template in the
follow-up PR.

## MCP feature parity test plan

Run these cases through Webstudio MCP on a disposable project. Create
and configure the Form with MCP, save and read back the configuration,
then test its generated Preview. Use only a controlled test mailbox for
real email delivery. This plan mirrors the user-facing UI cases above.

- Discover **Form (Beta)**, inspect its schema, insert the default
contact Form, and read back its fields, Actions, success/error content,
and absence of personal data.
- Change the submitted Subject and Name. Verify owner and visitor
subjects, visitor sender identity, friendly confirmation text, and the
owner page URL.
- Bind the complete `formData` object. Verify readable lines, nested
values, filenames, and exclusion of password/internal fields.
- Add HTTP, GraphQL, and Email Actions; reorder, disable, and remove
them. Verify concurrent dispatch, result order, partial failure, and the
10/11 Action limit.
- Submit repeated fields and one or multiple files to HTTP. Verify
multipart order, filename, MIME type, and exact bytes. Verify Email
attachments default on, then turn them off for the visitor Action and
confirm the visitor receives no file.
- Configure project email settings and Resource overrides. Save/reload
each recipient mode, Sender, Reply to, subject, body, and attachment
setting; verify overrides do not leak between Forms.
- Bind `formData` and `browserInfo` from a Form-scoped Resource. Verify
page URL, browser, language, and hosting-provided IP/referrer where the
test environment supplies them.
- Test dynamic route params and single/repeated query values before and
after navigation. Verify Navigation mode updates the URL and bound page
Resources without a full reload; reconnect an Action and verify Resource
mode. Check native `form` Element behavior separately.
- Verify Resource discovery order and method labels, then exercise
HTTP/GraphQL Request, Response, Diagnostics, load/refresh, and saved
exchange inspection. For Email, verify request preview sends nothing and
the Response appears after actual submission.
- Bind `formState`, `results`, and `errors`. Submit success, validation
failure, partial Action failure, and full failure. Verify feedback
content, visible/off-screen scrolling, reduced motion, and success-only
redirect behavior.
- Submit twice and verify separate email threads and stable retry
identity, with no duplicate delivery after an ambiguous send.
- Verify the existing Webhook Form remains editable and its route/query
behavior remains intact, while new Form discovery/creation and native
Form prop exposure match the documented component contract.

### Execution status and MCP limitation

The `mcp-*` suite authors through a current-source MCP server and
submits generated Preview Forms through `preview.submit-form`.
Playwright covers Builder UI, navigation/rendering, and viewport
assertions. The separate `forms.simulate-submission` operation submits
synthetic values from the saved canvas Form directly to the shared SDK
server Form engine, without starting Preview or a browser. Both paths
use the same saved-draft preparation and SDK submission handler. Most
automated email tests use a loopback receiver. The controlled
branch-source MCP test below separately verifies delivery to a real test
mailbox; it does not test the user’s connected MCP release.

On 2026-10-14, the branch-source MCP was tested against a running local
Builder and a copied disposable project. No npm package publish or
connected-MCP release was needed for this local verification.

- [x] Add a bounded `preview.submit-form` MCP operation for
session-owned generated Preview Forms. It uses native form controls and
validation, supports repeated values and bounded file uploads, returns
state/results/errors/exchanges, and never replays an ambiguous send. The
MCP-client E2E verifies one owner Email delivery and one HTTP delivery
with ordered results against local receivers. Focused Vision, Project
Build, CLI, and Builder E2E tests pass.
- [x] Migrate browser Preview Form runtime cases to
`preview.submit-form`; retain Playwright for Builder UI,
navigation/rendering, and viewport assertions. The 52 MCP-named Builder
E2E cases passed across the full 2-worker run (50/52) and a focused
rerun of its two timed-out Email cases (2/2), including MCP submission
and local receiver assertions.
- [x] Add `forms.simulate-submission` to the current-source CLI MCP
session. It reads the saved canvas Form, calls the Builder server route,
and reuses the Preview Form engine and SDK submission handler. The older
local CLI adapter rejected Email; the current server route supports it.
Static Checkbox and multiple Select array names come from saved
controls; dynamic array names may be supplied explicitly. Focused tests
and independent Astra Medium review pass.
- [x] Run the Luna Low `managed-form-runtime-v1` scenario against
`forms.simulate-submission` through a real MCP client on the current
source. `gpt-5.6-luna` at low reasoning passed 10/10 checks in 55
seconds. Three simulation calls produced success, an explicit 503
failure, and recovery against the controlled local HTTP receiver in the
expected sequence. The agent used no Preview/browser submission or Email
action. One `templates.get` MCP error was recovered before submission.
- [x] Verify `forms.simulate-submission` from branch-source MCP against
the local Builder server and a disposable saved Form. The supported
local database was started, and `EMAIL_SERVICE_URL` plus
`TRPC_SERVER_API_TOKEN` were supplied from the staging Infisical
environment without printing values. Luna Low used MCP discovery,
Form/resource inspection, `update-resource`, and simulation. Both Email
Resources resolved only to `testing@webstudio.is`; simulation returned
success, HTTP 200, two Email results with status 200, and no errors.
Gmail independently confirmed both owner and visitor messages delivered
to that controlled inbox at 15:46:51 UTC on 2026-10-14. The shared
server route and CLI transport received independent Astra Medium review;
focused CLI (164) and HTTP-client (45) tests, package typechecks,
formatting, and diff checks pass. No npm release or production
deployment was involved.

- [x] Rename the new Form component label to **Form (Beta)** in the
component picker and MCP discovery. Component IDs stay unchanged;
focused registry, Builder, MCP, and CLI tests pass; Astra Medium
reviewed the change. Pushed `592589ccfe`.

## MCP end-to-end verification

### Verified against this branch

These checks use the current-source MCP session server to author
disposable local Builder projects and `preview.submit-form` to submit
generated-site Forms to local test receivers. Playwright verifies
Builder UI, navigation/rendering, and viewport behavior. They verify
this branch's code, not the connected MCP release, staging services, or
real mailbox delivery.

Current branch rechecks (2026-10-14): Project Build MCP tests 142/142,
CLI MCP/evaluation harness tests 60/60, Vision CDP/Form tests 48/48, and
the React Router Navigation browser test 4/4 pass. Builder, CLI, Project
Build, Vision, and both React Router fixture typechecks pass; scoped
lint, formatting, and diff checks pass. The earlier head passed PR CI;
checks on commit `7438692ef5` are running. The separate full CLI
prebuild suite now passes 131/131 after adding the required `statusText`
to its private Email binding fixture. The main-merge CI failures in
Project Build expression expectations, CLI Preview config import,
formatting, and the SSG fixture size cap were fixed in `0272768260`;
checks on that commit are pending.

- [x] Verify all 52 MCP-named Builder E2E cases on the current head. The
complete 2-worker run passed 50/52; two complex Email cases exceeded
Playwright's 120-second per-test limit under concurrency, then both
passed in a focused one-worker rerun (44.4s and 31.0s; 2/2). A serial
full rerun reached 43/52 without assertion failures before the wrapper's
900-second command limit. An earlier full run passed 52/52 before the
final Preview readiness fix. Coverage includes contact Forms, Email
delivery and partial updates, attachments, readable `formData`, HTTP and
GraphQL Actions, navigation and repeated query values, legacy Form
editing, Resource inspectors, Form properties and type choices,
feedback, and redirects. Full-run command:
`E2E_TEST_COMMAND_TIMEOUT_SECONDS=1800 E2E_SKIP_BUILDER_BUILD=true
E2E_INSTALL_PLAYWRIGHT=false pnpm --filter @webstudio-is/builder e2e --
'mcp-' --project=chromium --workers=2`.
- [x] Run the Builder Preview Form E2E suite serially: 5/5 passed,
including authenticated Builder Preview submission, error rendering,
redirects, submitted browser `FormData`, off-screen feedback scrolling,
and Navigation mode without a Resource POST or canvas reload.
- [x] Verify the local Email inspector server path. The route
integration suite calls the real local `/rest/preview-form` handler and
passes a controlled Email Service binding response through it; 28/28
tests pass. The Email Service boundary is stubbed, so this does not
claim a staging Worker run.
- [x] Verify the Form Action picker browser tests: 2/2 pass for add,
disable, reorder, remove, the ten-Action limit, and rejection of an
eleventh Action. The MCP runtime E2E separately verified ten deliveries
and ordered results.
- [x] Verify local Preview request context across two pages: scoped
`formData`, `browserInfo.pageUrl`, trusted IP, user-agent, and language
all remain associated with the correct Form Resource.
- [x] Verify partial Email body updates through MCP. Custom and
explicitly blank bodies preserve the other recipient, sender, and
attachment settings; local Preview uses the requested body. Focused E2E
passes 2/2.
- [x] Verify the default Form template has no hardcoded email address,
sender, or recipient, and the error Collection renders each message as a
separated bullet in a red-tinted alert. Registry tests pass 11/11.
- [x] Verify the Action picker UI adds, disables, reorders, and removes
HTTP, GraphQL, and Email Resources; accepts 10 and blocks 11. Component
browser tests pass 2/2. Runtime MCP E2Es separately verify Action order
and concurrent dispatch; the picker test does not claim ten live
deliveries.
- [x] Verify the Luna Low managed-Form authoring evaluation: 20/20
checks pass. Validator tests pass 83/83.
- [x] Verify the legacy Webhook Form is excluded from new MCP
creation/copy paths while saved instances remain editable. Source tests
and the existing 139 MCP checks pass; this does not mean the published
MCP catalog has been refreshed.
- [x] Formatting, `git diff --check`, and Builder, CLI, and SDK
Components Registry typechecks pass.

## Runtime correctness

- [x] Prevent automatic retry of an Email Action when the Email Service
send may already have succeeded; report an ambiguous response without
sending the same email again, and verify one Form submission cannot
produce duplicate delivery. Pushed `07627e44fa`: Email Actions never
automatically replay; HTTP retries remain. RPC and Preview accept legacy
`{id}` and canonical replies, including successful canonical replies
with an empty provider ID. Regression tests cover one dispatch after
failures, timeouts, and malformed replies, response compatibility, and
HTTP retry. All 143 focused SDK tests, SDK typecheck, scoped lint, diff
checks, and independent Astra review pass.

- [x] Keep ambiguous Email Action outcomes non-retriable in Builder so a
possibly successful send is never replayed; preserve compatibility with
both deployed legacy `{id}` and canonical `{ok, status, statusText,
data}` Worker replies. Pushed `578a1a99`: canonical delivery IDs must be
nonblank, while legacy replies remain supported. SDK regressions cover
one dispatch after ambiguous RPC/Preview failures, timeouts, malformed
replies, and empty IDs.

## New Form navigation mode and MCP E2E (2026-10-11)

- [x] Give the new Form two submission modes using its valid action URL:
`?__webstudio__=resources` when one or more Resources are connected and
`?__webstudio__=navigate` when none are connected. Removing the last
Resource switches to Navigation mode. Keep a plain `form` Element native
and leave the legacy Webhook Form available but marked deprecated until
the next release. Runtime tests cover both action markers; the
MCP-authored browser E2E verifies navigation query updates and Resource
revalidation. Legacy Webhook Form metadata, compatibility exports,
component code, and docs now state its deprecation and support window.
- [x] In the new Form’s Action control, when no Resources are connected,
show centered “Navigation mode” with an info tooltip: “Submits the form
fields as URL query parameters and navigates without a full page reload.
Use this for search and filters that update page Resources from the
URL.”
- [x] Add MCP-authored end-to-end coverage for both modes and their
distinctions. Luna/low authored Resource and Navigation Forms plus a
native `form` Element through MCP, with separate registry searches for
Form (Beta), Webhook Form, and Element; the final project passes the
corrected structured evaluator. The MCP-authored Playwright E2E removes
all Form Actions and verifies repeated and single query values update
the URL and page Resource without a document reload or Resource POST.
Existing local MCP Preview coverage verifies Resource submission, native
GET behavior, legacy Webhook Form compatibility, and component
discovery.

## Ports from the earlier implementation

- [x] Resource selection and scoped `formData`/`browserInfo` access,
parallel dispatch, protected egress, server destination limits, and
bot-field validation are already in the new Form.
- [x] Resource editor URL autofocus and known header/value suggestions
are already reused.
- [x] Centralize the `formData` and `browserInfo` parameter names for
Builder, generator, and runtime checks.
- [x] Default HTTP body forwarding and automatic multipart for uploads
are now ported to the new Resource graph.
- [x] Success/error state slots and success redirect are now ported into
the new Form and Router/Remix adapters.
- [x] Add response `results`/`errors` bindings and one retry per failed
or timed-out destination.
- [x] Port feedback scrolling to the new Form in Router and Remix
adapters, with browser regression coverage.
- [x] Adapt the existing bot-field protection for the new Form; saved
Webhook Forms keep their prior bot-field behavior. The narrowly scoped
route/query fixes for #5512 and #3891 are tracked separately below.
- [x] Local new-Form bot checks: one fresh hidden value per submission,
five-minute expiration, malformed/missing rejection before dispatch,
Brave handling, and stripping internal form ID/bot fields before
Resource delivery. Evidence:
`packages/sdk/src/managed-form-submission.ts`,
`managed-form-submission.test.ts`,
`packages/sdk-components-react/src/form-submission.browser.test.ts`, and
managed generated-route cases in `packages/cli/src/prebuild.test.ts`.

## Batch 1 — New Form foundation

- [x] Make the existing Forms-section **Form** tile insert the new Form
component while retaining the existing Webhook Form tile and behavior.
- [x] Make the new Form a managed Resource submission component. With no
destination, it shows a configuration error and cannot dispatch or
navigate. Use Element with `tag=form` for ordinary browser form
behavior.
- [x] Exclude unrelated legacy-only runtime work from this feature.
Existing component metadata is deprecated; the new Form has no legacy
compatibility or migration contract. The targeted #5512/#3891
route/query fixes are tracked separately in Batch 2a.
- [x] Verify the Resource-only component with focused render tests,
package typecheck, and component story generation.
- [x] Verify the Batch 1 new Form acceptance criteria in the Builder and
browser.

### Acceptance criteria

- Inserting the new Form creates the default contact Form with named
inputs, a submit button, and two selected Email Resource Actions: one
for project recipients and one for the visitor email field. If all
destinations are removed, it shows a configuration error and cannot
dispatch or navigate until a destination is configured.
- Element with `tag=form` retains browser validation, method, encoding,
action, and navigation.
- Acceptance covers the new Form only. Apart from the explicitly tracked
#5512/#3891 route/query binding fixes in Batch 2a, legacy compatibility,
old native-mode settings, and old-component migration are outside the
feature contract.

**Verification:** Builder catalog and insertion tests; Chromium
empty-Resource blocking test; generated Element `tag=form` Playwright
test with a local receiver
(`packages/sdk-components-react/src/element-form.test.tsx`,
`40c6f972c8`, focused 1/1) proves invalid input sends nothing and valid
native multipart POST navigates using the configured action, method, and
encoding; generated published output for the new Form; relevant
typechecks and lint.

The user confirmed the test inbox received the test email attachment.
Staging Builder Preview verified Email and Webhook delivery. The user
confirmed the published staging route is live; the route returns HTTP
200 and includes a file input. Published delivery to both Webhooks and
final Form-state behavior are verified in Batch 7 below. Live Production
Form submissions are outside this PR’s verification scope.

## Batch 2 — Resource-only submission, scoped data, and Resource
selection

- [x] Give the new Form one submission path with one to ten selected
Resource destinations. Keep Actions and Success redirect as its Form
controls; plain HTML forms use Element with `tag=form`. An empty
selection reports an error without dispatch or navigation; tests cover
this path.
- [x] Expose one submission-only `formData` object, keyed by HTML name.
Repeated names are ordered lists; a known unchecked checkbox group is an
empty list. Preserve files and hidden inputs.
- [x] Expose safe `browserInfo`: trusted IP, user agent, language, and
referrer. Never expose raw request headers, cookies, or authorization.
- [x] Make explicit Resource expression bindings to a Form's `formData`
and `browserInfo` available only to Resources defined within that Form;
a selected HTTP Action with an unset or empty body implicitly receives
submitted Form data regardless of Resource scope.
- [x] Resource variables are created in **Variables** at their normal
scope. The Actions selector lists only action-capable Resource variables
visible in the Form's variable scope: defined on the Form or one of its
ancestors. Exclude sibling, descendant, and unrelated scopes. Resources
defined on the Form can bind its `formData` and `browserInfo`; ancestor
Resources cannot bind values from a descendant Form. Carry forward URL
autofocus and known header/value autocomplete. Enforce up to ten Actions
per Form in the Builder and server.
- [x] Keep **Actions** as a control inside **Properties & Attributes**,
with a plus menu and selected Resource rows. The plus menu offers only
existing action-capable HTTP, Email, and GraphQL Resource variables
visible in the Form's current variable scope (defined on the Form or an
ancestor); exclude System data variables and resources from sibling,
descendant, or unrelated scopes. Resource variables are created in
**Variables** at their normal scope; Actions only selects existing
variables. Disable already-selected Resources in the menu. Selected rows
expose enable, disable, and remove controls. A simple click on the
Action name opens the existing Resource editor through selection/open
state, leaves its Variables row visibly selected, and scrolls it into
view, while preserving page and canvas selection; drag, enable/disable,
and remove controls must not open it. The eye toggles enabled state; the
minus removes the Action from this Form only. Preserve explicit
selection, ordering, and the ten-Action limit. Published-site submission
checks are recorded in Batch 7.
- [x] Cover scope, expressions, repeated names, renames, files, copying,
deletion, save/reload, and unavailable bindings with focused tests.
- [x] Ensure `mapResourceExpressionsMutable` remaps Email
`senderExpression` and `recipientsExpression` data-source IDs;
`fragment.test.tsx` verifies copy/paste/fragment rebinding (focused
regression 1/1, full file 34/34). Project-build typecheck and `git diff
--check` pass.
- [x] Add focused fragment coverage for Email `senderExpression` and
`recipientsExpression` bound to variables inside a copied Form,
asserting references remap to the cloned variable IDs (not only
restoration of external parent bindings by name). `fragment.test.tsx`
passes 34/34 and combined project-build data+fragment tests pass
165/165; assertions verify both expressions remap to cloned variable IDs
distinct from the source IDs.
- [x] Implement and locally test Batch 2a current-page parameters and
repeated query values in managed and legacy Form Resource bindings
(#5512, #3891).
- [x] Add generated published-route loader integration coverage for a
native GET Form with repeated query keys; repeated `system.search`
values reach an expression-bound Resource in both `defaults` and
`react-router` templates. Focused prebuild tests pass 2/2.
- **Issue scope:** #5512 is fixed for legacy generated HTML Form actions
and the new Form path; generated-route tests cover both route templates.
#3891 exposes repeated values as ordered arrays through `system.search`
while preserving strings for single values; SDK, Builder Preview,
generated action, and generated native-GET loader regressions cover the
behavior.
- [x] Local #5512/#3891 implementation and regression: the new Form's
generated action uses current `system.params` and `system.search`, where
repeated values are ordered arrays; SDK search tests and the Builder
native GET preview test preserve repeated values
(`packages/cli/src/prebuild.test.ts`,
`packages/sdk/src/system-search.test.ts`,
`apps/builder/app/canvas/interceptor.test.ts`).
- [x] Locally verify #5428: bind trusted `browserInfo` values into
`X-Forwarded-For`, `User-Agent`, and `Accept-Language` Resource headers,
inspect the generated action’s outbound request, and document the setup
and trusted client-IP source for each hosting adapter without forwarding
cookies or authorization.
- [x] Local generated-route verification (`e9d5209882`): Remix and React
Router send the three configured headers to a test destination;
Cloudflare context uses `CF-Connecting-IP`, Node omits unavailable IP,
and arbitrary forwarding, cookie, and authorization headers are not
forwarded. Setup and hosting sources are documented.

### Form property inventory

- [x] Expose only the Actions control and **Success redirect** as Form
controls. The generic HTML attribute picker and native `id`, `class`,
`action`, `method`, `target`, and `encType` controls are unavailable for
this component.
- [x] Rename the Form control label from **Actions** to singular
**Action**.

Staging verification for the Form property panel is recorded in Batch 7.

### Acceptance criteria

- Action and Success redirect are the only Form controls. The component
label `Form` is system metadata and is not editable as an HTML
attribute; the Form has no `id`, `class`, `action`, `method`, `target`,
or `encType` controls.

- **Action** is a control inside **Properties & Attributes**. Its plus
menu offers only existing action-capable HTTP, Email, and GraphQL
Resource variables visible in the Form's current variable scope (defined
on the Form or one of its ancestors). It excludes System data variables
and Resources in sibling, descendant, or unrelated scopes. Resource
variables are created in **Variables** at their normal scope; Actions
only selects existing variables. Already-selected Resources are disabled
in the menu. Selected Resources appear as rows with enable, disable, and
remove controls, and can be reordered. Clicking an Action name opens the
corresponding Resource’s existing Edit variable dialog and highlights
its Variables row by setting the existing selection/open state directly,
without synthetic clicks; preserve the current page and canvas
selection. Drag, enable/disable, and remove controls do not open the
editor. The ten-Action limit is enforced. Resources defined on the Form
can bind that Form's `formData` and `browserInfo`; ancestor Resources
are visible but cannot bind values from the descendant Form. An empty
selection shows no canvas warning before submit; attempting to submit
shows the configuration error, dispatches nothing, and does not
navigate. The Form has no native or direct-URL submission mode.
- The new Form supports Resource Actions only; do not add a
legacy/native-mode compatibility path or migration requirement.
- A Resource defined on the Form can bind that Form's `formData` and
safe `browserInfo`; a visible ancestor Resource cannot access values
from its descendant Form. Resource variables are created in Variables at
their normal scope. The plus menu lists only existing action-capable
Resources from the Form and ancestor scopes, excluding sibling,
descendant, unrelated scopes, and System variables. Forms explicitly
select each action; none are auto-added. Already-selected Resources are
disabled in the menu. Bindings survive editing and save/reload.
- On a `/products/:slug` page visited as
`/products/chair?source=newsletter`, a submitted Resource can use
`system.params.slug` as `chair` and `system.search.source` as
`newsletter` in its URL, headers, or body. Values come from the current
submission's page, including after navigation; missing parameters remain
absent.
- Repeated names retain form order, unchecked checkbox groups resolve to
empty lists, and files stay file values. The Resource editor focuses URL
and suggests known header names and values.

## Batch 2a — Keep page parameters and every selected query value
(#5512, #3891)

New Form Resource bindings must receive the current page's parameters,
and a multiple-select GET form must not lose selections when a binding
reads the URL.

- [x] Extend #5512 route/query propagation to legacy native Form
actions: generated routes pass route params and ordered query values
while preserving the managed Form path. The regenerated runtime contract
and 26 fixture routes are pushed in `8c4bda7791`; `check:generated-api`,
fixture builds, and generated-route regressions pass.
- [x] Implement route/query propagation in both managed and legacy Form
Actions: populate `system.params` from the current route, preserve
single-value `system.search` strings and expose repeated query values as
ordered arrays through the same binding. Generated action and loader
regressions cover both templates; the consolidated CLI prebuild suite
and focused native-GET loader tests pass.

- [x] Verify #5512 with the new Form's Resource bindings using
`system.params` and `system.search`. Cover URL, header, and body
bindings, dynamic pages, missing values, and submission after navigation
in React Router and Remix.
- [x] Reproduce #3891 with a native GET form and a multiple-select
input. Keep the browser's standard repeated query keys; do not join
values with commas or rewrite the submitted URL.
- [x] Use `URLSearchParams` to preserve every value in order, including
empty values, repeated identical values, and values containing commas or
encoded characters. Keep an object-based binding interface so property
autocomplete still works.
- [x] Inspect existing `system.search` consumers and record the
compatibility choice here. Keep existing single-value bindings working,
expose all repeated values to bindings, and make any changed behavior
for existing repeated-key bindings explicit. Do not silently discard
values or break existing expressions.
- [x] Apply the agreed representation consistently in the Builder,
published page data, client navigation, and new Form action path. Update
affected types, binding suggestions, generated code, and fixtures.
- [x] Add passing SDK, Builder, and generated-route regressions for
current page parameters and repeated query values in new Form bindings;
document single-value and ordered multi-value query bindings with
working examples.
- [x] Local new-Form generated-route regressions cover current page
parameters and repeated query values in URL, headers, and body after
navigation. A red-before/green-after test proves configured body
bindings survive alongside submitted fields; CLI binding examples
document single and repeated query values.
- [x] Record regression coverage for #5512/#3891 on new Form bindings:
generated-route and Builder tests cover current-page parameters and
ordered repeated, empty, comma, and encoded query values, with SDK
coverage for scalar compatibility.

**Compatibility choice:** `system.search[name]` is a string when the
query key occurs once and an ordered string array when it occurs more
than once. Existing single-value expressions are unchanged; text
bindings stringify arrays as comma-separated values. The relevant
consumers in Builder system/preview and generated page/action templates
were reviewed. Focused SDK, Builder, and generated-route tests cover the
behavior.

### Acceptance criteria

- On a `/products/chair?source=newsletter` page, a new Form Resource can
bind `system.params.slug` as `chair` and `system.search.source` as
`newsletter` after navigation. Existing Webhook Form behavior is
unchanged except for the explicitly tracked #5512/#3891 route/query
binding fixes in Batch 2a.
- Selecting two options in a native GET form leaves both values in the
URL and makes both available to bindings in their original order.
Single-value access still works, and property autocomplete remains
available.
- Empty values, identical repeated values, commas, encoded characters,
reloads, and client navigation do not drop or corrupt query values.
- Verify current-page and repeated-query bindings for the new Form and
ordinary Element `tag=form` browser behavior. Legacy Webhook Form
changes are limited to the explicitly tracked #5512/#3891 route/query
fixes in Batch 2a; other legacy compatibility is not a closure
condition.

## Batch 3 — HTTP Resource submission

- [x] POST to each selected HTTP Resource. A selected Action whose
Resource body is unset or empty implicitly receives all submitted fields
regardless of Resource scope; an edited body can omit, rename, add, or
compute fields. Explicit `formData` expression bindings remain limited
to Resources defined within that Form.
- [x] Use JSON for text-only data and switch to multipart when the
resolved body contains a file. Set JSON content type unless configured
otherwise; preserve repeated fields and file bytes, and remove stale
`Content-Type` so fetch writes the multipart boundary.
- [x] Add an explicit `auto`/JSON/multipart choice. Reject an
incompatible body before that destination's fetch; dependency-free
requests are preflighted before any destination dispatch.
- [x] Resolve bindings and validate final outbound URLs and redirects
before sending. Block internal and private destinations; keep
credentials and sensitive request configuration off the public page.
- [x] Add generated-site and server tests for JSON, multipart, mapping,
files, repeated fields, invalid configuration, and destination safety.
- [x] New Form route proof: compiled Remix and React Router managed
actions forward repeated same-name text values and uploaded files as
separate multipart entries, preserving order, duplicate values,
filenames, MIME types, and bytes (`3c5b72a`; focused CLI tests passed
2/2). Existing Webhook Form behavior remains at its pre-PR baseline;
migration is out of scope.
- [x] Make file inputs easy to configure in the Builder: choose the file
input type and set its field name, required state, accepted file types
(`accept`), and multiple-file selection (`multiple`). Keep these
settings after saving, reopening, and publishing. Verified on
`d7f67307f9` with Builder insert/save/reopen, generated page, Chromium
required/optional/multiple upload, SDK template, typecheck, lint, and
format checks.

### Acceptance criteria

- Every selected HTTP destination receives POST. A Resource with an
unset or empty body receives all Form data implicitly, regardless of
where the Resource is defined. Explicit `formData` expression bindings
remain limited to Resources defined within that Form. Text-only bodies
arrive as JSON; bodies with uploads arrive as multipart with field
names, filenames, MIME types, file bytes, and repeated values.
- A site creator can add and configure a file input using the Builder
without custom code. Published forms support one or multiple selected
files, block submission when a required upload is empty, and submit
normally when an optional upload is empty. The `accept` setting guides
the file picker; it is not server-side file validation.
- An edited body can rename, omit, add, or compute fields. A Resource
outside the Form sends only its own configured data.
- An incompatible explicit body format fails before its destination
fetch. Dependency-free requests are validated before any dispatch; a
body that depends on another Resource is validated once that dependency
resolves, before its own destination fetch. Resolved destinations and
each redirect reject private or internal addresses, and secrets stay off
the public page.

## Batch 4 — Project Emails settings and Resource editor

- [x] Add Project Settings → **Emails**. Move the current Contact email
list without changing its stored value.
- [x] Configure site-wide defaults for Sender (name and email, or email
alone), recipients, owner subject, and plain-text owner body. Published
sites receive project default changes after republishing.
- [x] Add the Email Resource as a normal Resource, creatable inside or
outside a Form. It can inherit, override, and reset project defaults.
Only a Form-scoped Email Resource can bind that Form's data. Surface an
unavailable Form-only binding clearly; never send incomplete template
text silently.
- [x] Resolve team recipients from the project list or owner fallback,
support a custom comma-separated override, and default Sender to the
owner with a per-Resource override. Form data cannot choose team
recipients.
- [x] Configure the subject, plain-text owner body, and whether
submitted files should be attached. With no project body or Resource
body, any selected non-Visitor Email Resource uses readable submitted
fields and optional `browserInfo` interpolation, regardless of Resource
scope. Automatic owner-email text includes hidden fields while excluding
passwords and internal bot fields.
- [x] Test project settings storage, inheritance/override/reset,
recipient fallback, Form scope, expression validation, and preservation
of the existing Contact email setting. A complete project owner body
containing `${...}`, backslashes, or backticks renders as literal text;
an empty project body retains the automatic `formData` and `browserInfo`
interpolations.

### Acceptance criteria

- Existing Contact recipients appear in Project Settings → Emails
without data loss. Existing legacy forms retain their pre-PR behavior
except for the explicitly tracked #5512/#3891 current-page route and
repeated-query bindings.
- New Email Resources inherit published project defaults until
overridden; reset restores inheritance, and settings edits affect live
sites only after republishing.
- Team recipients use the project list or fall back to the owner. A
custom comma-separated recipient list and Sender override work;
submitted values cannot choose recipients or From.
- With no project owner body or Resource body, a selected non-Visitor
Email Resource uses readable submitted-field and `browserInfo` content
regardless of whether it is defined on the Form, an ancestor, or
globally. Explicit expressions can bind Form-only values only from
Resources defined within that Form. A nonempty project body is the
complete literal owner message, inherited until a Resource body
expression overrides it; reset restores inheritance. Automatic text
includes hidden form fields but excludes passwords and internal bot
fields.

## Batch 4a — Sender and recipient email format (#4414, #5658)

Use one **Sender** field that accepts either `Acme Support
<support@example.com>` or `support@example.com`, using the same address
format as recipients. The optional name becomes the displayed sender
name, and the entered email receives replies. Webstudio's authenticated
From address stays fixed.

- [x] Add the Sender field in Project Settings → Emails, with
inheritance, override, and reset in each Email Resource. Default it to
the project owner's email. This single field supplies the display name
and Reply-To; do not add separate sender-name and Reply-To inputs.
- [x] Parse Sender as exactly one mailbox and retain its optional name
and reply address; a plain email has no custom display name.
- [x] Use the site owner profile username as the default visible From
name when Sender has no explicit name; explicit Sender names take
precedence, and missing usernames fall back to “Site Owner”. Keep the
authenticated From address fixed.
- [x] Accept plain and named mailboxes in the Contact email list,
project recipients, and Email Resource recipient overrides.
- [x] Verify existing project address-count limits remain enforced
through both Builder and server updates; the separate five-team-delivery
runtime cap is tracked in Batch 5.
- [x] Use `Acme Support <support@example.com>` as the Sender placeholder
and `Acme Support <support@example.com>, team@example.com` in email-list
inputs.
- [x] Use an established email-address parser in Builder and server
validation. Handle quoted names containing commas, such as `"Example,
Alexs" <support@example.com>`, reject malformed addresses and
header-injection input, and count parsed recipient mailboxes including
duplicates for the runtime delivery cap.
- [x] Preserve parsed display names in generated Email Resource requests
and keep existing plain-address settings readable.
- [x] Test both Sender formats, mixed recipient parsing,
inheritance/reset, generated request values, and the five-team-delivery
runtime cap.
- [x] Local Builder E2E verifies Project Emails Sender and named
recipients save to persisted project settings and remain after reopening
(`b9ebf21fee`;
`apps/builder/e2e/tests/project-settings-runtime.[shard-2].[shard-5].[shard-6].e2e.ts`;
focused run 2/2).
- [x] Document the Sender/recipient input format, reply behavior,
inheritance, republishing, visitor Email Resource delivery, and the
current Cloud-unavailable delivery status without claiming that saving
settings sends email.
- [x] Local generated-graph verification (`1730840feb`): a translated
project body is the entire literal request body, a Resource body
expression overrides it, reset restores inheritance, and an empty
project body retains automatic `formData`/`browserInfo` text. Project
Emails help and docs explain plain-text behavior.

### Acceptance criteria

- Entering `Acme Support <support@example.com>` in Sender displays “Acme
Support” as the sender and directs replies to `support@example.com`,
while From uses Webstudio's sending address.
- Entering only `support@example.com` works without a separate name
field and directs replies to that address.
- With a plain Sender address, the visible From name uses the site owner
profile username, or “Site Owner” if unavailable; a named Sender
overrides it. The From address remains Webstudio’s fixed sending
address.
- Plain and named recipients can be mixed in a list; a quoted comma
inside a name does not create another recipient.
- Names and addresses survive saving, publishing, and delivery, and
existing plain-address settings continue working.
- The project owner confirmed that the email customization already
planned in Batches 4 and 4a is sufficient to close #4414 and #5658.
Sender supplies the display name and reply address; Webstudio remains
the authenticated sender. Do not add custom From addresses,
sending-domain verification, or a separate follow-up requirement to
close these issues. Do not describe Reply-To as a custom From address.
- Site creators can edit the notification subject, plain-text template,
content, and language, with project defaults and per-Resource overrides.
Together with Batch 4, this covers the email customization requested in
#4414.

## Batch 5 — Email delivery and visitor confirmation

- [x] Implement the Cloud-only `EMAIL_SERVICE` adapter for new Email
Resources. Attach every submitted file by default; preflight the 5 MiB
encoded-message and 32-attachment limits and return explicit service
errors. Staging published-Form Email delivery is verified in Batch 7.
- [x] Implement visitor confirmation as an ordinary Email Resource
selected in Actions, addressed through a submitted visitor email field
and dispatched alongside other Actions. Its optional body starts empty
and uses the existing Resource editor and expression bindings. Email
Service prepends a mandatory confirmation preamble with the site URL.
Remove the Form-level confirmation toggle and email-field selector; SDK
and generated-route tests cover delivery.
- [x] A failed visitor-addressed Email Resource appears in `errors` and
does not change aggregate Form success; SDK tests cover this.
- [x] Before any destination runs, count team-recipient deliveries
across all reachable Email Resources, counting duplicates and shared
dependencies once. Reject the whole submission above five at runtime;
permit at most one visitor-addressed receipt separately. No
cross-Resource Builder or publish-time cap substitutes for this
preflight.
- [x] Local subject validation (`1fa8e66d9d`): resolved Email Resource
subjects must be strings without CR/LF. Validate after expressions are
evaluated and before any selected destination dispatch. SDK tests cover
CR/LF from direct `formData` and `browserInfo` subject bindings and zero
provider or selected fetches
(`managed-form-resources-generator.test.ts`,
`managed-form-submission.test.ts`, `resource-loader.test.ts`; focused
tests 88/88 passed). Dependency-bound Email is rejected after any
required lookup and before selected destination dispatch.
- [x] Verify resolved owner and visitor-confirmation subjects in the
generated server path with provider fakes. Owner subject preflight
covers CR/LF from visitor-derived bindings before any selected
destination or provider send; confirmation subject preflight likewise
sends no HTTP or email request. Published staging delivery is verified
in Batch 7.
- [x] Test the local private-service envelope and response path with a
provider fake: recipients, Reply-To, optional Sender display name, plain
text, attachments, recipient and size/count preflight, privacy,
confirmation ordering, partial failure, quota error, and zero sends on
failed preflight. Compiled Remix and React Router action tests cover
confirmation with an HTTP sibling and Node's explicit unsupported
response.

### Cloudflare Email Sending integration plan

Companion SaaS PR:
[webstudio-is/webstudio-saas#666](https://github.com/webstudio-is/webstudio-saas/pull/666).
The Email Service contract uses the canonical Worker
`webstudio-email-service`, Cloudflare's native per-location Rate
Limiting binding, and the private `EMAIL_SERVICE` service binding for
published-site sends to `https://email-service.internal/v1/send`.
Builder Preview uses the authenticated shared Email Service endpoint
`https://apps.webstudio.is/v1/preview-send` with server-side
`TRPC_SERVER_API_TOKEN`. The shared Email Service Worker remains
deployed at version `8769175b-15d2-4c09-a312-b78dc93fd2f3`; this PR did
not deploy or change it. The named staging Preview was deleted and its
former URL returns 404; staging published-site Workers use the canonical
Worker through the private service binding. An authenticated malformed
production Preview request returned `400 invalid_request` / `Invalid
email fields` before send. This proves only authentication and
validation, not successful submission or delivery. Staging
published-Form delivery is verified in Batch 7; limiter verification is
tracked in companion SaaS PR #666. A separate direct Email Service test
delivery was confirmed received; no email was sent by the
malformed-request preflight.

- [x] Enforce Cloudflare's 5 MiB **total encoded message** limit and
32-attachment cap for ordinary outbound email, accounting for base64
expansion; report provider quota, suppression, sender, size, and count
errors without claiming delivery. These email limits are separate from
the Form's 25 MiB incoming upload limit and Webstudio's five
team-delivery preflight. Local Builder preflight/provider-fake tests and
the companion SaaS Worker tests cover the limits and stable error
mapping; staging published-Form delivery is verified in Batch 7.

- [x] Test the local generated-site private-service contract with
provider fakes for recipients, Reply-To, optional Sender display name,
body, attachments, confirmation timing, partial failures, quota/limit
errors, and zero sends for failed preflight
(`packages/sdk/src/managed-form-email.test.ts`,
`packages/cli/src/prebuild.test.ts`; `7507c3fbf7`, `ab04be99d4`,
`7c950eecec`).

#### Acceptance criteria

- Staging verification must prove the selected private call path works
for a Workers for Platforms published site; the central Worker alone
owns `send_email`, and a submitted Form never receives provider
credentials or direct sending capability.
- A Cloud published Form delivers owner mail and the optional
confirmation with the configured envelope and content; 5
MiB/32-attachment violations and provider failures produce clear
`errors`. HTTP siblings retain the existing partial-failure semantics.
- The Email Service contract is for the new Form only. Existing Webhook
Forms do not use this Email Service as part of this feature; no legacy
Email Service compatibility or migration is included.

### Acceptance criteria

- A Cloud Email Resource sends the configured plain-text subject and
body from Webstudio's sending address with the configured display name,
with every submitted file attached under its original filename and MIME
type, or returns an explicit size/count error.
- More than five total team-recipient deliveries across Email Resources
rejects the whole submission before any destination runs; duplicate
addresses count again.
- A visitor receipt is a normal Email Resource explicitly selected in
Actions and addressed to the submitted visitor email field. It runs in
parallel with the other selected Actions, with no separate Form-level
toggle or email-field selector. Its Resource body is empty by default;
the Email Service always prepends the fixed platform receipt and
published site URL before the Resource body. The Resource body uses the
normal editor and full existing expression/binding support. A failed
visitor Email Resource appears in `errors` but is nonfatal to the
aggregate Form result.
- Resolved owner and confirmation subjects are strings without CR or LF.
An invalid subject, including one produced from visitor data, is
rejected before the email provider is called; the provider fake records
no send.
- Provider integration checks exercise the central Email Worker
request/response contract. Mocked Builder delivery alone does not
satisfy this gate.
- Confirmation failure appears in `errors` while the aggregate
submission remains successful; environments without Cloud email do not
silently claim delivery.

## Batch 5a — Keep separate submissions in separate email threads
(#5018)

Site owners should see each form submission as a separate email
conversation, including when several visitors submit the same form close
together.

- [x] Append a short, unique submission reference to each new Form
owner-notification subject, keeping the configured subject text.
Generate it once per submission and reuse it for that submission's
delivery retries; submissions in the same second get different
references. At `52fcec3640`, SDK tests cover default/custom subjects,
two submissions at one mocked time, retry stability, empty/overlong
preflight with zero HTTP/email sends, and the 979-character boundary;
Form and Project Emails docs describe the suffix. Batch 7 verifies that
separate submissions create separate Gmail conversations.
- [x] Apply per-submission subject references to new Form owner
notifications (`52fcec3640`).
- [x] Add local regressions for new Form default/custom subjects,
same-time identical submissions, stable retry references, and
subject-length preflight (`managed-form-email.test.ts`). Document the
suffix in the new Form and Project Emails docs.

### Acceptance criteria

- Two separate submissions of the same form appear as separate
conversations in Gmail with conversation view enabled.
- Both default and custom subjects keep their configured text and
include a different reference for each submission.
- Retrying delivery within one submission keeps its reference. This does
not add delivery deduplication or submission storage.
- This submission-reference behavior applies to new Form owner
notifications only; it does not add delivery deduplication or submission
storage.

## Batch 6 — Parallel delivery and Form feedback

- [x] Resolve dependency Resources needed for bindings, preflight every
selected primary destination’s body format and deterministic URL
parse/protocol/credentials/denied-hostname policy before dispatching any
selected primary destination, then start selected primary destinations
in parallel. Dependency Resources may make outbound requests during
resolution. DNS/public-IP pinning and redirect checks remain in
protected transport at each request hop; other transport failures can
occur after a sibling dispatches. Overall success requires all primary
destinations to succeed.
- [x] Local deterministic group preflight (`e9b72d5d78`, `8bf4f4c8bf`):
red-before generated actions in Remix and React Router prove a dependent
JSON+File body or a denied selected URL blocks all selected POSTs; SDK
policy tests cover allowed URLs and denied scheme, credentials, and host
cases. Nonselected dependencies may run once to resolve bindings.
Provider and ingress behavior are covered by service tests; staging
verification is recorded in Batch 7 below.
- [x] Until Cloud email delivery is integrated, reject any selected
Email Resource or reachable Email dependency before dispatching an HTTP
sibling. Return an explicit unsupported-delivery error without claiming
success.
- [x] Retry only a failed or timed-out destination once within that
submission, including non-2xx responses. Never resend a known success
within the same submission. A new browser submission starts over; keep
no delivery history or cross-submission deduplication.
- [x] Keep aggregate HTTP status as transport metadata only; expose no
`status` variable. Bind each Resource's final status code and response
body through ordered `results` and `errors` arrays. Expose no response
headers.
- [x] Redirect only after overall success when configured. Render the
initial, success, and error states in the inserted Form template.
- [x] Fix #6487 feedback auto-scroll regression: success and error
feedback now scrolls into the viewport only when needed, uses instant
behavior for reduced motion, and success redirect skips scrolling.
MCP-authored generated-Preview tests assert actual viewport position for
off-screen feedback, no movement for visible feedback, partial failure
scrolling, and no scroll before redirect; the full serial MCP E2E suite
passes (36/36 including setup).
- [x] Copy the existing Webhook Form spam protection into the new Form's
managed submission path: generate the hidden browser field, validate it
on the server before delivery, preserve the Brave handling, and remove
internal fields before sending to Resources or email.

**Email Service rate-limit checkpoint:** The pushed SaaS code uses
Cloudflare's native Rate Limiting binding only on email sends: 50
recipient checks per project UUID per Cloudflare location per 60
seconds. Each recipient consumes a check; over-limit sends return 429
before provider delivery. Preview and published sends carry the trusted
project UUID. This is approximate per location, with no Durable Object,
SQL storage, or account-wide quota. The 60-attempt direct Worker
diagnostic and isolated non-production check are tracked in companion
SaaS PR #666; no live-user Form submission is part of this Builder PR.
- [x] Locally test concurrent starts, retries, timeouts, partial
success, results and errors bindings, redirect, and feedback scrolling
in both generated adapters and browser components.
- [x] Local new-Form behavior: generated Router and Remix adapters test
concurrent selected starts, one retry after non-2xx/network/timeout
failure, final partial-success `results`/`errors`, and no replay of
successful siblings or dependencies
(`packages/cli/src/prebuild.test.ts`). Builder insertion tests verify
`results` and `errors` bindings and confirm aggregate `status` is not
exposed as a variable
(`apps/builder/app/shared/instance-utils/insert.test.tsx`); browser
tests cover success-only redirect and visible/offscreen feedback for the
new Form.

### Acceptance criteria

- Primary destinations begin in parallel. Each failed or timed-out
destination gets one retry within the same submission; known successes
are not resent, and overall success requires every primary destination.
- Ordered `results` and `errors` expose each Action Resource's
`resourceId` and `resourceName`, final status code, and response body to
bindings, without response headers. Both arrays preserve configured
Action order even when responses finish out of order. Aggregate HTTP
status remains transport metadata and is not exposed as a Form variable.
- Redirect occurs only after overall success, without scrolling to
inline feedback first. Otherwise the correct feedback state renders and
scrolls into view only when outside the viewport. Already-visible
feedback does not move the page, and animated scrolling respects reduced
motion. This applies to the new Form.
- New Form submissions use the adapted hidden browser check: valid
browser and Brave submissions pass; missing, malformed, or expired
evidence stops delivery before any destination runs; internal bot fields
never reach Resources or email.
- The Email Service code returns 429 for recipient checks over the
native per-project-UUID, per-location 50-per-60-second limit before
provider delivery. HTTP/Webhook Actions and webhook-only Forms are not
throttled by it. The 60-request direct Worker diagnostic and webhook
control are tracked in companion SaaS PR #666; no production Form
submission is part of this Builder PR.

## Batch 6a — Legacy-only work excluded from this feature

### Acceptance criteria

- The new Form accepts a fresh valid submission after an earlier failed
attempt without stale bot data.
- No legacy compatibility path is added to the SaaS Email Service.

## Batch 6b — Shared submission runtime for the new Form (related to
#4093)

Use shared new-Form submission behavior across supported hosting
runtimes while keeping page data current after a submission. This batch
does not complete #4093's remaining legacy Webhook Form work.

- [x] Move new Form submission, pending/error/success handling, and
response handling into shared code that does not require Remix or React
Router hooks or their form components. Generated hosting adapters call
the shared managed-Form handler; existing Webhook Forms keep their
original behavior.
- [x] Local new-Form lifecycle: router-free Form submission uses shared
`submitFormData`; generated Router and Remix adapters supply the server
request and page-data refresh behavior. Legacy compatibility adapters
and lifecycle changes are not included.
- [x] Submit through a normal HTTP endpoint with a defined JSON response
and small Router/Remix request and page-data-refresh adapters. Keep
current HTTP Resource credentials, validation, bot checks, and
destination protection on the server.
- [x] Local managed-Form route: generated same-origin `/__ws-form` POST
returns structured JSON for new Form submissions in compiled Remix and
React Router handlers; route coverage includes root, nested, and dynamic
pages, repeated multipart fields/files, bot rejection, and Resource
results. Staging Cloud email delivery is verified in Batch 7; the Email
Service rate-limit verification is tracked in companion SaaS PR #666.
- [x] Integrate the Cloud `EMAIL_SERVICE` adapter for new Email
Resources into the generated server action, with provider-fake response
and preflight tests. The Email Service per-site rate limit is tracked
separately below.
- [x] Replace the automatic page-data refresh currently supplied by
Remix. After a successful submission changes data, refresh the current
page's Resources without a full-page reload. Handle navigation during
submission and refresh failures without resending a completed
submission.

- [x] Test the new Form's shared component without router context
against a test HTTP endpoint, then test both hosting adapters. Cover
response bindings, page-data refresh, files, redirects, errors, and
retries.
- [x] Local browser and generated-route matrix: router-free Form tests
cover pending/results, files, and HTTP/network failures; generated
Router and Remix adapter tests cover retries, redirects, loader refresh,
navigation, and refresh failure without replaying POST. Compiled-handler
tests cover both adapters; release/staging verification is complete in
Batch 7.
- [x] Real router-free HTTP test (`679eb8e0c275`,
`packages/sdk-components-react/src/native-form-http.test.tsx`): the
shared new Form runs without a router provider in Chromium and sends
multipart POST to a local same-origin JSON endpoint without mocking
`fetch`. It reports pending while the response is held, then success
with `results` and a later error with `errors`, without native
navigation. Release/staging verification is complete in Batch 7.
- [x] Page-data-refresh red-before/green-after proof: with the exact
`native-form-refresh.browser.test.tsx` files from `20989a2d64` placed
temporarily in detached pre-fix `41580dbe9c`, React Router and Remix
each failed 3/5 tests: successful submissions left displayed data at
`before`, and the refresh-failure path never ran its second loader call.
On PR head `679eb8e0c275`, both adapters pass 5/5. The temporary
checkout was restored cleanly; the red/green regression evidence is
recorded here.
- [x] Local new-Form regression tests cover pending/results, errors,
redirect behavior, selected destinations, retries, and page-data
refresh. Remove legacy Webhook-specific retry, feedback, lifecycle, and
converter claims; they are outside the PR scope.
- [x] Update the hosting and Form docs to explain the generated server
endpoint, dynamic hosting requirement, and static-export limitation. The
generated Cloud action calls the private `EMAIL_SERVICE` binding when
present. Staging published-Form delivery is verified in Batch 7.

### Acceptance criteria

- The shared submission component works without a Remix or React Router
provider; supported hosting adapters connect it to server delivery and
page-data refresh.
- A successful data-changing submission refreshes the displayed data
without reloading the whole page or sending the submission again.
- Resource response values remain available through the bindings from
Batch 6, with consistent success/error behavior across supported
runtimes.
- The generated new-Form submission path uses the shared handler;
existing CLI conversion and legacy submission behavior remain at their
pre-PR baseline except for the #5512/#3891 route/query binding fixes in
Batch 2a.
- Server protections and secret handling remain intact. Static exports
do not silently claim managed submission support.

## Batch 7 — New-Form integration, docs, and release gate

- [x] Mark only the legacy `Form` and `RemixForm` component metadata
deprecated and keep `NativeForm` as the sole Forms insert tile. Preserve
the old component IDs, registrations, templates, and supported settings
for saved instances (`820aed68ed`;
`apps/builder/app/shared/nano-states/components.test.tsx`, focused
Chromium 2/2).
- [x] Local file-input and HTTP upload segments: Builder
insertion/save/reopen retains name, required, accept, and multiple
settings (`apps/builder/app/shared/instance-utils/insert.test.tsx`);
browser tests cover required, optional, and multiple files
(`packages/sdk-components-react/src/native-form.browser.test.tsx`);
compiled Remix/React Router generated actions preserve repeated
multipart fields and original file names, MIME types, and bytes
(`packages/cli/src/prebuild.test.ts`, `3c5b72a`).
- [x] Partial published-site staging check: one controlled `/copy-1`
submission with unique test value `Staging E2E 2026-10-05` entered the
managed Form success state for the selected project-owner Email Resource
configured with subject `New form submission`. The exact wire HTTP
response and owner inbox receipt are not independently verified; the
user is checking that inbox. This does not close the full
multi-destination, file, confirmation, coverage.
- [x] Update Form, Resource, Project Emails, and hosting docs for File
Input settings, HTTP uploads and limits, visitor-addressed Email
Resource with mandatory confirmation preamble/site URL and optional
body, and plain HTML forms using Element with `tag=form`.
- [x] Document the current managed Form's combined 25 MiB upload-request
limit, multiple-file failure guidance, and separate HTTP Resource body
limit (`33b2c7eab9`); Email provider attachment limits are documented in
the Email Service README, and published staging delivery is verified in
Batch 7.
- [x] Document local Resource selection/scope and Auto/JSON/multipart
upload behavior, plus Project Emails Sender, recipient, owner-body,
inheritance, and visitor Email Resource settings (`b9dbb6ee55`,
`7507c3fbf7`). Form, Project Emails, and self-hosting docs now describe
conditional Cloud `EMAIL_SERVICE` delivery, explicit missing-service
failure, and self-hosted integration requirements (`61fcf3f3d5`);
published staging behavior remains unverified.
- [x] Document Cloud Email attachment count and encoded content/request
limits in Form docs (`61fcf3f3d5`).
- [x] Document provider/quota errors and the Cloud email hosting
requirement. Builder Form, Project Emails, and self-hosting docs cover
new-Form visitor behavior and hosting limits. Sending-domain setup and
companion SaaS deployment are tracked in the companion SaaS PR.
- [x] Refresh the current bundle-version metadata in all eight static
project fixtures and synced user metadata in seven;
`packages/protocol/src/fixtures.test.ts` passes 17/17 locally and
Linux/Windows fixture CI both pass on head `70a2091c69`.
- [x] Complete relevant local checks on current PR work. Focused tests,
typecheck, lint, formatting, and diff checks pass locally; full GitHub
CI passes on `84f24e8d12`.
- [x] Reviewed each new-Form issue row against current code/tests; no
additional legacy compatibility beyond the explicitly tracked
#5512/#3891 route/query fixes is a closure condition. Evidence: #3023
file and attachment checks in
`packages/sdk/src/managed-form-email.test.ts` and
`packages/cli/src/prebuild.test.ts`; #5512 and #3891 page parameters and
all query values in `packages/cli/src/prebuild.test.ts`; #5432 repeated
multipart values/files in the same generated-route suite; #5499 parallel
destinations and five-recipient preflight in
`packages/sdk/src/managed-form-handler.test.ts`,
`managed-form-resources-generator.test.ts`, and
`managed-form-submission.test.ts`; #3530 redirect behavior in
`packages/sdk-components-react/src/native-form.browser.test.tsx`; #5428
trusted browser info headers in `packages/cli/src/prebuild.test.ts`;
#5658 sender/reply-to validation in
`packages/sdk/src/managed-form-email.test.ts` and the companion SaaS
Worker tests; #6487 feedback scrolling in
`packages/sdk-components-react/src/form-feedback-scroll.browser.test.tsx`;
#4414 and #4385 project defaults, overrides, and recipient isolation in
`packages/sdk/src/email-resource.test.ts` and
`apps/builder/app/builder/features/settings-panel/resource-panel.test.ts`;
#5018 unique submission references and retry behavior in
`packages/sdk/src/managed-form-submission.ts` and
`managed-form-email.test.ts`. These are merge-time issue mappings, not
production delivery evidence.

### Acceptance criteria

- The insert menu offers one new Form. Deprecated old components and
their migration are outside acceptance; no legacy compatibility path is
added.
- Staging end-to-end coverage exercises an empty Form blocked from
navigation and a configured Form submitting to its Resource
destinations, plus two HTTP Resources, two Email Resources, files,
confirmation, and partial failure through Builder → publish → submit.
- Form, Resource, Project Emails, and hosting docs match the released
behavior, including the Cloud email requirement. Generated contracts,
focused checks, full CI, and staging tests pass before the PR is ready.

## Batch 8 — Submit current-draft Forms from Builder Preview

- [x] Add an authenticated Builder server endpoint for Preview
submissions. It checks the Builder session and exact project build
permission before effects; route tests cover authorized and rejected
requests.
- [x] Load current draft Form configuration and invoke the shared SDK
runtime handler without a prior publish or draft/published contract
comparison; Preview route and graph tests cover changed drafts.
- [x] Build the draft Resource graph with publish-equivalent scope,
dependency, and defaults rules. Reuse the existing
`evaluateExpressionSync` implementation for supported expressions; do
not add QuickJS, WASM, AST, or another expression engine. Focused graph
and expression tests cover parity.
- [x] Reuse the shared SDK managed-form handler in Builder Preview and
generated published-site routes. Their request, auth, and configuration
entry points remain runtime-specific; SDK and generated-route tests
cover both paths.
- [x] Execute HTTP Resource Actions from the Builder server in Preview,
and from the published-site Worker after publish. The Email Service
handles email only; Preview route tests assert the outbound HTTP
boundary.
- [x] Route Preview Email Resources server-to-server through the Email
Service with a server-only credential; published-site Workers use the
private `EMAIL_SERVICE` binding. Builder checks user and project
permission first; tests cover the Email Service call contract and
rejected auth.
- [x] Removed the unapproved Preview warning that submissions send real
emails and webhook requests; new user-facing warning copy requires
explicit approval.
- [x] Node tests execute the shared handler locally with a stubbed Email
Service boundary, without Cloudflare infrastructure. Staging
published-Form Email delivery is verified in Batch 7; the production
Worker limiter check is tracked in companion SaaS PR #666.
- [x] Keep a permanent Builder Preview transport Playwright E2E that
submits a current draft through the Preview backend and verifies the
response without publishing or triggering email/webhook side effects
(`apps/builder/e2e/tests/preview-managed-form.[shard-2].e2e.ts`; focused
2/2).
- [x] Preview converts rejected `onManagedSubmit` callbacks into a
structured 500 failure, clears stale result and pending state, and shows
the current error. Browser regression covers a prior structured failure
followed by a rejected callback
(`packages/sdk-components-react/src/native-form.browser.test.tsx`). The
new Form also cancels native submission when its `onSubmit` callback
throws; a Chromium browser regression clicks a submitter with
`formAction`/`formMethod` overrides and verifies cancellation, no
Resource dispatch, and visible failure (`28f7a93eed`).

### Acceptance criteria

- A Form in an unpublished project can be submitted from Builder Preview
without publishing first.
- The Preview endpoint rejects unauthenticated users and users without
edit access to that project before any HTTP request or email send
occurs.
- Preview uses the current draft. Changes to controls, Actions, Resource
dependencies, effective email settings, visitor-addressed Email
Resources, or redirects can be tested immediately without republishing
or a published-contract comparison.
- Draft expression results match published Resource evaluation for
supported syntax using the existing `evaluateExpressionSync`
implementation; no second expression engine is introduced.
- HTTP Resource requests go directly from the Builder server to their
configured destinations. Email Resource requests go through the central
Email Service Worker, which rejects requests without the server
credential; that credential never appears in browser traffic.
- Results, errors, uploads, response bindings, feedback, and redirects
match published submission behavior while keeping the Builder open.
- The generated published-site Worker continues to use the same shared
handler and public visitor submission path, and calls Email Service
through `EMAIL_SERVICE`.
- Local Node E2E tests exercise the shared handler and Builder Preview
authorization without Cloudflare; a separate integration check verifies
the real Email Service contract.

## Production release boundary

**The production Email Service Worker was deployed at version
`8769175b-15d2-4c09-a312-b78dc93fd2f3` under the user's explicit request
to update the code and Worker to use `TRPC_SERVER_API_TOKEN`. An
authenticated malformed validation request returned `400
invalid_request` before send; that request sent no email.** This Builder
PR makes no deployment to the live site; live-user Form submissions are
outside its verification scope.

## Boundaries and known tradeoffs

- No old-component migration, submission storage or history,
account-wide email quota feature, CC/BCC, custom From address or
customer sending-domain verification, HTML email, preview text, or
separate branding editor. Builder Preview submission is included in
Batch 8 and runs against the current draft without requiring
publication; it is a real submission, not a separate email test-send
feature. Cloudflare account sending quotas still govern delivery;
migrating Plunk authentication or other Plunk operations is separate
follow-up work.
- The Discord requests for an explicit CAPTCHA challenge, direct Google
Sheets connection, multi-thumb/vertical slider, and an exact submission
copy to an unverified visitor are not covered here. A visitor-addressed
Email Resource always gets the fixed platform preamble and site URL; its
optional builder-configured body may use normal Resource bindings.
- A timeout retry can duplicate a delivery that succeeded remotely. A
visitor-addressed Email Resource can send to an unverified submitted
address; the native Email Service limit of 50 recipient checks per
project UUID per Cloudflare location per minute can reject legitimate
local bursts; it is approximate and not a global cap.
- The five team-delivery cap is a server preflight across the whole
Form; it is intentionally not calculated across independent Resources in
the Builder.
- Project defaults apply site-wide. Form-only expressions resolve only
in Resources scoped inside that Form.

## Additional Builder and Resource behavior

### Builder UI

- [x] Add the `formState` bullet to the Action tooltip after the exact
user-facing description is approved; verify it with the focused tooltip
test. The exact wording was approved; covered by focused Action tooltip
tests.
> Sends each form submission to all selected destinations at the same
time.
  > - formData — submitted fields from this Form.
  > - browserInfo — visitor details.
  > - formState — current Form state: initial, success, or error.
  > - results — each action’s response, in order.
  > - errors — failed actions and their messages.
- [x] In the Variables list and Edit variable preview, show
server-provided `browserInfo` after an authenticated Builder Preview
submission when available. Use only trusted `cf-connecting-ip`, ignore
spoofed `x-forwarded-for`, and sanitize Referer by removing query and
fragment before exposing it. Keep `previewBrowserInfo` private to
Builder memory and strip it before Canvas pubsub. Route, bridge,
Variables list, and Edit variable preview tests cover these paths;
focused preview tests pass (2/2) and bridge tests pass (7/7). Published
Form behavior stays unchanged.
- [x] Recognize supported Chromium browsers without requiring
`window.chrome`; user-agent detection and unsupported-browser regression
coverage are committed.
- [x] Add the approved “Clear all” button below multiple visible toasts
and dismiss the stack; shared toast implementation and browser
regression are committed.

- [x] Remove the background from the maximize button in code and
expression editors; keep the icon button transparent, consistent with
other editor controls. `code-editor-base.browser.test.tsx` verifies
transparent hover styling.

- [x] Implement separate tooltips for the Form variables `formData`,
`browserInfo`, `formState`, `results`, and `errors`; exact wording was
approved on 2026-10-08, and `variables-section.test.tsx` verifies the
displayed descriptions.

- [x] Add a description to the Action label tooltip and show a yellow
warning triangle with “Add at least one action” when the Action list is
empty. The warning disappears once an Action is added; covered by the
Form Action control browser test.

- [x] Reset the Form Preview runtime state to `initial` when leaving
Preview, so the Builder returns from success/error feedback to the
editable Form state without changing saved bindings or published
behavior. Add regression tests.

- [x] Route every managed Form submission error through the user-styled
Error Message instance. Make its message dynamic from the submission
error result, remove static fallback text and raw React alerts, and
cover validation, partial Action failure, and service errors.

- [x] When a Form, Form content, Success Message, or Error Message
instance is selected on the canvas, show that selected instance in
Builder regardless of its bound `show` value. This is an editor
selection override only; preserve the saved binding and runtime
behavior. Add regression tests for each state.
- [x] Add the approved description “Sends each form submission to all
selected destinations at the same time” and a multiline list for
`formData`, `browserInfo`, `formState`, `results`, and `errors` to the
Action label tooltip; use lowercase “action” in descriptions. Remove the
aggregate `status` variable; Form state remains
`initial`/`success`/`error`, and each Action’s HTTP status stays in its
result/error entry. Retain the approved “Add at least one action”
warning when no Action is selected. The Action reset button says
“Reset.” Focused insertion and Action UI tests cover these behaviors.

- [x] The Action plus-button tooltip says “Add a resource to submit this
Form”; the focused Form Action control browser test covers it.

- [x] Rename the Form’s component prop from `submission` to `action`,
matching the singular **Action** control. Store selected Actions as an
ordered array of Resource references with enabled state. Execute enabled
requests in parallel while preserving Action order in `results` and
`errors`. Update generated metadata, runtime handling, and tests; do not
add legacy compatibility.

- [x] Add Delete, Copy, and Paste to each variable row menu and its
right-click context menu. Within Variables, right-click anywhere allows
Paste; target-specific commands are disabled without a variable row.
Remove the Variables section header menu. The Edit variable dialog menu
has Delete, Copy, and Refresh only; remove its redundant quick-copy
button and do not offer Paste there. Serialize definitions as versioned,
namespaced JSON; omit internal IDs, create fresh IDs on paste, preserve
and remap expression references, and report unresolved references. Base
menu and transfer tests pass.

- [x] Rename user-facing Builder UI section and control labels from
`Data variables` to `Variables`; retain `CSS variables` for clarity.
Update UI tests.

- [x] Give variable labels a tooltip that shows defining scope,
type/value-kind details, and Delete with its shortcut. Option-click
deletes the local variable; deleting a shadow reveals its ancestor. UI
tests cover the tooltip and Option-click deletion.
- [x] Clicking the rendered “Value comes from” source label navigates to
and focuses its defining instance. `variables-section.test.tsx`
exercises the real ancestor “Body” source label and Global root label;
the full focused file passes 9/9.
- [x] Label a Global Root user variable source as “Global root,” not
“System,” and keep the source label clickable to navigate to and focus
its definition. `variables-section.test.tsx` verifies the “Global root”
label, absence of “System,” and source navigation.
- [x] Fix the verified source-label behavior defect: clicking “Value
comes from” must reliably focus its defining Variables row after
ancestor or Global root navigation. Regression tests pass both
standalone and in-suite: `variables-section.test.tsx` passes 12/12, and
isolated ancestor/Global root navigation-focus cases pass 3/3 each.

- [x] Prevent deletion of the managed Form’s required `formState`,
`results`, and `errors` variables by stable identity in the Builder UI,
including after renaming, through Variables row menus, the Edit variable
menu, right-click context menus, and Option-click; ordinary user
variables remain deletable. `variable-menu.test.tsx` covers the menu
paths and ordinary deletion; focused suite passes 21/21. The
required-variable rule is enforced in both the Variables UI and the
mutation/domain layer.

- [x] Show a yellow warning triangle only when a variable name matches
an ancestor; allow the child-scope name. Tests cover an existing shadow
and an ancestor rename.

- [x] Keep the variable row highlighted while its Edit variable dialog
is open; use the shared list-row open state and cover it with a
regression test.

- [x] Use the shared warning color token for variable-shadow triangles
in both the Variables list and Edit variable dialog; the Builder UI test
verifies the token.

- [x] Reject duplicate Resource variable names on the same instance
while allowing a nested scope to shadow a parent name; add validation
and regression tests.

- [x] Use sentence case for the Form setting label: `Success redirect`.

- [x] Expose Form-scoped runtime values as inspectable JSON in Builder
Preview. `formData` reflects the current named controls and values
before submission, including empty values; `browserInfo` shows its safe
context values. Add focused UI and runtime tests.

- [x] Add `resourceName` alongside `resourceId` in each ordered
result/error and relevant inspection entry; verify naming, partial
failure, retries, and bindings without exposing secrets.

- [x] Independently rechecked #3891 against the implemented contract:
`system.search` returns a string for one value and an ordered array for
repeated query values. `packages/sdk/src/system-search.ts` and its
regressions cover repeated, empty, comma-containing, and encoded values;
Batch 2a retains the generated-route and documentation evidence.

- [x] Verify that a selected Email Resource defined on the Form, an
ancestor, or global scope uses the existing generated submitted-fields
default body when both its Resource body and Project Emails body are
unset. Preserve explicit Resource/Project body overrides, including an
explicitly empty Resource body, Visitor receipt behavior, and rejection
of explicit out-of-scope `formData` bindings. Draft and published graph
tests cover all three scopes and both override types in
`managed-form-resources-generator.test.ts` and
`managed-form-draft-graph.test.ts`; focused SDK tests pass (73 tests).

### Resource editor

- [x] In Project Settings → Emails, show all long explanations in the
existing info tooltips beside their related controls, preserving the
exact existing copy. Specifically verify the Recipients and Owner
plain-text body explanations; `section-emails.test.tsx` currently covers
tooltip content and keyboard access.

- [x] Restore the approved attachment behavior sentence in the Project
Settings → Emails documentation, in the Visitor email paragraph only:
“When a Form includes file inputs, submitted files are attached to the
outgoing Email Resource message by default. Turn off ‘Attach submitted
files’ to omit them.” Do not add this text to the settings UI. Added in
`c96fb7c409`; `pnpm check:generated-docs` and `git diff --check` pass.

- [x] Replace the outdated Visitor attachment statement in the Form
guide with the same approved sentence used in Project Settings
documentation: “When a Form includes file inputs, submitted files are
attached to the outgoing Email Resource message by default. Turn off
‘Attach submitted files’ to omit them.” Added in `40dd8c4af3`; `pnpm
check:generated-docs` and `git diff --check` pass.
- [x] **Email Resource Type description:** The exact description was
approved, and `variable-popover-type.test.tsx` asserts the Email option
displays “Send a plain-text email through Webstudio Cloud when a Form is
submitted.” Focused type-selector suite passes 7/7; Builder typecheck
passes.
- [x] **Method dropdown copy approval:** Exact copy is approved and
tested: GET “Read data from a server.”; POST “Send data to create or
process something.”; PUT “Replace data on a server.”; DELETE “Delete
data from a server.” Keep the existing Form-submission note with POST;
focused Resource editor tests verify all four descriptions and the POST
note.
- [x] Keep Email Resource field labels as `Sender`, `Recipients`,
`Subject`, and `Body`; use the existing binding control and Expression
Editor for supported values, and show validation errors in the standard
input tooltip rather than below the field. `resource-panel.test.ts`
asserts each label appears exactly once, covers the binding controls and
Sender/Custom recipient Expression Editor save/unmount/remount/reopen,
and verifies validation errors appear in standard input tooltips; the
focused suite passes 30/30.
- [x] Give Email Resource recipient controls programmatic accessible
names by associating the existing visible “Recipients” label with its
selector and using existing text for the Custom recipient input and
Visitor email selector. Keep visible copy unchanged.
`resource-panel.test.ts` passes 32/32; Builder typecheck, changed-file
`oxlint --deny-warnings`, and `oxfmt --check` pass.
- [x] Remove the separate Project default reset button; switching away
from Custom recipients clears its value. Show the custom address input
directly below the mode selector and the Visitor field selector without
redundant field labels. `resource-panel.test.ts` covers literal and
bound recipient clearing when switching to Project and Visitor modes,
mode-specific controls, and no duplicate Recipients label; the focused
suite passes 30/30, including Sender and Custom recipient bindings
through the Expression Editor and save/unmount/remount/reopen.

- [x] Verify and test the REST and GraphQL type-option descriptions
against the approved wording: “A REST resource is a configuration for
secure data fetching.” and “A GraphQL resource is a configuration for
secure data fetching with GraphQL.” Preserve the existing “You can
safely use secrets in any field.” note. `variable-popover-type.test.tsx`
covers both descriptions.
- [x] **Visitor email field info tooltip:** Approved exact copy for the
info tooltip beside the Visitor email field selector: “Adds a note with
this site’s URL to help recipients identify where the message came from
and discourage spam.” Keep it visible only when Visitor email field is
selected; verify the text opens on hover and keyboard focus and closes
on blur in `resource-panel.test.ts`.
- [x] Match the Edit variable dialog menu trigger icon size to the other
header controls and make the menu’s minimum width about twice its
current width; `variable-menu.test.tsx` covers the header icon and 360px
minimum width.
- [x] Simplify Builder Email Resource preflight: remove duplicated
Worker-authoritative mailbox and attachment metadata policy checks;
retain a small pre-Base64 attachment size guard, subject safety, and
aggregate recipient protections. Tests verify early size rejection,
valid attachment delivery, and Worker rejection propagation.

- [x] Replace the superficial Headers and Search params label
info-tooltip descriptions with clear technical explanations of their
purpose; propose and obtain approval for exact user-facing copy before
implementation. The approved label info icons explain these sections; no
additional plus-button tooltips are needed. Exact wording approved;
covered by focused Resource editor tests.

- [x] **Recipient selector descriptions:** Add the approved descriptions
exactly: Project recipients — “Send to the addresses in Project
Settings, or to the account holder if none are set.”; Custom recipients
— “Send to the addresses entered below.”; Visitor email field — “Choose
a Form input to use as the recipient’s email address.” Verify copy and
visibility in `resource-panel.test.ts`.
- [x] **Move Visitor email guidance into its recipient option
description:** Removed the extra info icon next to the selected Visitor
email field input. The Recipients dropdown option now explains that the
confirmation email goes to the selected Form input address.
`resource-panel.test.ts` passes (41/41); formatting, lint, and diff
checks pass. Pushed as `a85c77308f`.

- [x] Put the Form POST-method note in Method dropdown option
descriptions instead of inline copy; keyboard and pointer behavior are
covered by the Resource editor tests.
- [x] **Format option descriptions:** Approved exact copy: label
`Format`; help below the control “Choose how to send the body.”; `auto`
— “Uses text/plain for text values, application/json for other values,
and multipart/form-data when files are included.”; `application/json` —
“Sends an object or array as JSON.”; `multipart/form-data` — “Sends
fields as form data, including files.” `resource-panel.test.ts` verifies
the descriptions, below-control help, standalone GET hiding, Form Action
GET visibility, and Body editor; the focused suite passes 34/34.
- [x] **Headers and Search params add-button tooltips:** Superseded by
the user's clarification: the approved info icons beside the Headers and
Search params labels explain those sections, so no additional tooltips
on the plus buttons are needed. The existing info-icon descriptions
remain covered by the focused Resource editor tests.
- [x] **Project Settings → Emails helper-text placement:** Move the long
inline explanations (including Recipients and Owner plain-text body
help) into adjacent info tooltips so the settings stay compact. Do not
add or rewrite user-facing copy without explicit approval; preserve
approved behavior and cover tooltip placement with focused tests.
- [x] **Shadowing warning tooltip copy:** Reverted the unapproved
proposed wording and retained the existing tooltip.
`variables-section.test.tsx` verifies the parent-scope shadow condition,
including an existing shadow and an ancestor rename; a unique name
removes the warning.
- [x] Add an info tooltip beside Cache max age explaining the response
cache lifetime in seconds. A focused Resource editor test verifies it.
- [x] Use the approved info icons beside the Headers and Search params
labels to explain those sections; no additional plus-button tooltips are
needed. Use Minus icons to remove individual rows. Focused Resource
editor tests cover the label info tooltips and row removal.
- [x] Keep the Body label and remove the Body content type selector.
Infer text/plain for string bodies and application/json for objects,
arrays, numbers, and booleans; preserve automatic multipart handling for
files, explicit request-format validation, and useful editor/error
behavior.
- [x] Label the body-format dropdown Format and show the approved help
“Choose how to send the body.” below it. Use the effective method: hide
Body and Format for a standalone GET Resource; a GET-configured Resource
selected as a Form Action is effectively POST and keeps both controls
visible. Focused editor tests verify the help placement, visibility, and
selected body format.
- [x] Show Response, Request, and Diagnostics tabs for HTTP Resources,
with Response first and selected by default. Capture the actual outgoing
method, URL, headers, and body plus response status/status text,
headers, final URL when available, and body from the latest Form Preview
submission, including retry attempts. `request-inspector.test.tsx`
verifies the order and default selection, including the captured numeric
response status and actual response body for both HTTP and Email
exchanges (focused suite 7/7); route and inspector tests verify captured
exchange data, no replay or substitution from current config, and
authenticated Preview-only, no-store, ephemeral, bounded, redacted
capture. Files show metadata instead of bytes. Email inspection shows
the captured transport request and actual HTTP response, with
credentials and encoded attachment bytes redacted; the logical delivery
outcome remains separate for Form failure handling. Published staging
submission and attachment delivery are verified in Batch 7.

- [x] Classify Email inspection exchanges by Resource kind, never URL
alone; focused sanitizer and inspector tests verify that an ordinary
HTTP Resource targeting the Email Service URL keeps normal request-body
redaction.
- [x] Preserve actual Email Service response headers in the Email
inspection Response view; `resource-loader.test.ts` verifies transport
capture and `preview-form-inspection.server.test.ts` verifies safe
headers reach the inspection view.
- [x] Preserve the actual Email Service HTTP response body/status
separately from the logical Email delivery result, so provider-level
failures remain Form failures even when HTTP returns 200. Read the
response body once so inspection and delivery validation share the same
parse; keep captured data bounded. Add regressions for malformed success
and non-JSON error responses. Single response read, bounded inspection
snapshot, provider body and logical outcome regressions; SDK tests pass.

- [x] Keep the Variables panel context menu scoped to the panel:
right-clicking a variable row targets that row, blank panel space allows
Paste, and right-clicking inside the Edit variable dialog does not open
the panel menu. The dialog menu offers Delete, Copy, and Refresh only;
`variable-menu.test.tsx` covers row, blank-space, and dialog
context-menu behavior.
- [x] Keep Email Resource attachments enabled by default. The default
contact Form’s owner Action keeps attachments enabled, while its visitor
confirmation explicitly opts out because it does not include the
submitted file. `managed-form-email.test.ts`, `resource-panel.test.ts`,
and the default contact Form E2E cover defaults and opt-out.

- [x] Support bindings for Email Resource Sender and Custom recipients
using the existing binding/Expression Editor pattern; evaluate and
validate resolved mailbox values before dispatch.
`resource-panel.test.ts` verifies Sender and Custom recipient bindings
through the Expression Editor and save/unmount/remount/reopen (30/30).
`email-resource.test.ts` verifies resolution and rejects empty,
non-string, and invalid values; `managed-form-handler.test.ts` verifies
invalid bound values are rejected before Resource fetch or email send
(35/35 combined SDK tests).
- [x] Memoize Email Resource recipient expression scope inputs
(`recipientScope` and aliases) so editing a recipient value does not
restart asynchronous expression evaluation on every render; add focused
regression coverage. Unrelated Resource edit regression passes;
`resource-panel.test.ts` 34/34.
- [x] Make all Email binding tests use CodeMirror’s platform-aware Mod
shortcut (Meta on macOS, Control elsewhere), including Sender/Custom
recipient round-trip and Project-mode bound-recipient clearing, so they
pass Ubuntu CI. `resource-panel.test.ts` contains no hard-coded
Meta/Control keyboard chords and passes the full focused suite (30/30).
- [x] Ensure generated server modules import Email binding helpers only
once when both regular Resources and managed Forms use Sender or Custom
recipients bindings; generated-site resource-only and combined-module
tests in `packages/cli/src/prebuild.test.ts` assert one helper import
(2/2), and the CLI typecheck passes.
- [x] Ensure generated modules for generic (non-managed) Email Resources
using `senderExpression` or `recipientsExpression` import the runtime
resolver helpers. `packages/cli/src/prebuild.test.ts` verifies one
helper import and typechecks a mixed generated site with page-level and
managed-Form Email bindings, plus a page-level-only site; both focused
cases pass (2/2).
- [x] Enforce the five-recipient total before dispatch for Email
Resources with Sender or Custom recipients bindings. Count known/literal
recipients even when the Email Resource depends on another Resource;
reject recipient expressions whose count depends on a Resource output
before any send. Preserve Form-variable bindings.
`managed-form-handler.test.ts` covers a resolved six-mailbox binding and
verifies rejection before HTTP fetch or email send; existing dependency
tests cover Resource-output counts.
- [x] Prevent or support Email recipient expressions that depend on
another Resource. The editor currently accepts these expressions, but
managed-submission preflight rejects them; align editor validation and
runtime behavior, with focused regressions. Editor binding scope now
excludes Resource outputs; server preflight remains fail-closed; focused
tests and Builder typecheck pass.
- [x] Disallow Email recipient bindings that depend on another Resource
in the Builder editor, while keeping server preflight fail-closed.
Resolving dependencies before the recipient-limit check could trigger
arbitrary requests; add focused editor and preflight regressions. Editor
binding scope now excludes Resource outputs; server preflight remains
fail-closed; focused tests and Builder typecheck pass.
- [x] Fix Type and Recipients dropdowns in a narrow sidebar so each
dropdown panel matches its input trigger width, using Name as the
reference; focused tests cover Type, Recipients, and Method. Flattening
removes the separate Resource dropdown.
- [x] Flatten System resources into the single Type list: remove the
separate “System resource” category/dropdown and list Sitemap, Current
date, Assets, and Email alongside the other Type choices. When editing
an existing System Resource, changing between categories
(Sitemap/Current date/Assets ↔ Email) persists the selected type.
Preserve existing Assets Resources whose URL expressions use valid
non-JSON string-literal syntax; add a reopen regression in
`variable-popover-type.test.tsx`. Assets non-JSON URL expression reopen
regression passes; Builder popover tests pass.

- [x] Fix the Builder typecheck failures in `resource-panel.test.ts`
binding tests caused by nullable queried-button assertions, then rerun
and pass the Builder typecheck. Builder typecheck passes and
`resource-panel.test.ts` passes 30/30.
- [x] Add a generated published-route regression proving that an
unset/default Form Action body with an uploaded File selects multipart
automatically and preserves filename, MIME type, and bytes.
`packages/cli/src/prebuild.test.ts` runs the generated endpoint for both
defaults and React Router adapters; the focused test passes 2/2.
- [x] Add regression coverage that an ordinary Project/Custom Email
Resource with `includeAttachments` absent resolves default-on through
the Email Service payload. `packages/sdk/src/managed-form-email.test.ts`
covers both recipient modes and asserts attachment payloads; the focused
suite passes 29/29, and `pnpm oxfmt --check
packages/sdk/src/managed-form-email.test.ts` passes.

- [x] Resolve current changed-file lint findings (two `no-explicit-any`
findings in changed tests and one `react-hooks/exhaustive-deps` finding
in `variable-popover.tsx`), then rerun scoped lint. Changed-file `oxlint
--deny-warnings` passes on 50 TypeScript files; `oxfmt --check` passes
on all 48 matched changed files; Builder typecheck passes; focused
settings/variables suites pass 47/47.

- [x] Simplify `handleManagedFormSubmission` by removing the redundant
one-Visitor-Email validation and relying on the shared
`validateManagedFormRecipientLimit` check; add or retain focused
preflight regression coverage. Handler and submission suites pass 48
tests, and SDK typecheck passes.

## Additional Form and Builder behavior

- [x] **Use the existing upload icon for the File input component:** The
shared `UploadIcon` is used in the File Input template and asserted by
`core-templates.test.tsx`.

- [x] **Verify Success redirect in Builder Preview:** On successful
submission, keep navigation inside Preview for internal routes, resolve
relative URLs against the previewed page, and navigate the preview frame
for external URLs. Add end-to-end coverage for a matched internal route,
an unmatched route (which currently silently does nothing), and hash
navigation (which currently updates the hash without scrolling).
Preserve error feedback and never redirect after a failed action.
Matched internal, unmatched internal, and delayed hash target cases pass
in Preview E2E; failed actions retain error feedback and do not
redirect.

- [x] **Finish Email diagnostics loading:** The Email Resource
Diagnostics tab no longer remains pending without a request key; focused
regression coverage verifies the settled empty state.

- [x] **Separate variable editors by type:** The dialog composes focused
modules for HTTP, GraphQL, Email, Assets, Parameter, and scalar types;
shared controls remain neutral. Focused Builder tests and typecheck
pass.

## Issue checklist

Eleven issues below are intended to close when this PR merges; #5432 and
#4093 are related but remain open. Each closure row must be implemented
and verified first; keep remaining work unchecked.

| Issue | Required result before merge | Batch |
| --- | --- | --- |
| #3023 | Configure file inputs in the Builder; deliver single/multiple
files to HTTP destinations and Cloud email within documented limits. |
3, 5, 7 |
| #5512 | Current-page parameters work in new and legacy Form Resource
bindings, including after navigation. | 2a |
| #4093 | Related issue for the legacy Webhook Form; this PR implements
Resource Actions and response bindings in the new Form but does not
change legacy submission beyond the explicitly tracked #5512/#3891
route/query binding fixes, shared lifecycle, or CLI conversion behavior.
Keep #4093 open. | 2, 3, 6, 6b |
| #5432 | The new Form sends repeated field values as standard multipart
entries without losing selections. Legacy Webhook Form behavior remains
unchanged except for the separately tracked #5512/#3891 route/query
binding fixes; this PR does not close the original issue, and migration
is separate. | 2, 3 |
| #5499 | One submission can deliver to email and multiple HTTP
destinations together; document the ten-destination and
five-team-delivery limits. | 2, 5, 6 |
| #3530 | A successful submission follows the configured redirect;
failure does not redirect. | 6 |
| #5428 | A destination receives the trusted visitor IP, user agent, and
language through configured Resource headers, with setup documented. |
2, 7 |
| #5658 | Custom subject and Sender work as agreed, with provider-level
tests for From and Reply-To. | 4, 4a |
| #6487 | New Forms reveal off-screen feedback, leave visible feedback
alone, respect reduced motion, and do not scroll before redirecting. | 6
|
| #4414 | Editable name/reply address, subject, plain-text template, and
translated content work with project defaults and per-Resource
overrides. Webstudio remains the sender, as agreed. | 4, 4a, 5 |
| #4385 | Two forms in the same project can send to different configured
recipients without changing each other's delivery. | 4, 5 |
| #5018 | Separate new-Form submissions produce separate Gmail
conversations; retries retain the same submission reference. | 5a |
| #3891 | Every selected query value is available in new and legacy Form
Resource bindings through `system.search`, with a single value remaining
a string and repeated values becoming an ordered array. | 2a |

- [x] After PR #6530 merged (`a49a6769bd`), verified the new Form needs
no port: React Router and Remix use the same Form submit path, which
creates fresh `FormData` and calls `set` once for the bot field on each
request. `generates one fresh bot field for each managed submission`
passes (shared browser suite 7/7); Router managed Form tests pass 2/2,
Router refresh tests 7/7, and Remix refresh tests 5/5.

# Related issues

Closes #3023
Closes #5512
Related #4093
Related #5432
Closes #5499
Closes #3530
Closes #5428
Closes #5658
Closes #6487
Closes #4414
Closes #4385
Closes #5018
Closes #3891
Related #6520 — [Multi-step Forms with resumable local
drafts](https://github.com/webstudio-is/webstudio/issues/6520)

The existing Webhook Form bug #6437 and prior legacy-form fix #6436 are
outside this new-Form feature and are not claimed as closed here. The
old email planning PR #6486 is superseded by this description.

- [x] **Use the canonical server token for Preview email:** The user
confirmed the canonical `TRPC_SERVER_API_TOKEN` is supplied from
Infisical in Preview and Production. Builder Preview now sends this
token to Email Service `/v1/preview-send`; the redundant
`EMAIL_SERVICE_PREVIEW_TOKEN` wiring is removed. Focused route tests
verify authorization, missing-token behavior, webhook-only behavior, and
redaction.

- [x] **Defer validation for a new Resource URL:** Untouched blank URLs
are not marked invalid until save; edited invalid values validate on
blur. Regression tests pass.

- [x] **Handle safe public Resource redirects:** Public GET/HEAD
redirects are revalidated and allowed without forwarding credentials;
unsafe destinations and cross-origin body requests remain blocked.
Protected-fetch tests pass.

## Form component identity correction (2026-10-11)
- [x] Keep component picker labels and compatibility behavior clear:
show the new component as **Form (Beta)**, and keep the existing
**Webhook Form** available in its current Data category through the next
release. Update the guide for the 10-Action limit and Navigation mode
when Actions are empty. Builder component-list and registry template
tests pass.

- [x] Use one canonical managed component identity, `Form`, for Resource
submission and Navigation mode. Keep `WebhookForm` only as the legacy
component through the next release, and keep generic `Element` with tag
`form` for native browser behavior. Update exports, metadata, templates,
adapters, migrations, docs, CLI/MCP discovery, and E2E identifiers;
verify saved projects migrate without changing legacy Webhook Forms.
Project migration tests pass (25/25), and the CLI prebuild suite
verifies saved bundles are migrated before rendering and endpoint
generation.

## Framework-neutral Form core (2026-10-11)
- [x] Move managed Form contracts, browser submission behavior, and
server delivery into SDK Form entries. Keep React hooks/rendering in the
React adapter and router refresh timing in the router adapter; preserve
compatibility exports. Builder and CLI consume the dedicated server
entry. StrictMode, cancellation, redirect fallback, and refresh-failure
behavior have regression tests. SDK build and published types,
SDK/React/router/CLI/Builder typechecks, focused SDK/React/router/CLI
tests, generated route tests, and the browser bundle boundary check
pass. Astra Medium reviewed the architecture and final diff; no
remaining findings.

## SDK package boundaries (2026-10-11)
- [x] Document each SDK package’s architectural role and dependency
constraints. Added root READMEs for `sdk`, `sdk-cli`, and
`sdk-components-registry`; clarified the existing React SDK, React
component, Radix, Router, Remix, and animation package READMEs.
Formatting and diff checks pass.

## Form submission lifecycle
- [x] **Handle rejected submissions when the controller refuses them:**
Consume abort-aware submission promises when a duplicate or disposed
Form submission is refused. Regression tests cover both paths; four
lifecycle tests, SDK typecheck, and diff checks pass.












## Unified Canvas selection reveal (2026-10-12)
- [x] Reduce selection reveal metadata and resolver ceremony while
preserving occurrence validation, owner/source boundaries, and focused
coverage. Replaced ten one-element rule arrays with one optional rule
each, removed the unused fallback field and redundant source union,
combined selector validation with path construction, and bounded the
source search. The optimization removes 24 production lines and 10 test
lines (net), with the shared resolver and derived override layer intact.
Focused Builder tests pass 66/66, Radix 20/20, registry 1/1; SDK, Radix,
registry, and Builder typechecks, scoped lint, formatting, and diff
checks pass. The nested Radix portal check uses a rendered harness
rather than the full Canvas. Independent Astra Medium re-review found no
correctness findings. Pushed commit
`5bc392d3788ef004f9a35c9a12d82dab6087053a`; `builder-pr/whr.staging` SHA
verified.
- [x] Replace duplicated Radix Navigator selection handlers with
declarative component metadata and one Builder-owned, occurrence-aware
selection override resolver. Native Select, HeadSlot, and
AnimateChildren hooks remain for their separate editor behavior.
- [x] Reveal selected `ws:show=false` instances and ancestors through
resolved prop overrides, including Form success/error feedback, while
preserving normal published rendering.
- [x] Resolve fixed `open` and effective item/tab `value` rules for
Dialog, Popover, Tooltip, Select, Collapsible, Tabs, Accordion, and
Navigation Menu. DialogOverlay retains its existing reveal behavior.
Preserve unrelated memory props and Preview behavior.
- [x] Verify resolver, lifecycle, nested Dialog portal mounting,
Collection occurrence isolation, authored expression updates, and Canvas
prop behavior. Local focused Builder suites pass 66/66; Radix 20/20;
registry 2/2. SDK, Radix, registry, and Builder typechecks, scoped lint,
formatting, and diff checks pass. Independent Astra Medium review
findings were fixed and rechecked. Pushed commit
`f8bb1078195e17704ed856c4334683584e983485`; `builder-pr/whr.staging` SHA
verified. These are local automated checks, not live UI verification.





### Remaining Navigator hook migration

- [x] Migrated every remaining Navigator hook consumer: native
Option/Select and tagged `ws:element` use effective option values and
HTML text fallback; HeadSlot uses a fixed self override; AnimateChildren
uses a fixed override only for its exact selection.
- [x] Removed Navigator hook implementations,
`Hook`/`HookContext`/`InstanceData`/`InstancePath` and
`getClosestInstance`, hook subscriptions and store, library
registration, package hook entrypoints/build inputs, and the stale
catalog hook capability field.
- [x] Added behavior coverage for evaluated/bound native values,
empty/zero values, HTML whitespace/NBSP fallback, repeated occurrences,
nearest owner, stale selection, HeadSlot rendering, exact animation
selection, Preview, deselection, and no saved-prop/memory mutation.
Existing Radix runtime index behavior remains covered.
- [x] Completed Astra Medium self-review and independent Astra High
review. Fixed the High review finding: native fallback values must
preserve non-ASCII whitespace.
- [x] Final repository search found no remaining Navigator hook
consumers or registrations.

Validation:

- `pnpm --filter @webstudio-is/builder exec vitest run
app/shared/nano-states/selection-reveal.test.ts
app/shared/nano-states/selection-reveal-render.browser.test.tsx
app/shared/nano-states/components.test.tsx
app/shared/nano-states/props.test.ts
app/shared/nano-states/instance-selection.test.ts
app/canvas/instance-selection-events.test.ts
app/canvas/selected-instance-effects.test.ts` — 7 files, 84 tests
passed; the final resolver rerun passed 14 tests after adding one
additional authored-expression regression (85 tests across the same
files).
- `pnpm --filter @webstudio-is/project-build exec vitest run
src/runtime/component-catalog.test.ts
src/runtime/component-templates.test.ts` — 16 tests passed.
- `pnpm --filter @webstudio-is/sdk-components-react-radix test` — 20
tests passed.
- `pnpm --filter @webstudio-is/builder exec tsc --noEmit` — passed.
- `pnpm --filter @webstudio-is/sdk --filter @webstudio-is/react-sdk
--filter @webstudio-is/sdk-components-react --filter
@webstudio-is/sdk-components-animation --filter
@webstudio-is/sdk-components-registry --filter
@webstudio-is/project-build typecheck` — all 6 packages passed.
- `pnpm exec oxlint --deny-warnings` on all changed TypeScript files,
`pnpm exec oxfmt --check` on all changed files, and `git diff --check` —
passed.

Native HTML options use the browser's effective value semantics
(authored value or text); their runtime has no numeric index default.
Radix items continue using their existing runtime index fallback. All
three consumers migrated; no hook mechanism remains.
2026-10-14 20:03:07 +02:00
Oleg Isonen 2570bcdd69 fix: preserve cloned bindings and Content template design (#6533)
Cloning a Collection can leave its item bindings attached to the
original Collection. Content-mode template insertion also drops fixed
image attributes, rich-text editing can remove inline images, and
YouTube previews retain the previous thumbnail after a URL edit.

Reuse the Builder fragment-copy path for cloning, preserve exact fixed
props from the same Content Block template, protect mixed image/text
content from destructive editing, and refresh video previews. Direct
component metadata lookup now includes hidden required parts without
adding them to component lists.

Unsupported Resource fields now return validation errors instead of
unchanged success. Destructive confirmation failures retain their reason
through the existing issue-report pipeline, and reports include the
negotiated server API contract alongside the CLI contract. Contract
versions still use the existing serialized-schema hash algorithm.

## Verification

- [x] Reproduce each behavior fix and demonstrate regression tests fail
before/pass after.
- [x] Verify native Content template insertion, content editing, and
reload through isolated local Builder E2E.
- [x] Check copy permissions: reject arbitrary design values,
reused/mismatched prop keys, changed clone structure, and copies from
another Content Block.
- [x] Remove the unused clone implementation and reuse the UI's
copy/remapping logic.
- [x] Review documentation impact; existing instructions remain
accurate, no documentation update needed.
- [x] Regenerate fixture builds from committed snapshots; generated
fixture files remain unchanged.
- [x] Complete generated API/docs checks, 2,492 project-build tests, 88
protocol tests, 99 focused CLI tests, package typechecks, lint, and
formatting.
- [x] Full Luna/low evaluation suite: 6/6 fixtures pass after preparing
the Content runtime build. Existing baselines are incompatible with this
model override; they were not updated.
- [x] Independent Astra review: fixed and re-tested Global Root cloning
and protected-prop overwrite findings; final review has no findings.
- [x] Required CI passes: all 19 main-workflow jobs, visual regression,
submodules, and PR lint.

Closes #6531
Closes #6519
Closes #6521
Ref #6523
Ref #6524
Ref #6525
Ref #6526
Ref #6527
Ref #6528
Ref #6529
2026-10-14 19:15:51 +02:00
ff4a081f80 fix: export text pages in static builds (#6513)
Fixes #6440

## Description

Static exports currently omit Text pages such as `/robots.txt`,
`/ads.txt`, and `/.well-known/security.txt`. This generates their
routes, evaluates content through the existing page-data loader, and
uses Vike's native `pageContext.content` to write the exact text at the
configured file path.

Internal route directories are separate from public URLs so dot-prefixed
paths work. No generated writer script, text-page manifest, HTML
wrapper, or post-build file rewrite is needed.

## Dependencies

- Pin Vike to `0.4.267-commit-feffb0f`: native non-HTML output is
published in this commit prerelease but is not yet in stable `0.4.267`.
- Use Vite `7.1.12` and the compatible React plugin for SSG. Build
through `vike build && vike prerender` so Vike uses its matching Vite
dependency.
- Update React Router's `vite-node` dependency to `3.2.4` for
compatibility with the CLI's Vite 7 test environment.

## Validation

- All 1,173 CLI tests pass locally across 72 files, including all 79
prebuild tests for normal HTML, dynamic SSG routes, and React Router
builds.
- Text export coverage checks exact output for `/robots.txt`,
resource-backed `/.well-known/security.txt`, empty text, Unicode, and
HTML-like content.
- CLI and SSG fixture type checks, lint, and formatting pass locally.
- SSG fixtures regenerated; the packaged SSG test passes locally.
- All executed GitHub CI checks pass at
`201fa971616bb607ca35ee24a970f107eddee754`, including all six browser
shards. Shard 4 passed on retry after an MDX template rename timeout.
Visual regression is skipped and preview deployment remains gated.
- Corrected the existing animation navigation test for fork CI: wait for
the rendered component with the public fallback and retain the animation
initialization assertion when the private module is present.

## Manual verification

1. Export a static project with Text pages at `/robots.txt` and
`/.well-known/security.txt`.
2. Run the generated project's build.
3. Confirm both files under `dist/client` contain exactly the configured
text, including resource expressions.
4. Confirm normal pages still render HTML.

- [ ] Original author tested the updated export and confirmed it works.
- [ ] Preview tested (deployment approval remains gated).

---------

Co-authored-by: Sviat Barbutsa <9897782+sviat-barbutsa@users.noreply.github.com>
Co-authored-by: Oleg Isonen <oleg008@gmail.com>
2026-10-12 11:41:04 +02:00
Oleg Isonen 05ea26f6a6 fix: block publish when JSON prop value is missing (#6507)
## What failed
A JSON prop can be saved without a `value`. The publish runner then
rejects the build, but the Builder was starting the publish request
before its best-effort diagnostics completed, so the user could miss the
cause in the Builder.

## Fix
- Add a pre-publish audit finding for JSON props without a value, linked
to the affected element.
- Block cloud and static publish requests when local publish audit
errors are present, so the Builder shows the diagnostic before any build
starts.
- Keep the CLI diagnostic as a fallback for builds published through
older clients or direct API flows.

## Verification
- Project-build pre-publish audit tests pass (11 tests).
- Project-build and Builder typechecks pass.
- Oxlint passes for the changed files.
2026-10-06 01:48:33 +02:00
Oleg Isonen 3e310ddae3 fix: prevent canvas page switch reconciliation errors (#6494)
## Summary
- Keep the Canvas iframe mounted on page switches to avoid the blank,
slow document reload.
- Key the page's React boundary and place authored content under a
removable `display: contents` host node inside Canvas `<body>`. This
gives page teardown a generic DOM boundary.
- Use the merged sdk-components-animation fix from PR #36. The prior
animation implementation removed React-owned text nodes and triggered
`removeChild` when Canvas switched to an animated page.
- Add an end-to-end regression using the actual animation components and
retaining iframe identity. Keep the DOM-removal and preview navigation
regressions.

## Validation
- The animation regression reproduced the exact `removeChild` error
before the animation fix and passed with the fix.
- All checks passed on `f921c3011d`, including the submodule-ordering
check, all six Builder E2E shards, Builder builds, app/package checks,
typecheck, lint, and visual regression.
- Live switching speed on the affected project still needs a manual
check after deployment.
2026-10-03 00:05:41 +02:00
Oleg Isonen 54d720b185 fix: secure resource loader SSRF (#6497)
## Summary
- Require authenticated project view permission on the resources-loader
endpoint.
- Restrict external resource fetches to HTTP(S) destinations with public
IPs, pin DNS resolution to the validated socket address, and revalidate
redirect targets.
- Limit outbound connection origins and strip sensitive headers on
cross-origin redirects.

## Validation
- `oxfmt` and `oxlint` pass for the changed files.
- Workspace TypeScript checking reports extensive unrelated missing
workspace dependency/type errors; no diagnostics were reported for the
changed files.
- Tests were not run.
2026-10-02 20:57:24 +02:00
Oleg Isonen 00fcb26afe fix: align path rules with published routes and document headers (#6488)
## Problem

Builder page navigation, Authentication, and HTTP response headers used
different path matchers from published Remix pages. For example, Builder
did not select a `/docs/*` page at `/docs`, and a request for `/%64ocs`
could reach the `/docs` page without matching its Authentication rule.

## Change

- Use Remix's framework-independent router for page selection and
project path rules. Adapt Webstudio named splats and preserve encoded
static path segments.
- Keep Authentication's first matching rule and Headers' ordered
application of every matching rule.
- Preserve previously saved encoded literals such as `/%2A`, `/%3F`, and
`/%3Aid`. They match only their literal encoded pathname and cannot
become wildcards or parameters. Previously accepted malformed encoding
remains a literal path.
- Replace Builder's separate route ranking and URLPattern matcher.
URLPattern remains for page path validation and path editing.
- Use the request URL for the project-domain authentication exemption
instead of trusting `x-forwarded-host`. Generated HTML, XML, and text
routes share one authentication helper.
- Extend the HTTP headers guide and shared path pattern reference with
matching behavior, an iframe example, and verification steps.

## Validation

- Authentication package: 88 tests. New regression cases cover saved
Authentication and Headers rules, literal matching, route ranking,
parameter values, and a marker collision attempt. The regressions failed
before the fix and pass now.
- Project build: 2,484 tests, including 214 route and redirect checks.
SDK: 636 tests. CLI: 1,165 tests. Builder system: 5 tests.
- Typechecks: Authentication, project build, Builder, SDK, and CLI.
Lint, package boundaries, formatting, and diff checks pass.
- The fixture pipeline completed and made no additional changes. The
generated fixture files already changed by this PR remain included.
- Staging project build 196 published successfully using the companion
published-site Worker branch. The edge dispatcher was deployed from its
staging branch to normalize forwarded hosts. Live HTTP checks covered
base and child routes, dynamic pages, redirects, 404s, global headers,
and route-scoped headers. The generated site challenged protected base
and child paths, accepted the route password, and left public routes
accessible. The project domain intentionally skips route-specific auth
and has a separate staging Basic Auth gate, so the successful
route-password request was checked in the generated production runtime.
A forged `x-forwarded-host` no longer changes the hosted project-domain
auth decision.
- An initial CLI run alongside two other full suites timed out in one
fixture API test; that test passed alone, and the full CLI suite passed
when rerun alone.

## Compatibility

- [x] Preserve previously accepted percent-encoded route literals before
merging.
- The old URLPattern test asserting that `/docs/*` does not match
`/docs` was intentionally changed because the published Remix router
does match the base path. Tests for the removed custom route sorter were
replaced with router-selection tests.

## Rollout

- [x] Migrate matching in this repository.
- [x] Update user documentation.
- [x] Verify package consumers and related code.
- [ ] Merge
[webstudio-saas#665](https://github.com/webstudio-is/webstudio-saas/pull/665)
before releasing this PR. The current published-site Worker template
imports the removed `matchesPathnamePattern` export; without the
companion change, a published site fails at Wrangler build.
- [ ] After publishing the new `@webstudio-is/wsauth` version, update
the published-site Worker template’s pinned `0.301.0` dependency, remove
the temporary fallback, and deploy the hosted Worker.

Replaces #6482 so the review tracks the deployed `headers.staging`
branch.
2026-10-02 13:51:39 +02:00
Oleg Isonen c4684c141c fix: persist a valid JSON fallback when removing bindings (#6492)
## What changed

Resetting a JSON binding stores the expression's evaluated value. If it
evaluates to `undefined`, the serialized prop loses its `value` field
and fails the build schema. This change saves `null` instead for a
nullish fallback.

## Reproduction

Using the SDK `prop` schema locally, a JSON prop with the `value` field
omitted fails validation; adding `value: null` passes.

The full test suite was not run.
2026-10-02 12:42:36 +01:00