Skip to content

feat: add transactional recording sessions - #593

Closed
AnshulBhati01 wants to merge 1 commit into
CopilotKit:mainfrom
AnshulBhati01:upstream/aimock-recording-sessions
Closed

AnshulBhati01 wants to merge 1 commit into
CopilotKit:mainfrom
AnshulBhati01:upstream/aimock-recording-sessions

Conversation

@AnshulBhati01

Copy link
Copy Markdown
Contributor

Record mode currently publishes each response as it arrives. This adds LLMock.beginRecordingSession(testId) so a test can stage its HTTP text-generation recordings, then publish the batch with commit() or abandon it with discard().

Commit seals admission, waits for admitted captures and writes one batch file through an atomic rename before updating the fixture queue. Failed publication is retryable; discard, reset and shutdown release staged state. Session isolation, admission order and existing immediate recording are covered by regression tests. The README documents the API and its scope.

Validation: 365 tests pass across recording sessions, recorder, control and LLMock suites. Type checks, build, ESLint, formatting and package export checks pass. Generated API reports are included; please apply public-api-addition for compatibility review.

@pkg-pr-new

pkg-pr-new Bot commented Oct 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 2bdcc70

@jpr5

jpr5 commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Thanks for sending this over. I get the problem you're going after, since half-finished recordings from failed tests are annoying.

We're going to pass on it, mostly because per-test snapshot folders already handle that case: you can delete a failed test's recordings in afterEach. On top of that, committed sessions write a flat recording-<uuid>.json instead of the usual <slug>/<provider>.json layout (and skip the X-AIMock-Context folders), so repeated runs pile up files rather than merging. Session files also land as 0644 where normal recordings are 0600, a repeated identical request inside a session goes upstream twice and gets saved twice, and the recorder refactor turns 8 existing tests red.

If you've hit a case that per-test folders don't cover, open an issue and tell me about it. Happy to figure out the right shape with you. Appreciate you taking the time on this.

@jpr5 jpr5 closed this Oct 29, 2026
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.

2 participants