cog
6019c1b7 - feat: add schema-compare command to test harness (#2891)

Commit
111 days ago
feat: add schema-compare command to test harness (#2891) * feat: add schema-compare command to test harness Add a new `schema-compare` command that builds each model twice — once with COG_STATIC_SCHEMA=1 (Go tree-sitter) and once without (Python runtime) — then compares the resulting OpenAPI schemas for exact JSON equality. Differences are reported with a structured diff showing the exact JSON paths that diverge. Also add 7 local fixture models covering the full input type matrix: scalar types, optional types (PEP 604 + typing.Optional), list types, optional list types, constraints/choices, File/Path types, and structured BaseModel output. * feat(test-harness): add --cog-ref flag and parallel schema builds Add --cog-ref to build cog CLI + SDK wheel from any git ref (branch, tag, or commit SHA), enabling testing against main or feature branches without manual builds. When used, the SDK wheel is automatically built from the same ref and passed via COG_SDK_WHEEL. Also parallelize the static/runtime builds in schema-compare using ThreadPoolExecutor with distinct image tags, roughly halving wall-clock time per model. Extract _resolve_versions() helper to consolidate version resolution logic across all commands and produce clearer log output (no spurious PyPI lookups when --cog-ref provides a wheel). * fix: use TitleCase for cancel endpoint path parameter title (#2913) The static schema generator was using TitleCaseSingle (which only uppercases the first character) instead of TitleCase (which splits on underscores) for the cancel endpoint path parameter. This produced "Prediction_id" instead of "Prediction Id", diverging from the Python runtime schema generator. Found by the test harness schema-compare command. --------- Co-authored-by: Michael Dwan <code@michaeldwan.com>
Author
Parents
Loading