Skip to content

feat: add reusable fixture modules and atomic reloads - #590

Closed
AnshulBhati01 wants to merge 1 commit into
CopilotKit:mainfrom
AnshulBhati01:upstream/aimock-fixture-modules
Closed

AnshulBhati01 wants to merge 1 commit into
CopilotKit:mainfrom
AnshulBhati01:upstream/aimock-fixture-modules

Conversation

@AnshulBhati01

Copy link
Copy Markdown
Contributor

Reusable fixture sets currently have to be flattened before loading, and replacing a group of related fixtures can expose a partially updated queue. This adds JSON fixture modules with explicit parameters, relative includes and bounded expansion, plus named mounts that retain their position and reload affected dependencies atomically.

loadFixtureModule loads a snapshot; mountFixtureModule, reloadFixtureModules, unmountFixtureModule and getFixtureModules manage named registrations. Reload validates the complete selected set before publishing. Existing live-fixture validation, misbehavior opt-in and fixture queue updates are preserved. Usage and limits are documented in docs/fixture-modules.md.

Validation: 223 focused tests pass, including 119 module/lifecycle cases. Type checks, ESLint, formatting, build, generated API reports and package export checks pass. A full-suite run passed 19,540 tests; after building the CLI artifacts, rerunning its affected files passed 887 tests with one remaining A9 witness failure requiring 2 GiB free memory. That same memory failure reproduces on the unchanged upstream checkout.

This adds public APIs; the generated etc/ reports are included. Please apply the public-api-addition label for the repository's compatibility review gate.

@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@590

commit: ed4d85d

@jpr5

jpr5 commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Hey, really appreciate you putting this together. It's a lot of work and it's clear you thought hard about the reload semantics.

We're going to pass on it though. The biggest thing is reach: it's only usable from the TypeScript API, and folks in code can already compose fixtures however they like. The people who'd actually want reusable JSON fixture sets are running aimock from the CLI, a config file, or Docker, and this doesn't get to them.

A couple of things also bit us when we tried it. Mounting, reloading, or unmounting a module rebuilds the fixture list and drops anything record mode added at runtime, so the next matching request goes upstream again. And there's no cap on include expansion, so a short chain of files that each include the next one twice locked up the event loop for about 44 seconds.

If reusable fixture sets matter to you, I'd love to work out a version that starts from the CLI and config side. Open an issue with a sketch and let's go from there. Thanks again.

@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