Files
TREK/shared/scripts/open-request-schemas.d.mts
T
Maurice 0b4000af81 ci(shared): ratchet the open shapes in request schemas
The server's boot gate only checks that a write route has a Zod DTO, not
that the schema constrains anything, and 47 of the 213 exported request
schemas hold an open shape: a loose object, a record of unknown, or an
unknown field. shared/CLAUDE.md already says to narrow those rather than
add new ones, but nothing counted them.

scripts/open-request-schemas.mjs walks every exported *RequestSchema and
counts its open shapes against a baseline of today's 75. A new request
schema may hold none and an existing one no more than its entry;
--update only lowers. The CLI checks the built dist/ for CI, and
src/open-request-schemas.spec.ts runs the same walk over src/ so the
shared test run fails as well. A missing or malformed baseline, or a
dist/ without a single request schema, is an error.
2026-10-08 13:02:59 +02:00

22 lines
913 B
TypeScript

// Types for open-request-schemas.mjs, so the spec imports it without a suppression.
export declare const BASELINE: string;
export declare const REQUEST_SCHEMA: RegExp;
export declare function openShapes(root: unknown): string[];
export declare function countOpenShapes(namespace: Record<string, unknown>): Record<string, number>;
export declare function readBaseline(path?: string): Record<string, number>;
export declare function compare(
baseline: Record<string, number>,
counts: Record<string, number>,
): { grown: [string, number][]; lowerable: [string, number][] };
export declare function lowerBaseline(
baseline: Record<string, number>,
counts: Record<string, number>,
): Record<string, number>;
export declare function report(
baseline: Record<string, number>,
counts: Record<string, number>,
log?: Pick<Console, 'error'>,
): { grown: [string, number][]; lowerable: [string, number][] };