feat: context-based fixture routing via X-AIMock-Context header#226
Merged
Conversation
commit: |
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.
799b284 to
754c48b
Compare
Merged
4 tasks
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
X-AIMock-Contextheader support for scoping fixtures per integration — fixtures withmatch.contextonly match requests carrying that exact context value; fixtures withoutcontextremain sharedgetContext(req), WebSocket handlers viaupgradeHeadersextractionbuildFixtureMatch()and route recorded fixtures into context subdirectories inpersistFixture()Test plan
tsc --noEmit— 0 errors)