test+ci: codegen regression tests (#34) + PR verify gate#47
Conversation
- Add vitest + 'test' script. New tests in packages/openapi-codegen/src: - normalizeAllOf.test.ts: guards the #34 fix (sibling content/contentType distributed into strict anyOf branches) + plain allOf merge + passthrough. - runtime.test.ts: path/query/body splitting in prepareToolCallOperation. - Add .github/workflows/ci.yml: on PRs/pushes, runs install + build + lint + test and asserts tools.generated.ts is up to date (no stale generated output). Previously CI only published; nothing verified a PR built or that generated output was current. 5 tests pass; build produces no drift locally.
There was a problem hiding this comment.
Pull request overview
Adds a basic verification pipeline (tests + CI) to prevent regressions in the OpenAPI codegen/runtime behavior and to ensure generated MCP tools remain in sync with source.
Changes:
- Introduces Vitest at the repo root with a
yarn testscript. - Adds regression/unit tests for
normalizeAllOf(#34) andprepareToolCallOperation. - Adds a CI workflow to run install → build → lint → test and verify generated outputs don’t drift.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
yarn.lock |
Adds the Vitest/Vite dependency tree required for running tests. |
package.json |
Adds test script (vitest run) and the vitest devDependency. |
packages/openapi-codegen/src/runtime.test.ts |
Tests request splitting logic in prepareToolCallOperation (path/query/body). |
packages/openapi-codegen/src/normalizeAllOf.test.ts |
Adds regression coverage for #34 and additional normalizeAllOf behaviors. |
.github/workflows/ci.yml |
New PR/push verification workflow: build/lint/test + generated file drift check. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Build (regenerates MCP tools) | ||
| run: yarn build | ||
|
|
||
| - name: Ensure generated tools are up to date | ||
| run: git diff --exit-code packages/server/src/tools.generated.ts |
Addresses Copilot review: the gate only checked tools.generated.ts, but 'yarn build' also runs lint:fix — a lint issue could be silently auto-fixed and slip through. Assert 'git diff --exit-code' over the whole tree so both stale generated output and any auto-fixed file fail the gate.
|
✅ Validated → fixed → ready to merge
QA (exact CI sequence locally): Confidence: high · zero regression (additive workflow + tests). Merging. |
What & why
The repo had zero tests and CI only published — nothing verified that a PR builds, lints, or that the generated tools are current. The
normalizeAllOffix for #34 was shipped untested.Changes
testscript.packages/openapi-codegen/src/normalizeAllOf.test.ts— Bug: taskCreate fails with -32602 error — allOf schema validation incorrectly rejects content/contentType fields #34 regression guard: ataskCreate-shapedallOf+anyOf+additionalProperties:falseschema must distributecontent/contentTypeinto the strict branch (the exact bug that returned-32602). Plus plain-allOf merge + non-allOf passthrough.packages/openapi-codegen/src/runtime.test.ts— path/query/body split inprepareToolCallOperation..github/workflows/ci.yml— on PRs/pushes:install → build → lint → test+git diff --exit-code tools.generated.ts(catches stale generated output).Zero-regression
release.yml/force-release.yml.yarn build→ no drift,yarn lintclean, 5 tests pass.Recommended to land first
Optional follow-up
*.test.tsto an.npmignorefor@taskade/mcp-openapi-codegenso tests aren't packed (out of scope here).