Skip to content

Guide Validation Gate

Reese Hodge edited this page Nov 18, 2026 · 6 revisions

Guide: Validation Gate

The local gate is:

pnpm run validate

package.json defines it as:

eslint . && prettier --check . && tsc --build && pnpm -r --if-present build && pnpm -r --if-present test

So the required order is:

  1. lint
  2. format:check
  3. typecheck
  4. build
  5. test

All five must pass before work is considered done. See Concept-Testing-And-TDD for the broader testing principle and Guide-Local-Setup for first-time setup.

Individual scripts

Command Purpose
pnpm run lint ESLint over the configured repo surface
pnpm run lint:fix ESLint auto-fix
pnpm run format:check Prettier check without writing
pnpm run format Prettier write
pnpm run typecheck TypeScript project build
pnpm run build Workspace builds
pnpm run test Workspace tests
pnpm run test:coverage Workspace tests with coverage where configured

CI runs the same quality stages as separate steps, plus a separate dependency audit job. A locally green validate does not replace CI's audit.

Deprecated APIs fail lint

Since 2026-11-16 (main-repo 15e855c), @typescript-eslint/no-deprecated is an error for every TypeScript file under packages/. The builder asked for it after a deprecated CDK addDependency call reached new code.

The rule needs type information. Each package's tsconfig.json excludes its tests or configs, so each package also has an ESLint-only tsconfig.eslint.json that includes **/*.ts and **/*.tsx. Lint now takes about 14 seconds.

Trap: a file outside tsconfig.eslint.json is not checked

ESLint's projectService reported 57 files as "not found" and skipped them, so the config uses parserOptions.project with the per-package eslint tsconfigs instead. A new TypeScript file in a path those tsconfigs exclude (dist, build, cdk.out, coverage) gets no deprecation check.

The gate is enforced on main, not merely recommended

Until 2026-09-30 the "Main Branch Protection" ruleset carried only deletion and non_fast_forward. Anyone could push straight to main, and a red CI or Audit could not stop a merge — which is exactly how the advisory failure in Log entry 37 came to be discovered on main rather than on a pull request. The ruleset now also requires:

Rule Setting
Pull request Required, 0 approving reviews (solo maintainer)
Required status checks CI and Audit
Strict / up-to-date branch Off — a PR need not be rebased on every main commit
Bypass Repository admin, always

The check names come from the name: fields of the two jobs in .github/workflows/ci.yml. Renaming a job without updating its required context blocks merging: the old required check never reports, stays pending, and does not satisfy the gate. Rename the job and the ruleset context together. A conditionally skipped job is different: GitHub reports its check as success, which can satisfy a required context. A workflow skipped by path, branch, or commit-message filtering instead leaves its required check pending. See GitHub's required-check troubleshooting guide.

The sharp edge of requiring Audit

pnpm audit queries the live advisory database, so a newly published advisory turns every open pull request red at once, including ones touching nothing related — see Concept-Supply-Chain-Discipline. Requiring Audit therefore converts that from a noisy signal into a full stop on merging.

That is the intended behavior, and the admin bypass is the pressure valve. It exists for the case where the fix is genuinely blocked upstream, not as a way around a red build: the normal response is to fix the advisory, which on 2026-09-30 took a lockfile refresh and one commit.

Trap: the local wiki clone is intentionally ignored

prettier --check . is repo-wide. A local wiki/ clone is a separate git repo, contains author-controlled wiki prose, and would break or churn formatting if Prettier saw it. That is why:

  • .prettierignore excludes wiki/.
  • .gitignore excludes /wiki/.

This is the same pattern Guide-Wiki-Contributing relies on: edit the wiki locally, lint the wiki with wiki tooling when needed, but keep the main repo's validation gate independent of the optional clone. Gotchas links here for this trap.

Trap: root scripts are silently outside coverage

eslint.config.mjs ignores:

  • scripts/
  • *.mjs

vitest.workspace.ts includes only:

  • packages/frontend
  • packages/agent
  • packages/repo-tools

That means a root-level script in scripts/ or an .mjs helper can be unlinted and untested while pnpm run validate still passes. This is why repo tooling belongs in a workspace package such as packages/repo-tools instead of root scripts. Gotchas links here for this trap too.

This is not hypothetical. wiki:push was a root package.json one-liner, git add -A && git commit -m "Update wiki" && git push. The && chain encodes a conditional — push only if the commit succeeded — which is logic, and logic in a root script is checked by nothing. On a clone whose work was already committed, git commit exited non-zero and the push silently never ran. It took a wiki that looked published but was not to surface it. Moving it into packages/repo-tools put it under types, lint and eight tests.

The sequel is the more useful half. Under test, the script went on to produce two more bugs of its own — a bin reading argv[2] positionally committed the literal string --message to the live wiki, and a || git clone fallback buried git's real pull error under destination path 'wiki' already exists. Tests caught neither, because each was a decision the wrapper had no business making. Both scripts were deleted on 2026-11-01 in favour of git -C wiki ..., and the trap now lives in prose on Guide-Wiki-Contributing instead of in code.

The rule that follows: a root package.json script may chain commands, but the moment it encodes a decision, it belongs in a package — and before moving it, ask whether the decision needs to exist at all. wiki:lint passes that test; wiki:push never did.

What this gate does not mean

validate proves the configured repo surface is clean. It does not prove wiki pages are linted, browser-edited wiki content is safe, or AWS deployments are correct. For wiki rules, read Wiki-Conventions. For deploy behavior, read Guide-Deployment.

Clone this wiki locally