Skip to content

feat: context-based fixture routing via X-AIMock-Context header#226

Merged
jpr5 merged 5 commits into
mainfrom
feat/context-routing
May 19, 2026
Merged

feat: context-based fixture routing via X-AIMock-Context header#226
jpr5 merged 5 commits into
mainfrom
feat/context-routing

Conversation

@jpr5
Copy link
Copy Markdown
Contributor

@jpr5 jpr5 commented May 19, 2026

Summary

  • Adds X-AIMock-Context header support for scoping fixtures per integration — fixtures with match.context only match requests carrying that exact context value; fixtures without context remain shared
  • Injects context extraction in all 21 handler files (28 call sites) — HTTP handlers via getContext(req), WebSocket handlers via upgradeHeaders extraction
  • Enriches recorder to auto-capture context in buildFixtureMatch() and route recorded fixtures into context subdirectories in persistFixture()
  • Adds context validation in fixture-loader (type check, dedup key, discriminator)
  • 15 new tests across 5 test files covering matching, helper extraction, fixture loading, recording, and strict-mode interaction
  • Bumps version to 1.26.0 (includes timing-replay from Timing-aware recording and replay with --replay-speed multiplier #223)

Test plan

  • 3151 tests pass (90 files)
  • TypeScript clean (tsc --noEmit — 0 errors)
  • Prettier clean
  • ESLint clean
  • Pre-commit hooks pass on all commits
  • CR loop: 7-agent Round 1 + confirmation round — 0 bucket (a) findings on context routing code

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 19, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@copilotkit/aimock@226

commit: 754c48b

jpr5 added 5 commits May 18, 2026 22:36
Fixtures with match.context only match requests carrying that exact
context value. Fixtures without context remain shared (match all).
Recorder auto-captures context and routes recordings into context
subdirectories.
Every handler that calls matchFixture() now sets _context from the
X-AIMock-Context request header. HTTP handlers use getContext(req),
WebSocket handlers extract from upgradeHeaders.
15 new tests covering matchFixture context matching, getContext header
extraction, fixture-loader validation and discriminator, recorder
context propagation, and strict-mode interaction.
README feature bullet, fixtures page match-field table row and JSON
example, multi-turn chooser table row and gotcha, record-replay
context-aware recording section, and landing page highlight card.
Add context routing and v1.25.0 entries to CHANGELOG.
@jpr5 jpr5 force-pushed the feat/context-routing branch from 799b284 to 754c48b Compare May 19, 2026 05:37
@jpr5 jpr5 merged commit 7c8eb4d into main May 19, 2026
23 checks passed
@jpr5 jpr5 deleted the feat/context-routing branch May 19, 2026 05:38
@jpr5 jpr5 mentioned this pull request May 19, 2026
jpr5 added a commit that referenced this pull request May 19, 2026
## Summary

- Patch bump to publish context routing (from #226) to npm — 1.26.0 was
published before #226 merged
- All 4 version surfaces bumped: package.json, Chart.yaml, plugin.json,
marketplace.json
- CHANGELOG restructured to reflect reality: 1.26.0 = timing replay,
1.26.1 = adds context routing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant