Build Gate (Mandatory)

Rule

Work is not complete until all four checks pass:

  1. Unit tests — affected files green via the workspace-pinned test runner.
  2. Production buildnext build (or the relevant workspace’s build) clean with zero errors.
  3. UX verification — for any UI / agent / coworker / workflow / form change, exercise the affected path against the running Docker-served app.
  4. Migration applies cleanly — if a migration was added, it applies on a fresh DB without error.

TypeScript errors only surface in the production build (vitest and the IDE both miss some classes); a green vitest run is not sufficient evidence on its own.

Why

“Done” without evidence is a claim, not a state. The Build Gate is the platform’s contract for converting claims into verifiable states — once all four checks pass, the change is known to compile, test, render, and migrate. Skipping any one of them is how regressions reach production: a passing test suite that hides a build failure, a clean build that ships a broken UI, a green migration check that ignored the missing backfill. The four checks together cost minutes per PR and save days per incident; the cost asymmetry is what makes this commandment-tier rather than optional discipline.

Applies To

In-platform coworkers (Build Studio’s pre-ship sandbox verification mirrors this gate), external coding agents (Claude / Codex must run all four before claiming completion), and humans operating the platform. Symmetric. Applies to feature work, bug fixes, refactors, and any change that touches code, schema, or running services. Does NOT apply to pure-text doc edits with no code touched — those have a doc-lint gate instead.

How To Apply

Run the four checks in order; stop on the first failure and fix it before continuing. The pre-commit hook at .githooks/pre-commit enforces a typecheck on TypeScript files as a fast feedback loop; the full gate runs at PR open via CI and locally before push. When the build fails for reasons unrelated to your change (a pre-existing problem), note it in the PR and fix if feasible — don’t defer it, that’s how unrelated-failure technical debt accumulates. Build Studio’s sandbox runs the same gate before any PR leaves the sandbox; if a Build-Studio-produced PR would fail CI typecheck, it never leaves the sandbox.

Where each check runs matters. Unit tests and typecheck can run in the topic worktree when the workspace shape allows. Production build, UX verification, and migration-apply checks run against the canonical install (root clone or a governed shared nonprod environment), per worktree-is-source-control-not-runtime. A check that cannot run in the worktree because of harness limitations (missing pnpm/corepack on PATH, broken workspace symlinks, missing generated Prisma client, Next/Turbopack rejecting cross-workspace symlinks) is a harness finding, not a product failure: capture canonical-install verification evidence in the PR and file the harness gap as a separate platform BI rather than treating the worktree limitation as a build-gate failure.

Decision Dimensions

Examples

Sources

(Rendered from the sources: frontmatter by WikiSourceCitations — do not duplicate citation prose here.)