mirror of
https://github.com/simstudioai/sim.git
synced 2026-10-30 19:32:46 +08:00
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`.
This commit is contained in:
@@ -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)`
|
||||
|
||||
Reference in New Issue
Block a user