From 99c16162f9f422cb34d7ff26433caab72a61fdb8 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Sun, 23 Aug 2026 19:11:56 -0700 Subject: [PATCH] fix(ci): stop failing the API audit for adding a compliant route MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `totalRoutes` sits at 1162 and the repo has exactly 1162 routes, so the next route fails CI whether or not it is contract-backed: API validation audit failed: - route count increased from 1161 to 1162 The invariant worth holding is that every route has a contract, and `nonZodRoutes` states exactly that. It is 0, and it rises the moment a route ships without one — `zodRoutes === totalRoutes` today, so the total adds no information the other two counters do not already carry. What it adds instead is a habit. The only way past it is editing the number, and this file holds seven other baselines that work only while nobody bumps a baseline casually. The total is still printed; it is no longer a failure. Verified both directions: a compliant new route passes where it previously failed, and a route without a contract still fails through `nonZodRoutes`. --- scripts/check-api-validation-contracts.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/check-api-validation-contracts.ts b/scripts/check-api-validation-contracts.ts index 3f66bbc8a2f..bb66f38e3f8 100644 --- a/scripts/check-api-validation-contracts.ts +++ b/scripts/check-api-validation-contracts.ts @@ -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, @@ -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)`