Skip to content

[runtime] prefer builtin schemas during validator warmup#44

Merged
GsCommand merged 1 commit intomainfrom
codex/implement-builtin-first-schema-warmup
Mar 20, 2026
Merged

[runtime] prefer builtin schemas during validator warmup#44
GsCommand merged 1 commit intomainfrom
codex/implement-builtin-first-schema-warmup

Conversation

@GsCommand
Copy link
Contributor

Motivation

  • Cached-only /verify warmup could still hit the network before falling back to builtins, causing CI flakiness when builtin schemas are available.
  • Implement a builtin-first warmup path to make validator precompilation deterministic while preserving the public /verify contract.

Description

  • Add options support to fetchJsonWithTimeout(url, timeoutMs, options = {}) and implement preferBuiltin: true which normalizes the URL then uses getBuiltinSchema() first and caches/returns it if present.
  • Thread the option through makeAjv(options = {}) and getValidatorForVerb(verb, options = {}), using fetchJsonWithTimeout(..., options) for shared refs and main schema loads.
  • Modify the warm worker to call getValidatorForVerb(verb, { preferBuiltin: true }) so cached-only warmup compiles validators using builtin schemas before any network fetch.
  • Preserve existing semantics for validatorCache and inflightValidator, and leave default validation paths unchanged when preferBuiltin is omitted.

Testing

  • Ran node --test runtime/tests/runtime-signing.test.mjs; all tests passed (subtests covering the full verify warmup chain succeeded).
  • Ran npm test (unit tests + smoke); all tests and smoke checks passed.

Codex Task

Why: cached-only /verify warmup should avoid CI flakiness from remote schema fetches when builtin schemas already exist.
Contract impact: none
@GsCommand GsCommand merged commit abeeebe into main Mar 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant