# Check Agent — Quality Gates Run all quality gates and report the result. Fix any red gate before committing. ## Gate 1 — TypeScript Check (most important) ```bash docker compose exec frontend npx tsc --noEmit 2>&1 ``` Catches missing imports, type errors, undefined variables. A failure here causes a blank page in the browser. **Always run this first.** Expected: zero errors. ## Gate 2 — Backend Import Check ```bash docker compose exec backend python -c "from app.main import app; print('OK')" 2>&1 ``` Verifies all Python imports resolve. Catches `ImportError` before they reach production. Expected: prints `OK`. ## Gate 3 — Backend Startup ```bash docker compose logs backend 2>&1 | tail -20 ``` Check for `Application startup complete` and no exceptions. ## Gate 4 — Migration State ```bash docker compose exec backend alembic current 2>&1 ``` Verifies the DB is at the latest migration head. Expected: shows current revision with `(head)`. ## Gate 5 — Render Worker Health ```bash docker compose exec render-worker python3 -c " import subprocess, sys result = subprocess.run(['/opt/blender/blender', '--version'], capture_output=True, text=True) print(result.stdout.strip().split('\n')[0]) " 2>&1 ``` Expected: `Blender 5.0.1` or later. ## Gate 6 — Data Integrity: No Absolute storage_keys ```bash docker compose exec backend python -c " import asyncio from sqlalchemy import text from app.database import AsyncSessionLocal async def main(): async with AsyncSessionLocal() as db: r = await db.execute(text(\"SELECT COUNT(*) FROM media_assets WHERE storage_key LIKE '/%' AND is_archived=false\")) n = r.scalar() print(f'Absolute storage_keys: {n}') if n > 0: print('WARNING: absolute paths break on volume changes!') asyncio.run(main()) " 2>&1 ``` Expected: `Absolute storage_keys: 0` ## Gate 7 — Changed Files ```bash git diff --stat HEAD ``` Review what changed. Confirm no accidental files included (`.env`, secrets, large binaries). ## Gate 8 — Vite Build (optional, slow) ```bash docker compose exec frontend npm run build 2>&1 | tail -20 ``` Run this only when preparing for a release or after large frontend changes. --- ## Result **All gates green** → commit with a Conventional Commit message: ``` feat|fix|refactor|docs|chore: short description Co-Authored-By: Claude Sonnet 4.6 ``` **Any gate red** → fix the issue first, then re-run the failing gate. ## Why These Gates - **tsc --noEmit**: catches missing React hook imports (`useEffect`, `useCallback`) that cause blank pages at runtime - **Python import check**: catches `ImportError` before they surface in production - **Absolute storage_key check**: absolute paths break on every volume move or infrastructure change (Flamenco removal made 396 renders inaccessible this way) - **Migration state**: ensures the running DB matches the code's expected schema