# Page QA

> Record hosted-runtime QA for an exact page version, read QA state, inspect compile artifacts, and block publishing until QA passes

Canonical URL: https://77865786950d:3005/tools/page-qa

The MCP doesn't run a browser. Your agent checks the hosted preview with its own
browser, then records the results against the exact page version it tested.
When enforcement is on, publishing is blocked until the current version has a
passing report.

| Tool · action | Access | Use it to |
|---|---|---|
| `lexsis_pages` · `compile_artifact` | Read | Inspect a compiled bundle by `compile_id` |
| `lexsis_drafts` · `page_record_qa` | Draft | Record QA results for one page version |
| `lexsis_pages` · `qa` | Read | Read the latest report, enforcement mode and history |

## Where QA fits

1. `lexsis_pages` · `compile` validates source and returns a `compile_id`.
2. Optionally, `lexsis_pages` · `compile_artifact` lets you inspect that bundle.
3. `lexsis_page_create` · `create`, or a `lexsis_drafts` page edit, saves a new
   version and returns a preview URL.
4. Your agent checks the preview at desktop and mobile widths and runs the
   Quick Add-to-cart flow. See [Page safety](/tools/page-safety#browser-qa).
5. `lexsis_drafts` · `page_record_qa` records the results for that version.
6. After approval, `lexsis_live_ops` · `publish`.

Any edit after step 5 creates a new version. Record QA again for it.

## Inspect a compile artifact

`compile_artifact` takes `{ compile_id }` and returns the compiled page bundle.
Artifacts are kept for 30 minutes. After that the action returns
`COMPILE_ARTIFACT_EXPIRED`; compile again. You don't need this step to create a
draft, because `create` accepts `compile_id` directly.

## Record QA

```json
{
  "name": "lexsis_drafts",
  "arguments": {
    "action": "page_record_qa",
    "args": {
      "page_id": "page-uuid",
      "version": 8,
      "desktop": {
        "visual": { "status": "pass" },
        "overflow": { "status": "pass" },
        "cls": { "status": "pass" }
      },
      "mobile": {
        "visual": { "status": "pass" },
        "overflow": { "status": "warn", "summary": "Trust row wraps to 2 lines at 390px" },
        "cls": { "status": "pass" }
      },
      "controls": { "status": "pass" },
      "shell": { "status": "pass" },
      "assets": { "status": "pass" },
      "commerce": [
        { "step": "open_quick_add", "status": "pass" },
        { "step": "select_variant", "status": "pass" },
        { "step": "add_to_cart_request", "status": "pass" },
        { "step": "verify_cart_state", "status": "pass" },
        { "step": "verify_cart_count", "status": "pass" },
        { "step": "verify_responsive_cart_drawer", "status": "pass" }
      ],
      "enforce": true
    }
  }
}
```

- Every check is `{ status, summary? }`. `status` is `pass`, `warn`, `fail` or
  `not_run`, and `summary` can be up to 500 characters.
- `desktop` and `mobile` each need `visual`, `overflow` and `cls` (layout
  shift).
- `controls`, `shell` and `assets` are page-wide checks.
- `commerce` lists up to 20 steps from: `open_quick_add`, `select_variant`,
  `add_to_cart_request`, `verify_cart_state`, `verify_cart_count`,
  `verify_responsive_cart_drawer`.
- `version` must be a version that exists for the page. `source` defaults to
  `hosted-runtime`. `notes` can be up to 2,000 characters.

### Overall status

The server derives one status for the report:

- `fail` if any check is `fail` or `not_run`.
- Otherwise `warn` if any check is `warn`, or if `commerce` is empty.
- Otherwise `pass`.

## Enforce QA before publishing

`enforce: true` switches the page into `block` mode. The setting persists:
reports that leave `enforce` out keep the current mode, and `enforce: false`
switches back to `observe`.

In `block` mode, `lexsis_live_ops` · `publish` fails with code
`hosted_qa_required` unless the latest report:

- is for the page's current version, and
- has overall status `pass`.

The error details include `current_version`, `qa_version` and `qa_status`.
In `observe` mode, reports are stored but never block publishing.

## Read QA state

`lexsis_pages` · `qa` takes `{ page_id }` and returns:

- `enforce` and `mode` (`block` or `observe`)
- `latest`, the newest report
- `history`, the last 10 reports, newest first

## Related

- [Tool Reference](/tools/reference)
- [Page safety](/tools/page-safety)
- [Page management](/tools/page-management)
- [Publishing](/pages/publishing)
