Files
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
..

Webstudio Fixtures

Fixtures are test projects that ensure the CLI and build process work correctly across different deployment targets.

Updating Fixtures After Changes

# From repository root - updates all fixtures
pnpm fixtures

This command will:

  1. Link all fixtures to their respective projects
  2. Sync the latest data from the development environment
  3. Build all fixtures with the latest code

Working with Individual Fixtures

# Go to fixture folder
cd fixtures/webstudio-features

# Link to project
pnpm fixtures:link

# Sync latest data
pnpm fixtures:sync

# Build fixture
pnpm fixtures:build

# Start it
pnpm run dev

Adding Assets to Fixtures

To add a new asset (image, video, audio, etc.) to a fixture:

  1. Publish to staging

    • Make your changes in the builder
    • Publish to the staging environment
  2. Get the build ID from CI

    • After publishing, check the CI logs
    • Find the build ID that was created
  3. Update the fixture's build ID

    • Edit fixtures/[fixture-name]/package.json
    • Update the --buildId parameter in the fixtures:sync script
    "fixtures:sync": "pnpm cli sync --buildId NEW_BUILD_ID_HERE && pnpm oxfmt ./.webstudio/"
    
  4. Sync with the correct environment

    # Go to fixture folder
    cd fixtures/webstudio-features
    
    # Sync from staging environment (replace with your branch)
    BUILDER_HOST=fix-assets.staging.webstudio.is pnpm run fixtures
    
  5. Fix the origin URL

    • After syncing, edit .webstudio/data.json
    • Change the origin back to:
    "origin": "https://main.development.webstudio.is"
    
    • This is necessary because sync changes it to the current branch
  6. Commit the changes

    git add fixtures/
    git commit -m "chore: update fixtures with new assets"
    git push