feat: per-test sequence isolation via X-Test-Id header#93
Merged
Conversation
Journal.fixtureMatchCounts now nested Map<string, Map<Fixture, number>> keyed by testId. Requests with X-Test-Id header (or ?testId= query param) get isolated sequence counters. Requests without use "__default__" scope (backwards compatible). resetMatchCounts(testId?) selectively or globally clears counters.
Extract testId via getTestId(req) in every handler, pass per-test counter maps to matchFixture, thread testId to incrementFixtureMatchCount. WebSocket handlers receive testId via defaults from upgrade request.
Journal unit tests (4), integration tests covering parallel isolation, backwards compat, query param fallback, Anthropic cross-provider, selective reset, header-over-query precedence, global reset.
a028097 to
c3a5678
Compare
commit: |
jpr5
approved these changes
Apr 8, 2026
Contributor
jpr5
left a comment
There was a problem hiding this comment.
Zero source code bugs found in Round 1. Clean implementation — all 15 handlers wired consistently, backwards compatible, no race conditions.
Rebased on current main (post PR #88, #89, #92), redone as 3 clean commits. Internal docs removed. Added 2 missing test cases (header-over-query precedence, global resetMatchCounts integration). 11 tests, 2104 full suite pass.
🤖 Reviewed with Claude Code
jpr5
added a commit
that referenced
this pull request
Apr 8, 2026
## Summary - **Per-test sequence isolation** via `X-Test-Id` header — each test gets its own fixture match counters across all 12 HTTP + 3 WebSocket handlers (#93) - **Combined content + toolCalls** in fixture responses — new `ContentWithToolCallsResponse` type across OpenAI Chat, Responses, Anthropic Messages, and Gemini with stream collapse support (#92) - **OpenRouter reasoning_content** support (#88) - **Clean URLs** for docs site — all pages restructured as directories, .html extensions removed from links - Fix `web_search_call` items to use `action.query` matching real OpenAI API (#89) - Bump aimock-pytest to 0.3.0 ## Version bumps - `package.json`: 1.8.0 → 1.9.0 - `pyproject.toml`: 0.2.0 → 0.3.0 - `Chart.yaml` appVersion: 1.8.0 → 1.9.0 - `plugin.json` / `marketplace.json`: 1.8.0 → 1.9.0 ## Test plan - [x] All 2206 tests pass (including 80 new clean-URL validation tests) - [x] Build passes - [x] Prettier clean - [ ] npm publish triggers automatically on merge via OIDC workflow - [ ] Verify v1.9.0 appears on npm after merge 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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-Test-Idheader (and?testId=query param fallback) to scopesequenceIndexcounters per test, enabling parallel test execution against a shared aimock instanceJournal.fixtureMatchCountsfromMap<Fixture, number>to a nestedMap<string, Map<Fixture, number>>keyed by testId, with a backwards-compatible getter for the default scoperesetMatchCounts(testId?)to theLLMockpublic API — with testId clears only that test's counters, without clears allZero breaking changes — requests without
X-Test-Iduse"__default__"scope, identical to current behavior.Test plan