Skip to content
MSO CloudDocumentation

Quality gates

On this page

In short#

Every change passes the same gates, a recurring bug becomes a permanent guard, and a number is checked against the outside world before it is called correct. A hook states what it skips, so a green push is never mistaken for a green release.

pre-commitpre-pushCIcheckCIimagesCIdataCIbrowserweeklyFormat checkSecurity scan (static rules)Dependency audit (high+)TypecheckLintUnit testsStatic audits (audit:all, incl. docs build)Production buildRoute bundle budgetsTopology vs tracked templateDocs verify (browser)Images, Dockerfile policy, identitiesData reconciliation (verify:data)Tenancy gate (verify:rls)Operator smoke (browser)Ring: staged files only. Every stage calls the same scripts from the workspace root; the static audit list exists once, in package.json.The full local gate (pnpm run verify) adds build, budgets, topology, data and tenancy to the pre-push set; only the browser jobs stay CI-only.
Where each check runs. Pre-push is not CI: build, budgets, database and browser gates run only in CI or in the full local gate.
  • One enumeration. The static audit list lives once, in the workspace package.json; hooks and CI both call it, so results cannot drift.
  • Fast fail first. Pre-push runs the cached format check and eslint plus a type check on the changed packages before the full steps; when a green full gate already covers the identical tree the same day, the hook says so and reruns nothing.
  • The hook states what it skips. Pre-push runs no build, budget or database gate; pnpm run verify is the complete local non-browser gate.
  • Verify at the root. A filtered single-package run is not a verification claim: it hides failures in skipped packages.
  • The tenancy job changes identity. It seeds as a privileged identity, proves as the deployed non-bypass roles, asserts that posture first, and fails when fewer checks ran than its floor.
  • No bypass. Hooks are never skipped; a high-severity dependency advisory blocks the push, and a weekly workflow repeats the dependency audit and security scan.

The class-of-bug contract#

A recurring bug is never fixed only where it was found. It gets a stable rule plus the strongest proportional guard at the layer that owns the invariant, wired into the one canonical gate.

1 · Type or constraintUnique index or discriminatedunion: bug unrepresentable2 · Behavioural testAt the layer that ownsthe logic3 · Static auditOver the repository, whenthe bug is a shape4 · RatchetChecked-in baseline thatonly shrinksStrongestWeakestPlus, for numbersA numeric bug also gets a reconciliation assertion whose expected value traces to external ground truth, never a second derivation in code.

A reconciliation assertion's expected value comes from an operator rule, a customer's own export, or a frozen oracle derived from one. A second derivation in code repeats the same misunderstanding and agrees with itself, and a discrepancy is not presumed a bug until its semantics are confirmed against the external source. Cross-surface arithmetic (a headline equals the sum of its rows, a two-feed merge does not double count) holds only against real data in a real database, which typecheck, lint, unit tests and a build cannot see.

The static audit fleet#

Each audit encodes one class of shipped defect, with the story in its docstring; several self-test before judging the repository. Audits fail closed: the only escape is an explicit per-rule suppression token at the call site, and a security suppression is logged separately.

Class Guarded because
Time-zone day edges A UTC day edge drags an adjacent day into a Vietnam-time range
SQL binding hazards An interpolation inside a SQL comment still becomes a bound parameter
Nullable upsert targets Without NULLS NOT DISTINCT, every re-sync inserts duplicates
Runtime privileges A table missing from the grant manifest would otherwise fail only at deploy
Tenancy pins A null-brand pin silently disables a policy's brand leg
Copy quality Filler, self-describing chart subtitles and mixed quote glyphs in user-facing strings
Docs Status words off the status page, internal ids in reader prose, pages without an owner

Where it stops#

Pre-push omits database, build and browser gates. pnpm run verify includes database and build checks; browser verification runs separately. The CI image job checks and builds seven distinct images: web, worker, migrate, Cube, the storage initializer, PDF browser and issuer. It inspects runtime users, startup commands, exposed ports and Cube's image healthcheck; image boot-smoke runs remain outside this gate. Some classes are still ratchets with a non-zero baseline. A green gate does not prove behaviour it does not enumerate, so tenant-facing lists and defaults are also checked across organization types. Dated status per capability: Project status.

Decisions#

Decision Why Enforced by
A recurring bug is fixed everywhere and gets a rule plus its strongest guard A per-site fix leaves the shape in place for the next change to reintroduce A rulebook audit failing on an unguarded rule or an unnamed gate-wired guard
Static audits are listed once; hooks and CI run them at the workspace root Two lists of checks drift, and a filtered run hides failures CI calls the hook scripts; a coverage audit fails on any untypechecked script
Every metric-bearing surface has a reconciliation assertion anchored to external ground truth Re-deriving a number with the same code agrees with itself and misses a wrong definition verify:data in CI on a freshly migrated database seeded with adversarial fixtures