Verify

You can't tell by reading whether what your agent shipped is safe. Verify tests it the way a careful tester would: it signs in as each role, tries every table for read, create, update and delete (rolling the writes back), checks what signed-out visitors can reach, and opens every page in a real browser. Each failing check comes back with its evidence and the fix, and a deploy refuses to go out while anything is red.

When to use it

After every change that matters, and always before a release. Agents run it after each apply and fix what it reports before calling the work done; deploy runs it again on its own.

What it checks

AreaChecks
staticcontract (the project compiles), reachability (every page is reachable by some role), access-patterns (unsafe policy shapes), indexes (indexes on the columns your policies filter on), workflows (armed)
matrixrole-matrix: every role against every table, each operation tried and rolled back. signed-out: what visitors can read
productionlogins (each demo sign-in works), secrets (values the app needs are set), sign-in-providers (your own Google client before launch), domain
browserwalk:<role> and walk:guest: signed in as each role (and signed out), every page it can reach opened in Chromium and checked for errors. nav-scope: each role is offered only its own pages

elevated-functions lists every security definer function in db/ with its -- @definer reason, so a reviewer reads each one.

Run it

verify { "project_id": "…" }                                   // everything, on dev
verify { "project_id": "…", "checks": ["static", "matrix"] }   // fast, while fixing access
verify { "project_id": "…", "env": "prod" }                    // the published app
verify { "project_id": "…", "last": true }                     // the last report again, without running

explain { "project_id": "…", "about": "check", "check_id": "role-matrix" }   // one check's evidence, fix and items

Verify takes a few minutes: when it answers { "status": "running", "job_id": … }, call it again (or job) to join the same run. Over HTTP it is POST /api/dev/v1/projects/<id>/verify with a personal access token, for CI.

Reading a report

The shape of an answer, trimmed, with one failing check:

{
  "status": "fail",
  "summary": "…",
  "checks": [
    { "id": "role-matrix", "area": "matrix", "title": "Role permissions", "status": "pass", "evidence": "…" },
    { "id": "signed-out", "area": "matrix", "title": "Signed-out access", "status": "fail",
      "evidence": "…", "fix": "…", "items": ["…"] },
    { "id": "walk:member", "area": "browser", "title": "Browser walk as member", "status": "pass", "artifacts": ["…"] }
  ]
}
  • A check is pass, fail, warn or skipped. A failing one names the role, table or page, with evidence, a fix and the items behind it.
  • Fix the files, apply, and verify again until status is pass.
  • Read the signed-out line on every app. If a table there should be private, its policy is too wide; see access.

At deploy

A release's migration first runs on a copy of production; verify then runs the role matrix and the page walk against that copy, real rows included. A red report stops the publish with production untouched. skip_verify exists for emergencies: deploying past red is your call. See publishing.

Gotchas

  • Skipped is never pass. A skipped check means that part is unverified.
  • Verify signs in with the demo sign-ins. Keep a seed profile row each role's demo sign-in can take (one without an email), or the role has no data to test with.
  • Hydration errors fail the browser walk. A page that renders differently on the server and in the browser (dates in the visitor's locale, Date.now() in render) shows React error #418.
  • Pair it with screenshot: verify proves behaviour, screenshots show how it looks, and screenshot steps prove a flow (sign up, book, pay).

Related