Skip to content

feat: verify request completion dependencies - #592

Closed
AnshulBhati01 wants to merge 1 commit into
CopilotKit:mainfrom
AnshulBhati01:upstream/aimock-request-verification
Closed

AnshulBhati01 wants to merge 1 commit into
CopilotKit:mainfrom
AnshulBhati01:upstream/aimock-request-verification

Conversation

@AnshulBhati01

Copy link
Copy Markdown
Contributor

Request counts alone cannot show whether a dependent call started before its prerequisites finished. This adds per-test-ID request expectations with completion barriers (after), consumable prerequisite occurrences (afterEach) and optional causal/correlation grouping.

verifyRequests() reports started, completed, aborted, pending, missing, excess and premature requests without blocking or changing the response. Expectations are validated before replacement; resets detach in-flight observations from the new state. Control and system routes are excluded. See docs/request-verification.md for examples.

Validation: 453 tests pass across the dependency, journal, server, control, LLMock and test-ID isolation 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@592

commit: 4e5c136

@jpr5

jpr5 commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Thanks a lot for this. The implementation is careful and the tests are genuinely good, which made this a harder call.

We're going to pass on it. Checking ordering between dependent calls is a pretty narrow need for most aimock users, and it brings a lot of new public API with it. It also adds a bit of work to every request even when nobody's registered an expectation. And causal mode gets expensive as traffic grows: 16k requests took about 55 seconds and blocked the server while it ran, and prerequisite matching blows up quickly (one request took ~555ms with five prerequisites).

I think there's a lighter version that gets most of the value: record start and completion times on journal entries, and let tests check ordering themselves. If you're up for that, I'd happily take a small PR for it. Thanks again for the effort here.

@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