<!-- TokenOS docs · Building apps · Markdown mirror of https://tokenos.ai/docs/quality-gate · HTML: https://tokenos.ai/docs/quality-gate · index: https://tokenos.ai/llms.txt -->

# Build quality gate & brand art

Two v5 additions make sure what you see in the preview is a working product: a **headless render check**that catches runtime errors before a build is called done, and **brand art generation** that replaces imaginary image paths with real assets.

### Render gate

1. **Mount** — After the Vite bundle is written, a headless Chromium (Playwright) loads the preview exactly as the IDE iframe would, with the wallet bridge in no-op mode.
2. **Observe** — Console errors, uncaught exceptions, failed module loads and React render errors are collected; a screenshot is captured once the app settles.
3. **Repair** — If anything blocking was recorded, the errors plus the offending files are sent back to the model with repair guidance. The preview is rebuilt and re-checked. Up to 2 rounds (RENDER_GATE_MAX_ROUNDS).
4. **Report** — The final status is stored in result.render and shown as the Render badge in the IDE. The task is only marked completed after this step.

| Status | Meaning | What to do |
| --- | --- | --- |
| verified | Mounted with no blocking errors on the first attempt. | Nothing — ship it. |
| repaired | Errors were found and fixed automatically within the repair rounds. | Review the change list; the repaired files are listed. |
| degraded | Preview has runtime errors that two repair rounds could not fix. The build is delivered, but flagged. | Click Fix it (pre-fills a repair prompt with the exact errors) or Re-check after your own edit. |
| unverified | The check could not run (bundler unavailable, timeout). | Open the preview manually; Re-check when the environment is back. |
| checking | In progress. | Wait — Mission Control streams the rounds. |

> **Note — Why a build can be “completed but flagged”**
> Delivering a degraded build is deliberate: you keep the files, the plan and the preview URL, and the badge tells you precisely what failed. Two rounds is the limit so a stubborn error does not silently burn credits.

### Brand art

Generated apps reference imagery like `/media/hero.png` or `/media/logo.svg`. Before the preview is built, every such reference is resolved to a real file:

- **Raster images** (hero, feature, backgrounds) are generated with Google's Gemini image model (`gemini-3.1-flash-image-preview`, “Nano Banana”) from a prompt derived from the product plan and design system. Capped at 4 AI images per build (`MAX_AI_IMAGES`).
- **SVG assets** (logo, icons, extras) are produced procedurally from the design tokens so they are crisp at every size.
- References are normalised to relative `media/…` paths so they work in the preview, in hosted copies and in a downloaded project.
- Bytes are stored in `project_assets` with a disk cache and materialised into `<preview>/media/`; Go Live and static deploys carry them along.

If image generation is unavailable, a tasteful generated placeholder in the app's palette is used so layouts never break — the badge and the build log tell you when that happened.

### Related checks

- Lint gate on deploy: the ruff blocker set (E722, F601, F821, F823, E9) must be clean on the backend and oxlint on the frontend.
- Protected runtime files are never passed through the JSX sanitizers, which previously caused “address is not defined” failures.
- Harness verification adds an isolated LLM evaluator and a Jev acceptance check on top of the render gate.

---

*Building apps · TokenOS documentation. Canonical page: https://tokenos.ai/docs/quality-gate. All docs as Markdown: https://tokenos.ai/llms.txt. Payments on TokenOS are for metered usage only; nothing on this page is investment advice or a promise of income.*
