Repository navigation
fix(aimock): validate fixtures at load time to prevent runtime 500s - #3973
Merged
Merged
Conversation
Follow-up to #3971. aimock supports fixture schema validation at startup via --validate-on-load, but it's opt-in. The showcase Dockerfile did not pass the flag, so fixtures with unrecognized response keys (e.g. "text" instead of "content") loaded silently and only failed at request time with HTTP 500. That's what crashed crewai-crews on startup. Changes: - showcase/aimock/Dockerfile: pass --validate-on-load so broken fixtures fail the container boot, not individual requests. - showcase/scripts/__tests__/aimock-fixtures.test.ts: new vitest spec that loads feature-parity.json and smoke.json via @copilotkit/aimock's loadFixtureFile + validateFixtures and asserts zero errors. Runs as part of the existing showcase-validate CI workflow. - showcase/scripts/package.json: add @copilotkit/aimock dependency for the validator import. Verified red-green: with the pre-#3971 broken "text" fixtures, validateFixtures flags 5 errors; post-#3971 it returns zero. Docker red-green: container with an intentionally broken fixture fails to start with "Validation failed: 1 error(s)" and non-zero exit.
jpr5
requested review from
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
April 16, 2026 19:33
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Contributor
📣 Social Copy GeneratorGenerate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.
|
- Add --validate-on-load to all aimock invocations (4 workflows/scripts
+ 13 integration docker-compose files)
- Replace hardcoded 2-file fixture list with dynamic discovery across
showcase/, examples/integrations/*/, scripts/doc-tests/ (16 fixtures)
- Add sanity check to prevent silent zero-test pass when discovery fails
- Extend showcase_validate.yml path filter to trigger on
examples/integrations/**/fixtures/** and scripts/doc-tests/fixtures/**
- Import and use ValidationResult type for callback parameters
- Fix scripts/doc-tests/fixtures/default.json to use { fixtures: [...] }
envelope shape
jpr5
added a commit
that referenced
this pull request
Apr 16, 2026
Adds showcase/aimock/README.md covering: what aimock is and why the showcase uses it; the roles of feature-parity.json and smoke.json; the hand-maintained sync policy and its two layers of load-time schema validation (Dockerfile --validate-on-load + CI fixture test from #3973); how to add/update a fixture; drift risk surfaces and response; and the CI workflows that exercise the fixtures.
2 of 3 tasks
jpr5
added a commit
that referenced
this pull request
Apr 16, 2026
Adds showcase/aimock/README.md covering: what aimock is and why the showcase uses it; the roles of feature-parity.json and smoke.json; the hand-maintained sync policy and its two layers of load-time schema validation (Dockerfile --validate-on-load + CI fixture test from #3973); how to add/update a fixture; drift risk surfaces and response; and the CI workflows that exercise the fixtures.
zeekay
pushed a commit
to Dream-AI-4444/CopilotKit
that referenced
this pull request
Sep 11, 2026
…opilotKit#3973) ## Summary Follow-up hardening to CopilotKit#3971. aimock supports fixture schema validation at startup via `--validate-on-load`, but the flag is **opt-in** and the showcase Dockerfile was not passing it. That meant fixtures with unrecognized response keys (e.g. `"text"` instead of `"content"`) loaded silently and only surfaced as HTTP 500s at request time — which is exactly what crashed crewai-crews and triggered CopilotKit#3971. This PR wires up two independent safety nets so a broken fixture can't ship again: 1. **Dockerfile (fail-fast at container boot)** — `showcase/aimock/Dockerfile` now passes `--validate-on-load`. If any fixture fails the aimock schema, the container exits non-zero instead of starting and serving 500s. Railway will not promote a bad build. 2. **CI test (fail-fast in PR review)** — new vitest spec at `showcase/scripts/__tests__/aimock-fixtures.test.ts` imports `loadFixtureFile` + `validateFixtures` from `@copilotkit/aimock` and asserts zero errors against both `feature-parity.json` and `smoke.json`. Runs inside the existing ` Showcase: Validate` workflow (`showcase/scripts` vitest suite) on every PR that touches `showcase/**`. ## Verification **Red-green on the vitest spec:** - Rebased onto the tip of main *before* CopilotKit#3971 merged: the spec fails with 5 errors — exactly the 5 broken `"text"` fixtures (`plan`, `steps`, `mars`, `dashboard`, `report`) that CopilotKit#3971 repaired. - Rebased forward onto main *after* CopilotKit#3971: spec passes with 0 errors, all 549 showcase/scripts tests green. **Red-green on the Dockerfile:** - Current fixtures + `--validate-on-load`: container boots cleanly, logs `Loaded 39 fixture(s) from /fixtures`. - Injecting an intentionally broken fixture (`response: { "text": "..." }`): container fails to start with `[aimock] Fixture 0: response is not a recognized type (must have content, toolCalls, error, or embedding)` / `Validation failed: 1 error(s), 0 warning(s)` and non-zero exit. ## Test plan - [x] Local: full `showcase/scripts` vitest suite passes (549/549) - [x] Local: `pnpm run test` (monorepo) passes - [x] Docker: image builds and starts with `--validate-on-load` against current fixtures - [x] Docker red-green: broken fixture fails container start with non-zero exit - [ ] CI: ` Showcase: Validate` job runs the new test file on PR
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up hardening to #3971. aimock supports fixture schema validation at startup via
--validate-on-load, but the flag is opt-in and the showcase Dockerfile was not passing it. That meant fixtures with unrecognized response keys (e.g."text"instead of"content") loaded silently and only surfaced as HTTP 500s at request time — which is exactly what crashed crewai-crews and triggered #3971.This PR wires up two independent safety nets so a broken fixture can't ship again:
showcase/aimock/Dockerfilenow passes--validate-on-load. If any fixture fails the aimock schema, the container exits non-zero instead of starting and serving 500s. Railway will not promote a bad build.showcase/scripts/__tests__/aimock-fixtures.test.tsimportsloadFixtureFile+validateFixturesfrom@copilotkit/aimockand asserts zero errors against bothfeature-parity.jsonandsmoke.json. Runs inside the existingShowcase: Validateworkflow (showcase/scriptsvitest suite) on every PR that touchesshowcase/**.Verification
Red-green on the vitest spec:
"text"fixtures (plan,steps,mars,dashboard,report) that fix(aimock): use valid response schema for broken feature-parity fixtures #3971 repaired.Red-green on the Dockerfile:
--validate-on-load: container boots cleanly, logsLoaded 39 fixture(s) from /fixtures.response: { "text": "..." }): container fails to start with[aimock] Fixture 0: response is not a recognized type (must have content, toolCalls, error, or embedding)/Validation failed: 1 error(s), 0 warning(s)and non-zero exit.Test plan
showcase/scriptsvitest suite passes (549/549)pnpm run test(monorepo) passes--validate-on-loadagainst current fixturesShowcase: Validatejob runs the new test file on PR