Skip to Content
Quality gates

Quality gates

What runs on every pull request

The Check PR workflow (.github/workflows/ci.yml) is billed per job, rounded up to the minute, and every job repeats checkout, Node setup and install. So I put the cheap gates in one job, and the heavier ones start only after it passes. A failing step stops the rest of its job, a new push to a pull request cancels the run in progress, and draft pull requests are skipped.

  1. Check job, in this order:
    1. Commit messages: commitlint, checking conventional commits.
    2. Changed areas: a path filter decides which of the jobs below are needed.
    3. Quality: pnpm type-check, pnpm format:ci (Prettier, over the whole repository) and pnpm lint (ESLint 9).
    4. App build: pnpm build (the production Next.js build). Runs when src/, public/, the Next config or the dependency files changed.
  2. Storybook: pnpm test (Vitest: unit tests and every Storybook story outside src/prototypes, in the Chrome preinstalled on the runner). Storybook accessibility checks run in "error" mode, so a story with an axe violation fails. Runs when src/, public/, .storybook/, scripts/, the Vitest config or the dependency files changed. pnpm build-storybook is not part of CI; the story tests already compile every story.
  3. Docs: the docs-site tests and build. Runs when docs-site/ or docs/ changed.

A change to ci.yml itself runs the check job, the app build and Storybook, but not the docs job.

Run the same checks locally

pnpm type-check pnpm lint pnpm format:check pnpm test pnpm build

pnpm test needs a Chromium for Playwright once: npx playwright install chromium.

The transition probe is not part of CI. It needs a running production server, so run it locally when you change motion or navigation: pnpm build && pnpm start, then pnpm probe:transitions in another terminal. See Motion probes.

Tests

vitest.config.ts defines two projects:

  • unit runs src/**/*.test.{ts,tsx} and scripts/**/*.test.mjs in Node. The resume request logic in src/lib/resume-request/ and the transition probe’s budget logic in scripts/probes/budgets.mjs are covered here.
  • storybook runs every story as a browser test, except the throwaway ones under src/prototypes (set TEST_PROTOTYPES=true to include them). Stories sit next to their components as *.stories.tsx (see Folder layout), and a story with a play function is also an interaction test. Run pnpm storybook to work on components on port 6006.

The Storybook Vite config in .storybook/main.ts mirrors the app: vanilla-extract styles, the @/ aliases and the app fonts.

Visual comparison

scripts/visual-qa/capture.mjs compares two running production builds, a baseline and a candidate, and writes a report with before, after and diff images. It captures each route across viewports, themes, reduced motion and scroll positions, walks keyboard focus, and flags a state as unstable when a build differs from itself. It is not part of CI and keeps no stored baselines, so nothing can be overwritten to make a failure pass.

node scripts/visual-qa/capture.mjs --baseline http://localhost:3001 --candidate http://localhost:3100 --out docs/screenshots/issue-N

Exit code 0 means nothing differs beyond calibrated noise, 1 means something differs or is unstable and needs a person to review it, and 2 means it could not run or a state never became ready (the splash screen still showing, images in view unloaded), which is listed as not run and never compared. Build the baseline from the merge base with origin/main, not the local main. The visual-qa skill in .claude/skills/visual-qa/ runs the whole workflow, including the probes, and its reference files list the states to capture. A pixel diff shows that two builds differ. It cannot tell me whether the difference is wrong, and it does not see timing, hover or touch. The motion probes cover those.

Security review

The security-boundary-review skill in .claude/skills/security-boundary-review/ is a read-only review for changes that touch API routes, webhooks, Draft Mode, headers, environment handling, third-party calls, dependencies, CMS content rendering, GitHub workflows or agent permissions. It maps the trust boundary, reads the code path, runs the existing tests for it, and reports findings with the file and line, the preconditions an attacker needs, the impact and how it was verified. A finding with no realistic precondition path is reported as an observation. It never prints a secret, never tests a deployed service and never changes a security setting without approval. No CI job runs it. The route tests it relies on (src/app/api/**/route.test.ts, src/lib/blog/webhook.test.ts) run in pnpm test.

Codex review loop

Codex (chatgpt-codex-connector[bot]) reviews each pull request when it is opened for review, marked ready, or asked with @codex review; a push alone does not start a review. The codex-review-loop skill (.claude/skills/codex-review-loop/) works a pull request through that review: it triages each finding against the code, fixes or answers it, re-requests, watches, and merges only when I say so.

scripts/codex-review/status.mjs is the gate. It reads the pull request, Codex’s reactions, its summary comment and the CI check runs with gh api, and writes nothing.

pnpm codex:status --pr 465 # one reading: ready, waiting or blocked, and why pnpm codex:status --pr 465 --json pnpm codex:status --pr 465 --watch # print each change; stop when ready, merged or closed

The skill also resolves Codex’s review threads once they have been answered, with pnpm codex:resolve --pr 465 (--dry-run lists them). It resolves only a thread Codex started that someone else has replied to: never one a person started, one nobody has answered, or one already resolved. pnpm codex:status reports how many Codex threads are open; thread state is information and does not change the verdict.

A pull request is ready when Codex’s review names the current head, finds nothing unresolved, and has put its 👍 on the pull request, and every CI job that ran has passed with none still running. A 👍 or a clean review counts only for the commit it names, so a push after it makes it stale. A skipped job is not a pass, and a draft is blocked because CI is skipped and Codex has not reviewed it. ready is the evidence, not permission: the merge needs my say-so.

Exit codes of status.mjs: 0 ready or merged, 1 blocked or closed, 2 the pull request could not be read, 3 waiting. The rules are in scripts/codex-review/review.mjs and tested in review.test.mjs; resolve.mjs is the only script that writes.

Commit hooks and conventions

  • Conventional commits are enforced by Husky and commitlint (.commitlintrc.json) on every commit message. The same convention drives the release process: feat becomes a minor release and fix a patch.
  • Pre-commit lint-staged (lint and format on staged files) runs only when HUSKY_ENABLED=true is set locally.

What I cannot enforce

Branch protection is not available for this private repository on the GitHub Free plan, so the checks above are advisory. I wait for a green run before merging.

Last updated on