Skip to content

Commit 1aa714c

Browse files
authored
fix(ci): stop failing the API audit for adding a compliant route (#7027)
`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`.
1 parent f37c24e commit 1aa714c

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

scripts/check-api-validation-contracts.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ const CONTRACTS_DIR = path.join(ROOT, 'apps/sim/lib/api/contracts')
88
const QUERY_HOOKS_DIR = path.join(ROOT, 'apps/sim/hooks/queries')
99
const SELECTOR_HOOKS_DIR = path.join(ROOT, 'apps/sim/hooks/selectors')
1010

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

13751386
const failures: string[] = []
1376-
if (totalRoutes > BASELINE.totalRoutes) {
1377-
failures.push(`route count increased from ${BASELINE.totalRoutes} to ${totalRoutes}`)
1378-
}
13791387
if (nonZodRoutes > BASELINE.nonZodRoutes) {
13801388
failures.push(
13811389
`non-Zod routes increased from ${BASELINE.nonZodRoutes} to ${nonZodRoutes} (${zodRoutes} Zod-backed routes)`

0 commit comments

Comments
 (0)