Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions scripts/check-api-validation-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ const CONTRACTS_DIR = path.join(ROOT, 'apps/sim/lib/api/contracts')
const QUERY_HOOKS_DIR = path.join(ROOT, 'apps/sim/hooks/queries')
const SELECTOR_HOOKS_DIR = path.join(ROOT, 'apps/sim/hooks/selectors')

/**
* `totalRoutes` is reported, never gated.
*
* The invariant worth holding is that every route is contract-backed, and
* `nonZodRoutes` states exactly that: it is 0, and rises the moment a route ships
* without one. Failing on the total as well meant a fully compliant new route
* still turned CI red, fixable only by editing the number here. A ratchet
* survives on the habit of never bumping it casually, and a gate that must be
* bumped to add a compliant route teaches precisely the opposite habit — on a
* file whose other seven baselines depend on that habit holding.
*/
const BASELINE = {
totalRoutes: 1162,
zodRoutes: 1162,
Expand Down Expand Up @@ -1373,9 +1384,6 @@ async function main() {
if (!checkOnly) return

const failures: string[] = []
if (totalRoutes > BASELINE.totalRoutes) {
failures.push(`route count increased from ${BASELINE.totalRoutes} to ${totalRoutes}`)
}
if (nonZodRoutes > BASELINE.nonZodRoutes) {
failures.push(
`non-Zod routes increased from ${BASELINE.nonZodRoutes} to ${nonZodRoutes} (${zodRoutes} Zod-backed routes)`
Expand Down
Loading