Timing-aware recording and replay with --replay-speed multiplier#223
Merged
Conversation
commit: |
53a304f to
fe9aa07
Compare
8171c3c to
f2c5df8
Compare
6 tasks
jpr5
added a commit
that referenced
this pull request
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 #223) ## Test plan - [x] 3151 tests pass (90 files) - [x] TypeScript clean (`tsc --noEmit` — 0 errors) - [x] Prettier clean - [x] ESLint clean - [x] Pre-commit hooks pass on all commits - [x] CR loop: 7-agent Round 1 + confirmation round — 0 bucket (a) findings on context routing 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
Records per-frame arrival timestamps during proxy recording and replays them at configurable speed. Requested by Atai.
\ndelimiter. Bedrock binary EventStream uses 4-byte length-prefix frame detection. StoresrecordedTimings { ttftMs, interChunkDelaysMs, totalDurationMs }on fixtures.calculateDelayextended withrecordedTimings+replaySpeedparams. Precedence: streamingProfile > recordedTimings > global latency. Speed multiplier divides all delays.--replay-speed 2.0(2x faster). Per-fixturereplaySpeedoverride.replaySpeed <= 0stripped with warning. NaN/negative values inrecordedTimingssanitized.Approximate timing reproduction based on recorded TTFT and inter-frame cadence. Replay chunk count may differ from recording — TTFT and average pace are preserved, not per-token fidelity.
Spec: https://www.notion.so/3643aa38185281328fe6ddf27407c6ed
Test plan
🤖 Generated with Claude Code