# Page Safety & QA

> Resolve edit context, compare versions, run integrity checks, and roll back safely

Canonical URL: https://fa7e86e3d553:3005/tools/page-safety

Use the page safety actions before and after every meaningful edit.

## Recommended workflow

```text
1. lexsis_pages → find
2. lexsis_pages → edit_context
3. lexsis_pages → section_source or source
4. lexsis_drafts → page_patch
5. lexsis_pages → diff
6. lexsis_pages → integrity
7. Host-agent browser QA
8. lexsis_live_ops → publish, only after approval
```

## Resolve edit context

```json
{
  "name": "lexsis_pages",
  "arguments": {
    "action": "edit_context",
    "args": {
      "page_id": "page-uuid"
    }
  }
}
```

Stop if:

- `workspace_consistent` is false
- `corrective_action` is non-null
- The resolved store or shop domain is not the intended one
- The expected theme is missing

Use the returned `current_version` as `expected_version` for the write.

## Run integrity checks

```json
{
  "name": "lexsis_pages",
  "arguments": {
    "action": "integrity",
    "args": {
      "page_id": "page-uuid",
      "archetype": "pdp"
    }
  }
}
```

Integrity checks cover:

- Head and section structure
- Unique section IDs
- Island names and props
- PDP BuyBox and product media
- Header, footer, and navigation expectations
- Cart configuration
- Placeholder text and URLs
- Restricted CSS and JavaScript

Integrity checks do not prove that the page is visually correct. They do not
reliably detect stacked columns, overlap, clipping, excessive section height,
or broken responsive composition.

## Compare versions

```json
{
  "name": "lexsis_pages",
  "arguments": {
    "action": "diff",
    "args": {
      "page_id": "page-uuid",
      "version_a": 6,
      "version_b": 7
    }
  }
}
```

Review:

- Added, removed, and modified sections
- Section ordering
- Head changes
- Theme changes
- Page-script changes

The diff should match the user's requested scope. Investigate unrelated
changes before publishing.

## Optimistic concurrency

Every edit should include:

```json
{
  "expected_version": 6
}
```

If the page is now version 7, the write must fail rather than overwrite it.
Re-read the current source and reapply the intended change.

Use a stable idempotency key only when `lexsis_discover` shows it in the
selected action schema. `page_patch` currently relies on `expected_version`;
inspect the current version and diff before retrying after a timeout.

## Browser QA

The host AI agent performs visual verification with its own browser capability.
The MCP does not create a shared browser session.

Verify:

- 390px mobile
- 768px tablet
- 1280px desktop
- No horizontal overflow
- Expected row and column counts
- No overlap or clipping
- Correct hover and focus behavior
- No broken images
- No console errors

When screenshots fail, use computed styles, DOM bounds, scroll measurements,
and image completeness checks.

## Rollback

Rollback changes live state and requires explicit approval:

```json
{
  "name": "lexsis_live_ops",
  "arguments": {
    "action": "rollback",
    "args": {
      "page_id": "page-uuid",
      "version": 6
    }
  }
}
```

Inspect the version diff before rollback and re-run integrity plus browser QA
afterward.

## Published pages

Public rendering uses the immutable `published_version_id`; preview rendering
uses the requested or current draft version. Edits to an already published
page remain non-live until an explicit publish succeeds. Check
`has_unpublished_changes` in `edit_context` before release.

## Related

- [Page Management](/tools/page-management)
- [Publishing](/pages/publishing)
- [Styling Issues](/troubleshooting/styling-issues)
